From 6303bf6fc0cf8c5dbacffb6797d23fff95f0f58a Mon Sep 17 00:00:00 2001 From: npm CLI robot Date: Mon, 16 Dec 2024 17:40:35 +0000 Subject: [PATCH] deps: upgrade npm to 11.0.0 --- deps/npm/docs/content/commands/npm-hook.md | 112 -- deps/npm/docs/content/commands/npm-ls.md | 30 +- deps/npm/docs/content/commands/npm-pack.md | 14 + deps/npm/docs/content/commands/npm-prefix.md | 2 +- deps/npm/docs/content/commands/npm-publish.md | 3 + deps/npm/docs/content/commands/npm.md | 2 +- .../npm/docs/content/configuring-npm/npmrc.md | 2 +- .../content/configuring-npm/package-json.md | 14 + deps/npm/docs/content/using-npm/config.md | 12 +- deps/npm/docs/content/using-npm/developers.md | 7 +- deps/npm/docs/output/commands/npm-access.html | 4 +- .../npm/docs/output/commands/npm-adduser.html | 4 +- deps/npm/docs/output/commands/npm-audit.html | 4 +- deps/npm/docs/output/commands/npm-bugs.html | 4 +- deps/npm/docs/output/commands/npm-cache.html | 4 +- deps/npm/docs/output/commands/npm-ci.html | 4 +- .../docs/output/commands/npm-completion.html | 4 +- deps/npm/docs/output/commands/npm-config.html | 4 +- deps/npm/docs/output/commands/npm-dedupe.html | 4 +- .../docs/output/commands/npm-deprecate.html | 4 +- deps/npm/docs/output/commands/npm-diff.html | 4 +- .../docs/output/commands/npm-dist-tag.html | 4 +- deps/npm/docs/output/commands/npm-docs.html | 4 +- deps/npm/docs/output/commands/npm-doctor.html | 4 +- deps/npm/docs/output/commands/npm-edit.html | 4 +- deps/npm/docs/output/commands/npm-exec.html | 4 +- .../npm/docs/output/commands/npm-explain.html | 4 +- .../npm/docs/output/commands/npm-explore.html | 4 +- .../docs/output/commands/npm-find-dupes.html | 4 +- deps/npm/docs/output/commands/npm-fund.html | 4 +- .../docs/output/commands/npm-help-search.html | 4 +- deps/npm/docs/output/commands/npm-help.html | 4 +- deps/npm/docs/output/commands/npm-hook.html | 234 --- deps/npm/docs/output/commands/npm-init.html | 4 +- .../output/commands/npm-install-ci-test.html | 4 +- .../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-login.html | 4 +- deps/npm/docs/output/commands/npm-logout.html | 4 +- deps/npm/docs/output/commands/npm-ls.html | 29 +- deps/npm/docs/output/commands/npm-org.html | 4 +- .../docs/output/commands/npm-outdated.html | 4 +- deps/npm/docs/output/commands/npm-owner.html | 4 +- deps/npm/docs/output/commands/npm-pack.html | 16 +- deps/npm/docs/output/commands/npm-ping.html | 4 +- deps/npm/docs/output/commands/npm-pkg.html | 4 +- deps/npm/docs/output/commands/npm-prefix.html | 6 +- .../npm/docs/output/commands/npm-profile.html | 4 +- deps/npm/docs/output/commands/npm-prune.html | 4 +- .../npm/docs/output/commands/npm-publish.html | 6 +- deps/npm/docs/output/commands/npm-query.html | 4 +- .../npm/docs/output/commands/npm-rebuild.html | 4 +- deps/npm/docs/output/commands/npm-repo.html | 4 +- .../npm/docs/output/commands/npm-restart.html | 4 +- deps/npm/docs/output/commands/npm-root.html | 4 +- .../docs/output/commands/npm-run-script.html | 4 +- deps/npm/docs/output/commands/npm-sbom.html | 4 +- deps/npm/docs/output/commands/npm-search.html | 4 +- .../docs/output/commands/npm-shrinkwrap.html | 4 +- deps/npm/docs/output/commands/npm-star.html | 4 +- deps/npm/docs/output/commands/npm-stars.html | 4 +- deps/npm/docs/output/commands/npm-start.html | 4 +- deps/npm/docs/output/commands/npm-stop.html | 4 +- deps/npm/docs/output/commands/npm-team.html | 4 +- deps/npm/docs/output/commands/npm-test.html | 4 +- deps/npm/docs/output/commands/npm-token.html | 4 +- .../docs/output/commands/npm-uninstall.html | 4 +- .../docs/output/commands/npm-unpublish.html | 4 +- deps/npm/docs/output/commands/npm-unstar.html | 4 +- deps/npm/docs/output/commands/npm-update.html | 4 +- .../npm/docs/output/commands/npm-version.html | 4 +- deps/npm/docs/output/commands/npm-view.html | 4 +- deps/npm/docs/output/commands/npm-whoami.html | 4 +- deps/npm/docs/output/commands/npm.html | 6 +- deps/npm/docs/output/commands/npx.html | 4 +- .../docs/output/configuring-npm/folders.html | 4 +- .../docs/output/configuring-npm/install.html | 4 +- .../output/configuring-npm/npm-global.html | 4 +- .../docs/output/configuring-npm/npm-json.html | 16 +- .../configuring-npm/npm-shrinkwrap-json.html | 4 +- .../docs/output/configuring-npm/npmrc.html | 6 +- .../output/configuring-npm/package-json.html | 16 +- .../configuring-npm/package-lock-json.html | 4 +- deps/npm/docs/output/using-npm/config.html | 16 +- .../using-npm/dependency-selectors.html | 4 +- .../npm/docs/output/using-npm/developers.html | 10 +- deps/npm/docs/output/using-npm/logging.html | 4 +- deps/npm/docs/output/using-npm/orgs.html | 4 +- .../docs/output/using-npm/package-spec.html | 4 +- deps/npm/docs/output/using-npm/registry.html | 4 +- deps/npm/docs/output/using-npm/removal.html | 4 +- deps/npm/docs/output/using-npm/scope.html | 4 +- deps/npm/docs/output/using-npm/scripts.html | 4 +- .../npm/docs/output/using-npm/workspaces.html | 4 +- deps/npm/lib/cli/entry.js | 5 - deps/npm/lib/commands/cache.js | 4 +- deps/npm/lib/commands/deprecate.js | 6 +- deps/npm/lib/commands/diff.js | 10 +- deps/npm/lib/commands/dist-tag.js | 10 +- deps/npm/lib/commands/doctor.js | 6 +- deps/npm/lib/commands/explain.js | 2 +- deps/npm/lib/commands/hook.js | 109 -- deps/npm/lib/commands/init.js | 2 +- deps/npm/lib/commands/install.js | 4 +- deps/npm/lib/commands/ls.js | 2 +- deps/npm/lib/commands/pack.js | 4 +- deps/npm/lib/commands/pkg.js | 6 +- deps/npm/lib/commands/prefix.js | 1 - deps/npm/lib/commands/publish.js | 37 + deps/npm/lib/commands/repo.js | 2 +- deps/npm/lib/commands/star.js | 6 +- deps/npm/lib/commands/stars.js | 4 +- deps/npm/lib/commands/view.js | 20 +- deps/npm/lib/utils/cmd-list.js | 1 - deps/npm/lib/utils/ping.js | 4 +- deps/npm/lib/utils/sbom-cyclonedx.js | 4 +- deps/npm/lib/utils/sbom-spdx.js | 2 +- deps/npm/lib/utils/verify-signatures.js | 8 +- deps/npm/man/man1/npm-access.1 | 2 +- deps/npm/man/man1/npm-adduser.1 | 2 +- deps/npm/man/man1/npm-audit.1 | 2 +- deps/npm/man/man1/npm-bugs.1 | 2 +- deps/npm/man/man1/npm-cache.1 | 2 +- deps/npm/man/man1/npm-ci.1 | 2 +- deps/npm/man/man1/npm-completion.1 | 2 +- deps/npm/man/man1/npm-config.1 | 2 +- deps/npm/man/man1/npm-dedupe.1 | 2 +- deps/npm/man/man1/npm-deprecate.1 | 2 +- deps/npm/man/man1/npm-diff.1 | 2 +- deps/npm/man/man1/npm-dist-tag.1 | 2 +- deps/npm/man/man1/npm-docs.1 | 2 +- deps/npm/man/man1/npm-doctor.1 | 2 +- deps/npm/man/man1/npm-edit.1 | 2 +- deps/npm/man/man1/npm-exec.1 | 2 +- deps/npm/man/man1/npm-explain.1 | 2 +- deps/npm/man/man1/npm-explore.1 | 2 +- deps/npm/man/man1/npm-find-dupes.1 | 2 +- deps/npm/man/man1/npm-fund.1 | 2 +- deps/npm/man/man1/npm-help-search.1 | 2 +- deps/npm/man/man1/npm-help.1 | 2 +- deps/npm/man/man1/npm-hook.1 | 115 -- deps/npm/man/man1/npm-init.1 | 2 +- deps/npm/man/man1/npm-install-ci-test.1 | 2 +- deps/npm/man/man1/npm-install-test.1 | 2 +- deps/npm/man/man1/npm-install.1 | 2 +- deps/npm/man/man1/npm-link.1 | 2 +- deps/npm/man/man1/npm-login.1 | 2 +- deps/npm/man/man1/npm-logout.1 | 2 +- deps/npm/man/man1/npm-ls.1 | 16 +- 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 | 14 +- deps/npm/man/man1/npm-ping.1 | 2 +- deps/npm/man/man1/npm-pkg.1 | 2 +- deps/npm/man/man1/npm-prefix.1 | 4 +- deps/npm/man/man1/npm-profile.1 | 2 +- deps/npm/man/man1/npm-prune.1 | 2 +- deps/npm/man/man1/npm-publish.1 | 4 +- deps/npm/man/man1/npm-query.1 | 2 +- deps/npm/man/man1/npm-rebuild.1 | 2 +- deps/npm/man/man1/npm-repo.1 | 2 +- deps/npm/man/man1/npm-restart.1 | 2 +- deps/npm/man/man1/npm-root.1 | 2 +- deps/npm/man/man1/npm-run-script.1 | 2 +- deps/npm/man/man1/npm-sbom.1 | 2 +- deps/npm/man/man1/npm-search.1 | 2 +- deps/npm/man/man1/npm-shrinkwrap.1 | 2 +- deps/npm/man/man1/npm-star.1 | 2 +- deps/npm/man/man1/npm-stars.1 | 2 +- deps/npm/man/man1/npm-start.1 | 2 +- deps/npm/man/man1/npm-stop.1 | 2 +- deps/npm/man/man1/npm-team.1 | 2 +- deps/npm/man/man1/npm-test.1 | 2 +- deps/npm/man/man1/npm-token.1 | 2 +- deps/npm/man/man1/npm-uninstall.1 | 2 +- deps/npm/man/man1/npm-unpublish.1 | 2 +- deps/npm/man/man1/npm-unstar.1 | 2 +- deps/npm/man/man1/npm-update.1 | 2 +- deps/npm/man/man1/npm-version.1 | 2 +- deps/npm/man/man1/npm-view.1 | 2 +- deps/npm/man/man1/npm-whoami.1 | 2 +- deps/npm/man/man1/npm.1 | 4 +- deps/npm/man/man1/npx.1 | 2 +- deps/npm/man/man5/folders.5 | 2 +- deps/npm/man/man5/install.5 | 2 +- deps/npm/man/man5/npm-global.5 | 2 +- deps/npm/man/man5/npm-json.5 | 18 +- deps/npm/man/man5/npm-shrinkwrap-json.5 | 2 +- deps/npm/man/man5/npmrc.5 | 4 +- deps/npm/man/man5/package-json.5 | 18 +- deps/npm/man/man5/package-lock-json.5 | 2 +- deps/npm/man/man7/config.7 | 8 +- deps/npm/man/man7/dependency-selectors.7 | 2 +- deps/npm/man/man7/developers.7 | 6 +- deps/npm/man/man7/logging.7 | 2 +- deps/npm/man/man7/orgs.7 | 2 +- deps/npm/man/man7/package-spec.7 | 2 +- deps/npm/man/man7/registry.7 | 2 +- deps/npm/man/man7/removal.7 | 2 +- deps/npm/man/man7/scope.7 | 2 +- deps/npm/man/man7/scripts.7 | 2 +- deps/npm/man/man7/workspaces.7 | 2 +- .../@npmcli/arborist/lib/arborist/rebuild.js | 4 +- .../@npmcli/arborist/lib/audit-report.js | 104 +- .../arborist/lib/query-selector-all.js | 4 +- .../@npmcli/arborist/package.json | 18 +- .../config/lib/definitions/definitions.js | 10 +- .../node_modules/@npmcli/config/package.json | 10 +- .../node_modules/pacote/LICENSE | 15 - .../node_modules/pacote/README.md | 283 --- .../node_modules/pacote/bin/index.js | 158 -- .../node_modules/pacote/lib/dir.js | 105 - .../node_modules/pacote/lib/fetcher.js | 497 ----- .../node_modules/pacote/lib/file.js | 94 - .../node_modules/pacote/lib/git.js | 317 --- .../node_modules/pacote/lib/index.js | 23 - .../node_modules/pacote/lib/registry.js | 369 ---- .../node_modules/pacote/lib/remote.js | 89 - .../pacote/lib/util/add-git-sha.js | 15 - .../node_modules/pacote/lib/util/cache-dir.js | 15 - .../pacote/lib/util/is-package-bin.js | 25 - .../node_modules/pacote/lib/util/npm.js | 14 - .../node_modules/pacote/lib/util/protected.js | 5 - .../pacote/lib/util/tar-create-options.js | 31 - .../pacote/lib/util/trailing-slashes.js | 10 - .../node_modules/pacote/package.json | 79 - .../@npmcli/metavuln-calculator/package.json | 10 +- .../@sigstore/bundle/LICENSE | 0 .../@sigstore/bundle/dist/build.js | 0 .../@sigstore/bundle/dist/bundle.js | 0 .../@sigstore/bundle/dist/error.js | 0 .../@sigstore/bundle/dist/index.js | 0 .../@sigstore/bundle/dist/serialized.js | 0 .../@sigstore/bundle/dist/utility.js | 0 .../@sigstore/bundle/dist/validate.js | 0 .../@sigstore/bundle/package.json | 0 .../node_modules => }/@sigstore/core/LICENSE | 0 .../@sigstore/core/dist/asn1/error.js | 0 .../@sigstore/core/dist/asn1/index.js | 0 .../@sigstore/core/dist/asn1/length.js | 0 .../@sigstore/core/dist/asn1/obj.js | 0 .../@sigstore/core/dist/asn1/parse.js | 0 .../@sigstore/core/dist/asn1/tag.js | 0 .../@sigstore/core/dist/crypto.js | 0 .../@sigstore/core/dist/dsse.js | 0 .../@sigstore/core/dist/encoding.js | 0 .../@sigstore/core/dist/index.js | 0 .../@sigstore/core/dist/json.js | 0 .../@sigstore/core/dist/oid.js | 0 .../@sigstore/core/dist/pem.js | 0 .../@sigstore/core/dist/rfc3161/error.js | 0 .../@sigstore/core/dist/rfc3161/index.js | 0 .../@sigstore/core/dist/rfc3161/timestamp.js | 0 .../@sigstore/core/dist/rfc3161/tstinfo.js | 0 .../@sigstore/core/dist/stream.js | 0 .../@sigstore/core/dist/x509/cert.js | 0 .../@sigstore/core/dist/x509/ext.js | 0 .../@sigstore/core/dist/x509/index.js | 0 .../@sigstore/core/dist/x509/sct.js | 0 .../@sigstore/core/package.json | 0 .../node_modules => }/@sigstore/sign/LICENSE | 0 .../@sigstore/sign/dist/bundler/base.js | 0 .../@sigstore/sign/dist/bundler/bundle.js | 0 .../@sigstore/sign/dist/bundler/dsse.js | 0 .../@sigstore/sign/dist/bundler/index.js | 0 .../@sigstore/sign/dist/bundler/message.js | 0 .../@sigstore/sign/dist/error.js | 0 .../@sigstore/sign/dist/external/error.js | 0 .../@sigstore/sign/dist/external/fetch.js | 0 .../@sigstore/sign/dist/external/fulcio.js | 0 .../@sigstore/sign/dist/external/rekor.js | 0 .../@sigstore/sign/dist/external/tsa.js | 0 .../@sigstore/sign/dist/identity/ci.js | 0 .../@sigstore/sign/dist/identity/index.js | 0 .../@sigstore/sign/dist/identity/provider.js | 0 .../@sigstore/sign/dist/index.js | 0 .../@sigstore/sign/dist/signer/fulcio/ca.js | 0 .../sign/dist/signer/fulcio/ephemeral.js | 0 .../sign/dist/signer/fulcio/index.js | 0 .../@sigstore/sign/dist/signer/index.js | 0 .../@sigstore/sign/dist/signer/signer.js | 0 .../@sigstore/sign/dist/types/fetch.js | 0 .../@sigstore/sign/dist/util/index.js | 0 .../@sigstore/sign/dist/util/oidc.js | 0 .../@sigstore/sign/dist/util/ua.js | 0 .../@sigstore/sign/dist/witness/index.js | 0 .../sign/dist/witness/tlog/client.js | 0 .../@sigstore/sign/dist/witness/tlog/entry.js | 0 .../@sigstore/sign/dist/witness/tlog/index.js | 0 .../@sigstore/sign/dist/witness/tsa/client.js | 0 .../@sigstore/sign/dist/witness/tsa/index.js | 0 .../@sigstore/sign/dist/witness/witness.js | 0 .../@sigstore/sign/package.json | 0 .../@sigstore/verify/dist/bundle/dsse.js | 0 .../@sigstore/verify/dist/bundle/index.js | 0 .../@sigstore/verify/dist/bundle/message.js | 0 .../@sigstore/verify/dist/error.js | 0 .../@sigstore/verify/dist/index.js | 0 .../@sigstore/verify/dist/key/certificate.js | 0 .../@sigstore/verify/dist/key/index.js | 0 .../@sigstore/verify/dist/key/sct.js | 0 .../@sigstore/verify/dist/policy.js | 0 .../@sigstore/verify/dist/shared.types.js | 0 .../verify/dist/timestamp/checkpoint.js | 0 .../@sigstore/verify/dist/timestamp/index.js | 0 .../@sigstore/verify/dist/timestamp/merkle.js | 0 .../@sigstore/verify/dist/timestamp/set.js | 0 .../@sigstore/verify/dist/timestamp/tsa.js | 0 .../@sigstore/verify/dist/tlog/dsse.js | 0 .../verify/dist/tlog/hashedrekord.js | 0 .../@sigstore/verify/dist/tlog/index.js | 0 .../@sigstore/verify/dist/tlog/intoto.js | 0 .../@sigstore/verify/dist/trust/filter.js | 0 .../@sigstore/verify/dist/trust/index.js | 0 .../verify/dist/trust/trust.types.js | 0 .../@sigstore/verify/dist/verifier.js | 0 .../@sigstore/verify/package.json | 0 .../node_modules => }/@tufjs/models/LICENSE | 0 .../@tufjs/models/dist/base.js | 0 .../@tufjs/models/dist/delegations.js | 0 .../@tufjs/models/dist/error.js | 0 .../@tufjs/models/dist/file.js | 0 .../@tufjs/models/dist/index.js | 0 .../@tufjs/models/dist/key.js | 0 .../@tufjs/models/dist/metadata.js | 0 .../@tufjs/models/dist/role.js | 0 .../@tufjs/models/dist/root.js | 0 .../@tufjs/models/dist/signature.js | 0 .../@tufjs/models/dist/snapshot.js | 0 .../@tufjs/models/dist/targets.js | 0 .../@tufjs/models/dist/timestamp.js | 0 .../@tufjs/models/dist/utils/guard.js | 0 .../@tufjs/models/dist/utils/index.js | 0 .../@tufjs/models/dist/utils/key.js | 0 .../@tufjs/models/dist/utils/oid.js | 0 .../@tufjs/models/dist/utils/types.js | 0 .../@tufjs/models/dist/utils/verify.js | 0 .../@tufjs/models/package.json | 0 .../npm/node_modules/agent-base/dist/index.js | 9 +- deps/npm/node_modules/agent-base/package.json | 7 +- .../npm/node_modules/aggregate-error/index.js | 47 - deps/npm/node_modules/aggregate-error/license | 9 - .../node_modules/aggregate-error/package.json | 41 - .../node_modules/binary-extensions/index.js | 4 +- .../binary-extensions/package.json | 21 +- .../cacache/node_modules/p-map/index.js | 269 --- .../cacache/node_modules/p-map/license | 9 - .../cacache/node_modules/p-map/package.json | 57 - deps/npm/node_modules/clean-stack/index.js | 40 - deps/npm/node_modules/clean-stack/license | 9 - .../npm/node_modules/clean-stack/package.json | 39 - deps/npm/node_modules/debug/package.json | 7 +- deps/npm/node_modules/debug/src/browser.js | 1 + deps/npm/node_modules/debug/src/common.js | 96 +- deps/npm/node_modules/diff/CONTRIBUTING.md | 10 +- deps/npm/node_modules/diff/dist/diff.js | 1720 ++++++++++------- deps/npm/node_modules/diff/dist/diff.min.js | 38 +- deps/npm/node_modules/diff/lib/convert/dmp.js | 11 +- deps/npm/node_modules/diff/lib/convert/xml.js | 9 +- deps/npm/node_modules/diff/lib/diff/array.js | 20 +- deps/npm/node_modules/diff/lib/diff/base.js | 188 +- .../node_modules/diff/lib/diff/character.js | 18 +- deps/npm/node_modules/diff/lib/diff/css.js | 19 +- deps/npm/node_modules/diff/lib/diff/json.js | 94 +- deps/npm/node_modules/diff/lib/diff/line.js | 79 +- .../node_modules/diff/lib/diff/sentence.js | 17 +- deps/npm/node_modules/diff/lib/diff/word.js | 525 ++++- deps/npm/node_modules/diff/lib/index.es6.js | 1676 +++++++++------- deps/npm/node_modules/diff/lib/index.js | 103 +- deps/npm/node_modules/diff/lib/index.mjs | 1676 +++++++++------- deps/npm/node_modules/diff/lib/patch/apply.js | 411 ++-- .../npm/node_modules/diff/lib/patch/create.js | 497 +++-- .../diff/lib/patch/line-endings.js | 176 ++ deps/npm/node_modules/diff/lib/patch/merge.js | 186 +- deps/npm/node_modules/diff/lib/patch/parse.js | 130 +- .../node_modules/diff/lib/patch/reverse.js | 19 +- deps/npm/node_modules/diff/lib/util/array.js | 7 +- .../diff/lib/util/distance-iterator.js | 33 +- deps/npm/node_modules/diff/lib/util/params.js | 4 +- deps/npm/node_modules/diff/lib/util/string.js | 131 ++ deps/npm/node_modules/diff/package.json | 51 +- deps/npm/node_modules/diff/release-notes.md | 46 +- .../https-proxy-agent/dist/index.js | 21 +- .../https-proxy-agent/package.json | 4 +- deps/npm/node_modules/indent-string/index.js | 35 - deps/npm/node_modules/indent-string/license | 9 - .../node_modules/indent-string/package.json | 37 - .../init-package-json/lib/default-input.js | 5 + .../lib/init-package-json.js | 2 +- .../init-package-json/package.json | 12 +- .../node_modules/libnpmaccess/package.json | 9 +- .../libnpmdiff/lib/format-diff.js | 4 +- .../libnpmdiff/lib/should-print-patch.js | 6 +- deps/npm/node_modules/libnpmdiff/package.json | 16 +- deps/npm/node_modules/libnpmexec/lib/index.js | 2 +- deps/npm/node_modules/libnpmexec/package.json | 14 +- deps/npm/node_modules/libnpmfund/package.json | 10 +- deps/npm/node_modules/libnpmhook/LICENSE.md | 16 - deps/npm/node_modules/libnpmhook/README.md | 271 --- deps/npm/node_modules/libnpmhook/lib/index.js | 70 - deps/npm/node_modules/libnpmhook/package.json | 57 - deps/npm/node_modules/libnpmorg/lib/index.js | 8 +- deps/npm/node_modules/libnpmorg/package.json | 8 +- deps/npm/node_modules/libnpmpack/lib/index.js | 2 +- deps/npm/node_modules/libnpmpack/package.json | 12 +- .../node_modules/libnpmpublish/lib/publish.js | 2 +- .../node_modules/libnpmpublish/package.json | 9 +- .../node_modules/libnpmsearch/package.json | 8 +- deps/npm/node_modules/libnpmteam/package.json | 8 +- .../node_modules/libnpmversion/package.json | 8 +- .../node_modules/npm-package-arg/lib/npa.js | 5 +- .../node_modules/npm-package-arg/package.json | 6 +- .../node_modules/npm-packlist/lib/index.js | 1 + .../node_modules/npm-packlist/package.json | 12 +- deps/npm/node_modules/p-map/index.js | 256 ++- deps/npm/node_modules/p-map/package.json | 28 +- deps/npm/node_modules/pacote/lib/dir.js | 3 + deps/npm/node_modules/pacote/package.json | 13 +- .../socks-proxy-agent/dist/index.js | 16 +- .../socks-proxy-agent/package.json | 4 +- deps/npm/node_modules/sprintf-js/bower.json | 14 - .../node_modules/sprintf-js/demo/angular.html | 20 - deps/npm/node_modules/sprintf-js/gruntfile.js | 36 - deps/npm/node_modules/sprintf-js/test/test.js | 82 - deps/npm/node_modules/walk-up-path/LICENSE | 2 +- .../dist/{cjs => commonjs}/index.js | 0 .../dist/{cjs => commonjs}/package.json | 0 .../walk-up-path/dist/{mjs => esm}/index.js | 0 .../dist/{mjs => esm}/package.json | 0 .../node_modules/walk-up-path/package.json | 75 +- deps/npm/package.json | 54 +- .../test/lib/commands/audit.js.test.cjs | 15 - .../test/lib/commands/completion.js.test.cjs | 1 - .../test/lib/commands/publish.js.test.cjs | 1 - .../test/lib/commands/search.js.test.cjs | 82 - .../test/lib/commands/view.js.test.cjs | 74 +- .../tap-snapshots/test/lib/docs.js.test.cjs | 47 +- .../tap-snapshots/test/lib/npm.js.test.cjs | 76 +- deps/npm/test/fixtures/git-test.tgz | Bin 0 -> 268 bytes .../fixtures/libnpmsearch-stream-result.js | 22 - deps/npm/test/fixtures/mock-npm.js | 20 +- deps/npm/test/lib/cli/entry.js | 8 +- deps/npm/test/lib/commands/audit.js | 48 - deps/npm/test/lib/commands/exec.js | 24 + deps/npm/test/lib/commands/hook.js | 640 ------ deps/npm/test/lib/commands/pkg.js | 20 + deps/npm/test/lib/commands/publish.js | 530 +++-- deps/npm/test/lib/commands/view.js | 15 + 450 files changed, 6414 insertions(+), 8837 deletions(-) delete mode 100644 deps/npm/docs/content/commands/npm-hook.md delete mode 100644 deps/npm/docs/output/commands/npm-hook.html delete mode 100644 deps/npm/lib/commands/hook.js delete mode 100644 deps/npm/man/man1/npm-hook.1 delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/LICENSE delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/README.md delete mode 100755 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/bin/index.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/dir.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/fetcher.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/file.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/git.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/index.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/registry.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/remote.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/add-git-sha.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/cache-dir.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/is-package-bin.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/npm.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/protected.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/tar-create-options.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/trailing-slashes.js delete mode 100644 deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/package.json rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/bundle/LICENSE (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/bundle/dist/build.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/bundle/dist/bundle.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/bundle/dist/error.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/bundle/dist/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/bundle/dist/serialized.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/bundle/dist/utility.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/bundle/dist/validate.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/bundle/package.json (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/LICENSE (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/asn1/error.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/asn1/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/asn1/length.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/asn1/obj.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/asn1/parse.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/asn1/tag.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/crypto.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/dsse.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/encoding.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/json.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/oid.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/pem.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/rfc3161/error.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/rfc3161/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/rfc3161/timestamp.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/rfc3161/tstinfo.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/stream.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/x509/cert.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/x509/ext.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/x509/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/dist/x509/sct.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/core/package.json (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/LICENSE (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/bundler/base.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/bundler/bundle.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/bundler/dsse.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/bundler/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/bundler/message.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/error.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/external/error.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/external/fetch.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/external/fulcio.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/external/rekor.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/external/tsa.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/identity/ci.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/identity/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/identity/provider.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/signer/fulcio/ca.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/signer/fulcio/ephemeral.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/signer/fulcio/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/signer/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/signer/signer.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/types/fetch.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/util/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/util/oidc.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/util/ua.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/witness/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/witness/tlog/client.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/witness/tlog/entry.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/witness/tlog/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/witness/tsa/client.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/witness/tsa/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/dist/witness/witness.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/sign/package.json (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/bundle/dsse.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/bundle/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/bundle/message.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/error.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/key/certificate.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/key/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/key/sct.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/policy.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/shared.types.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/timestamp/checkpoint.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/timestamp/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/timestamp/merkle.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/timestamp/set.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/timestamp/tsa.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/tlog/dsse.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/tlog/hashedrekord.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/tlog/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/tlog/intoto.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/trust/filter.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/trust/index.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/trust/trust.types.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/dist/verifier.js (100%) rename deps/npm/node_modules/{sigstore/node_modules => }/@sigstore/verify/package.json (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/LICENSE (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/base.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/delegations.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/error.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/file.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/index.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/key.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/metadata.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/role.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/root.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/signature.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/snapshot.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/targets.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/timestamp.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/utils/guard.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/utils/index.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/utils/key.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/utils/oid.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/utils/types.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/dist/utils/verify.js (100%) rename deps/npm/node_modules/{tuf-js/node_modules => }/@tufjs/models/package.json (100%) delete mode 100644 deps/npm/node_modules/aggregate-error/index.js delete mode 100644 deps/npm/node_modules/aggregate-error/license delete mode 100644 deps/npm/node_modules/aggregate-error/package.json delete mode 100644 deps/npm/node_modules/cacache/node_modules/p-map/index.js delete mode 100644 deps/npm/node_modules/cacache/node_modules/p-map/license delete mode 100644 deps/npm/node_modules/cacache/node_modules/p-map/package.json delete mode 100644 deps/npm/node_modules/clean-stack/index.js delete mode 100644 deps/npm/node_modules/clean-stack/license delete mode 100644 deps/npm/node_modules/clean-stack/package.json create mode 100644 deps/npm/node_modules/diff/lib/patch/line-endings.js create mode 100644 deps/npm/node_modules/diff/lib/util/string.js delete mode 100644 deps/npm/node_modules/indent-string/index.js delete mode 100644 deps/npm/node_modules/indent-string/license delete mode 100644 deps/npm/node_modules/indent-string/package.json delete mode 100644 deps/npm/node_modules/libnpmhook/LICENSE.md delete mode 100644 deps/npm/node_modules/libnpmhook/README.md delete mode 100644 deps/npm/node_modules/libnpmhook/lib/index.js delete mode 100644 deps/npm/node_modules/libnpmhook/package.json delete mode 100644 deps/npm/node_modules/sprintf-js/bower.json delete mode 100644 deps/npm/node_modules/sprintf-js/demo/angular.html delete mode 100644 deps/npm/node_modules/sprintf-js/gruntfile.js delete mode 100644 deps/npm/node_modules/sprintf-js/test/test.js rename deps/npm/node_modules/walk-up-path/dist/{cjs => commonjs}/index.js (100%) rename deps/npm/node_modules/walk-up-path/dist/{cjs => commonjs}/package.json (100%) rename deps/npm/node_modules/walk-up-path/dist/{mjs => esm}/index.js (100%) rename deps/npm/node_modules/walk-up-path/dist/{mjs => esm}/package.json (100%) create mode 100644 deps/npm/test/fixtures/git-test.tgz delete mode 100644 deps/npm/test/lib/commands/hook.js diff --git a/deps/npm/docs/content/commands/npm-hook.md b/deps/npm/docs/content/commands/npm-hook.md deleted file mode 100644 index 581e78661d6c2f..00000000000000 --- a/deps/npm/docs/content/commands/npm-hook.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: npm-hook -section: 1 -description: Manage registry hooks ---- - -### Synopsis - -```bash -npm hook add [--type=] -npm hook ls [pkg] -npm hook rm -npm hook update -``` - -Note: This command is unaware of workspaces. - -### Description - -Allows you to manage [npm -hooks](https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm), -including adding, removing, listing, and updating. - -Hooks allow you to configure URL endpoints that will be notified whenever a -change happens to any of the supported entity types. Three different types -of entities can be watched by hooks: packages, owners, and scopes. - -To create a package hook, simply reference the package name. - -To create an owner hook, prefix the owner name with `~` (as in, -`~youruser`). - -To create a scope hook, prefix the scope name with `@` (as in, -`@yourscope`). - -The hook `id` used by `update` and `rm` are the IDs listed in `npm hook ls` -for that particular hook. - -The shared secret will be sent along to the URL endpoint so you can verify -the request came from your own configured hook. - -### Example - -Add a hook to watch a package for changes: - -```bash -$ npm hook add lodash https://example.com/ my-shared-secret -``` - -Add a hook to watch packages belonging to the user `substack`: - -```bash -$ npm hook add ~substack https://example.com/ my-shared-secret -``` - -Add a hook to watch packages in the scope `@npm` - -```bash -$ npm hook add @npm https://example.com/ my-shared-secret -``` - -List all your active hooks: - -```bash -$ npm hook ls -``` - -List your active hooks for the `lodash` package: - -```bash -$ npm hook ls lodash -``` - -Update an existing hook's url: - -```bash -$ npm hook update id-deadbeef https://my-new-website.here/ -``` - -Remove a hook: - -```bash -$ npm hook rm id-deadbeef -``` - -### Configuration - -#### `registry` - -* Default: "https://registry.npmjs.org/" -* Type: URL - -The base URL of the npm registry. - - - -#### `otp` - -* Default: null -* Type: null or String - -This is a one-time password from a two-factor authenticator. It's needed -when publishing or changing package permissions with `npm access`. - -If not set, and a registry response fails with a challenge for a one-time -password, npm will prompt on the command line for one. - - - -### See Also - -* ["Introducing Hooks" blog post](https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm) diff --git a/deps/npm/docs/content/commands/npm-ls.md b/deps/npm/docs/content/commands/npm-ls.md index 69bc86f85f3508..1169da1f0973b0 100644 --- a/deps/npm/docs/content/commands/npm-ls.md +++ b/deps/npm/docs/content/commands/npm-ls.md @@ -27,7 +27,7 @@ packages will *also* show the paths to the specified packages. For example, running `npm ls promzard` in npm's source tree will show: ```bash -npm@10.9.2 /path/to/npm +npm@11.0.0 /path/to/npm └─┬ init-package-json@0.0.4 └── promzard@0.1.5 ``` @@ -43,34 +43,6 @@ dependencies, not the physical layout of your `node_modules` folder. When run as `ll` or `la`, it shows extended information by default. -### Note: Design Changes Pending - -The `npm ls` command's output and behavior made a _ton_ of sense when npm -created a `node_modules` folder that naively nested every dependency. In -such a case, the logical dependency graph and physical tree of packages on -disk would be roughly identical. - -With the advent of automatic install-time deduplication of dependencies in -npm v3, the `ls` output was modified to display the logical dependency -graph as a tree structure, since this was more useful to most users. -However, without using `npm ls -l`, it became impossible to show _where_ a -package was actually installed much of the time! - -With the advent of automatic installation of `peerDependencies` in npm v7, -this gets even more curious, as `peerDependencies` are logically -"underneath" their dependents in the dependency graph, but are always -physically at or above their location on disk. - -Also, in the years since npm got an `ls` command (in version 0.0.2!), -dependency graphs have gotten much larger as a general rule. Therefore, in -order to avoid dumping an excessive amount of content to the terminal, `npm -ls` now only shows the _top_ level dependencies, unless `--all` is -provided. - -A thorough re-examination of the use cases, intention, behavior, and output -of this command, is currently underway. Expect significant changes to at -least the default human-readable `npm ls` output in npm v8. - ### Configuration #### `all` diff --git a/deps/npm/docs/content/commands/npm-pack.md b/deps/npm/docs/content/commands/npm-pack.md index 2ef859786085f2..2d3e3453d36886 100644 --- a/deps/npm/docs/content/commands/npm-pack.md +++ b/deps/npm/docs/content/commands/npm-pack.md @@ -103,6 +103,20 @@ the specified workspaces, and not on the root project. This value is not exported to the environment for child processes. +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + ### Description For anything that's installable (that is, a package folder, tarball, diff --git a/deps/npm/docs/content/commands/npm-prefix.md b/deps/npm/docs/content/commands/npm-prefix.md index 7718ed34ff828c..ad584643a1ecec 100644 --- a/deps/npm/docs/content/commands/npm-prefix.md +++ b/deps/npm/docs/content/commands/npm-prefix.md @@ -7,7 +7,7 @@ description: Display prefix ### Synopsis ```bash -npm prefix [-g] +npm prefix ``` Note: This command is unaware of workspaces. diff --git a/deps/npm/docs/content/commands/npm-publish.md b/deps/npm/docs/content/commands/npm-publish.md index 6bff5ff1c30201..266038c306359c 100644 --- a/deps/npm/docs/content/commands/npm-publish.md +++ b/deps/npm/docs/content/commands/npm-publish.md @@ -85,6 +85,9 @@ See [`developers`](/using-npm/developers) for full details on what's included in the published package, as well as details on how the package is built. +See [`package.json`](/configuring-npm/package-json) for more info on +what can and can't be ignored. + ### Configuration #### `tag` diff --git a/deps/npm/docs/content/commands/npm.md b/deps/npm/docs/content/commands/npm.md index 029b9fa7631544..36398a3cb34f36 100644 --- a/deps/npm/docs/content/commands/npm.md +++ b/deps/npm/docs/content/commands/npm.md @@ -14,7 +14,7 @@ Note: This command is unaware of workspaces. ### Version -10.9.2 +11.0.0 ### Description diff --git a/deps/npm/docs/content/configuring-npm/npmrc.md b/deps/npm/docs/content/configuring-npm/npmrc.md index fb335b2d43da70..cd31ae886f1320 100644 --- a/deps/npm/docs/content/configuring-npm/npmrc.md +++ b/deps/npm/docs/content/configuring-npm/npmrc.md @@ -103,7 +103,7 @@ The full list is: - `username` - `_password` - `email` - - `certfile` (path to certificate file) + - `cafile` (path to certificate authority file) - `keyfile` (path to key file) In order to scope these values, they must be prefixed by a URI fragment. diff --git a/deps/npm/docs/content/configuring-npm/package-json.md b/deps/npm/docs/content/configuring-npm/package-json.md index 7e9daf1317717f..90fbcee64de783 100644 --- a/deps/npm/docs/content/configuring-npm/package-json.md +++ b/deps/npm/docs/content/configuring-npm/package-json.md @@ -324,6 +324,7 @@ Some files are always ignored by default: if you wish it to be published) * `pnpm-lock.yaml` * `yarn.lock` +* `bun.lockb` Most of these ignored files can be included specifically if included in the `files` globs. Exceptions to this are: @@ -334,6 +335,7 @@ the `files` globs. Exceptions to this are: * `package-lock.json` * `pnpm-lock.yaml` * `yarn.lock` +* `bun.lockb` These can not be included. @@ -1129,6 +1131,18 @@ Like the `os` option, you can also block architectures: The host architecture is determined by `process.arch` +### libc + +If your code only runs or builds in certain versions of libc, you can +specify which ones. This field only applies if `os` is `linux`. + +```json +{ + "os": "linux", + "libc": "glibc" +} +``` + ### devEngines The `devEngines` field aids engineers working on a codebase to all be using the same tooling. diff --git a/deps/npm/docs/content/using-npm/config.md b/deps/npm/docs/content/using-npm/config.md index 6143e59d46a040..4209b9bb1ae57c 100644 --- a/deps/npm/docs/content/using-npm/config.md +++ b/deps/npm/docs/content/using-npm/config.md @@ -1833,9 +1833,9 @@ When set to `dev` or `development`, this is an alias for `--include=dev`. * Default: null * Type: null or String * DEPRECATED: `key` and `cert` are no longer used for most registry - operations. Use registry scoped `keyfile` and `certfile` instead. Example: + operations. Use registry scoped `keyfile` and `cafile` instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem - //other-registry.tld/:certfile=/path/to/cert.crt + //other-registry.tld/:cafile=/path/to/cert.crt A client certificate to pass when accessing the registry. Values should be in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with @@ -1846,8 +1846,8 @@ cert="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----" ``` It is _not_ the path to a certificate file, though you can set a -registry-scoped "certfile" path like -"//other-registry.tld/:certfile=/path/to/cert.pem". +registry-scoped "cafile" path like +"//other-registry.tld/:cafile=/path/to/cert.pem". @@ -1938,9 +1938,9 @@ Alias for `--init-version` * Default: null * Type: null or String * DEPRECATED: `key` and `cert` are no longer used for most registry - operations. Use registry scoped `keyfile` and `certfile` instead. Example: + operations. Use registry scoped `keyfile` and `cafile` instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem - //other-registry.tld/:certfile=/path/to/cert.crt + //other-registry.tld/:cafile=/path/to/cert.crt A client key to pass when accessing the registry. Values should be in PEM format with newlines replaced by the string "\n". For example: diff --git a/deps/npm/docs/content/using-npm/developers.md b/deps/npm/docs/content/using-npm/developers.md index 5fc2e5876e3dd3..b97ca038b4a4ba 100644 --- a/deps/npm/docs/content/using-npm/developers.md +++ b/deps/npm/docs/content/using-npm/developers.md @@ -112,8 +112,8 @@ as `.gitignore` files: * You can end patterns with a forward slash `/` to specify a directory. * You can negate a pattern by starting it with an exclamation point `!`. -By default, the following paths and files are ignored, so there's no -need to add them to `.npmignore` explicitly: +By default, some paths and files are ignored, so there's no +need to add them to `.npmignore` explicitly. Some examples are: * `.*.swp` * `._*` @@ -148,6 +148,9 @@ property of `package.json`, which is an array of file or directory names that should be included in your package. Sometimes manually picking which items to allow is easier to manage than building a block list. +See [`package.json`](/configuring-npm/package-json) for more info on +what can and can't be ignored. + #### Testing whether your `.npmignore` or `files` config works If you want to double check that your package will include only the files diff --git a/deps/npm/docs/output/commands/npm-access.html b/deps/npm/docs/output/commands/npm-access.html index 9ce3c00e3525d8..705489bba53296 100644 --- a/deps/npm/docs/output/commands/npm-access.html +++ b/deps/npm/docs/output/commands/npm-access.html @@ -141,9 +141,9 @@
-

+

npm-access - @10.9.2 + @11.0.0

Set access level on published packages
diff --git a/deps/npm/docs/output/commands/npm-adduser.html b/deps/npm/docs/output/commands/npm-adduser.html index 5f6627229d2c8b..c71dd30b1fd8b8 100644 --- a/deps/npm/docs/output/commands/npm-adduser.html +++ b/deps/npm/docs/output/commands/npm-adduser.html @@ -141,9 +141,9 @@
-

+

npm-adduser - @10.9.2 + @11.0.0

Add a registry user account
diff --git a/deps/npm/docs/output/commands/npm-audit.html b/deps/npm/docs/output/commands/npm-audit.html index a8934d172e3602..15c2d5129d1806 100644 --- a/deps/npm/docs/output/commands/npm-audit.html +++ b/deps/npm/docs/output/commands/npm-audit.html @@ -141,9 +141,9 @@
-

+

npm-audit - @10.9.2 + @11.0.0

Run a security audit
diff --git a/deps/npm/docs/output/commands/npm-bugs.html b/deps/npm/docs/output/commands/npm-bugs.html index 3ec74a05673259..6afee019696255 100644 --- a/deps/npm/docs/output/commands/npm-bugs.html +++ b/deps/npm/docs/output/commands/npm-bugs.html @@ -141,9 +141,9 @@
-

+

npm-bugs - @10.9.2 + @11.0.0

Report bugs for a package in a web browser
diff --git a/deps/npm/docs/output/commands/npm-cache.html b/deps/npm/docs/output/commands/npm-cache.html index 0a4fd00a276a47..dc0e1d7792d5bc 100644 --- a/deps/npm/docs/output/commands/npm-cache.html +++ b/deps/npm/docs/output/commands/npm-cache.html @@ -141,9 +141,9 @@
-

+

npm-cache - @10.9.2 + @11.0.0

Manipulates packages cache
diff --git a/deps/npm/docs/output/commands/npm-ci.html b/deps/npm/docs/output/commands/npm-ci.html index 3af67dc55c81db..da9bef01d51722 100644 --- a/deps/npm/docs/output/commands/npm-ci.html +++ b/deps/npm/docs/output/commands/npm-ci.html @@ -141,9 +141,9 @@
-

+

npm-ci - @10.9.2 + @11.0.0

Clean install a project
diff --git a/deps/npm/docs/output/commands/npm-completion.html b/deps/npm/docs/output/commands/npm-completion.html index 3f8b509e4ec8d6..687fd873263ce7 100644 --- a/deps/npm/docs/output/commands/npm-completion.html +++ b/deps/npm/docs/output/commands/npm-completion.html @@ -141,9 +141,9 @@
-

+

npm-completion - @10.9.2 + @11.0.0

Tab Completion for npm
diff --git a/deps/npm/docs/output/commands/npm-config.html b/deps/npm/docs/output/commands/npm-config.html index c9b9a2c7550bcc..6db882f847de76 100644 --- a/deps/npm/docs/output/commands/npm-config.html +++ b/deps/npm/docs/output/commands/npm-config.html @@ -141,9 +141,9 @@
-

+

npm-config - @10.9.2 + @11.0.0

Manage the npm configuration files
diff --git a/deps/npm/docs/output/commands/npm-dedupe.html b/deps/npm/docs/output/commands/npm-dedupe.html index 0aa8bf5a5bde77..598f7ff9472d6d 100644 --- a/deps/npm/docs/output/commands/npm-dedupe.html +++ b/deps/npm/docs/output/commands/npm-dedupe.html @@ -141,9 +141,9 @@
-

+

npm-dedupe - @10.9.2 + @11.0.0

Reduce duplication in the package tree
diff --git a/deps/npm/docs/output/commands/npm-deprecate.html b/deps/npm/docs/output/commands/npm-deprecate.html index 0019583ee2135a..88e4c4682407f7 100644 --- a/deps/npm/docs/output/commands/npm-deprecate.html +++ b/deps/npm/docs/output/commands/npm-deprecate.html @@ -141,9 +141,9 @@
-

+

npm-deprecate - @10.9.2 + @11.0.0

Deprecate a version of a package
diff --git a/deps/npm/docs/output/commands/npm-diff.html b/deps/npm/docs/output/commands/npm-diff.html index fe2123ee60fdc8..d682aff9b479c2 100644 --- a/deps/npm/docs/output/commands/npm-diff.html +++ b/deps/npm/docs/output/commands/npm-diff.html @@ -141,9 +141,9 @@
-

+

npm-diff - @10.9.2 + @11.0.0

The registry diff command
diff --git a/deps/npm/docs/output/commands/npm-dist-tag.html b/deps/npm/docs/output/commands/npm-dist-tag.html index dce3f752ba4eaa..34698aa4bcd59c 100644 --- a/deps/npm/docs/output/commands/npm-dist-tag.html +++ b/deps/npm/docs/output/commands/npm-dist-tag.html @@ -141,9 +141,9 @@
-

+

npm-dist-tag - @10.9.2 + @11.0.0

Modify package distribution tags
diff --git a/deps/npm/docs/output/commands/npm-docs.html b/deps/npm/docs/output/commands/npm-docs.html index caef5afe3b1bd4..cf0980ddecfd8c 100644 --- a/deps/npm/docs/output/commands/npm-docs.html +++ b/deps/npm/docs/output/commands/npm-docs.html @@ -141,9 +141,9 @@
-

+

npm-docs - @10.9.2 + @11.0.0

Open documentation for a package in a web browser
diff --git a/deps/npm/docs/output/commands/npm-doctor.html b/deps/npm/docs/output/commands/npm-doctor.html index d9f7a71450ab75..c662329ee54077 100644 --- a/deps/npm/docs/output/commands/npm-doctor.html +++ b/deps/npm/docs/output/commands/npm-doctor.html @@ -141,9 +141,9 @@
-

+

npm-doctor - @10.9.2 + @11.0.0

Check the health of your npm environment
diff --git a/deps/npm/docs/output/commands/npm-edit.html b/deps/npm/docs/output/commands/npm-edit.html index ab835ddcd352f9..bea9f57318650e 100644 --- a/deps/npm/docs/output/commands/npm-edit.html +++ b/deps/npm/docs/output/commands/npm-edit.html @@ -141,9 +141,9 @@
-

+

npm-edit - @10.9.2 + @11.0.0

Edit an installed package
diff --git a/deps/npm/docs/output/commands/npm-exec.html b/deps/npm/docs/output/commands/npm-exec.html index b5b8f66bdbb54f..3a60bfbe9e79a9 100644 --- a/deps/npm/docs/output/commands/npm-exec.html +++ b/deps/npm/docs/output/commands/npm-exec.html @@ -141,9 +141,9 @@
-

+

npm-exec - @10.9.2 + @11.0.0

Run a command from a local or remote npm package
diff --git a/deps/npm/docs/output/commands/npm-explain.html b/deps/npm/docs/output/commands/npm-explain.html index 812ce85f73a130..f9a4cfd44a15fa 100644 --- a/deps/npm/docs/output/commands/npm-explain.html +++ b/deps/npm/docs/output/commands/npm-explain.html @@ -141,9 +141,9 @@
-

+

npm-explain - @10.9.2 + @11.0.0

Explain installed packages
diff --git a/deps/npm/docs/output/commands/npm-explore.html b/deps/npm/docs/output/commands/npm-explore.html index 20d761c0db149c..63c33e340bb64a 100644 --- a/deps/npm/docs/output/commands/npm-explore.html +++ b/deps/npm/docs/output/commands/npm-explore.html @@ -141,9 +141,9 @@
-

+

npm-explore - @10.9.2 + @11.0.0

Browse an installed package
diff --git a/deps/npm/docs/output/commands/npm-find-dupes.html b/deps/npm/docs/output/commands/npm-find-dupes.html index 9b2810cf1b17ac..888337152afff1 100644 --- a/deps/npm/docs/output/commands/npm-find-dupes.html +++ b/deps/npm/docs/output/commands/npm-find-dupes.html @@ -141,9 +141,9 @@
-

+

npm-find-dupes - @10.9.2 + @11.0.0

Find duplication in the package tree
diff --git a/deps/npm/docs/output/commands/npm-fund.html b/deps/npm/docs/output/commands/npm-fund.html index 91e0a71c3b32af..56eff2d49873a5 100644 --- a/deps/npm/docs/output/commands/npm-fund.html +++ b/deps/npm/docs/output/commands/npm-fund.html @@ -141,9 +141,9 @@
-

+

npm-fund - @10.9.2 + @11.0.0

Retrieve funding information
diff --git a/deps/npm/docs/output/commands/npm-help-search.html b/deps/npm/docs/output/commands/npm-help-search.html index 35e2ec587c48e8..cc62294b56227b 100644 --- a/deps/npm/docs/output/commands/npm-help-search.html +++ b/deps/npm/docs/output/commands/npm-help-search.html @@ -141,9 +141,9 @@
-

+

npm-help-search - @10.9.2 + @11.0.0

Search npm help documentation
diff --git a/deps/npm/docs/output/commands/npm-help.html b/deps/npm/docs/output/commands/npm-help.html index 17403f14c89427..f7f6085021a435 100644 --- a/deps/npm/docs/output/commands/npm-help.html +++ b/deps/npm/docs/output/commands/npm-help.html @@ -141,9 +141,9 @@
-

+

npm-help - @10.9.2 + @11.0.0

Get help on npm
diff --git a/deps/npm/docs/output/commands/npm-hook.html b/deps/npm/docs/output/commands/npm-hook.html deleted file mode 100644 index d06784faf03624..00000000000000 --- a/deps/npm/docs/output/commands/npm-hook.html +++ /dev/null @@ -1,234 +0,0 @@ - - -npm-hook - - - - - -
-
-

- npm-hook - @10.9.2 -

-Manage registry hooks -
- -
-

Table of contents

- -
- -

Synopsis

-
npm hook add <pkg> <url> <secret> [--type=<type>]
-npm hook ls [pkg]
-npm hook rm <id>
-npm hook update <id> <url> <secret>
-
-

Note: This command is unaware of workspaces.

-

Description

-

Allows you to manage npm -hooks, -including adding, removing, listing, and updating.

-

Hooks allow you to configure URL endpoints that will be notified whenever a -change happens to any of the supported entity types. Three different types -of entities can be watched by hooks: packages, owners, and scopes.

-

To create a package hook, simply reference the package name.

-

To create an owner hook, prefix the owner name with ~ (as in, -~youruser).

-

To create a scope hook, prefix the scope name with @ (as in, -@yourscope).

-

The hook id used by update and rm are the IDs listed in npm hook ls -for that particular hook.

-

The shared secret will be sent along to the URL endpoint so you can verify -the request came from your own configured hook.

-

Example

-

Add a hook to watch a package for changes:

-
$ npm hook add lodash https://example.com/ my-shared-secret
-
-

Add a hook to watch packages belonging to the user substack:

-
$ npm hook add ~substack https://example.com/ my-shared-secret
-
-

Add a hook to watch packages in the scope @npm

-
$ npm hook add @npm https://example.com/ my-shared-secret
-
-

List all your active hooks:

-
$ npm hook ls
-
-

List your active hooks for the lodash package:

-
$ npm hook ls lodash
-
-

Update an existing hook's url:

-
$ npm hook update id-deadbeef https://my-new-website.here/
-
-

Remove a hook:

-
$ npm hook rm id-deadbeef
-
-

Configuration

-

registry

- -

The base URL of the npm registry.

-

otp

-
    -
  • Default: null
  • -
  • Type: null or String
  • -
-

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

-

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

-

See Also

-
- - -
- - - - \ No newline at end of file diff --git a/deps/npm/docs/output/commands/npm-init.html b/deps/npm/docs/output/commands/npm-init.html index 430763db6ba6af..0a95b514d387c2 100644 --- a/deps/npm/docs/output/commands/npm-init.html +++ b/deps/npm/docs/output/commands/npm-init.html @@ -141,9 +141,9 @@
-

+

npm-init - @10.9.2 + @11.0.0

Create a package.json file
diff --git a/deps/npm/docs/output/commands/npm-install-ci-test.html b/deps/npm/docs/output/commands/npm-install-ci-test.html index 6a29d2d54f679e..1ac7a4650e8ed2 100644 --- a/deps/npm/docs/output/commands/npm-install-ci-test.html +++ b/deps/npm/docs/output/commands/npm-install-ci-test.html @@ -141,9 +141,9 @@
-

+

npm-install-ci-test - @10.9.2 + @11.0.0

Install a project with a clean slate and run tests
diff --git a/deps/npm/docs/output/commands/npm-install-test.html b/deps/npm/docs/output/commands/npm-install-test.html index 32bd2271074fb6..e9c0ec8aa23f6b 100644 --- a/deps/npm/docs/output/commands/npm-install-test.html +++ b/deps/npm/docs/output/commands/npm-install-test.html @@ -141,9 +141,9 @@
-

+

npm-install-test - @10.9.2 + @11.0.0

Install package(s) and run tests
diff --git a/deps/npm/docs/output/commands/npm-install.html b/deps/npm/docs/output/commands/npm-install.html index db7d717d18160b..466171e4eeca78 100644 --- a/deps/npm/docs/output/commands/npm-install.html +++ b/deps/npm/docs/output/commands/npm-install.html @@ -141,9 +141,9 @@
-

+

npm-install - @10.9.2 + @11.0.0

Install a package
diff --git a/deps/npm/docs/output/commands/npm-link.html b/deps/npm/docs/output/commands/npm-link.html index 5778cc2a6268d2..76b8ed6c57ea07 100644 --- a/deps/npm/docs/output/commands/npm-link.html +++ b/deps/npm/docs/output/commands/npm-link.html @@ -141,9 +141,9 @@
-

+

npm-link - @10.9.2 + @11.0.0

Symlink a package folder
diff --git a/deps/npm/docs/output/commands/npm-login.html b/deps/npm/docs/output/commands/npm-login.html index 81555fcecefd3e..6d7c32a66c5720 100644 --- a/deps/npm/docs/output/commands/npm-login.html +++ b/deps/npm/docs/output/commands/npm-login.html @@ -141,9 +141,9 @@
-

+

npm-login - @10.9.2 + @11.0.0

Login to a registry user account
diff --git a/deps/npm/docs/output/commands/npm-logout.html b/deps/npm/docs/output/commands/npm-logout.html index 1b6cdf8b923034..8308703080305c 100644 --- a/deps/npm/docs/output/commands/npm-logout.html +++ b/deps/npm/docs/output/commands/npm-logout.html @@ -141,9 +141,9 @@
-

+

npm-logout - @10.9.2 + @11.0.0

Log out of the registry
diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index c9aa847abf1dd4..2f60ef08840272 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -141,16 +141,16 @@
-

+

npm-ls - @10.9.2 + @11.0.0

List installed packages

Table of contents

- +

Synopsis

@@ -168,7 +168,7 @@

Description

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

-
npm@10.9.2 /path/to/npm
+
npm@11.0.0 /path/to/npm
 └─┬ init-package-json@0.0.4
   └── promzard@0.1.5
 
@@ -179,27 +179,6 @@

Description

The tree shown is the logical dependency tree, based on package dependencies, not the physical layout of your node_modules folder.

When run as ll or la, it shows extended information by default.

-

Note: Design Changes Pending

-

The npm ls command's output and behavior made a ton of sense when npm -created a node_modules folder that naively nested every dependency. In -such a case, the logical dependency graph and physical tree of packages on -disk would be roughly identical.

-

With the advent of automatic install-time deduplication of dependencies in -npm v3, the ls output was modified to display the logical dependency -graph as a tree structure, since this was more useful to most users. -However, without using npm ls -l, it became impossible to show where a -package was actually installed much of the time!

-

With the advent of automatic installation of peerDependencies in npm v7, -this gets even more curious, as peerDependencies are logically -"underneath" their dependents in the dependency graph, but are always -physically at or above their location on disk.

-

Also, in the years since npm got an ls command (in version 0.0.2!), -dependency graphs have gotten much larger as a general rule. Therefore, in -order to avoid dumping an excessive amount of content to the terminal, npm ls now only shows the top level dependencies, unless --all is -provided.

-

A thorough re-examination of the use cases, intention, behavior, and output -of this command, is currently underway. Expect significant changes to at -least the default human-readable npm ls output in npm v8.

Configuration

all

    diff --git a/deps/npm/docs/output/commands/npm-org.html b/deps/npm/docs/output/commands/npm-org.html index 6c45111f034994..ccc310efdb165e 100644 --- a/deps/npm/docs/output/commands/npm-org.html +++ b/deps/npm/docs/output/commands/npm-org.html @@ -141,9 +141,9 @@
    -

    +

    npm-org - @10.9.2 + @11.0.0

    Manage orgs
    diff --git a/deps/npm/docs/output/commands/npm-outdated.html b/deps/npm/docs/output/commands/npm-outdated.html index 9be28fdfd239e1..1875a6f204f73b 100644 --- a/deps/npm/docs/output/commands/npm-outdated.html +++ b/deps/npm/docs/output/commands/npm-outdated.html @@ -141,9 +141,9 @@
    -

    +

    npm-outdated - @10.9.2 + @11.0.0

    Check for outdated packages
    diff --git a/deps/npm/docs/output/commands/npm-owner.html b/deps/npm/docs/output/commands/npm-owner.html index fc0899e5e5d66b..5bf138010b189a 100644 --- a/deps/npm/docs/output/commands/npm-owner.html +++ b/deps/npm/docs/output/commands/npm-owner.html @@ -141,9 +141,9 @@
    -

    +

    npm-owner - @10.9.2 + @11.0.0

    Manage package owners
    diff --git a/deps/npm/docs/output/commands/npm-pack.html b/deps/npm/docs/output/commands/npm-pack.html index 359d463780e510..acc909f46c701f 100644 --- a/deps/npm/docs/output/commands/npm-pack.html +++ b/deps/npm/docs/output/commands/npm-pack.html @@ -141,16 +141,16 @@
    -

    +

    npm-pack - @10.9.2 + @11.0.0

    Create a tarball from a package

    Table of contents

    - +

    Synopsis

    @@ -230,6 +230,16 @@

    include-workspace-root

    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.

    +

    ignore-scripts

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

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

    +

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

    Description

    For anything that's installable (that is, a package folder, tarball, tarball url, git url, name@tag, name@version, name, or scoped name), this diff --git a/deps/npm/docs/output/commands/npm-ping.html b/deps/npm/docs/output/commands/npm-ping.html index 4b3fbbc698cbb7..ca4f2cabf33232 100644 --- a/deps/npm/docs/output/commands/npm-ping.html +++ b/deps/npm/docs/output/commands/npm-ping.html @@ -141,9 +141,9 @@

    -

    +

    npm-ping - @10.9.2 + @11.0.0

    Ping npm registry
    diff --git a/deps/npm/docs/output/commands/npm-pkg.html b/deps/npm/docs/output/commands/npm-pkg.html index f1fe76e8073150..6ff0880e37acb5 100644 --- a/deps/npm/docs/output/commands/npm-pkg.html +++ b/deps/npm/docs/output/commands/npm-pkg.html @@ -141,9 +141,9 @@
    -

    +

    npm-pkg - @10.9.2 + @11.0.0

    Manages your package.json
    diff --git a/deps/npm/docs/output/commands/npm-prefix.html b/deps/npm/docs/output/commands/npm-prefix.html index 9708e55234ab4c..c72108668925da 100644 --- a/deps/npm/docs/output/commands/npm-prefix.html +++ b/deps/npm/docs/output/commands/npm-prefix.html @@ -141,9 +141,9 @@
    -

    +

    npm-prefix - @10.9.2 + @11.0.0

    Display prefix
    @@ -154,7 +154,7 @@

    Table of contents

    Synopsis

    -
    npm prefix [-g]
    +
    npm prefix
     

    Note: This command is unaware of workspaces.

    Description

    diff --git a/deps/npm/docs/output/commands/npm-profile.html b/deps/npm/docs/output/commands/npm-profile.html index 6bb08b1fda63a6..86705775e1c86b 100644 --- a/deps/npm/docs/output/commands/npm-profile.html +++ b/deps/npm/docs/output/commands/npm-profile.html @@ -141,9 +141,9 @@
    -

    +

    npm-profile - @10.9.2 + @11.0.0

    Change settings on your registry profile
    diff --git a/deps/npm/docs/output/commands/npm-prune.html b/deps/npm/docs/output/commands/npm-prune.html index 818522d63754f9..da263ef7fc83a2 100644 --- a/deps/npm/docs/output/commands/npm-prune.html +++ b/deps/npm/docs/output/commands/npm-prune.html @@ -141,9 +141,9 @@
    -

    +

    npm-prune - @10.9.2 + @11.0.0

    Remove extraneous packages
    diff --git a/deps/npm/docs/output/commands/npm-publish.html b/deps/npm/docs/output/commands/npm-publish.html index 37c19e0b8f357c..55b32480044e16 100644 --- a/deps/npm/docs/output/commands/npm-publish.html +++ b/deps/npm/docs/output/commands/npm-publish.html @@ -141,9 +141,9 @@
    -

    +

    npm-publish - @10.9.2 + @11.0.0

    Publish a package
    @@ -225,6 +225,8 @@

    Files included in package

    See developers for full details on what's included in the published package, as well as details on how the package is built.

    +

    See package.json for more info on +what can and can't be ignored.

    Configuration

    tag

      diff --git a/deps/npm/docs/output/commands/npm-query.html b/deps/npm/docs/output/commands/npm-query.html index 4a0210e62f58ea..7c9819a59dfc8a 100644 --- a/deps/npm/docs/output/commands/npm-query.html +++ b/deps/npm/docs/output/commands/npm-query.html @@ -141,9 +141,9 @@
      -

      +

      npm-query - @10.9.2 + @11.0.0

      Dependency selector query
      diff --git a/deps/npm/docs/output/commands/npm-rebuild.html b/deps/npm/docs/output/commands/npm-rebuild.html index 0a356397c4a95b..541163fe454649 100644 --- a/deps/npm/docs/output/commands/npm-rebuild.html +++ b/deps/npm/docs/output/commands/npm-rebuild.html @@ -141,9 +141,9 @@
      -

      +

      npm-rebuild - @10.9.2 + @11.0.0

      Rebuild a package
      diff --git a/deps/npm/docs/output/commands/npm-repo.html b/deps/npm/docs/output/commands/npm-repo.html index ad86f81682375d..cf5ad32161239b 100644 --- a/deps/npm/docs/output/commands/npm-repo.html +++ b/deps/npm/docs/output/commands/npm-repo.html @@ -141,9 +141,9 @@
      -

      +

      npm-repo - @10.9.2 + @11.0.0

      Open package repository page in the browser
      diff --git a/deps/npm/docs/output/commands/npm-restart.html b/deps/npm/docs/output/commands/npm-restart.html index 4a2244b048ecbc..ac1ee9710a9ade 100644 --- a/deps/npm/docs/output/commands/npm-restart.html +++ b/deps/npm/docs/output/commands/npm-restart.html @@ -141,9 +141,9 @@
      -

      +

      npm-restart - @10.9.2 + @11.0.0

      Restart a package
      diff --git a/deps/npm/docs/output/commands/npm-root.html b/deps/npm/docs/output/commands/npm-root.html index 499bc84358b3e5..5e51f975dd7086 100644 --- a/deps/npm/docs/output/commands/npm-root.html +++ b/deps/npm/docs/output/commands/npm-root.html @@ -141,9 +141,9 @@
      -

      +

      npm-root - @10.9.2 + @11.0.0

      Display npm root
      diff --git a/deps/npm/docs/output/commands/npm-run-script.html b/deps/npm/docs/output/commands/npm-run-script.html index 9c0ef4fedbc16e..5d4fd8a4e63296 100644 --- a/deps/npm/docs/output/commands/npm-run-script.html +++ b/deps/npm/docs/output/commands/npm-run-script.html @@ -141,9 +141,9 @@
      -

      +

      npm-run-script - @10.9.2 + @11.0.0

      Run arbitrary package scripts
      diff --git a/deps/npm/docs/output/commands/npm-sbom.html b/deps/npm/docs/output/commands/npm-sbom.html index b648df1654e8a6..7d57f380eb1915 100644 --- a/deps/npm/docs/output/commands/npm-sbom.html +++ b/deps/npm/docs/output/commands/npm-sbom.html @@ -141,9 +141,9 @@
      -

      +

      npm-sbom - @10.9.2 + @11.0.0

      Generate a Software Bill of Materials (SBOM)
      diff --git a/deps/npm/docs/output/commands/npm-search.html b/deps/npm/docs/output/commands/npm-search.html index bfd70c2a8abe92..b109ce855945b9 100644 --- a/deps/npm/docs/output/commands/npm-search.html +++ b/deps/npm/docs/output/commands/npm-search.html @@ -141,9 +141,9 @@
      -

      +

      npm-search - @10.9.2 + @11.0.0

      Search for packages
      diff --git a/deps/npm/docs/output/commands/npm-shrinkwrap.html b/deps/npm/docs/output/commands/npm-shrinkwrap.html index 60d198f85ce67e..023f5fefc3f744 100644 --- a/deps/npm/docs/output/commands/npm-shrinkwrap.html +++ b/deps/npm/docs/output/commands/npm-shrinkwrap.html @@ -141,9 +141,9 @@
      -

      +

      npm-shrinkwrap - @10.9.2 + @11.0.0

      Lock down dependency versions for publication
      diff --git a/deps/npm/docs/output/commands/npm-star.html b/deps/npm/docs/output/commands/npm-star.html index ccda8bb3297d70..2bd9e65a79f585 100644 --- a/deps/npm/docs/output/commands/npm-star.html +++ b/deps/npm/docs/output/commands/npm-star.html @@ -141,9 +141,9 @@
      -

      +

      npm-star - @10.9.2 + @11.0.0

      Mark your favorite packages
      diff --git a/deps/npm/docs/output/commands/npm-stars.html b/deps/npm/docs/output/commands/npm-stars.html index 2f9619190f0122..8ddaec6f6d3b9d 100644 --- a/deps/npm/docs/output/commands/npm-stars.html +++ b/deps/npm/docs/output/commands/npm-stars.html @@ -141,9 +141,9 @@
      -

      +

      npm-stars - @10.9.2 + @11.0.0

      View packages marked as favorites
      diff --git a/deps/npm/docs/output/commands/npm-start.html b/deps/npm/docs/output/commands/npm-start.html index fad3ce05c3a2c9..1b761fe4d940c8 100644 --- a/deps/npm/docs/output/commands/npm-start.html +++ b/deps/npm/docs/output/commands/npm-start.html @@ -141,9 +141,9 @@
      -

      +

      npm-start - @10.9.2 + @11.0.0

      Start a package
      diff --git a/deps/npm/docs/output/commands/npm-stop.html b/deps/npm/docs/output/commands/npm-stop.html index bc70086d9991d5..645e4336830c96 100644 --- a/deps/npm/docs/output/commands/npm-stop.html +++ b/deps/npm/docs/output/commands/npm-stop.html @@ -141,9 +141,9 @@
      -

      +

      npm-stop - @10.9.2 + @11.0.0

      Stop a package
      diff --git a/deps/npm/docs/output/commands/npm-team.html b/deps/npm/docs/output/commands/npm-team.html index e03442dc68bf9c..8abe275d4fbbda 100644 --- a/deps/npm/docs/output/commands/npm-team.html +++ b/deps/npm/docs/output/commands/npm-team.html @@ -141,9 +141,9 @@
      -

      +

      npm-team - @10.9.2 + @11.0.0

      Manage organization teams and team memberships
      diff --git a/deps/npm/docs/output/commands/npm-test.html b/deps/npm/docs/output/commands/npm-test.html index b30af4ed9b3b30..f82bb32675cee6 100644 --- a/deps/npm/docs/output/commands/npm-test.html +++ b/deps/npm/docs/output/commands/npm-test.html @@ -141,9 +141,9 @@
      -

      +

      npm-test - @10.9.2 + @11.0.0

      Test a package
      diff --git a/deps/npm/docs/output/commands/npm-token.html b/deps/npm/docs/output/commands/npm-token.html index 353709607b4bd4..8df68fc4426ec9 100644 --- a/deps/npm/docs/output/commands/npm-token.html +++ b/deps/npm/docs/output/commands/npm-token.html @@ -141,9 +141,9 @@
      -

      +

      npm-token - @10.9.2 + @11.0.0

      Manage your authentication tokens
      diff --git a/deps/npm/docs/output/commands/npm-uninstall.html b/deps/npm/docs/output/commands/npm-uninstall.html index 633dbbe58f933e..e1f43ac059c82b 100644 --- a/deps/npm/docs/output/commands/npm-uninstall.html +++ b/deps/npm/docs/output/commands/npm-uninstall.html @@ -141,9 +141,9 @@
      -

      +

      npm-uninstall - @10.9.2 + @11.0.0

      Remove a package
      diff --git a/deps/npm/docs/output/commands/npm-unpublish.html b/deps/npm/docs/output/commands/npm-unpublish.html index e4f4090936d4ff..4456a22d1be387 100644 --- a/deps/npm/docs/output/commands/npm-unpublish.html +++ b/deps/npm/docs/output/commands/npm-unpublish.html @@ -141,9 +141,9 @@
      -

      +

      npm-unpublish - @10.9.2 + @11.0.0

      Remove a package from the registry
      diff --git a/deps/npm/docs/output/commands/npm-unstar.html b/deps/npm/docs/output/commands/npm-unstar.html index 741ed8e707a4f9..082be228f20225 100644 --- a/deps/npm/docs/output/commands/npm-unstar.html +++ b/deps/npm/docs/output/commands/npm-unstar.html @@ -141,9 +141,9 @@
      -

      +

      npm-unstar - @10.9.2 + @11.0.0

      Remove an item from your favorite packages
      diff --git a/deps/npm/docs/output/commands/npm-update.html b/deps/npm/docs/output/commands/npm-update.html index 287ed19fe9f5f6..0bd67db45ba3a5 100644 --- a/deps/npm/docs/output/commands/npm-update.html +++ b/deps/npm/docs/output/commands/npm-update.html @@ -141,9 +141,9 @@
      -

      +

      npm-update - @10.9.2 + @11.0.0

      Update packages
      diff --git a/deps/npm/docs/output/commands/npm-version.html b/deps/npm/docs/output/commands/npm-version.html index 43b978ffa94c80..e7679c65f407b6 100644 --- a/deps/npm/docs/output/commands/npm-version.html +++ b/deps/npm/docs/output/commands/npm-version.html @@ -141,9 +141,9 @@
      -

      +

      npm-version - @10.9.2 + @11.0.0

      Bump a package version
      diff --git a/deps/npm/docs/output/commands/npm-view.html b/deps/npm/docs/output/commands/npm-view.html index 1e388cfb922462..c8d4fdd52cd849 100644 --- a/deps/npm/docs/output/commands/npm-view.html +++ b/deps/npm/docs/output/commands/npm-view.html @@ -141,9 +141,9 @@
      -

      +

      npm-view - @10.9.2 + @11.0.0

      View registry info
      diff --git a/deps/npm/docs/output/commands/npm-whoami.html b/deps/npm/docs/output/commands/npm-whoami.html index 944a762ad4aea1..ab9c86004719fc 100644 --- a/deps/npm/docs/output/commands/npm-whoami.html +++ b/deps/npm/docs/output/commands/npm-whoami.html @@ -141,9 +141,9 @@
      -

      +

      npm-whoami - @10.9.2 + @11.0.0

      Display npm username
      diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index eae0fdc7b20659..d3641aebcd135c 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -141,9 +141,9 @@
      -

      +

      npm - @10.9.2 + @11.0.0

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

      Table of contents

    Note: This command is unaware of workspaces.

    Version

    -

    10.9.2

    +

    11.0.0

    Description

    npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency diff --git a/deps/npm/docs/output/commands/npx.html b/deps/npm/docs/output/commands/npx.html index ec5547306359f7..39ef19db4f5c5c 100644 --- a/deps/npm/docs/output/commands/npx.html +++ b/deps/npm/docs/output/commands/npx.html @@ -141,9 +141,9 @@

    -

    +

    npx - @10.9.2 + @11.0.0

    Run a command from a local or remote npm package
    diff --git a/deps/npm/docs/output/configuring-npm/folders.html b/deps/npm/docs/output/configuring-npm/folders.html index daca0c019a942b..8c5d99c58d1169 100644 --- a/deps/npm/docs/output/configuring-npm/folders.html +++ b/deps/npm/docs/output/configuring-npm/folders.html @@ -141,9 +141,9 @@
    -

    +

    folders - @10.9.2 + @11.0.0

    Folder Structures Used by npm
    diff --git a/deps/npm/docs/output/configuring-npm/install.html b/deps/npm/docs/output/configuring-npm/install.html index abda3bcc06ab62..a563910ccac75d 100644 --- a/deps/npm/docs/output/configuring-npm/install.html +++ b/deps/npm/docs/output/configuring-npm/install.html @@ -141,9 +141,9 @@
    -

    +

    install - @10.9.2 + @11.0.0

    Download and install node and npm
    diff --git a/deps/npm/docs/output/configuring-npm/npm-global.html b/deps/npm/docs/output/configuring-npm/npm-global.html index daca0c019a942b..8c5d99c58d1169 100644 --- a/deps/npm/docs/output/configuring-npm/npm-global.html +++ b/deps/npm/docs/output/configuring-npm/npm-global.html @@ -141,9 +141,9 @@
    -

    +

    folders - @10.9.2 + @11.0.0

    Folder Structures Used by npm
    diff --git a/deps/npm/docs/output/configuring-npm/npm-json.html b/deps/npm/docs/output/configuring-npm/npm-json.html index 1645e91a762b8f..b8b847d60bac0d 100644 --- a/deps/npm/docs/output/configuring-npm/npm-json.html +++ b/deps/npm/docs/output/configuring-npm/npm-json.html @@ -141,16 +141,16 @@
    -

    +

    package.json - @10.9.2 + @11.0.0

    Specifics of npm's package.json handling

    Table of contents

    - +

    Description

    @@ -399,6 +399,7 @@

    files

    if you wish it to be published)
  • pnpm-lock.yaml
  • yarn.lock
  • +
  • bun.lockb

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

@@ -409,6 +410,7 @@

files

  • package-lock.json
  • pnpm-lock.yaml
  • yarn.lock
  • +
  • bun.lockb
  • These can not be included.

    exports

    @@ -1007,6 +1009,14 @@

    cpu

    }

    The host architecture is determined by process.arch

    +

    libc

    +

    If your code only runs or builds in certain versions of libc, you can +specify which ones. This field only applies if os is linux.

    +
    {
    +  "os": "linux",
    +  "libc": "glibc"
    +}
    +

    devEngines

    The devEngines field aids engineers working on a codebase to all be using the same tooling.

    You can specify a devEngines property in your package.json which will run before install, ci, and run commands.

    diff --git a/deps/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html b/deps/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html index 65f0b0c184bef9..25af90bd1bddc6 100644 --- a/deps/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html +++ b/deps/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html @@ -141,9 +141,9 @@
    -

    +

    npm-shrinkwrap.json - @10.9.2 + @11.0.0

    A publishable lockfile
    diff --git a/deps/npm/docs/output/configuring-npm/npmrc.html b/deps/npm/docs/output/configuring-npm/npmrc.html index e5e94afe63a94c..04cea4c5fb66b2 100644 --- a/deps/npm/docs/output/configuring-npm/npmrc.html +++ b/deps/npm/docs/output/configuring-npm/npmrc.html @@ -141,9 +141,9 @@
    -

    +

    npmrc - @10.9.2 + @11.0.0

    The npm config files
    @@ -223,7 +223,7 @@
  • username
  • _password
  • email
  • -
  • certfile (path to certificate file)
  • +
  • cafile (path to certificate authority file)
  • keyfile (path to key file)
  • In order to scope these values, they must be prefixed by a URI fragment. diff --git a/deps/npm/docs/output/configuring-npm/package-json.html b/deps/npm/docs/output/configuring-npm/package-json.html index 1645e91a762b8f..b8b847d60bac0d 100644 --- a/deps/npm/docs/output/configuring-npm/package-json.html +++ b/deps/npm/docs/output/configuring-npm/package-json.html @@ -141,16 +141,16 @@

    -

    +

    package.json - @10.9.2 + @11.0.0

    Specifics of npm's package.json handling

    Table of contents

    - +

    Description

    @@ -399,6 +399,7 @@

    files

    if you wish it to be published)
  • pnpm-lock.yaml
  • yarn.lock
  • +
  • bun.lockb
  • Most of these ignored files can be included specifically if included in the files globs. Exceptions to this are:

    @@ -409,6 +410,7 @@

    files

  • package-lock.json
  • pnpm-lock.yaml
  • yarn.lock
  • +
  • bun.lockb
  • These can not be included.

    exports

    @@ -1007,6 +1009,14 @@

    cpu

    }

    The host architecture is determined by process.arch

    +

    libc

    +

    If your code only runs or builds in certain versions of libc, you can +specify which ones. This field only applies if os is linux.

    +
    {
    +  "os": "linux",
    +  "libc": "glibc"
    +}
    +

    devEngines

    The devEngines field aids engineers working on a codebase to all be using the same tooling.

    You can specify a devEngines property in your package.json which will run before install, ci, and run commands.

    diff --git a/deps/npm/docs/output/configuring-npm/package-lock-json.html b/deps/npm/docs/output/configuring-npm/package-lock-json.html index 80fa8bf8bd4ac8..8017f0332b7065 100644 --- a/deps/npm/docs/output/configuring-npm/package-lock-json.html +++ b/deps/npm/docs/output/configuring-npm/package-lock-json.html @@ -141,9 +141,9 @@
    -

    +

    package-lock.json - @10.9.2 + @11.0.0

    A manifestation of the manifest
    diff --git a/deps/npm/docs/output/using-npm/config.html b/deps/npm/docs/output/using-npm/config.html index 487cc56439e9ed..94207774337468 100644 --- a/deps/npm/docs/output/using-npm/config.html +++ b/deps/npm/docs/output/using-npm/config.html @@ -141,9 +141,9 @@
    -

    +

    config - @10.9.2 + @11.0.0

    More than you probably want to know about npm configuration
    @@ -1468,9 +1468,9 @@

    cert

  • Default: null
  • Type: null or String
  • DEPRECATED: key and cert are no longer used for most registry -operations. Use registry scoped keyfile and certfile instead. Example: +operations. Use registry scoped keyfile and cafile instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem -//other-registry.tld/:certfile=/path/to/cert.crt
  • +//other-registry.tld/:cafile=/path/to/cert.crt

    A client certificate to pass when accessing the registry. Values should be in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with @@ -1478,8 +1478,8 @@

    cert

    cert="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
     

    It is not the path to a certificate file, though you can set a -registry-scoped "certfile" path like -"//other-registry.tld/:certfile=/path/to/cert.pem".

    +registry-scoped "cafile" path like +"//other-registry.tld/:cafile=/path/to/cert.pem".

    dev

    • Default: false
    • @@ -1543,9 +1543,9 @@

      key

    • Default: null
    • Type: null or String
    • DEPRECATED: key and cert are no longer used for most registry -operations. Use registry scoped keyfile and certfile instead. Example: +operations. Use registry scoped keyfile and cafile instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem -//other-registry.tld/:certfile=/path/to/cert.crt
    • +//other-registry.tld/:cafile=/path/to/cert.crt

    A client key to pass when accessing the registry. Values should be in PEM format with newlines replaced by the string "\n". For example:

    diff --git a/deps/npm/docs/output/using-npm/dependency-selectors.html b/deps/npm/docs/output/using-npm/dependency-selectors.html index 24e34408de9c52..db54f7a6e397bc 100644 --- a/deps/npm/docs/output/using-npm/dependency-selectors.html +++ b/deps/npm/docs/output/using-npm/dependency-selectors.html @@ -141,9 +141,9 @@
    -

    +

    Dependency Selector Syntax & Querying - @10.9.2 + @11.0.0

    Dependency Selector Syntax & Querying
    diff --git a/deps/npm/docs/output/using-npm/developers.html b/deps/npm/docs/output/using-npm/developers.html index d7848c6e6647f3..bc1479514c2e80 100644 --- a/deps/npm/docs/output/using-npm/developers.html +++ b/deps/npm/docs/output/using-npm/developers.html @@ -141,9 +141,9 @@
    -

    +

    developers - @10.9.2 + @11.0.0

    Developer Guide
    @@ -249,8 +249,8 @@

    Keeping files out of your Pa
  • You can end patterns with a forward slash / to specify a directory.
  • You can negate a pattern by starting it with an exclamation point !.
  • -

    By default, the following paths and files are ignored, so there's no -need to add them to .npmignore explicitly:

    +

    By default, some paths and files are ignored, so there's no +need to add them to .npmignore explicitly. Some examples are:

    • .*.swp
    • ._*
    • @@ -283,6 +283,8 @@

      Keeping files out of your Pa property of package.json, which is an array of file or directory names that should be included in your package. Sometimes manually picking which items to allow is easier to manage than building a block list.

      +

      See package.json for more info on +what can and can't be ignored.

      Testing whether your .npmignore or files config works

      If you want to double check that your package will include only the files you intend it to when published, you can run the npm pack command locally diff --git a/deps/npm/docs/output/using-npm/logging.html b/deps/npm/docs/output/using-npm/logging.html index d1e6b0a7532253..4760437326d374 100644 --- a/deps/npm/docs/output/using-npm/logging.html +++ b/deps/npm/docs/output/using-npm/logging.html @@ -141,9 +141,9 @@

      -

      +

      Logging - @10.9.2 + @11.0.0

      Why, What & How We Log
      diff --git a/deps/npm/docs/output/using-npm/orgs.html b/deps/npm/docs/output/using-npm/orgs.html index 5b7007b3618406..68264d661a8b80 100644 --- a/deps/npm/docs/output/using-npm/orgs.html +++ b/deps/npm/docs/output/using-npm/orgs.html @@ -141,9 +141,9 @@
      -

      +

      orgs - @10.9.2 + @11.0.0

      Working with Teams & Orgs
      diff --git a/deps/npm/docs/output/using-npm/package-spec.html b/deps/npm/docs/output/using-npm/package-spec.html index eee81153269653..b23958ad734f51 100644 --- a/deps/npm/docs/output/using-npm/package-spec.html +++ b/deps/npm/docs/output/using-npm/package-spec.html @@ -141,9 +141,9 @@
      -

      +

      package-spec - @10.9.2 + @11.0.0

      Package name specifier
      diff --git a/deps/npm/docs/output/using-npm/registry.html b/deps/npm/docs/output/using-npm/registry.html index bd464be3fd67c9..1ab0e032dc1ef1 100644 --- a/deps/npm/docs/output/using-npm/registry.html +++ b/deps/npm/docs/output/using-npm/registry.html @@ -141,9 +141,9 @@
      -

      +

      registry - @10.9.2 + @11.0.0

      The JavaScript Package Registry
      diff --git a/deps/npm/docs/output/using-npm/removal.html b/deps/npm/docs/output/using-npm/removal.html index f0ccb74eb50811..8645555c8eb43f 100644 --- a/deps/npm/docs/output/using-npm/removal.html +++ b/deps/npm/docs/output/using-npm/removal.html @@ -141,9 +141,9 @@
      -

      +

      removal - @10.9.2 + @11.0.0

      Cleaning the Slate
      diff --git a/deps/npm/docs/output/using-npm/scope.html b/deps/npm/docs/output/using-npm/scope.html index 35ed91f147f107..ff18511303a351 100644 --- a/deps/npm/docs/output/using-npm/scope.html +++ b/deps/npm/docs/output/using-npm/scope.html @@ -141,9 +141,9 @@
      -

      +

      scope - @10.9.2 + @11.0.0

      Scoped packages
      diff --git a/deps/npm/docs/output/using-npm/scripts.html b/deps/npm/docs/output/using-npm/scripts.html index 9982862814e73a..33067cbd524e07 100644 --- a/deps/npm/docs/output/using-npm/scripts.html +++ b/deps/npm/docs/output/using-npm/scripts.html @@ -141,9 +141,9 @@
      -

      +

      scripts - @10.9.2 + @11.0.0

      How npm handles the "scripts" field
      diff --git a/deps/npm/docs/output/using-npm/workspaces.html b/deps/npm/docs/output/using-npm/workspaces.html index 5e2756479c7636..ebdbb762285628 100644 --- a/deps/npm/docs/output/using-npm/workspaces.html +++ b/deps/npm/docs/output/using-npm/workspaces.html @@ -141,9 +141,9 @@
      -

      +

      workspaces - @10.9.2 + @11.0.0

      Working with workspaces
      diff --git a/deps/npm/lib/cli/entry.js b/deps/npm/lib/cli/entry.js index ed73eb89e2d360..f36bc59feaec9b 100644 --- a/deps/npm/lib/cli/entry.js +++ b/deps/npm/lib/cli/entry.js @@ -6,11 +6,6 @@ module.exports = async (process, validateEngines) => { // leak any private CLI configs to other programs process.title = 'npm' - // if npm is called as "npmg" or "npm_g", then run in global mode. - if (process.argv[1][process.argv[1].length - 1] === 'g') { - process.argv.splice(1, 1, 'npm', '-g') - } - // Patch the global fs module here at the app level require('graceful-fs').gracefulify(require('node:fs')) diff --git a/deps/npm/lib/commands/cache.js b/deps/npm/lib/commands/cache.js index 87c70a57dc0edf..45d308a57d0c23 100644 --- a/deps/npm/lib/commands/cache.js +++ b/deps/npm/lib/commands/cache.js @@ -38,7 +38,7 @@ const searchCachePackage = async (path, parsed, cacheKeys) => { try { details = await cacache.get(path, key) packument = jsonParse(details.data) - } catch (_) { + } catch { // if we couldn't parse the packument, abort continue } @@ -131,7 +131,7 @@ class Cache extends BaseCommand { let entry try { entry = await cacache.get(cachePath, key) - } catch (err) { + } catch { log.warn('cache', `Not Found: ${key}`) break } diff --git a/deps/npm/lib/commands/deprecate.js b/deps/npm/lib/commands/deprecate.js index 977fd9fce11dac..95eaf429120fac 100644 --- a/deps/npm/lib/commands/deprecate.js +++ b/deps/npm/lib/commands/deprecate.js @@ -1,4 +1,4 @@ -const fetch = require('npm-registry-fetch') +const npmFetch = require('npm-registry-fetch') const { otplease } = require('../utils/auth.js') const npa = require('npm-package-arg') const { log } = require('proc-log') @@ -47,7 +47,7 @@ class Deprecate extends BaseCommand { } const uri = '/' + p.escapedName - const packument = await fetch.json(uri, { + const packument = await npmFetch.json(uri, { ...this.npm.flatOptions, spec: p, query: { write: true }, @@ -60,7 +60,7 @@ class Deprecate extends BaseCommand { for (const v of versions) { packument.versions[v].deprecated = msg } - return otplease(this.npm, this.npm.flatOptions, opts => fetch(uri, { + return otplease(this.npm, this.npm.flatOptions, opts => npmFetch(uri, { ...opts, spec: p, method: 'PUT', diff --git a/deps/npm/lib/commands/diff.js b/deps/npm/lib/commands/diff.js index 3fa8090a350468..a97eed92c83cba 100644 --- a/deps/npm/lib/commands/diff.js +++ b/deps/npm/lib/commands/diff.js @@ -83,7 +83,7 @@ class Diff extends BaseCommand { try { const { content: pkg } = await pkgJson.normalize(this.prefix) name = pkg.name - } catch (e) { + } catch { log.verbose('diff', 'could not read project dir package.json') } @@ -117,7 +117,7 @@ class Diff extends BaseCommand { try { const { content: pkg } = await pkgJson.normalize(this.prefix) pkgName = pkg.name - } catch (e) { + } catch { log.verbose('diff', 'could not read project dir package.json') noPackageJson = true } @@ -156,7 +156,7 @@ class Diff extends BaseCommand { node = actualTree && actualTree.inventory.query('name', spec.name) .values().next().value - } catch (e) { + } catch { log.verbose('diff', 'failed to load actual install tree') } @@ -230,7 +230,7 @@ class Diff extends BaseCommand { try { const { content: pkg } = await pkgJson.normalize(this.prefix) pkgName = pkg.name - } catch (e) { + } catch { log.verbose('diff', 'could not read project dir package.json') } @@ -265,7 +265,7 @@ class Diff extends BaseCommand { } const arb = new Arborist(opts) actualTree = await arb.loadActual(opts) - } catch (e) { + } catch { log.verbose('diff', 'failed to load actual install tree') } diff --git a/deps/npm/lib/commands/dist-tag.js b/deps/npm/lib/commands/dist-tag.js index 663f0eb44a26ad..3fdecd926a564e 100644 --- a/deps/npm/lib/commands/dist-tag.js +++ b/deps/npm/lib/commands/dist-tag.js @@ -1,5 +1,5 @@ const npa = require('npm-package-arg') -const regFetch = require('npm-registry-fetch') +const npmFetch = require('npm-registry-fetch') const semver = require('semver') const { log, output } = require('proc-log') const { otplease } = require('../utils/auth.js') @@ -119,7 +119,7 @@ class DistTag extends BaseCommand { }, spec, } - await otplease(this.npm, reqOpts, o => regFetch(url, o)) + await otplease(this.npm, reqOpts, o => npmFetch(url, o)) output.standard(`+${t}: ${spec.name}@${version}`) } @@ -145,7 +145,7 @@ class DistTag extends BaseCommand { method: 'DELETE', spec, } - await otplease(this.npm, reqOpts, o => regFetch(url, o)) + await otplease(this.npm, reqOpts, o => npmFetch(url, o)) output.standard(`-${tag}: ${spec.name}@${version}`) } @@ -182,7 +182,7 @@ class DistTag extends BaseCommand { try { output.standard(`${name}:`) await this.list(npa(name), this.npm.flatOptions) - } catch (err) { + } catch { // set the exitCode directly, but ignore the error // since it will have already been logged by this.list() process.exitCode = 1 @@ -191,7 +191,7 @@ class DistTag extends BaseCommand { } async fetchTags (spec, opts) { - const data = await regFetch.json( + const data = await npmFetch.json( `/-/package/${spec.escapedName}/dist-tags`, { ...opts, 'prefer-online': true, spec } ) diff --git a/deps/npm/lib/commands/doctor.js b/deps/npm/lib/commands/doctor.js index 8fbd49b7ca8bfb..8f87fdc17891c5 100644 --- a/deps/npm/lib/commands/doctor.js +++ b/deps/npm/lib/commands/doctor.js @@ -1,6 +1,6 @@ const cacache = require('cacache') const { access, lstat, readdir, constants: { R_OK, W_OK, X_OK } } = require('node:fs/promises') -const fetch = require('make-fetch-happen') +const npmFetch = require('make-fetch-happen') const which = require('which') const pacote = require('pacote') const { resolve } = require('node:path') @@ -166,7 +166,7 @@ class Doctor extends BaseCommand { const currentRange = `^${current}` const url = 'https://nodejs.org/dist/index.json' log.info('doctor', 'Getting Node.js release information') - const res = await fetch(url, { method: 'GET', ...this.npm.flatOptions }) + const res = await npmFetch(url, { method: 'GET', ...this.npm.flatOptions }) const data = await res.json() let maxCurrent = '0.0.0' let maxLTS = '0.0.0' @@ -246,7 +246,7 @@ class Doctor extends BaseCommand { try { await access(f, mask) - } catch (er) { + } catch { ok = false const msg = `Missing permissions on ${f} (expect: ${maskLabel(mask)})` log.error('doctor', 'checkFilesPermission', msg) diff --git a/deps/npm/lib/commands/explain.js b/deps/npm/lib/commands/explain.js index cb0644304d2b55..1505b4dbf5e9a4 100644 --- a/deps/npm/lib/commands/explain.js +++ b/deps/npm/lib/commands/explain.js @@ -109,7 +109,7 @@ class Explain extends ArboristWorkspaceCmd { // otherwise, try to select all matching nodes try { return this.getNodesByVersion(tree, arg) - } catch (er) { + } catch { return [] } } diff --git a/deps/npm/lib/commands/hook.js b/deps/npm/lib/commands/hook.js deleted file mode 100644 index 5793b974197c8d..00000000000000 --- a/deps/npm/lib/commands/hook.js +++ /dev/null @@ -1,109 +0,0 @@ -const hookApi = require('libnpmhook') -const { otplease } = require('../utils/auth.js') -const relativeDate = require('tiny-relative-date') -const { output } = require('proc-log') -const BaseCommand = require('../base-cmd.js') - -class Hook extends BaseCommand { - static description = 'Manage registry hooks' - static name = 'hook' - static params = [ - 'registry', - 'otp', - ] - - static usage = [ - 'add [--type=]', - 'ls [pkg]', - 'rm ', - 'update ', - ] - - async exec (args) { - return otplease(this.npm, { ...this.npm.flatOptions }, (opts) => { - switch (args[0]) { - case 'add': - return this.add(args[1], args[2], args[3], opts) - case 'ls': - return this.ls(args[1], opts) - case 'rm': - return this.rm(args[1], opts) - case 'update': - case 'up': - return this.update(args[1], args[2], args[3], opts) - default: - throw this.usageError() - } - }) - } - - async add (pkg, uri, secret, opts) { - const hook = await hookApi.add(pkg, uri, secret, opts) - if (opts.json) { - output.buffer(hook) - } else if (opts.parseable) { - output.standard(Object.keys(hook).join('\t')) - output.standard(Object.keys(hook).map(k => hook[k]).join('\t')) - } else if (!this.npm.silent) { - output.standard(`+ ${this.hookName(hook)} ${opts.unicode ? ' ➜ ' : ' -> '} ${hook.endpoint}`) - } - } - - async ls (pkg, opts) { - const hooks = await hookApi.ls({ ...opts, package: pkg }) - - if (opts.json) { - output.buffer(hooks) - } else if (opts.parseable) { - output.standard(Object.keys(hooks[0]).join('\t')) - hooks.forEach(hook => { - output.standard(Object.keys(hook).map(k => hook[k]).join('\t')) - }) - } else if (!hooks.length) { - output.standard("You don't have any hooks configured yet.") - } else if (!this.npm.silent) { - output.standard(`You have ${hooks.length} hook${hooks.length !== 1 ? 's' : ''} configured.`) - - for (const hook of hooks) { - output.standard(`Hook ${hook.id}: ${this.hookName(hook)}`) - output.standard(`Endpoint: ${hook.endpoint}`) - if (hook.last_delivery) { - /* eslint-disable-next-line max-len */ - output.standard(`Triggered ${relativeDate(hook.last_delivery)}, response code was "${hook.response_code}"\n`) - } else { - output.standard('Never triggered\n') - } - } - } - } - - async rm (id, opts) { - const hook = await hookApi.rm(id, opts) - if (opts.json) { - output.buffer(hook) - } else if (opts.parseable) { - output.standard(Object.keys(hook).join('\t')) - output.standard(Object.keys(hook).map(k => hook[k]).join('\t')) - } else if (!this.npm.silent) { - output.standard(`- ${this.hookName(hook)} ${opts.unicode ? ' ✘ ' : ' X '} ${hook.endpoint}`) - } - } - - async update (id, uri, secret, opts) { - const hook = await hookApi.update(id, uri, secret, opts) - if (opts.json) { - output.buffer(hook) - } else if (opts.parseable) { - output.standard(Object.keys(hook).join('\t')) - output.standard(Object.keys(hook).map(k => hook[k]).join('\t')) - } else if (!this.npm.silent) { - output.standard(`+ ${this.hookName(hook)} ${opts.unicode ? ' ➜ ' : ' -> '} ${hook.endpoint}`) - } - } - - hookName (hook) { - return `${hook.type === 'owner' ? '~' : ''}${hook.name}` - } -} - -module.exports = Hook diff --git a/deps/npm/lib/commands/init.js b/deps/npm/lib/commands/init.js index 09e8d8522f7f31..bef54b0e4138d9 100644 --- a/deps/npm/lib/commands/init.js +++ b/deps/npm/lib/commands/init.js @@ -192,7 +192,7 @@ class Init extends BaseCommand { // top-level package.json try { statSync(resolve(workspacePath, 'package.json')) - } catch (err) { + } catch { return } diff --git a/deps/npm/lib/commands/install.js b/deps/npm/lib/commands/install.js index 24e5f6819b3141..71f4229bb25664 100644 --- a/deps/npm/lib/commands/install.js +++ b/deps/npm/lib/commands/install.js @@ -68,7 +68,7 @@ class Install extends ArboristWorkspaceCmd { const contents = await readdir(join(partialPath, sibling)) const result = (contents.indexOf('package.json') !== -1) return result - } catch (er) { + } catch { return false } } @@ -86,7 +86,7 @@ class Install extends ArboristWorkspaceCmd { } // no matches return [] - } catch (er) { + } catch { return [] // invalid dir: no matching } } diff --git a/deps/npm/lib/commands/ls.js b/deps/npm/lib/commands/ls.js index 417cb1b40d8c25..bc8beb007e8093 100644 --- a/deps/npm/lib/commands/ls.js +++ b/deps/npm/lib/commands/ls.js @@ -233,7 +233,7 @@ const isGitNode = (node) => { try { const { type } = npa(node.resolved) return type === 'git' || type === 'hosted' - } catch (err) { + } catch { return false } } diff --git a/deps/npm/lib/commands/pack.js b/deps/npm/lib/commands/pack.js index 79e7f49f819ecc..bd190d88d82b68 100644 --- a/deps/npm/lib/commands/pack.js +++ b/deps/npm/lib/commands/pack.js @@ -15,6 +15,7 @@ class Pack extends BaseCommand { 'workspace', 'workspaces', 'include-workspace-root', + 'ignore-scripts', ] static usage = [''] @@ -29,12 +30,13 @@ class Pack extends BaseCommand { const unicode = this.npm.config.get('unicode') const json = this.npm.config.get('json') + const Arborist = require('@npmcli/arborist') // Get the manifests and filenames first so we can bail early on manifest // errors before making any tarballs const manifests = [] for (const arg of args) { const spec = npa(arg) - const manifest = await pacote.manifest(spec, this.npm.flatOptions) + const manifest = await pacote.manifest(spec, { ...this.npm.flatOptions, Arborist }) if (!manifest._id) { throw new Error('Invalid package, must have name and version') } diff --git a/deps/npm/lib/commands/pkg.js b/deps/npm/lib/commands/pkg.js index a011fc10be1070..5a236f6e622709 100644 --- a/deps/npm/lib/commands/pkg.js +++ b/deps/npm/lib/commands/pkg.js @@ -63,12 +63,12 @@ class Pkg extends BaseCommand { if (args.length) { result = new Queryable(result).query(args) - // in case there's only a single result from the query - // just prints that one element to stdout + // in case there's only a single argument and a single result from the query + // just prints that one element to stdout. // TODO(BREAKING_CHANGE): much like other places where we unwrap single // item arrays this should go away. it makes the behavior unknown for users // who don't already know the shape of the data. - if (Object.keys(result).length === 1) { + if (Object.keys(result).length === 1 && args.length === 1) { result = result[args] } } diff --git a/deps/npm/lib/commands/prefix.js b/deps/npm/lib/commands/prefix.js index da8702cf91caaf..907ed5af2c1799 100644 --- a/deps/npm/lib/commands/prefix.js +++ b/deps/npm/lib/commands/prefix.js @@ -5,7 +5,6 @@ class Prefix extends BaseCommand { static description = 'Display prefix' static name = 'prefix' static params = ['global'] - static usage = ['[-g]'] async exec () { return output.standard(this.npm.prefix) diff --git a/deps/npm/lib/commands/publish.js b/deps/npm/lib/commands/publish.js index c2cd3cf9c927b6..c59588fefb241f 100644 --- a/deps/npm/lib/commands/publish.js +++ b/deps/npm/lib/commands/publish.js @@ -116,6 +116,13 @@ class Publish extends BaseCommand { // note that publishConfig might have changed as well! manifest = await this.#getManifest(spec, opts, true) + const isPreRelease = Boolean(semver.parse(manifest.version).prerelease.length) + const isDefaultTag = this.npm.config.isDefault('tag') + + if (isPreRelease && isDefaultTag) { + throw new Error('You must specify a tag using --tag when publishing a prerelease version.') + } + // If we are not in JSON mode then we show the user the contents of the tarball // before it is published so they can see it while their otp is pending if (!json) { @@ -150,6 +157,14 @@ class Publish extends BaseCommand { } } + const latestVersion = await this.#latestPublishedVersion(resolved, registry) + const latestSemverIsGreater = !!latestVersion && semver.gte(latestVersion, manifest.version) + + if (latestSemverIsGreater && isDefaultTag) { + /* eslint-disable-next-line max-len */ + throw new Error(`Cannot implicitly apply the "latest" tag because published version ${latestVersion} is higher than the new version ${manifest.version}. You must specify a tag using --tag.`) + } + const access = opts.access === null ? 'default' : opts.access let msg = `Publishing to ${outputRegistry} with tag ${defaultTag} and ${access} access` if (dryRun) { @@ -189,6 +204,28 @@ class Publish extends BaseCommand { } } + async #latestPublishedVersion (spec, registry) { + try { + const packument = await pacote.packument(spec, { + ...this.npm.flatOptions, + preferOnline: true, + registry, + }) + if (typeof packument?.versions === 'undefined') { + return null + } + const ordered = Object.keys(packument?.versions) + .flatMap(v => { + const s = new semver.SemVer(v) + return s.prerelease.length > 0 ? [] : s + }) + .sort((a, b) => b.compare(a)) + return ordered.length >= 1 ? ordered[0].version : null + } catch (e) { + return null + } + } + // if it's a directory, read it from the file system // otherwise, get the full metadata from whatever it is // XXX can't pacote read the manifest from a directory? diff --git a/deps/npm/lib/commands/repo.js b/deps/npm/lib/commands/repo.js index 3f120c0a3f59f5..0bfb2cf962c9b0 100644 --- a/deps/npm/lib/commands/repo.js +++ b/deps/npm/lib/commands/repo.js @@ -49,7 +49,7 @@ const unknownHostedUrl = url => { const proto = /(git\+)http:$/.test(protocol) ? 'http:' : 'https:' const path = pathname.replace(/\.git$/, '') return `${proto}//${hostname}${path}` - } catch (e) { + } catch { return null } } diff --git a/deps/npm/lib/commands/star.js b/deps/npm/lib/commands/star.js index 1b76955810c726..7d1be1d389730d 100644 --- a/deps/npm/lib/commands/star.js +++ b/deps/npm/lib/commands/star.js @@ -1,4 +1,4 @@ -const fetch = require('npm-registry-fetch') +const npmFetch = require('npm-registry-fetch') const npa = require('npm-package-arg') const { log, output } = require('proc-log') const getIdentity = require('../utils/get-identity') @@ -32,7 +32,7 @@ class Star extends BaseCommand { const username = await getIdentity(this.npm, this.npm.flatOptions) for (const pkg of pkgs) { - const fullData = await fetch.json(pkg.escapedName, { + const fullData = await npmFetch.json(pkg.escapedName, { ...this.npm.flatOptions, spec: pkg, query: { write: true }, @@ -55,7 +55,7 @@ class Star extends BaseCommand { log.verbose('unstar', 'unstarring', body) } - const data = await fetch.json(pkg.escapedName, { + const data = await npmFetch.json(pkg.escapedName, { ...this.npm.flatOptions, spec: pkg, method: 'PUT', diff --git a/deps/npm/lib/commands/stars.js b/deps/npm/lib/commands/stars.js index 1059569979dafe..d059d01250900b 100644 --- a/deps/npm/lib/commands/stars.js +++ b/deps/npm/lib/commands/stars.js @@ -1,4 +1,4 @@ -const fetch = require('npm-registry-fetch') +const npmFetch = require('npm-registry-fetch') const { log, output } = require('proc-log') const getIdentity = require('../utils/get-identity.js') const BaseCommand = require('../base-cmd.js') @@ -16,7 +16,7 @@ class Stars extends BaseCommand { user = await getIdentity(this.npm, this.npm.flatOptions) } - const { rows } = await fetch.json('/-/_view/starredByUser', { + const { rows } = await npmFetch.json('/-/_view/starredByUser', { ...this.npm.flatOptions, query: { key: `"${user}"` }, }) diff --git a/deps/npm/lib/commands/view.js b/deps/npm/lib/commands/view.js index cf7292a2f3b814..627c126f00c21c 100644 --- a/deps/npm/lib/commands/view.js +++ b/deps/npm/lib/commands/view.js @@ -266,6 +266,18 @@ class View extends BaseCommand { const deps = Object.entries(manifest.dependencies || {}).map(([k, dep]) => `${chalk.blue(k)}: ${dep}` ) + // Sort dist-tags by publish time, then tag name, keeping latest at the top of the list + const distTags = Object.entries(packu['dist-tags']) + .sort(([aTag, aVer], [bTag, bVer]) => { + const aTime = aTag === 'latest' ? Infinity : Date.parse(packu.time[aVer]) + const bTime = bTag === 'latest' ? Infinity : Date.parse(packu.time[bVer]) + if (aTime === bTime) { + return aTag > bTag ? -1 : 1 + } + return aTime > bTime ? -1 : 1 + }) + .map(([k, t]) => `${chalk.blue(k)}: ${t}`) + const site = manifest.homepage?.url || manifest.homepage const bins = Object.keys(manifest.bin || {}) const licenseField = manifest.license || 'Proprietary' @@ -333,9 +345,11 @@ class View extends BaseCommand { } res.push('\ndist-tags:') - res.push(columns(Object.entries(packu['dist-tags']).map(([k, t]) => - `${chalk.blue(k)}: ${t}` - ))) + const maxTags = 12 + res.push(columns(distTags.slice(0, maxTags), { padding: 1, sort: false })) + if (distTags.length > maxTags) { + res.push(chalk.dim(`(...and ${distTags.length - maxTags} more.)`)) + } const publisher = manifest._npmUser && unparsePerson({ name: chalk.blue(manifest._npmUser.name), diff --git a/deps/npm/lib/utils/cmd-list.js b/deps/npm/lib/utils/cmd-list.js index 9017b2b80ce527..039d6ffddeb161 100644 --- a/deps/npm/lib/utils/cmd-list.js +++ b/deps/npm/lib/utils/cmd-list.js @@ -26,7 +26,6 @@ const commands = [ 'get', 'help', 'help-search', - 'hook', 'init', 'install', 'install-ci-test', diff --git a/deps/npm/lib/utils/ping.js b/deps/npm/lib/utils/ping.js index 1c8c9e827a4eaa..3d47ca1ecaf545 100644 --- a/deps/npm/lib/utils/ping.js +++ b/deps/npm/lib/utils/ping.js @@ -1,7 +1,7 @@ // ping the npm registry // used by the ping and doctor commands -const fetch = require('npm-registry-fetch') +const npmFetch = require('npm-registry-fetch') module.exports = async (flatOptions) => { - const res = await fetch('/-/ping', { ...flatOptions, cache: false }) + const res = await npmFetch('/-/ping', { ...flatOptions, cache: false }) return res.json().catch(() => ({})) } diff --git a/deps/npm/lib/utils/sbom-cyclonedx.js b/deps/npm/lib/utils/sbom-cyclonedx.js index 989abea58dae83..f3bab28000953f 100644 --- a/deps/npm/lib/utils/sbom-cyclonedx.js +++ b/deps/npm/lib/utils/sbom-cyclonedx.js @@ -94,7 +94,7 @@ const toCyclonedxItem = (node, { packageType }) => { } parsedLicense = parseLicense(license) - } catch (err) { + } catch { parsedLicense = null } @@ -192,7 +192,7 @@ const isGitNode = (node) => { try { const { type } = npa(node.resolved) return type === 'git' || type === 'hosted' - } catch (err) { + } catch { /* istanbul ignore next */ return false } diff --git a/deps/npm/lib/utils/sbom-spdx.js b/deps/npm/lib/utils/sbom-spdx.js index e3af77e10c7513..16aed186567640 100644 --- a/deps/npm/lib/utils/sbom-spdx.js +++ b/deps/npm/lib/utils/sbom-spdx.js @@ -173,7 +173,7 @@ const isGitNode = (node) => { try { const { type } = npa(node.resolved) return type === 'git' || type === 'hosted' - } catch (err) { + } catch { /* istanbul ignore next */ return false } diff --git a/deps/npm/lib/utils/verify-signatures.js b/deps/npm/lib/utils/verify-signatures.js index 09711581d11ddd..0a32742b5ee2a2 100644 --- a/deps/npm/lib/utils/verify-signatures.js +++ b/deps/npm/lib/utils/verify-signatures.js @@ -1,8 +1,7 @@ -const fetch = require('npm-registry-fetch') +const npmFetch = require('npm-registry-fetch') const localeCompare = require('@isaacs/string-locale-compare')('en') const npa = require('npm-package-arg') const pacote = require('pacote') -const pMap = require('p-map') const tufClient = require('@sigstore/tuf') const { log, output } = require('proc-log') @@ -26,6 +25,7 @@ class VerifySignatures { async run () { const start = process.hrtime.bigint() + const { default: pMap } = await import('p-map') // Find all deps in tree const { edges, registries } = this.getEdgesOut(this.tree.inventory.values(), this.filterSet) @@ -202,7 +202,7 @@ class VerifySignatures { // If keys not found in Sigstore TUF repo, fallback to registry keys API if (!keys) { - keys = await fetch.json('/-/npm/v1/keys', { + keys = await npmFetch.json('/-/npm/v1/keys', { ...this.npm.flatOptions, registry, }).then(({ keys: ks }) => ks.map((key) => ({ @@ -253,7 +253,7 @@ class VerifySignatures { } getSpecRegistry (spec) { - return fetch.pickRegistry(spec, this.npm.flatOptions) + return npmFetch.pickRegistry(spec, this.npm.flatOptions) } getValidPackageInfo (edge) { diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1 index 96beab28fc365d..7352f7065abb39 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-ACCESS" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-access\fR - Set access level on published packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-adduser.1 b/deps/npm/man/man1/npm-adduser.1 index 0096f28229122d..283274b7b9b03f 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-ADDUSER" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-adduser\fR - Add a registry user account .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-audit.1 b/deps/npm/man/man1/npm-audit.1 index 38b977d3871d59..39236214f2dc74 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-AUDIT" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-audit\fR - Run a security audit .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index 92c57c2c3c4146..a4cccc82794e63 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-BUGS" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-bugs\fR - Report bugs for a package in a web browser .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-cache.1 b/deps/npm/man/man1/npm-cache.1 index da188a0914e016..c1d5a37fdc8f4f 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-CACHE" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-cache\fR - Manipulates packages cache .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-ci.1 b/deps/npm/man/man1/npm-ci.1 index 1ae5e934e2d2b7..5eb18d43735f08 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-CI" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-ci\fR - Clean install a project .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-completion.1 b/deps/npm/man/man1/npm-completion.1 index ea44a0c9c56a51..260445e84df4fd 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-COMPLETION" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-completion\fR - Tab Completion for npm .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-config.1 b/deps/npm/man/man1/npm-config.1 index dbe609ba3b727f..11461b0eedb871 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-CONFIG" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-config\fR - Manage the npm configuration files .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-dedupe.1 b/deps/npm/man/man1/npm-dedupe.1 index 530de6344d5f4e..4753980016b312 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-DEDUPE" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-dedupe\fR - Reduce duplication in the package tree .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1 index 0333772b97c690..80ff50236102a5 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-DEPRECATE" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-deprecate\fR - Deprecate a version of a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-diff.1 b/deps/npm/man/man1/npm-diff.1 index 168f4397430854..442ea98f4823e4 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-DIFF" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-diff\fR - The registry diff command .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-dist-tag.1 b/deps/npm/man/man1/npm-dist-tag.1 index 97e2927ac1e2fa..839891720c68e1 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-DIST-TAG" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-dist-tag\fR - Modify package distribution tags .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-docs.1 b/deps/npm/man/man1/npm-docs.1 index 6b09a835bbf318..fa1ecaa6cd7e24 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-DOCS" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-docs\fR - Open documentation for a package in a web browser .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-doctor.1 b/deps/npm/man/man1/npm-doctor.1 index 9a0374b0896b52..8924a8158fa7eb 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-DOCTOR" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-doctor\fR - Check the health of your npm environment .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-edit.1 b/deps/npm/man/man1/npm-edit.1 index 779feeede13656..dc41757464b840 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-EDIT" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-edit\fR - Edit an installed package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-exec.1 b/deps/npm/man/man1/npm-exec.1 index 3b5fe4c425ee3e..a959ff3e72e4d4 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-EXEC" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-exec\fR - Run a command from a local or remote npm package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-explain.1 b/deps/npm/man/man1/npm-explain.1 index 5f86d19236fdb0..efef3975aa28a2 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-EXPLAIN" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-explain\fR - Explain installed packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-explore.1 b/deps/npm/man/man1/npm-explore.1 index eb71089b62446f..47b672d843ffe0 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-EXPLORE" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-explore\fR - Browse an installed package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-find-dupes.1 b/deps/npm/man/man1/npm-find-dupes.1 index 88a42adcec1f20..bc302ea525518f 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-FIND-DUPES" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-find-dupes\fR - Find duplication in the package tree .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-fund.1 b/deps/npm/man/man1/npm-fund.1 index 31c5ceb7ff8c1f..86b8034a0747d1 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-FUND" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-fund\fR - Retrieve funding information .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-help-search.1 b/deps/npm/man/man1/npm-help-search.1 index c954795c2778c7..7178197085b95e 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-HELP-SEARCH" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-help-search\fR - Search npm help documentation .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-help.1 b/deps/npm/man/man1/npm-help.1 index 2d0fc6e3a2c0e7..09e59985599d80 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-HELP" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-help\fR - Get help on npm .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-hook.1 b/deps/npm/man/man1/npm-hook.1 deleted file mode 100644 index 8d5d9334692b9e..00000000000000 --- a/deps/npm/man/man1/npm-hook.1 +++ /dev/null @@ -1,115 +0,0 @@ -.TH "NPM-HOOK" "1" "December 2024" "NPM@10.9.2" "" -.SH "NAME" -\fBnpm-hook\fR - Manage registry hooks -.SS "Synopsis" -.P -.RS 2 -.nf -npm hook add \[lB]--type=\[rB] -npm hook ls \[lB]pkg\[rB] -npm hook rm -npm hook update -.fi -.RE -.P -Note: This command is unaware of workspaces. -.SS "Description" -.P -Allows you to manage \fBnpm hooks\fR \fI\(lahttps://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm\(ra\fR, including adding, removing, listing, and updating. -.P -Hooks allow you to configure URL endpoints that will be notified whenever a change happens to any of the supported entity types. Three different types of entities can be watched by hooks: packages, owners, and scopes. -.P -To create a package hook, simply reference the package name. -.P -To create an owner hook, prefix the owner name with \fB~\fR (as in, \fB~youruser\fR). -.P -To create a scope hook, prefix the scope name with \fB@\fR (as in, \fB@yourscope\fR). -.P -The hook \fBid\fR used by \fBupdate\fR and \fBrm\fR are the IDs listed in \fBnpm hook ls\fR for that particular hook. -.P -The shared secret will be sent along to the URL endpoint so you can verify the request came from your own configured hook. -.SS "Example" -.P -Add a hook to watch a package for changes: -.P -.RS 2 -.nf -$ npm hook add lodash https://example.com/ my-shared-secret -.fi -.RE -.P -Add a hook to watch packages belonging to the user \fBsubstack\fR: -.P -.RS 2 -.nf -$ npm hook add ~substack https://example.com/ my-shared-secret -.fi -.RE -.P -Add a hook to watch packages in the scope \fB@npm\fR -.P -.RS 2 -.nf -$ npm hook add @npm https://example.com/ my-shared-secret -.fi -.RE -.P -List all your active hooks: -.P -.RS 2 -.nf -$ npm hook ls -.fi -.RE -.P -List your active hooks for the \fBlodash\fR package: -.P -.RS 2 -.nf -$ npm hook ls lodash -.fi -.RE -.P -Update an existing hook's url: -.P -.RS 2 -.nf -$ npm hook update id-deadbeef https://my-new-website.here/ -.fi -.RE -.P -Remove a hook: -.P -.RS 2 -.nf -$ npm hook rm id-deadbeef -.fi -.RE -.SS "Configuration" -.SS "\fBregistry\fR" -.RS 0 -.IP \(bu 4 -Default: "https://registry.npmjs.org/" -.IP \(bu 4 -Type: URL -.RE 0 - -.P -The base URL of the npm registry. -.SS "\fBotp\fR" -.RS 0 -.IP \(bu 4 -Default: null -.IP \(bu 4 -Type: null or String -.RE 0 - -.P -This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fBnpm access\fR. -.P -If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. -.SS "See Also" -.RS 0 -.IP \(bu 4 -\fB"Introducing Hooks" blog post\fR \fI\(lahttps://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm\(ra\fR -.RE 0 diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1 index 1c1b008baa1deb..ace9295a8a95a3 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-INIT" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-init\fR - Create a package.json file .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-install-ci-test.1 b/deps/npm/man/man1/npm-install-ci-test.1 index 4bbbb51140521b..72fc3a8595d262 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-INSTALL-CI-TEST" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-install-ci-test\fR - Install a project with a clean slate and run tests .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-install-test.1 b/deps/npm/man/man1/npm-install-test.1 index eef940c066c709..20320bba890ed0 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-INSTALL-TEST" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-install-test\fR - Install package(s) and run tests .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index bbe4a43c10863e..3b32711397ba25 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-INSTALL" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-install\fR - Install a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1 index 9aca1f4a7fb80d..0ed6887d3c0d88 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-LINK" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-link\fR - Symlink a package folder .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-login.1 b/deps/npm/man/man1/npm-login.1 index a5e0cb71bb0d98..e7e7cc4cd88bc8 100644 --- a/deps/npm/man/man1/npm-login.1 +++ b/deps/npm/man/man1/npm-login.1 @@ -1,4 +1,4 @@ -.TH "NPM-LOGIN" "1" "December 2024" "NPM@10.9.2" "" +.TH "NPM-LOGIN" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-login\fR - Login to a registry user account .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-logout.1 b/deps/npm/man/man1/npm-logout.1 index 8ac69429ea320d..97d75001502a19 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-LOGOUT" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-logout\fR - Log out of the registry .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 47d20120898b59..15e44a19c6768e 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-LS" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-ls\fR - List installed packages .SS "Synopsis" @@ -20,7 +20,7 @@ Positional arguments are \fBname@version-range\fR identifiers, which will limit .P .RS 2 .nf -npm@10.9.2 /path/to/npm +npm@11.0.0 /path/to/npm └─┬ init-package-json@0.0.4 └── promzard@0.1.5 .fi @@ -33,18 +33,6 @@ If a project specifies git urls for dependencies these are shown in parentheses The tree shown is the logical dependency tree, based on package dependencies, not the physical layout of your \fBnode_modules\fR folder. .P When run as \fBll\fR or \fBla\fR, it shows extended information by default. -.SS "Note: Design Changes Pending" -.P -The \fBnpm ls\fR command's output and behavior made a \fIton\fR of sense when npm created a \fBnode_modules\fR folder that naively nested every dependency. In such a case, the logical dependency graph and physical tree of packages on disk would be roughly identical. -.P -With the advent of automatic install-time deduplication of dependencies in npm v3, the \fBls\fR output was modified to display the logical dependency graph as a tree structure, since this was more useful to most users. However, without using \fBnpm ls -l\fR, it became impossible to show \fIwhere\fR a package was actually installed much of the time! -.P -With the advent of automatic installation of \fBpeerDependencies\fR in npm v7, this gets even more curious, as \fBpeerDependencies\fR are logically "underneath" their dependents in the dependency graph, but are always physically at or above their location on disk. -.P -Also, in the years since npm got an \fBls\fR command (in version 0.0.2!), dependency graphs have gotten much larger as a general rule. Therefore, in order to avoid dumping an excessive amount of content to the terminal, \fBnpm -ls\fR now only shows the \fItop\fR level dependencies, unless \fB--all\fR is provided. -.P -A thorough re-examination of the use cases, intention, behavior, and output of this command, is currently underway. Expect significant changes to at least the default human-readable \fBnpm ls\fR output in npm v8. .SS "Configuration" .SS "\fBall\fR" .RS 0 diff --git a/deps/npm/man/man1/npm-org.1 b/deps/npm/man/man1/npm-org.1 index 88df3325a344fd..daca78255f42b9 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-ORG" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-org\fR - Manage orgs .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-outdated.1 b/deps/npm/man/man1/npm-outdated.1 index 17aabbd0857183..aab4bdff5e9465 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-OUTDATED" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-outdated\fR - Check for outdated packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-owner.1 b/deps/npm/man/man1/npm-owner.1 index f01e67e6464e7f..6cf50562ce259a 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-OWNER" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-owner\fR - Manage package owners .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-pack.1 b/deps/npm/man/man1/npm-pack.1 index b9b56a31e30eef..a6aa420eb4022e 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-PACK" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-pack\fR - Create a tarball from a package .SS "Synopsis" @@ -106,6 +106,18 @@ Include the workspace root when workspaces are enabled for a command. When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR 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 "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. .SS "Description" .P For anything that's installable (that is, a package folder, tarball, tarball url, git url, name@tag, name@version, name, or scoped name), this command will fetch it to the cache, copy the tarball to the current working directory as \fB-.tgz\fR, and then write the filenames out to stdout. diff --git a/deps/npm/man/man1/npm-ping.1 b/deps/npm/man/man1/npm-ping.1 index 2d16431b030ea8..0f15acec8c41df 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-PING" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-ping\fR - Ping npm registry .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-pkg.1 b/deps/npm/man/man1/npm-pkg.1 index e55a0280d1211b..cfab22912461e3 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-PKG" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-pkg\fR - Manages your package.json .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-prefix.1 b/deps/npm/man/man1/npm-prefix.1 index dca8d0c47497b4..cac17c68b27925 100644 --- a/deps/npm/man/man1/npm-prefix.1 +++ b/deps/npm/man/man1/npm-prefix.1 @@ -1,11 +1,11 @@ -.TH "NPM-PREFIX" "1" "December 2024" "NPM@10.9.2" "" +.TH "NPM-PREFIX" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-prefix\fR - Display prefix .SS "Synopsis" .P .RS 2 .nf -npm prefix \[lB]-g\[rB] +npm prefix .fi .RE .P diff --git a/deps/npm/man/man1/npm-profile.1 b/deps/npm/man/man1/npm-profile.1 index 89837b408f5a67..0eed37569a2c23 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-PROFILE" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-profile\fR - Change settings on your registry profile .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-prune.1 b/deps/npm/man/man1/npm-prune.1 index 243426dffaf20f..e01d867a0326ba 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-PRUNE" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-prune\fR - Remove extraneous packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1 index 1110b097182988..f584ca319bd356 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-PUBLISH" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-publish\fR - Publish a package .SS "Synopsis" @@ -60,6 +60,8 @@ Symbolic links are never included in npm packages. .P See npm help developers for full details on what's included in the published package, as well as details on how the package is built. +.P +See \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR for more info on what can and can't be ignored. .SS "Configuration" .SS "\fBtag\fR" .RS 0 diff --git a/deps/npm/man/man1/npm-query.1 b/deps/npm/man/man1/npm-query.1 index 983f2cad388940..83f5eb489e7c04 100644 --- a/deps/npm/man/man1/npm-query.1 +++ b/deps/npm/man/man1/npm-query.1 @@ -1,4 +1,4 @@ -.TH "NPM-QUERY" "1" "December 2024" "NPM@10.9.2" "" +.TH "NPM-QUERY" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-query\fR - Dependency selector query .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1 index 396d9adf779cb1..904ec74ac6ac29 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-REBUILD" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-rebuild\fR - Rebuild a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1 index b9c7bbdfbc233c..1536ae5d38acf6 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-REPO" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-repo\fR - Open package repository page in the browser .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-restart.1 b/deps/npm/man/man1/npm-restart.1 index 1112bf9180cece..c1f7d129365c1d 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-RESTART" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-restart\fR - Restart a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1 index 2456bdba6d1816..4f222a697a594b 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-ROOT" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-root\fR - Display npm root .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1 index a05362361848d2..303dd432acf30f 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-RUN-SCRIPT" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-run-script\fR - Run arbitrary package scripts .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-sbom.1 b/deps/npm/man/man1/npm-sbom.1 index f784a53edd4c08..9e33d7f257d413 100644 --- a/deps/npm/man/man1/npm-sbom.1 +++ b/deps/npm/man/man1/npm-sbom.1 @@ -1,4 +1,4 @@ -.TH "NPM-SBOM" "1" "December 2024" "NPM@10.9.2" "" +.TH "NPM-SBOM" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-sbom\fR - Generate a Software Bill of Materials (SBOM) .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1 index 3ee7bcb7cb4e92..b4bd3edf353468 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-SEARCH" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-search\fR - Search for packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-shrinkwrap.1 b/deps/npm/man/man1/npm-shrinkwrap.1 index d7e64493a90754..f4003d1eb25870 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-SHRINKWRAP" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-shrinkwrap\fR - Lock down dependency versions for publication .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1 index 7c3a528ec3a04f..9965ec8c52112f 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-STAR" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-star\fR - Mark your favorite packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-stars.1 b/deps/npm/man/man1/npm-stars.1 index 61d60d9534da40..a45038b761b465 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-STARS" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-stars\fR - View packages marked as favorites .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-start.1 b/deps/npm/man/man1/npm-start.1 index 4c687a1ecba49e..89ee167e22fc13 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-START" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-start\fR - Start a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-stop.1 b/deps/npm/man/man1/npm-stop.1 index dadebe98c52834..05cc8f8abcaf83 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-STOP" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-stop\fR - Stop a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-team.1 b/deps/npm/man/man1/npm-team.1 index 42ee63f4743b6e..96351687e77b06 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-TEAM" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-team\fR - Manage organization teams and team memberships .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-test.1 b/deps/npm/man/man1/npm-test.1 index 80eb6a1d7bb9e7..7aff8375de68b4 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-TEST" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-test\fR - Test a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-token.1 b/deps/npm/man/man1/npm-token.1 index 1d14f81553b5c9..139a61c5666398 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-TOKEN" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-token\fR - Manage your authentication tokens .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-uninstall.1 b/deps/npm/man/man1/npm-uninstall.1 index f5e25641fc57c5..5c1ec68079d40e 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-UNINSTALL" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-uninstall\fR - Remove a package .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1 index fcf62bbd7da263..b7d070c4b765a4 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-UNPUBLISH" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-unpublish\fR - Remove a package from the registry .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-unstar.1 b/deps/npm/man/man1/npm-unstar.1 index e9edf3ab6634dd..8c91421ba21143 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-UNSTAR" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-unstar\fR - Remove an item from your favorite packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-update.1 b/deps/npm/man/man1/npm-update.1 index 052008d73485c9..cfac4fa4399024 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-UPDATE" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-update\fR - Update packages .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index f79a0c84c3f8fd..fef0dc3ceb3720 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-VERSION" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-version\fR - Bump a package version .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1 index e862ddc4b8780d..db2487155a2d98 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-VIEW" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-view\fR - View registry info .SS "Synopsis" diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1 index a003f634a2b293..4202647f6c69f5 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-WHOAMI" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-whoami\fR - Display npm username .SS "Synopsis" diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 28e8774ad1b4d0..ffcdbf0f7bd45e 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "December 2024" "NPM@10.9.2" "" +.TH "NPM" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm\fR - javascript package manager .SS "Synopsis" @@ -12,7 +12,7 @@ npm Note: This command is unaware of workspaces. .SS "Version" .P -10.9.2 +11.0.0 .SS "Description" .P npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently. diff --git a/deps/npm/man/man1/npx.1 b/deps/npm/man/man1/npx.1 index 9b4ba1af1dc365..3e25d37e42fd9a 100644 --- a/deps/npm/man/man1/npx.1 +++ b/deps/npm/man/man1/npx.1 @@ -1,4 +1,4 @@ -.TH "NPX" "1" "December 2024" "NPM@10.9.2" "" +.TH "NPX" "1" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpx\fR - Run a command from a local or remote npm package .SS "Synopsis" diff --git a/deps/npm/man/man5/folders.5 b/deps/npm/man/man5/folders.5 index 8eb8a8230333f9..8348e518a170df 100644 --- a/deps/npm/man/man5/folders.5 +++ b/deps/npm/man/man5/folders.5 @@ -1,4 +1,4 @@ -.TH "FOLDERS" "5" "December 2024" "NPM@10.9.2" "" +.TH "FOLDERS" "5" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBfolders\fR - Folder Structures Used by npm .SS "Description" diff --git a/deps/npm/man/man5/install.5 b/deps/npm/man/man5/install.5 index 0b75adf308685a..b49be9e98c7c32 100644 --- a/deps/npm/man/man5/install.5 +++ b/deps/npm/man/man5/install.5 @@ -1,4 +1,4 @@ -.TH "INSTALL" "5" "December 2024" "NPM@10.9.2" "" +.TH "INSTALL" "5" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBinstall\fR - Download and install node and npm .SS "Description" diff --git a/deps/npm/man/man5/npm-global.5 b/deps/npm/man/man5/npm-global.5 index 8eb8a8230333f9..8348e518a170df 100644 --- a/deps/npm/man/man5/npm-global.5 +++ b/deps/npm/man/man5/npm-global.5 @@ -1,4 +1,4 @@ -.TH "FOLDERS" "5" "December 2024" "NPM@10.9.2" "" +.TH "FOLDERS" "5" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBfolders\fR - Folder Structures Used by npm .SS "Description" diff --git a/deps/npm/man/man5/npm-json.5 b/deps/npm/man/man5/npm-json.5 index 81fa9a8c95b8dc..4b807fbf00e9a4 100644 --- a/deps/npm/man/man5/npm-json.5 +++ b/deps/npm/man/man5/npm-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE.JSON" "5" "December 2024" "NPM@10.9.2" "" +.TH "PACKAGE.JSON" "5" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBpackage.json\fR - Specifics of npm's package.json handling .SS "Description" @@ -317,6 +317,8 @@ Some files are always ignored by default: \fBpnpm-lock.yaml\fR .IP \(bu 4 \fByarn.lock\fR +.IP \(bu 4 +\fBbun.lockb\fR .RE 0 .P @@ -334,6 +336,8 @@ Most of these ignored files can be included specifically if included in the \fBf \fBpnpm-lock.yaml\fR .IP \(bu 4 \fByarn.lock\fR +.IP \(bu 4 +\fBbun.lockb\fR .RE 0 .P @@ -1044,6 +1048,18 @@ Like the \fBos\fR option, you can also block architectures: .RE .P The host architecture is determined by \fBprocess.arch\fR +.SS "libc" +.P +If your code only runs or builds in certain versions of libc, you can specify which ones. This field only applies if \fBos\fR is \fBlinux\fR. +.P +.RS 2 +.nf +{ + "os": "linux", + "libc": "glibc" +} +.fi +.RE .SS "devEngines" .P The \fBdevEngines\fR field aids engineers working on a codebase to all be using the same tooling. diff --git a/deps/npm/man/man5/npm-shrinkwrap-json.5 b/deps/npm/man/man5/npm-shrinkwrap-json.5 index 7e8efb285e959e..0600f5d61aa99d 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" "December 2024" "NPM@10.9.2" "" +.TH "NPM-SHRINKWRAP.JSON" "5" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpm-shrinkwrap.json\fR - A publishable lockfile .SS "Description" diff --git a/deps/npm/man/man5/npmrc.5 b/deps/npm/man/man5/npmrc.5 index 947a0fe433faa3..098793f1a970ad 100644 --- a/deps/npm/man/man5/npmrc.5 +++ b/deps/npm/man/man5/npmrc.5 @@ -1,4 +1,4 @@ -.TH "NPMRC" "5" "December 2024" "NPM@10.9.2" "" +.TH "NPMRC" "5" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBnpmrc\fR - The npm config files .SS "Description" @@ -89,7 +89,7 @@ The full list is: .IP \(bu 4 \fBemail\fR .IP \(bu 4 -\fBcertfile\fR (path to certificate file) +\fBcafile\fR (path to certificate authority file) .IP \(bu 4 \fBkeyfile\fR (path to key file) .RE 0 diff --git a/deps/npm/man/man5/package-json.5 b/deps/npm/man/man5/package-json.5 index 81fa9a8c95b8dc..4b807fbf00e9a4 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" "December 2024" "NPM@10.9.2" "" +.TH "PACKAGE.JSON" "5" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBpackage.json\fR - Specifics of npm's package.json handling .SS "Description" @@ -317,6 +317,8 @@ Some files are always ignored by default: \fBpnpm-lock.yaml\fR .IP \(bu 4 \fByarn.lock\fR +.IP \(bu 4 +\fBbun.lockb\fR .RE 0 .P @@ -334,6 +336,8 @@ Most of these ignored files can be included specifically if included in the \fBf \fBpnpm-lock.yaml\fR .IP \(bu 4 \fByarn.lock\fR +.IP \(bu 4 +\fBbun.lockb\fR .RE 0 .P @@ -1044,6 +1048,18 @@ Like the \fBos\fR option, you can also block architectures: .RE .P The host architecture is determined by \fBprocess.arch\fR +.SS "libc" +.P +If your code only runs or builds in certain versions of libc, you can specify which ones. This field only applies if \fBos\fR is \fBlinux\fR. +.P +.RS 2 +.nf +{ + "os": "linux", + "libc": "glibc" +} +.fi +.RE .SS "devEngines" .P The \fBdevEngines\fR field aids engineers working on a codebase to all be using the same tooling. diff --git a/deps/npm/man/man5/package-lock-json.5 b/deps/npm/man/man5/package-lock-json.5 index 78deecab3757c1..0fe3cf8920411d 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" "December 2024" "NPM@10.9.2" "" +.TH "PACKAGE-LOCK.JSON" "5" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBpackage-lock.json\fR - A manifestation of the manifest .SS "Description" diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7 index 0ce1f25f38d5d3..c9bfc8f9cf23c5 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -1,4 +1,4 @@ -.TH "CONFIG" "7" "December 2024" "NPM@10.9.2" "" +.TH "CONFIG" "7" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBconfig\fR - More than you probably want to know about npm configuration .SS "Description" @@ -1835,7 +1835,7 @@ Default: null .IP \(bu 4 Type: null or String .IP \(bu 4 -DEPRECATED: \fBkey\fR and \fBcert\fR are no longer used for most registry operations. Use registry scoped \fBkeyfile\fR and \fBcertfile\fR instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem //other-registry.tld/:certfile=/path/to/cert.crt +DEPRECATED: \fBkey\fR and \fBcert\fR are no longer used for most registry operations. Use registry scoped \fBkeyfile\fR and \fBcafile\fR instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem //other-registry.tld/:cafile=/path/to/cert.crt .RE 0 .P @@ -1847,7 +1847,7 @@ cert="-----BEGIN CERTIFICATE-----\[rs]nXXXX\[rs]nXXXX\[rs]n-----END CERTIFICATE- .fi .RE .P -It is \fInot\fR the path to a certificate file, though you can set a registry-scoped "certfile" path like "//other-registry.tld/:certfile=/path/to/cert.pem". +It is \fInot\fR the path to a certificate file, though you can set a registry-scoped "cafile" path like "//other-registry.tld/:cafile=/path/to/cert.pem". .SS "\fBdev\fR" .RS 0 .IP \(bu 4 @@ -1951,7 +1951,7 @@ Default: null .IP \(bu 4 Type: null or String .IP \(bu 4 -DEPRECATED: \fBkey\fR and \fBcert\fR are no longer used for most registry operations. Use registry scoped \fBkeyfile\fR and \fBcertfile\fR instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem //other-registry.tld/:certfile=/path/to/cert.crt +DEPRECATED: \fBkey\fR and \fBcert\fR are no longer used for most registry operations. Use registry scoped \fBkeyfile\fR and \fBcafile\fR instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem //other-registry.tld/:cafile=/path/to/cert.crt .RE 0 .P diff --git a/deps/npm/man/man7/dependency-selectors.7 b/deps/npm/man/man7/dependency-selectors.7 index e15648cb400af4..7331ef393a6a46 100644 --- a/deps/npm/man/man7/dependency-selectors.7 +++ b/deps/npm/man/man7/dependency-selectors.7 @@ -1,4 +1,4 @@ -.TH "QUERYING" "7" "December 2024" "NPM@10.9.2" "" +.TH "QUERYING" "7" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBQuerying\fR - Dependency Selector Syntax & Querying .SS "Description" diff --git a/deps/npm/man/man7/developers.7 b/deps/npm/man/man7/developers.7 index a5d429c60a5cef..b6fc11026bff41 100644 --- a/deps/npm/man/man7/developers.7 +++ b/deps/npm/man/man7/developers.7 @@ -1,4 +1,4 @@ -.TH "DEVELOPERS" "7" "December 2024" "NPM@10.9.2" "" +.TH "DEVELOPERS" "7" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBdevelopers\fR - Developer Guide .SS "Description" @@ -91,7 +91,7 @@ You can negate a pattern by starting it with an exclamation point \fB!\fR. .RE 0 .P -By default, the following paths and files are ignored, so there's no need to add them to \fB.npmignore\fR explicitly: +By default, some paths and files are ignored, so there's no need to add them to \fB.npmignore\fR explicitly. Some examples are: .RS 0 .IP \(bu 4 \fB.*.swp\fR @@ -140,6 +140,8 @@ The following paths and files are never ignored, so adding them to \fB.npmignore .P If, given the structure of your project, you find \fB.npmignore\fR to be a maintenance headache, you might instead try populating the \fBfiles\fR property of \fBpackage.json\fR, which is an array of file or directory names that should be included in your package. Sometimes manually picking which items to allow is easier to manage than building a block list. +.P +See \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR for more info on what can and can't be ignored. .SS "Testing whether your \fB.npmignore\fR or \fBfiles\fR config works" .P If you want to double check that your package will include only the files you intend it to when published, you can run the \fBnpm pack\fR command locally which will generate a tarball in the working directory, the same way it does for publishing. diff --git a/deps/npm/man/man7/logging.7 b/deps/npm/man/man7/logging.7 index 200ad578584521..4b1bd5a17fd290 100644 --- a/deps/npm/man/man7/logging.7 +++ b/deps/npm/man/man7/logging.7 @@ -1,4 +1,4 @@ -.TH "LOGGING" "7" "December 2024" "NPM@10.9.2" "" +.TH "LOGGING" "7" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBLogging\fR - Why, What & How We Log .SS "Description" diff --git a/deps/npm/man/man7/orgs.7 b/deps/npm/man/man7/orgs.7 index 8f12f6e0434a19..4f61c68e1a7090 100644 --- a/deps/npm/man/man7/orgs.7 +++ b/deps/npm/man/man7/orgs.7 @@ -1,4 +1,4 @@ -.TH "ORGS" "7" "December 2024" "NPM@10.9.2" "" +.TH "ORGS" "7" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBorgs\fR - Working with Teams & Orgs .SS "Description" diff --git a/deps/npm/man/man7/package-spec.7 b/deps/npm/man/man7/package-spec.7 index f8a0ac73903272..0d68ede455119b 100644 --- a/deps/npm/man/man7/package-spec.7 +++ b/deps/npm/man/man7/package-spec.7 @@ -1,4 +1,4 @@ -.TH "PACKAGE-SPEC" "7" "December 2024" "NPM@10.9.2" "" +.TH "PACKAGE-SPEC" "7" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBpackage-spec\fR - Package name specifier .SS "Description" diff --git a/deps/npm/man/man7/registry.7 b/deps/npm/man/man7/registry.7 index 1e8134daaf751d..82e7b3c722ee50 100644 --- a/deps/npm/man/man7/registry.7 +++ b/deps/npm/man/man7/registry.7 @@ -1,4 +1,4 @@ -.TH "REGISTRY" "7" "December 2024" "NPM@10.9.2" "" +.TH "REGISTRY" "7" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBregistry\fR - The JavaScript Package Registry .SS "Description" diff --git a/deps/npm/man/man7/removal.7 b/deps/npm/man/man7/removal.7 index 74a7703f177e47..f571d2a6f3be38 100644 --- a/deps/npm/man/man7/removal.7 +++ b/deps/npm/man/man7/removal.7 @@ -1,4 +1,4 @@ -.TH "REMOVAL" "7" "December 2024" "NPM@10.9.2" "" +.TH "REMOVAL" "7" "December 2024" "NPM@11.0.0" "" .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 ccf0d9e7ee99c4..f665aafe4ab591 100644 --- a/deps/npm/man/man7/scope.7 +++ b/deps/npm/man/man7/scope.7 @@ -1,4 +1,4 @@ -.TH "SCOPE" "7" "December 2024" "NPM@10.9.2" "" +.TH "SCOPE" "7" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBscope\fR - Scoped packages .SS "Description" diff --git a/deps/npm/man/man7/scripts.7 b/deps/npm/man/man7/scripts.7 index 1758473fc89dbb..e28461883c1fab 100644 --- a/deps/npm/man/man7/scripts.7 +++ b/deps/npm/man/man7/scripts.7 @@ -1,4 +1,4 @@ -.TH "SCRIPTS" "7" "December 2024" "NPM@10.9.2" "" +.TH "SCRIPTS" "7" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBscripts\fR - How npm handles the "scripts" field .SS "Description" diff --git a/deps/npm/man/man7/workspaces.7 b/deps/npm/man/man7/workspaces.7 index cd7df95b81cf3e..c3cdec35116936 100644 --- a/deps/npm/man/man7/workspaces.7 +++ b/deps/npm/man/man7/workspaces.7 @@ -1,4 +1,4 @@ -.TH "WORKSPACES" "7" "December 2024" "NPM@10.9.2" "" +.TH "WORKSPACES" "7" "December 2024" "NPM@11.0.0" "" .SH "NAME" \fBworkspaces\fR - Working with workspaces .SS "Description" diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js index 82f84772f9a856..3340ddaa67067a 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js @@ -154,7 +154,9 @@ module.exports = cls => class Builder extends cls { // links should run prepare scripts and only link bins after that if (type === 'links') { - await this.#runScripts('prepare') + if (!this.options.ignoreScripts) { + await this.#runScripts('prepare') + } } if (this.options.binLinks) { await this.#linkAllBins() 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 f7700ce9119de3..dbd9be8bd3865a 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js @@ -15,7 +15,7 @@ const _init = Symbol('init') const _omit = Symbol('omit') const { log, time } = require('proc-log') -const fetch = require('npm-registry-fetch') +const npmFetch = require('npm-registry-fetch') class AuditReport extends Map { static load (tree, opts) { @@ -274,33 +274,6 @@ class AuditReport extends Map { throw new Error('do not call AuditReport.set() directly') } - // convert a quick-audit into a bulk advisory listing - static auditToBulk (report) { - if (!report.advisories) { - // tack on the report json where the response body would go - throw Object.assign(new Error('Invalid advisory report'), { - body: JSON.stringify(report), - }) - } - - const bulk = {} - const { advisories } = report - for (const advisory of Object.values(advisories)) { - const { - id, - url, - title, - severity = 'high', - vulnerable_versions = '*', - module_name: name, - } = advisory - bulk[name] = bulk[name] || [] - bulk[name].push({ id, url, title, severity, vulnerable_versions }) - } - - return bulk - } - async [_getReport] () { // if we're not auditing, just return false if (this.options.audit === false || this.options.offline === true || this.tree.inventory.size === 1) { @@ -309,39 +282,24 @@ class AuditReport extends Map { const timeEnd = time.start('auditReport:getReport') try { - try { - // first try the super fast bulk advisory listing - const body = prepareBulkData(this.tree, this[_omit], this.filterSet) - log.silly('audit', 'bulk request', body) - - // no sense asking if we don't have anything to audit, - // we know it'll be empty - if (!Object.keys(body).length) { - return null - } + const body = prepareBulkData(this.tree, this[_omit], this.filterSet) + log.silly('audit', 'bulk request', body) - const res = await fetch('/-/npm/v1/security/advisories/bulk', { - ...this.options, - registry: this.options.auditRegistry || this.options.registry, - method: 'POST', - gzip: true, - body, - }) - - return await res.json() - } catch (er) { - log.silly('audit', 'bulk request failed', String(er.body)) - // that failed, try the quick audit endpoint - const body = prepareData(this.tree, this.options) - const res = await fetch('/-/npm/v1/security/audits/quick', { - ...this.options, - registry: this.options.auditRegistry || this.options.registry, - method: 'POST', - gzip: true, - body, - }) - return AuditReport.auditToBulk(await res.json()) + // no sense asking if we don't have anything to audit, + // we know it'll be empty + if (!Object.keys(body).length) { + return null } + + const res = await npmFetch('/-/npm/v1/security/advisories/bulk', { + ...this.options, + registry: this.options.auditRegistry || this.options.registry, + method: 'POST', + gzip: true, + body, + }) + + return await res.json() } catch (er) { log.verbose('audit error', er) log.silly('audit error', String(er.body)) @@ -384,32 +342,4 @@ const prepareBulkData = (tree, omit, filterSet) => { return payload } -const prepareData = (tree, opts) => { - const { npmVersion: npm_version } = opts - const node_version = process.version - const { platform, arch } = process - const { NODE_ENV: node_env } = process.env - const data = tree.meta.commit() - // the legacy audit endpoint doesn't support any kind of pre-filtering - // we just have to get the advisories and skip over them in the report - return { - name: data.name, - version: data.version, - requires: { - ...(tree.package.devDependencies || {}), - ...(tree.package.peerDependencies || {}), - ...(tree.package.optionalDependencies || {}), - ...(tree.package.dependencies || {}), - }, - dependencies: data.dependencies, - metadata: { - node_version, - npm_version, - platform, - arch, - node_env, - }, - } -} - module.exports = AuditReport diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/query-selector-all.js b/deps/npm/node_modules/@npmcli/arborist/lib/query-selector-all.js index fa48d5f84b5562..c2cd00d0a2e2ee 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/query-selector-all.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/query-selector-all.js @@ -8,7 +8,7 @@ const { minimatch } = require('minimatch') const npa = require('npm-package-arg') const pacote = require('pacote') const semver = require('semver') -const fetch = require('npm-registry-fetch') +const npmFetch = require('npm-registry-fetch') // handle results for parsed query asts, results are stored in a map that has a // key that points to each ast selector node and stores the resulting array of @@ -461,7 +461,7 @@ class Results { packages[node.name].push(node.version) } }) - const res = await fetch('/-/npm/v1/security/advisories/bulk', { + const res = await npmFetch('/-/npm/v1/security/advisories/bulk', { ...this.flatOptions, registry: this.flatOptions.auditRegistry || this.flatOptions.registry, method: 'POST', diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json index b1e2b21a254635..a8c9ae04152440 100644 --- a/deps/npm/node_modules/@npmcli/arborist/package.json +++ b/deps/npm/node_modules/@npmcli/arborist/package.json @@ -1,13 +1,13 @@ { "name": "@npmcli/arborist", - "version": "8.0.0", + "version": "9.0.0", "description": "Manage node_modules trees", "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", "@npmcli/fs": "^4.0.0", "@npmcli/installed-package-contents": "^3.0.0", "@npmcli/map-workspaces": "^4.0.1", - "@npmcli/metavuln-calculator": "^8.0.0", + "@npmcli/metavuln-calculator": "^9.0.0", "@npmcli/name-from-folder": "^3.0.0", "@npmcli/node-gyp": "^4.0.0", "@npmcli/package-json": "^6.0.1", @@ -18,7 +18,6 @@ "cacache": "^19.0.1", "common-ancestor-path": "^1.0.1", "hosted-git-info": "^8.0.0", - "json-parse-even-better-errors": "^4.0.0", "json-stringify-nice": "^1.1.4", "lru-cache": "^10.2.2", "minimatch": "^9.0.4", @@ -27,7 +26,7 @@ "npm-package-arg": "^12.0.0", "npm-pick-manifest": "^10.0.0", "npm-registry-fetch": "^18.0.1", - "pacote": "^19.0.0", + "pacote": "^21.0.0", "parse-conflict-json": "^4.0.0", "proc-log": "^5.0.0", "proggy": "^3.0.0", @@ -37,11 +36,12 @@ "semver": "^7.3.7", "ssri": "^12.0.0", "treeverse": "^3.0.0", - "walk-up-path": "^3.0.1" + "walk-up-path": "^4.0.0" }, "devDependencies": { "@npmcli/eslint-config": "^5.0.1", - "@npmcli/template-oss": "4.23.3", + "@npmcli/mock-registry": "^1.0.0", + "@npmcli/template-oss": "4.23.6", "benchmark": "^2.1.4", "minify-registry-metadata": "^4.0.0", "nock": "^13.3.3", @@ -82,18 +82,18 @@ "test-env": [ "LC_ALL=sk" ], - "timeout": "360", + "timeout": "720", "nyc-arg": [ "--exclude", "tap-snapshots/**" ] }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.6", "content": "../../scripts/template-oss/index.js" } } diff --git a/deps/npm/node_modules/@npmcli/config/lib/definitions/definitions.js b/deps/npm/node_modules/@npmcli/config/lib/definitions/definitions.js index 627d624be4a024..8a84abd50ff699 100644 --- a/deps/npm/node_modules/@npmcli/config/lib/definitions/definitions.js +++ b/deps/npm/node_modules/@npmcli/config/lib/definitions/definitions.js @@ -397,14 +397,14 @@ const definitions = { \`\`\` It is _not_ the path to a certificate file, though you can set a registry-scoped - "certfile" path like "//other-registry.tld/:certfile=/path/to/cert.pem". + "cafile" path like "//other-registry.tld/:cafile=/path/to/cert.pem". `, deprecated: ` \`key\` and \`cert\` are no longer used for most registry operations. - Use registry scoped \`keyfile\` and \`certfile\` instead. + Use registry scoped \`keyfile\` and \`cafile\` instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem - //other-registry.tld/:certfile=/path/to/cert.crt + //other-registry.tld/:cafile=/path/to/cert.crt `, flatten, }), @@ -1077,10 +1077,10 @@ const definitions = { `, deprecated: ` \`key\` and \`cert\` are no longer used for most registry operations. - Use registry scoped \`keyfile\` and \`certfile\` instead. + Use registry scoped \`keyfile\` and \`cafile\` instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem - //other-registry.tld/:certfile=/path/to/cert.crt + //other-registry.tld/:cafile=/path/to/cert.crt `, flatten, }), diff --git a/deps/npm/node_modules/@npmcli/config/package.json b/deps/npm/node_modules/@npmcli/config/package.json index 18c677393b5ff3..eb89879ffe52fa 100644 --- a/deps/npm/node_modules/@npmcli/config/package.json +++ b/deps/npm/node_modules/@npmcli/config/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/config", - "version": "9.0.0", + "version": "10.0.0", "files": [ "bin/", "lib/" @@ -33,7 +33,7 @@ "devDependencies": { "@npmcli/eslint-config": "^5.0.1", "@npmcli/mock-globals": "^1.0.0", - "@npmcli/template-oss": "4.23.3", + "@npmcli/template-oss": "4.23.6", "tap": "^16.3.8" }, "dependencies": { @@ -44,14 +44,14 @@ "nopt": "^8.0.0", "proc-log": "^5.0.0", "semver": "^7.3.5", - "walk-up-path": "^3.0.1" + "walk-up-path": "^4.0.0" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.6", "content": "../../scripts/template-oss/index.js" } } diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/LICENSE b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/LICENSE deleted file mode 100644 index a03cd0ed0b338b..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter, Kat Marchán, npm, Inc., 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/metavuln-calculator/node_modules/pacote/README.md b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/README.md deleted file mode 100644 index dbb0051de23a4d..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/README.md +++ /dev/null @@ -1,283 +0,0 @@ -# pacote - -Fetches package manifests and tarballs from the npm registry. - -## USAGE - -```js -const pacote = require('pacote') - -// get a package manifest -pacote.manifest('foo@1.x').then(manifest => console.log('got it', manifest)) - -// extract a package into a folder -pacote.extract('github:npm/cli', 'some/path', options) - .then(({from, resolved, integrity}) => { - console.log('extracted!', from, resolved, integrity) - }) - -pacote.tarball('https://server.com/package.tgz').then(data => { - console.log('got ' + data.length + ' bytes of tarball data') -}) -``` - -`pacote` works with any kind of package specifier that npm can install. If -you can pass it to the npm CLI, you can pass it to pacote. (In fact, that's -exactly what the npm CLI does.) - -Anything that you can do with one kind of package, you can do with another. - -Data that isn't relevant (like a packument for a tarball) will be -simulated. - -`prepare` scripts will be run when generating tarballs from `git` and -`directory` locations, to simulate what _would_ be published to the -registry, so that you get a working package instead of just raw source -code that might need to be transpiled. - -## CLI - -This module exports a command line interface that can do most of what is -described below. Run `pacote -h` to learn more. - -``` -Pacote - The JavaScript Package Handler, v10.1.1 - -Usage: - - pacote resolve - Resolve a specifier and output the fully resolved target - Returns integrity and from if '--long' flag is set. - - pacote manifest - Fetch a manifest and print to stdout - - pacote packument - Fetch a full packument and print to stdout - - pacote tarball [] - Fetch a package tarball and save to - If is missing or '-', the tarball will be streamed to stdout. - - pacote extract - Extract a package to the destination folder. - -Configuration values all match the names of configs passed to npm, or -options passed to Pacote. Additional flags for this executable: - - --long Print an object from 'resolve', including integrity and spec. - --json Print result objects as JSON rather than node's default. - (This is the default if stdout is not a TTY.) - --help -h Print this helpful text. - -For example '--cache=/path/to/folder' will use that folder as the cache. -``` - -## API - -The `spec` refers to any kind of package specifier that npm can install. -If you can pass it to the npm CLI, you can pass it to pacote. (In fact, -that's exactly what the npm CLI does.) - -See below for valid `opts` values. - -* `pacote.resolve(spec, opts)` Resolve a specifier like `foo@latest` or - `github:user/project` all the way to a tarball url, tarball file, or git - repo with commit hash. - -* `pacote.extract(spec, dest, opts)` Extract a package's tarball into a - destination folder. Returns a promise that resolves to the - `{from,resolved,integrity}` of the extracted package. - -* `pacote.manifest(spec, opts)` Fetch (or simulate) a package's manifest - (basically, the `package.json` file, plus a bit of metadata). - See below for more on manifests and packuments. Returns a Promise that - resolves to the manifest object. - -* `pacote.packument(spec, opts)` Fetch (or simulate) a package's packument - (basically, the top-level package document listing all the manifests that - the registry returns). See below for more on manifests and packuments. - Returns a Promise that resolves to the packument object. - -* `pacote.tarball(spec, opts)` Get a package tarball data as a buffer in - memory. Returns a Promise that resolves to the tarball data Buffer, with - `from`, `resolved`, and `integrity` fields attached. - -* `pacote.tarball.file(spec, dest, opts)` Save a package tarball data to - a file on disk. Returns a Promise that resolves to - `{from,integrity,resolved}` of the fetched tarball. - -* `pacote.tarball.stream(spec, streamHandler, opts)` Fetch a tarball and - make the stream available to the `streamHandler` function. - - This is mostly an internal function, but it is exposed because it does - provide some functionality that may be difficult to achieve otherwise. - - The `streamHandler` function MUST return a Promise that resolves when - the stream (and all associated work) is ended, or rejects if the stream - has an error. - - The `streamHandler` function MAY be called multiple times, as Pacote - retries requests in some scenarios, such as cache corruption or - retriable network failures. - -### Options - -Options are passed to -[`npm-registry-fetch`](http://npm.im/npm-registry-fetch) and -[`cacache`](http://npm.im/cacache), so in addition to these, anything for -those modules can be given to pacote as well. - -Options object is cloned, and mutated along the way to add integrity, -resolved, and other properties, as they are determined. - -* `cache` Where to store cache entries and temp files. Passed to - [`cacache`](http://npm.im/cacache). Defaults to the same cache directory - that npm will use by default, based on platform and environment. -* `where` Base folder for resolving relative `file:` dependencies. -* `resolved` Shortcut for looking up resolved values. Should be specified - if known. -* `integrity` Expected integrity of fetched package tarball. If specified, - tarballs with mismatched integrity values will raise an `EINTEGRITY` - error. -* `umask` Permission mode mask for extracted files and directories. - Defaults to `0o22`. See "Extracted File Modes" below. -* `fmode` Minimum permission mode for extracted files. Defaults to - `0o666`. See "Extracted File Modes" below. -* `dmode` Minimum permission mode for extracted directories. Defaults to - `0o777`. See "Extracted File Modes" below. -* `preferOnline` Prefer to revalidate cache entries, even when it would not - be strictly necessary. Default `false`. -* `before` When picking a manifest from a packument, only consider - packages published before the specified date. Default `null`. -* `defaultTag` The default `dist-tag` to use when choosing a manifest from a - packument. Defaults to `latest`. -* `registry` The npm registry to use by default. Defaults to - `https://registry.npmjs.org/`. -* `fullMetadata` Fetch the full metadata from the registry for packuments, - including information not strictly required for installation (author, - description, etc.) Defaults to `true` when `before` is set, since the - version publish time is part of the extended packument metadata. -* `fullReadJson` Use the slower `read-package-json` package insted of - `read-package-json-fast` in order to include extra fields like "readme" in - the manifest. Defaults to `false`. -* `packumentCache` For registry packuments only, you may provide a `Map` - object which will be used to cache packument requests between pacote - calls. This allows you to easily avoid hitting the registry multiple - times (even just to validate the cache) for a given packument, since it - is unlikely to change in the span of a single command. -* `verifySignatures` A boolean that will make pacote verify the - integrity signature of a manifest, if present. There must be a - configured `_keys` entry in the config that is scoped to the - registry the manifest is being fetched from. -* `verifyAttestations` A boolean that will make pacote verify Sigstore - attestations, if present. There must be a configured `_keys` entry in the - config that is scoped to the registry the manifest is being fetched from. -* `tufCache` Where to store metadata/target files when retrieving the package - attestation key material via TUF. Defaults to the same cache directory that - npm will use by default, based on platform and environment. - -### Advanced API - -Each different type of fetcher is exposed for more advanced usage such as -using helper methods from this classes: - -* `DirFetcher` -* `FileFetcher` -* `GitFetcher` -* `RegistryFetcher` -* `RemoteFetcher` - -## Extracted File Modes - -Files are extracted with a mode matching the following formula: - -``` -( (tarball entry mode value) | (minimum mode option) ) ~ (umask) -``` - -This is in order to prevent unreadable files or unlistable directories from -cluttering a project's `node_modules` folder, even if the package tarball -specifies that the file should be inaccessible. - -It also prevents files from being group- or world-writable without explicit -opt-in by the user, because all file and directory modes are masked against -the `umask` value. - -So, a file which is `0o771` in the tarball, using the default `fmode` of -`0o666` and `umask` of `0o22`, will result in a file mode of `0o755`: - -``` -(0o771 | 0o666) => 0o777 -(0o777 ~ 0o22) => 0o755 -``` - -In almost every case, the defaults are appropriate. To respect exactly -what is in the package tarball (even if this makes an unusable system), set -both `dmode` and `fmode` options to `0`. Otherwise, the `umask` config -should be used in most cases where file mode modifications are required, -and this functions more or less the same as the `umask` value in most Unix -systems. - -## Extracted File Ownership - -When running as `root` on Unix systems, all extracted files and folders -will have their owning `uid` and `gid` values set to match the ownership -of the containing folder. - -This prevents `root`-owned files showing up in a project's `node_modules` -folder when a user runs `sudo npm install`. - -## Manifests - -A `manifest` is similar to a `package.json` file. However, it has a few -pieces of extra metadata, and sometimes lacks metadata that is inessential -to package installation. - -In addition to the common `package.json` fields, manifests include: - -* `manifest._resolved` The tarball url or file path where the package - artifact can be found. -* `manifest._from` A normalized form of the spec passed in as an argument. -* `manifest._integrity` The integrity value for the package artifact. -* `manifest._id` The canonical spec of this package version: name@version. -* `manifest.dist` Registry manifests (those included in a packument) have a - `dist` object. Only `tarball` is required, though at least one of - `shasum` or `integrity` is almost always present. - - * `tarball` The url to the associated package artifact. (Copied by - Pacote to `manifest._resolved`.) - * `integrity` The integrity SRI string for the artifact. This may not - be present for older packages on the npm registry. (Copied by Pacote - to `manifest._integrity`.) - * `shasum` Legacy integrity value. Hexadecimal-encoded sha1 hash. - (Converted to an SRI string and copied by Pacote to - `manifest._integrity` when `dist.integrity` is not present.) - * `fileCount` Number of files in the tarball. - * `unpackedSize` Size on disk of the package when unpacked. - * `signatures` Signatures of the shasum. Includes the keyid that - correlates to a [`key from the npm - registry`](https://registry.npmjs.org/-/npm/v1/keys) - -## Packuments - -A packument is the top-level package document that lists the set of -manifests for available versions for a package. - -When a packument is fetched with `accept: -application/vnd.npm.install-v1+json` in the HTTP headers, only the most -minimum necessary metadata is returned. Additional metadata is returned -when fetched with only `accept: application/json`. - -For Pacote's purposes, the following fields are relevant: - -* `versions` An object where each key is a version, and each value is the - manifest for that version. -* `dist-tags` An object mapping dist-tags to version numbers. This is how - `foo@latest` gets turned into `foo@1.2.3`. -* `time` In the full packument, an object mapping version numbers to - publication times, for the `opts.before` functionality. - -Pacote adds the following field, regardless of the accept header: - -* `_contentLength` The size of the packument. diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/bin/index.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/bin/index.js deleted file mode 100755 index f35b62ca71a537..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/bin/index.js +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/env node - -const run = conf => { - const pacote = require('../') - switch (conf._[0]) { - case 'resolve': - case 'manifest': - case 'packument': - if (conf._[0] === 'resolve' && conf.long) { - return pacote.manifest(conf._[1], conf).then(mani => ({ - resolved: mani._resolved, - integrity: mani._integrity, - from: mani._from, - })) - } - return pacote[conf._[0]](conf._[1], conf) - - case 'tarball': - if (!conf._[2] || conf._[2] === '-') { - return pacote.tarball.stream(conf._[1], stream => { - stream.pipe( - conf.testStdout || - /* istanbul ignore next */ - process.stdout - ) - // make sure it resolves something falsey - return stream.promise().then(() => { - return false - }) - }, conf) - } else { - return pacote.tarball.file(conf._[1], conf._[2], conf) - } - - case 'extract': - return pacote.extract(conf._[1], conf._[2], conf) - - default: /* istanbul ignore next */ { - throw new Error(`bad command: ${conf._[0]}`) - } - } -} - -const version = require('../package.json').version -const usage = () => -`Pacote - The JavaScript Package Handler, v${version} - -Usage: - - pacote resolve - Resolve a specifier and output the fully resolved target - Returns integrity and from if '--long' flag is set. - - pacote manifest - Fetch a manifest and print to stdout - - pacote packument - Fetch a full packument and print to stdout - - pacote tarball [] - Fetch a package tarball and save to - If is missing or '-', the tarball will be streamed to stdout. - - pacote extract - Extract a package to the destination folder. - -Configuration values all match the names of configs passed to npm, or -options passed to Pacote. Additional flags for this executable: - - --long Print an object from 'resolve', including integrity and spec. - --json Print result objects as JSON rather than node's default. - (This is the default if stdout is not a TTY.) - --help -h Print this helpful text. - -For example '--cache=/path/to/folder' will use that folder as the cache. -` - -const shouldJSON = (conf, result) => - conf.json || - !process.stdout.isTTY && - conf.json === undefined && - result && - typeof result === 'object' - -const pretty = (conf, result) => - shouldJSON(conf, result) ? JSON.stringify(result, 0, 2) : result - -let addedLogListener = false -const main = args => { - const conf = parse(args) - if (conf.help || conf.h) { - return console.log(usage()) - } - - if (!addedLogListener) { - process.on('log', console.error) - addedLogListener = true - } - - try { - return run(conf) - .then(result => result && console.log(pretty(conf, result))) - .catch(er => { - console.error(er) - process.exit(1) - }) - } catch (er) { - console.error(er.message) - console.error(usage()) - } -} - -const parseArg = arg => { - const split = arg.slice(2).split('=') - const k = split.shift() - const v = split.join('=') - const no = /^no-/.test(k) && !v - 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 - return { key, value } -} - -const parse = args => { - const conf = { - _: [], - cache: process.env.HOME + '/.npm/_cacache', - } - let dashdash = false - args.forEach(arg => { - if (dashdash) { - conf._.push(arg) - } else if (arg === '--') { - dashdash = true - } else if (arg === '-h') { - conf.help = true - } else if (/^--/.test(arg)) { - const { key, value } = parseArg(arg) - conf[key] = value - } else { - conf._.push(arg) - } - }) - return conf -} - -if (module === require.main) { - main(process.argv.slice(2)) -} else { - module.exports = { - main, - run, - usage, - parseArg, - parse, - } -} diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/dir.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/dir.js deleted file mode 100644 index 04846eb8a6e221..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/dir.js +++ /dev/null @@ -1,105 +0,0 @@ -const { resolve } = require('node:path') -const packlist = require('npm-packlist') -const runScript = require('@npmcli/run-script') -const tar = require('tar') -const { Minipass } = require('minipass') -const Fetcher = require('./fetcher.js') -const FileFetcher = require('./file.js') -const _ = require('./util/protected.js') -const tarCreateOptions = require('./util/tar-create-options.js') - -class DirFetcher extends Fetcher { - constructor (spec, opts) { - super(spec, opts) - // just the fully resolved filename - this.resolved = this.spec.fetchSpec - - this.tree = opts.tree || null - this.Arborist = opts.Arborist || null - } - - // exposes tarCreateOptions as public API - static tarCreateOptions (manifest) { - return tarCreateOptions(manifest) - } - - get types () { - return ['directory'] - } - - #prepareDir () { - return this.manifest().then(mani => { - if (!mani.scripts || !mani.scripts.prepare) { - return - } - if (this.opts.ignoreScripts) { - return - } - - // we *only* run prepare. - // pre/post-pack is run by the npm CLI for publish and pack, - // but this function is *also* run when installing git deps - const stdio = this.opts.foregroundScripts ? 'inherit' : 'pipe' - - return runScript({ - // this || undefined is because runScript will be unhappy with the default null value - scriptShell: this.opts.scriptShell || undefined, - pkg: mani, - event: 'prepare', - path: this.resolved, - stdio, - env: { - npm_package_resolved: this.resolved, - npm_package_integrity: this.integrity, - npm_package_json: resolve(this.resolved, 'package.json'), - }, - }) - }) - } - - [_.tarballFromResolved] () { - if (!this.tree && !this.Arborist) { - throw new Error('DirFetcher requires either a tree or an Arborist constructor to pack') - } - - const stream = new Minipass() - stream.resolved = this.resolved - stream.integrity = this.integrity - - const { prefix, workspaces } = this.opts - - // run the prepare script, get the list of files, and tar it up - // pipe to the stream, and proxy errors the chain. - this.#prepareDir() - .then(async () => { - if (!this.tree) { - const arb = new this.Arborist({ path: this.resolved }) - this.tree = await arb.loadActual() - } - return packlist(this.tree, { path: this.resolved, prefix, workspaces }) - }) - .then(files => tar.c(tarCreateOptions(this.package), files) - .on('error', er => stream.emit('error', er)).pipe(stream)) - .catch(er => stream.emit('error', er)) - return stream - } - - manifest () { - if (this.package) { - return Promise.resolve(this.package) - } - - return this[_.readPackageJson](this.resolved) - .then(mani => this.package = { - ...mani, - _integrity: this.integrity && String(this.integrity), - _resolved: this.resolved, - _from: this.from, - }) - } - - packument () { - return FileFetcher.prototype.packument.apply(this) - } -} -module.exports = DirFetcher diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/fetcher.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/fetcher.js deleted file mode 100644 index f2ac97619d3af1..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/fetcher.js +++ /dev/null @@ -1,497 +0,0 @@ -// This is the base class that the other fetcher types in lib -// all descend from. -// It handles the unpacking and retry logic that is shared among -// all of the other Fetcher types. - -const { basename, dirname } = require('node:path') -const { rm, mkdir } = require('node:fs/promises') -const PackageJson = require('@npmcli/package-json') -const cacache = require('cacache') -const fsm = require('fs-minipass') -const getContents = require('@npmcli/installed-package-contents') -const npa = require('npm-package-arg') -const retry = require('promise-retry') -const ssri = require('ssri') -const tar = require('tar') -const { Minipass } = require('minipass') -const { log } = require('proc-log') -const _ = require('./util/protected.js') -const cacheDir = require('./util/cache-dir.js') -const isPackageBin = require('./util/is-package-bin.js') -const removeTrailingSlashes = require('./util/trailing-slashes.js') - -// Pacote is only concerned with the package.json contents -const packageJsonPrepare = (p) => PackageJson.prepare(p).then(pkg => pkg.content) -const packageJsonNormalize = (p) => PackageJson.normalize(p).then(pkg => pkg.content) - -class FetcherBase { - constructor (spec, opts) { - if (!opts || typeof opts !== 'object') { - throw new TypeError('options object is required') - } - this.spec = npa(spec, opts.where) - - this.allowGitIgnore = !!opts.allowGitIgnore - - // a bit redundant because presumably the caller already knows this, - // but it makes it easier to not have to keep track of the requested - // spec when we're dispatching thousands of these at once, and normalizing - // is nice. saveSpec is preferred if set, because it turns stuff like - // x/y#committish into github:x/y#committish. use name@rawSpec for - // registry deps so that we turn xyz and xyz@ -> xyz@ - this.from = this.spec.registry - ? `${this.spec.name}@${this.spec.rawSpec}` : this.spec.saveSpec - - this.#assertType() - // clone the opts object so that others aren't upset when we mutate it - // by adding/modifying the integrity value. - this.opts = { ...opts } - - this.cache = opts.cache || cacheDir().cacache - this.tufCache = opts.tufCache || cacheDir().tufcache - this.resolved = opts.resolved || null - - // default to caching/verifying with sha512, that's what we usually have - // need to change this default, or start overriding it, when sha512 - // is no longer strong enough. - this.defaultIntegrityAlgorithm = opts.defaultIntegrityAlgorithm || 'sha512' - - if (typeof opts.integrity === 'string') { - this.opts.integrity = ssri.parse(opts.integrity) - } - - this.package = null - this.type = this.constructor.name - this.fmode = opts.fmode || 0o666 - this.dmode = opts.dmode || 0o777 - // we don't need a default umask, because we don't chmod files coming - // out of package tarballs. they're forced to have a mode that is - // valid, regardless of what's in the tarball entry, and then we let - // the process's umask setting do its job. but if configured, we do - // respect it. - this.umask = opts.umask || 0 - - this.preferOnline = !!opts.preferOnline - this.preferOffline = !!opts.preferOffline - this.offline = !!opts.offline - - this.before = opts.before - this.fullMetadata = this.before ? true : !!opts.fullMetadata - this.fullReadJson = !!opts.fullReadJson - this[_.readPackageJson] = this.fullReadJson - ? packageJsonPrepare - : packageJsonNormalize - - // rrh is a registry hostname or 'never' or 'always' - // defaults to registry.npmjs.org - this.replaceRegistryHost = (!opts.replaceRegistryHost || opts.replaceRegistryHost === 'npmjs') ? - 'registry.npmjs.org' : opts.replaceRegistryHost - - this.defaultTag = opts.defaultTag || 'latest' - this.registry = removeTrailingSlashes(opts.registry || 'https://registry.npmjs.org') - - // command to run 'prepare' scripts on directories and git dirs - // To use pacote with yarn, for example, set npmBin to 'yarn' - // and npmCliConfig with yarn's equivalents. - this.npmBin = opts.npmBin || 'npm' - - // command to install deps for preparing - this.npmInstallCmd = opts.npmInstallCmd || ['install', '--force'] - - // XXX fill more of this in based on what we know from this.opts - // we explicitly DO NOT fill in --tag, though, since we are often - // going to be packing in the context of a publish, which may set - // a dist-tag, but certainly wants to keep defaulting to latest. - this.npmCliConfig = opts.npmCliConfig || [ - `--cache=${dirname(this.cache)}`, - `--prefer-offline=${!!this.preferOffline}`, - `--prefer-online=${!!this.preferOnline}`, - `--offline=${!!this.offline}`, - ...(this.before ? [`--before=${this.before.toISOString()}`] : []), - '--no-progress', - '--no-save', - '--no-audit', - // override any omit settings from the environment - '--include=dev', - '--include=peer', - '--include=optional', - // we need the actual things, not just the lockfile - '--no-package-lock-only', - '--no-dry-run', - ] - } - - get integrity () { - return this.opts.integrity || null - } - - set integrity (i) { - if (!i) { - return - } - - i = ssri.parse(i) - const current = this.opts.integrity - - // do not ever update an existing hash value, but do - // merge in NEW algos and hashes that we don't already have. - if (current) { - current.merge(i) - } else { - this.opts.integrity = i - } - } - - get notImplementedError () { - return new Error('not implemented in this fetcher type: ' + this.type) - } - - // override in child classes - // Returns a Promise that resolves to this.resolved string value - resolve () { - return this.resolved ? Promise.resolve(this.resolved) - : Promise.reject(this.notImplementedError) - } - - packument () { - return Promise.reject(this.notImplementedError) - } - - // override in child class - // returns a manifest containing: - // - name - // - version - // - _resolved - // - _integrity - // - plus whatever else was in there (corgi, full metadata, or pj file) - manifest () { - return Promise.reject(this.notImplementedError) - } - - // private, should be overridden. - // Note that they should *not* calculate or check integrity or cache, - // but *just* return the raw tarball data stream. - [_.tarballFromResolved] () { - throw this.notImplementedError - } - - // public, should not be overridden - tarball () { - return this.tarballStream(stream => stream.concat().then(data => { - data.integrity = this.integrity && String(this.integrity) - data.resolved = this.resolved - data.from = this.from - return data - })) - } - - // private - // Note: cacache will raise a EINTEGRITY error if the integrity doesn't match - #tarballFromCache () { - const startTime = Date.now() - const stream = cacache.get.stream.byDigest(this.cache, this.integrity, this.opts) - const elapsedTime = Date.now() - startTime - // cache is good, so log it as a hit in particular since there was no fetch logged - log.http( - 'cache', - `${this.spec} ${elapsedTime}ms (cache hit)` - ) - return stream - } - - get [_.cacheFetches] () { - return true - } - - #istream (stream) { - // if not caching this, just return it - if (!this.opts.cache || !this[_.cacheFetches]) { - // instead of creating a new integrity stream, we only piggyback on the - // provided stream's events - if (stream.hasIntegrityEmitter) { - stream.on('integrity', i => this.integrity = i) - return stream - } - - const istream = ssri.integrityStream(this.opts) - istream.on('integrity', i => this.integrity = i) - stream.on('error', err => istream.emit('error', err)) - return stream.pipe(istream) - } - - // we have to return a stream that gets ALL the data, and proxies errors, - // but then pipe from the original tarball stream into the cache as well. - // To do this without losing any data, and since the cacache put stream - // is not a passthrough, we have to pipe from the original stream into - // the cache AFTER we pipe into the middleStream. Since the cache stream - // has an asynchronous flush to write its contents to disk, we need to - // defer the middleStream end until the cache stream ends. - const middleStream = new Minipass() - stream.on('error', err => middleStream.emit('error', err)) - stream.pipe(middleStream, { end: false }) - const cstream = cacache.put.stream( - this.opts.cache, - `pacote:tarball:${this.from}`, - this.opts - ) - cstream.on('integrity', i => this.integrity = i) - cstream.on('error', err => stream.emit('error', err)) - stream.pipe(cstream) - - // eslint-disable-next-line promise/catch-or-return - cstream.promise().catch(() => {}).then(() => middleStream.end()) - return middleStream - } - - pickIntegrityAlgorithm () { - return this.integrity ? this.integrity.pickAlgorithm(this.opts) - : this.defaultIntegrityAlgorithm - } - - // TODO: check error class, once those are rolled out to our deps - isDataCorruptionError (er) { - return er.code === 'EINTEGRITY' || er.code === 'Z_DATA_ERROR' - } - - // override the types getter - get types () { - return false - } - - #assertType () { - if (this.types && !this.types.includes(this.spec.type)) { - throw new TypeError(`Wrong spec type (${ - this.spec.type - }) for ${ - this.constructor.name - }. Supported types: ${this.types.join(', ')}`) - } - } - - // We allow ENOENTs from cacache, but not anywhere else. - // An ENOENT trying to read a tgz file, for example, is Right Out. - isRetriableError (er) { - // TODO: check error class, once those are rolled out to our deps - return this.isDataCorruptionError(er) || - er.code === 'ENOENT' || - er.code === 'EISDIR' - } - - // Mostly internal, but has some uses - // Pass in a function which returns a promise - // Function will be called 1 or more times with streams that may fail. - // Retries: - // Function MUST handle errors on the stream by rejecting the promise, - // so that retry logic can pick it up and either retry or fail whatever - // promise it was making (ie, failing extraction, etc.) - // - // The return value of this method is a Promise that resolves the same - // as whatever the streamHandler resolves to. - // - // This should never be overridden by child classes, but it is public. - tarballStream (streamHandler) { - // Only short-circuit via cache if we have everything else we'll need, - // and the user has not expressed a preference for checking online. - - const fromCache = ( - !this.preferOnline && - this.integrity && - this.resolved - ) ? streamHandler(this.#tarballFromCache()).catch(er => { - if (this.isDataCorruptionError(er)) { - log.warn('tarball', `cached data for ${ - this.spec - } (${this.integrity}) seems to be corrupted. Refreshing cache.`) - return this.cleanupCached().then(() => { - throw er - }) - } else { - throw er - } - }) : null - - const fromResolved = er => { - if (er) { - if (!this.isRetriableError(er)) { - throw er - } - log.silly('tarball', `no local data for ${ - this.spec - }. Extracting by manifest.`) - } - return this.resolve().then(() => retry(tryAgain => - streamHandler(this.#istream(this[_.tarballFromResolved]())) - .catch(streamErr => { - // Most likely data integrity. A cache ENOENT error is unlikely - // here, since we're definitely not reading from the cache, but it - // 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(streamErr)) { - log.warn('tarball', `tarball data for ${ - this.spec - } (${this.integrity}) seems to be corrupted. Trying again.`) - return this.cleanupCached().then(() => tryAgain(streamErr)) - } - throw streamErr - }), { retries: 1, minTimeout: 0, maxTimeout: 0 })) - } - - return fromCache ? fromCache.catch(fromResolved) : fromResolved() - } - - cleanupCached () { - return cacache.rm.content(this.cache, this.integrity, this.opts) - } - - #empty (path) { - return getContents({ path, depth: 1 }).then(contents => Promise.all( - contents.map(entry => rm(entry, { recursive: true, force: true })))) - } - - async #mkdir (dest) { - await this.#empty(dest) - return await mkdir(dest, { recursive: true }) - } - - // extraction is always the same. the only difference is where - // the tarball comes from. - async extract (dest) { - await this.#mkdir(dest) - return this.tarballStream((tarball) => this.#extract(dest, tarball)) - } - - #toFile (dest) { - return this.tarballStream(str => new Promise((res, rej) => { - const writer = new fsm.WriteStream(dest) - str.on('error', er => writer.emit('error', er)) - writer.on('error', er => rej(er)) - writer.on('close', () => res({ - integrity: this.integrity && String(this.integrity), - resolved: this.resolved, - from: this.from, - })) - str.pipe(writer) - })) - } - - // don't use this.#mkdir because we don't want to rimraf anything - async tarballFile (dest) { - const dir = dirname(dest) - await mkdir(dir, { recursive: true }) - return this.#toFile(dest) - } - - #extract (dest, tarball) { - const extractor = tar.x(this.#tarxOptions({ cwd: dest })) - const p = new Promise((resolve, reject) => { - extractor.on('end', () => { - resolve({ - resolved: this.resolved, - integrity: this.integrity && String(this.integrity), - from: this.from, - }) - }) - - extractor.on('error', er => { - log.warn('tar', er.message) - log.silly('tar', er) - reject(er) - }) - - tarball.on('error', er => reject(er)) - }) - - tarball.pipe(extractor) - return p - } - - // always ensure that entries are at least as permissive as our configured - // dmode/fmode, but never more permissive than the umask allows. - #entryMode (path, mode, type) { - const m = /Directory|GNUDumpDir/.test(type) ? this.dmode - : /File$/.test(type) ? this.fmode - : /* istanbul ignore next - should never happen in a pkg */ 0 - - // make sure package bins are executable - const exe = isPackageBin(this.package, path) ? 0o111 : 0 - // always ensure that files are read/writable by the owner - return ((mode | m) & ~this.umask) | exe | 0o600 - } - - #tarxOptions ({ cwd }) { - const sawIgnores = new Set() - return { - cwd, - noChmod: true, - noMtime: true, - filter: (name, entry) => { - if (/Link$/.test(entry.type)) { - return false - } - entry.mode = this.#entryMode(entry.path, entry.mode, entry.type) - // this replicates the npm pack behavior where .gitignore files - // are treated like .npmignore files, but only if a .npmignore - // file is not present. - if (/File$/.test(entry.type)) { - const base = basename(entry.path) - if (base === '.npmignore') { - sawIgnores.add(entry.path) - } else if (base === '.gitignore' && !this.allowGitIgnore) { - // rename, but only if there's not already a .npmignore - const ni = entry.path.replace(/\.gitignore$/, '.npmignore') - if (sawIgnores.has(ni)) { - return false - } - entry.path = ni - } - return true - } - }, - strip: 1, - onwarn: /* istanbul ignore next - we can trust that tar logs */ - (code, msg, data) => { - log.warn('tar', code, msg) - log.silly('tar', code, msg, data) - }, - umask: this.umask, - // always ignore ownership info from tarball metadata - preserveOwner: false, - } - } -} - -module.exports = FetcherBase - -// Child classes -const GitFetcher = require('./git.js') -const RegistryFetcher = require('./registry.js') -const FileFetcher = require('./file.js') -const DirFetcher = require('./dir.js') -const RemoteFetcher = require('./remote.js') - -// Get an appropriate fetcher object from a spec and options -FetcherBase.get = (rawSpec, opts = {}) => { - const spec = npa(rawSpec, opts.where) - switch (spec.type) { - case 'git': - return new GitFetcher(spec, opts) - - case 'remote': - return new RemoteFetcher(spec, opts) - - case 'version': - case 'range': - case 'tag': - case 'alias': - return new RegistryFetcher(spec.subSpec || spec, opts) - - case 'file': - return new FileFetcher(spec, opts) - - case 'directory': - return new DirFetcher(spec, opts) - - default: - throw new TypeError('Unknown spec type: ' + spec.type) - } -} diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/file.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/file.js deleted file mode 100644 index 2021325085e4f0..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/file.js +++ /dev/null @@ -1,94 +0,0 @@ -const { resolve } = require('node:path') -const { stat, chmod } = require('node:fs/promises') -const cacache = require('cacache') -const fsm = require('fs-minipass') -const Fetcher = require('./fetcher.js') -const _ = require('./util/protected.js') - -class FileFetcher extends Fetcher { - constructor (spec, opts) { - super(spec, opts) - // just the fully resolved filename - this.resolved = this.spec.fetchSpec - } - - get types () { - return ['file'] - } - - manifest () { - if (this.package) { - return Promise.resolve(this.package) - } - - // have to unpack the tarball for this. - return cacache.tmp.withTmp(this.cache, this.opts, dir => - this.extract(dir) - .then(() => this[_.readPackageJson](dir)) - .then(mani => this.package = { - ...mani, - _integrity: this.integrity && String(this.integrity), - _resolved: this.resolved, - _from: this.from, - })) - } - - #exeBins (pkg, dest) { - if (!pkg.bin) { - return Promise.resolve() - } - - return Promise.all(Object.keys(pkg.bin).map(async k => { - const script = resolve(dest, pkg.bin[k]) - // Best effort. Ignore errors here, the only result is that - // a bin script is not executable. But if it's missing or - // something, we just leave it for a later stage to trip over - // when we can provide a more useful contextual error. - try { - const st = await stat(script) - const mode = st.mode | 0o111 - if (mode === st.mode) { - return - } - await chmod(script, mode) - } catch { - // Ignore errors here - } - })) - } - - extract (dest) { - // if we've already loaded the manifest, then the super got it. - // but if not, read the unpacked manifest and chmod properly. - return super.extract(dest) - .then(result => this.package ? result - : this[_.readPackageJson](dest).then(pkg => - this.#exeBins(pkg, dest)).then(() => result)) - } - - [_.tarballFromResolved] () { - // create a read stream and return it - return new fsm.ReadStream(this.resolved) - } - - packument () { - // simulate based on manifest - return this.manifest().then(mani => ({ - name: mani.name, - 'dist-tags': { - [this.defaultTag]: mani.version, - }, - versions: { - [mani.version]: { - ...mani, - dist: { - tarball: `file:${this.resolved}`, - integrity: this.integrity && String(this.integrity), - }, - }, - }, - })) - } -} - -module.exports = FileFetcher diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/git.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/git.js deleted file mode 100644 index 077193a86f026f..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/git.js +++ /dev/null @@ -1,317 +0,0 @@ -const cacache = require('cacache') -const git = require('@npmcli/git') -const npa = require('npm-package-arg') -const pickManifest = require('npm-pick-manifest') -const { Minipass } = require('minipass') -const { log } = require('proc-log') -const DirFetcher = require('./dir.js') -const Fetcher = require('./fetcher.js') -const FileFetcher = require('./file.js') -const RemoteFetcher = require('./remote.js') -const _ = require('./util/protected.js') -const addGitSha = require('./util/add-git-sha.js') -const npm = require('./util/npm.js') - -const hashre = /^[a-f0-9]{40}$/ - -// get the repository url. -// prefer https if there's auth, since ssh will drop that. -// otherwise, prefer ssh if available (more secure). -// We have to add the git+ back because npa suppresses it. -const repoUrl = (h, opts) => - h.sshurl && !(h.https && h.auth) && addGitPlus(h.sshurl(opts)) || - h.https && addGitPlus(h.https(opts)) - -// add git+ to the url, but only one time. -const addGitPlus = url => url && `git+${url}`.replace(/^(git\+)+/, 'git+') - -class GitFetcher extends Fetcher { - constructor (spec, opts) { - super(spec, opts) - - // we never want to compare integrity for git dependencies: npm/rfcs#525 - if (this.opts.integrity) { - delete this.opts.integrity - log.warn(`skipping integrity check for git dependency ${this.spec.fetchSpec}`) - } - - this.resolvedRef = null - if (this.spec.hosted) { - this.from = this.spec.hosted.shortcut({ noCommittish: false }) - } - - // shortcut: avoid full clone when we can go straight to the tgz - // if we have the full sha and it's a hosted git platform - if (this.spec.gitCommittish && hashre.test(this.spec.gitCommittish)) { - this.resolvedSha = this.spec.gitCommittish - // use hosted.tarball() when we shell to RemoteFetcher later - this.resolved = this.spec.hosted - ? repoUrl(this.spec.hosted, { noCommittish: false }) - : this.spec.rawSpec - } else { - this.resolvedSha = '' - } - - this.Arborist = opts.Arborist || null - } - - // just exposed to make it easier to test all the combinations - static repoUrl (hosted, opts) { - return repoUrl(hosted, opts) - } - - get types () { - return ['git'] - } - - resolve () { - // likely a hosted git repo with a sha, so get the tarball url - // but in general, no reason to resolve() more than necessary! - if (this.resolved) { - return super.resolve() - } - - // fetch the git repo and then look at the current hash - const h = this.spec.hosted - // try to use ssh, fall back to git. - return h - ? this.#resolvedFromHosted(h) - : this.#resolvedFromRepo(this.spec.fetchSpec) - } - - // first try https, since that's faster and passphrase-less for - // public repos, and supports private repos when auth is provided. - // Fall back to SSH to support private repos - // NB: we always store the https url in resolved field if auth - // is present, otherwise ssh if the hosted type provides it - #resolvedFromHosted (hosted) { - return this.#resolvedFromRepo(hosted.https && hosted.https()).catch(er => { - // Throw early since we know pathspec errors will fail again if retried - if (er instanceof git.errors.GitPathspecError) { - throw er - } - const ssh = hosted.sshurl && hosted.sshurl() - // no fallthrough if we can't fall through or have https auth - if (!ssh || hosted.auth) { - throw er - } - return this.#resolvedFromRepo(ssh) - }) - } - - #resolvedFromRepo (gitRemote) { - // XXX make this a custom error class - if (!gitRemote) { - return Promise.reject(new Error(`No git url for ${this.spec}`)) - } - const gitRange = this.spec.gitRange - const name = this.spec.name - return git.revs(gitRemote, this.opts).then(remoteRefs => { - return gitRange ? pickManifest({ - versions: remoteRefs.versions, - 'dist-tags': remoteRefs['dist-tags'], - name, - }, gitRange, this.opts) - : this.spec.gitCommittish ? - remoteRefs.refs[this.spec.gitCommittish] || - remoteRefs.refs[remoteRefs.shas[this.spec.gitCommittish]] - : remoteRefs.refs.HEAD // no git committish, get default head - }).then(revDoc => { - // the committish provided isn't in the rev list - // things like HEAD~3 or @yesterday can land here. - if (!revDoc || !revDoc.sha) { - return this.#resolvedFromClone() - } - - this.resolvedRef = revDoc - this.resolvedSha = revDoc.sha - this.#addGitSha(revDoc.sha) - return this.resolved - }) - } - - #setResolvedWithSha (withSha) { - // we haven't cloned, so a tgz download is still faster - // of course, if it's not a known host, we can't do that. - this.resolved = !this.spec.hosted ? withSha - : repoUrl(npa(withSha).hosted, { noCommittish: false }) - } - - // when we get the git sha, we affix it to our spec to build up - // either a git url with a hash, or a tarball download URL - #addGitSha (sha) { - this.#setResolvedWithSha(addGitSha(this.spec, sha)) - } - - #resolvedFromClone () { - // do a full or shallow clone, then look at the HEAD - // kind of wasteful, but no other option, really - return this.#clone(() => this.resolved) - } - - #prepareDir (dir) { - return this[_.readPackageJson](dir).then(mani => { - // no need if we aren't going to do any preparation. - const scripts = mani.scripts - if (!mani.workspaces && (!scripts || !( - scripts.postinstall || - scripts.build || - scripts.preinstall || - scripts.install || - scripts.prepack || - scripts.prepare))) { - return - } - - // to avoid cases where we have an cycle of git deps that depend - // on one another, we only ever do preparation for one instance - // of a given git dep along the chain of installations. - // Note that this does mean that a dependency MAY in theory end up - // trying to run its prepare script using a dependency that has not - // been properly prepared itself, but that edge case is smaller - // and less hazardous than a fork bomb of npm and git commands. - const noPrepare = !process.env._PACOTE_NO_PREPARE_ ? [] - : process.env._PACOTE_NO_PREPARE_.split('\n') - if (noPrepare.includes(this.resolved)) { - log.info('prepare', 'skip prepare, already seen', this.resolved) - return - } - noPrepare.push(this.resolved) - - // the DirFetcher will do its own preparation to run the prepare scripts - // All we have to do is put the deps in place so that it can succeed. - return npm( - this.npmBin, - [].concat(this.npmInstallCmd).concat(this.npmCliConfig), - dir, - { ...process.env, _PACOTE_NO_PREPARE_: noPrepare.join('\n') }, - { message: 'git dep preparation failed' } - ) - }) - } - - [_.tarballFromResolved] () { - const stream = new Minipass() - stream.resolved = this.resolved - stream.from = this.from - - // check it out and then shell out to the DirFetcher tarball packer - this.#clone(dir => this.#prepareDir(dir) - .then(() => new Promise((res, rej) => { - if (!this.Arborist) { - throw new Error('GitFetcher requires an Arborist constructor to pack a tarball') - } - const df = new DirFetcher(`file:${dir}`, { - ...this.opts, - Arborist: this.Arborist, - resolved: null, - integrity: null, - }) - const dirStream = df[_.tarballFromResolved]() - dirStream.on('error', rej) - dirStream.on('end', res) - dirStream.pipe(stream) - }))).catch( - /* istanbul ignore next: very unlikely and hard to test */ - er => stream.emit('error', er) - ) - return stream - } - - // clone a git repo into a temp folder (or fetch and unpack if possible) - // handler accepts a directory, and returns a promise that resolves - // when we're done with it, at which point, cacache deletes it - // - // TODO: after cloning, create a tarball of the folder, and add to the cache - // with cacache.put.stream(), using a key that's deterministic based on the - // spec and repo, so that we don't ever clone the same thing multiple times. - #clone (handler, tarballOk = true) { - const o = { tmpPrefix: 'git-clone' } - const ref = this.resolvedSha || this.spec.gitCommittish - const h = this.spec.hosted - const resolved = this.resolved - - // can be set manually to false to fall back to actual git clone - tarballOk = tarballOk && - h && resolved === repoUrl(h, { noCommittish: false }) && h.tarball - - return cacache.tmp.withTmp(this.cache, o, async tmp => { - // if we're resolved, and have a tarball url, shell out to RemoteFetcher - if (tarballOk) { - const nameat = this.spec.name ? `${this.spec.name}@` : '' - return new RemoteFetcher(h.tarball({ noCommittish: false }), { - ...this.opts, - allowGitIgnore: true, - pkgid: `git:${nameat}${this.resolved}`, - resolved: this.resolved, - integrity: null, // it'll always be different, if we have one - }).extract(tmp).then(() => handler(tmp), er => { - // fall back to ssh download if tarball fails - if (er.constructor.name.match(/^Http/)) { - return this.#clone(handler, false) - } else { - throw er - } - }) - } - - const sha = await ( - h ? this.#cloneHosted(ref, tmp) - : this.#cloneRepo(this.spec.fetchSpec, ref, tmp) - ) - this.resolvedSha = sha - if (!this.resolved) { - await this.#addGitSha(sha) - } - return handler(tmp) - }) - } - - // first try https, since that's faster and passphrase-less for - // public repos, and supports private repos when auth is provided. - // Fall back to SSH to support private repos - // NB: we always store the https url in resolved field if auth - // is present, otherwise ssh if the hosted type provides it - #cloneHosted (ref, tmp) { - const hosted = this.spec.hosted - return this.#cloneRepo(hosted.https({ noCommittish: true }), ref, tmp) - .catch(er => { - // Throw early since we know pathspec errors will fail again if retried - if (er instanceof git.errors.GitPathspecError) { - throw er - } - const ssh = hosted.sshurl && hosted.sshurl({ noCommittish: true }) - // no fallthrough if we can't fall through or have https auth - if (!ssh || hosted.auth) { - throw er - } - return this.#cloneRepo(ssh, ref, tmp) - }) - } - - #cloneRepo (repo, ref, tmp) { - const { opts, spec } = this - return git.clone(repo, ref, tmp, { ...opts, spec }) - } - - manifest () { - if (this.package) { - return Promise.resolve(this.package) - } - - return this.spec.hosted && this.resolved - ? FileFetcher.prototype.manifest.apply(this) - : this.#clone(dir => - this[_.readPackageJson](dir) - .then(mani => this.package = { - ...mani, - _resolved: this.resolved, - _from: this.from, - })) - } - - packument () { - return FileFetcher.prototype.packument.apply(this) - } -} -module.exports = GitFetcher diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/index.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/index.js deleted file mode 100644 index f35314d275d5fd..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/index.js +++ /dev/null @@ -1,23 +0,0 @@ -const { get } = require('./fetcher.js') -const GitFetcher = require('./git.js') -const RegistryFetcher = require('./registry.js') -const FileFetcher = require('./file.js') -const DirFetcher = require('./dir.js') -const RemoteFetcher = require('./remote.js') - -const tarball = (spec, opts) => get(spec, opts).tarball() -tarball.stream = (spec, handler, opts) => get(spec, opts).tarballStream(handler) -tarball.file = (spec, dest, opts) => get(spec, opts).tarballFile(dest) - -module.exports = { - GitFetcher, - RegistryFetcher, - FileFetcher, - DirFetcher, - RemoteFetcher, - resolve: (spec, opts) => get(spec, opts).resolve(), - extract: (spec, dest, opts) => get(spec, opts).extract(dest), - manifest: (spec, opts) => get(spec, opts).manifest(), - packument: (spec, opts) => get(spec, opts).packument(), - tarball, -} diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/registry.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/registry.js deleted file mode 100644 index 1ecf4ee1773499..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/registry.js +++ /dev/null @@ -1,369 +0,0 @@ -const crypto = require('node:crypto') -const PackageJson = require('@npmcli/package-json') -const pickManifest = require('npm-pick-manifest') -const ssri = require('ssri') -const npa = require('npm-package-arg') -const sigstore = require('sigstore') -const fetch = require('npm-registry-fetch') -const Fetcher = require('./fetcher.js') -const RemoteFetcher = require('./remote.js') -const pacoteVersion = require('../package.json').version -const removeTrailingSlashes = require('./util/trailing-slashes.js') -const _ = require('./util/protected.js') - -// Corgis are cute. 🐕🐶 -const corgiDoc = 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*' -const fullDoc = 'application/json' - -// Some really old packages have no time field in their packument so we need a -// cutoff date. -const MISSING_TIME_CUTOFF = '2015-01-01T00:00:00.000Z' - -class RegistryFetcher extends Fetcher { - #cacheKey - constructor (spec, opts) { - super(spec, opts) - - // you usually don't want to fetch the same packument multiple times in - // the span of a given script or command, no matter how many pacote calls - // are made, so this lets us avoid doing that. It's only relevant for - // registry fetchers, because other types simulate their packument from - // the manifest, which they memoize on this.package, so it's very cheap - // already. - this.packumentCache = this.opts.packumentCache || null - - this.registry = fetch.pickRegistry(spec, opts) - this.packumentUrl = `${removeTrailingSlashes(this.registry)}/${this.spec.escapedName}` - this.#cacheKey = `${this.fullMetadata ? 'full' : 'corgi'}:${this.packumentUrl}` - - const parsed = new URL(this.registry) - const regKey = `//${parsed.host}${parsed.pathname}` - // unlike the nerf-darted auth keys, this one does *not* allow a mismatch - // of trailing slashes. It must match exactly. - if (this.opts[`${regKey}:_keys`]) { - this.registryKeys = this.opts[`${regKey}:_keys`] - } - - // XXX pacote <=9 has some logic to ignore opts.resolved if - // the resolved URL doesn't go to the same registry. - // Consider reproducing that here, to throw away this.resolved - // in that case. - } - - async resolve () { - // fetching the manifest sets resolved and (if present) integrity - await this.manifest() - if (!this.resolved) { - throw Object.assign( - new Error('Invalid package manifest: no `dist.tarball` field'), - { package: this.spec.toString() } - ) - } - return this.resolved - } - - #headers () { - return { - // npm will override UA, but ensure that we always send *something* - 'user-agent': this.opts.userAgent || - `pacote/${pacoteVersion} node/${process.version}`, - ...(this.opts.headers || {}), - 'pacote-version': pacoteVersion, - 'pacote-req-type': 'packument', - 'pacote-pkg-id': `registry:${this.spec.name}`, - accept: this.fullMetadata ? fullDoc : corgiDoc, - } - } - - async packument () { - // note this might be either an in-flight promise for a request, - // or the actual packument, but we never want to make more than - // one request at a time for the same thing regardless. - if (this.packumentCache?.has(this.#cacheKey)) { - return this.packumentCache.get(this.#cacheKey) - } - - // npm-registry-fetch the packument - // set the appropriate header for corgis if fullMetadata isn't set - // return the res.json() promise - try { - const res = await fetch(this.packumentUrl, { - ...this.opts, - headers: this.#headers(), - spec: this.spec, - - // never check integrity for packuments themselves - integrity: null, - }) - const packument = await res.json() - const contentLength = res.headers.get('content-length') - if (contentLength) { - packument._contentLength = Number(contentLength) - } - this.packumentCache?.set(this.#cacheKey, packument) - return packument - } catch (err) { - this.packumentCache?.delete(this.#cacheKey) - if (err.code !== 'E404' || this.fullMetadata) { - throw err - } - // possible that corgis are not supported by this registry - this.fullMetadata = true - return this.packument() - } - } - - async manifest () { - if (this.package) { - return this.package - } - - // When verifying signatures, we need to fetch the full/uncompressed - // packument to get publish time as this is not included in the - // corgi/compressed packument. - if (this.opts.verifySignatures) { - this.fullMetadata = true - } - - const packument = await this.packument() - const steps = PackageJson.normalizeSteps.filter(s => s !== '_attributes') - const mani = await new PackageJson().fromContent(pickManifest(packument, this.spec.fetchSpec, { - ...this.opts, - defaultTag: this.defaultTag, - before: this.before, - })).normalize({ steps }).then(p => p.content) - - /* XXX add ETARGET and E403 revalidation of cached packuments here */ - - // add _time from packument if fetched with fullMetadata - const time = packument.time?.[mani.version] - if (time) { - mani._time = time - } - - // add _resolved and _integrity from dist object - const { dist } = mani - if (dist) { - this.resolved = mani._resolved = dist.tarball - mani._from = this.from - const distIntegrity = dist.integrity ? ssri.parse(dist.integrity) - : dist.shasum ? ssri.fromHex(dist.shasum, 'sha1', { ...this.opts }) - : null - if (distIntegrity) { - if (this.integrity && !this.integrity.match(distIntegrity)) { - // only bork if they have algos in common. - // otherwise we end up breaking if we have saved a sha512 - // previously for the tarball, but the manifest only - // provides a sha1, which is possible for older publishes. - // Otherwise, this is almost certainly a case of holding it - // wrong, and will result in weird or insecure behavior - // later on when building package tree. - for (const algo of Object.keys(this.integrity)) { - if (distIntegrity[algo]) { - throw Object.assign(new Error( - `Integrity checksum failed when using ${algo}: ` + - `wanted ${this.integrity} but got ${distIntegrity}.` - ), { code: 'EINTEGRITY' }) - } - } - } - // made it this far, the integrity is worthwhile. accept it. - // the setter here will take care of merging it into what we already - // had. - this.integrity = distIntegrity - } - } - if (this.integrity) { - mani._integrity = String(this.integrity) - if (dist.signatures) { - if (this.opts.verifySignatures) { - // validate and throw on error, then set _signatures - const message = `${mani._id}:${mani._integrity}` - for (const signature of dist.signatures) { - const publicKey = this.registryKeys && - this.registryKeys.filter(key => (key.keyid === signature.keyid))[0] - if (!publicKey) { - throw Object.assign(new Error( - `${mani._id} has a registry signature with keyid: ${signature.keyid} ` + - 'but no corresponding public key can be found' - ), { code: 'EMISSINGSIGNATUREKEY' }) - } - - const publishedTime = Date.parse(mani._time || MISSING_TIME_CUTOFF) - const validPublicKey = !publicKey.expires || - publishedTime < Date.parse(publicKey.expires) - if (!validPublicKey) { - throw Object.assign(new Error( - `${mani._id} has a registry signature with keyid: ${signature.keyid} ` + - `but the corresponding public key has expired ${publicKey.expires}` - ), { code: 'EEXPIREDSIGNATUREKEY' }) - } - const verifier = crypto.createVerify('SHA256') - verifier.write(message) - verifier.end() - const valid = verifier.verify( - publicKey.pemkey, - signature.sig, - 'base64' - ) - if (!valid) { - throw Object.assign(new Error( - `${mani._id} has an invalid registry signature with ` + - `keyid: ${publicKey.keyid} and signature: ${signature.sig}` - ), { - code: 'EINTEGRITYSIGNATURE', - keyid: publicKey.keyid, - signature: signature.sig, - resolved: mani._resolved, - integrity: mani._integrity, - }) - } - } - mani._signatures = dist.signatures - } else { - mani._signatures = dist.signatures - } - } - - if (dist.attestations) { - if (this.opts.verifyAttestations) { - // Always fetch attestations from the current registry host - const attestationsPath = new URL(dist.attestations.url).pathname - const attestationsUrl = removeTrailingSlashes(this.registry) + attestationsPath - const res = await fetch(attestationsUrl, { - ...this.opts, - // disable integrity check for attestations json payload, we check the - // integrity in the verification steps below - integrity: null, - }) - const { attestations } = await res.json() - const bundles = attestations.map(({ predicateType, bundle }) => { - const statement = JSON.parse( - Buffer.from(bundle.dsseEnvelope.payload, 'base64').toString('utf8') - ) - const keyid = bundle.dsseEnvelope.signatures[0].keyid - const signature = bundle.dsseEnvelope.signatures[0].sig - - return { - predicateType, - bundle, - statement, - keyid, - signature, - } - }) - - const attestationKeyIds = bundles.map((b) => b.keyid).filter((k) => !!k) - const attestationRegistryKeys = (this.registryKeys || []) - .filter(key => attestationKeyIds.includes(key.keyid)) - if (!attestationRegistryKeys.length) { - throw Object.assign(new Error( - `${mani._id} has attestations but no corresponding public key(s) can be found` - ), { code: 'EMISSINGSIGNATUREKEY' }) - } - - for (const { predicateType, bundle, keyid, signature, statement } of bundles) { - const publicKey = attestationRegistryKeys.find(key => key.keyid === keyid) - // Publish attestations have a keyid set and a valid public key must be found - if (keyid) { - if (!publicKey) { - throw Object.assign(new Error( - `${mani._id} has attestations with keyid: ${keyid} ` + - 'but no corresponding public key can be found' - ), { code: 'EMISSINGSIGNATUREKEY' }) - } - - const integratedTime = new Date( - Number( - bundle.verificationMaterial.tlogEntries[0].integratedTime - ) * 1000 - ) - const validPublicKey = !publicKey.expires || - (integratedTime < Date.parse(publicKey.expires)) - if (!validPublicKey) { - throw Object.assign(new Error( - `${mani._id} has attestations with keyid: ${keyid} ` + - `but the corresponding public key has expired ${publicKey.expires}` - ), { code: 'EEXPIREDSIGNATUREKEY' }) - } - } - - const subject = { - name: statement.subject[0].name, - sha512: statement.subject[0].digest.sha512, - } - - // Only type 'version' can be turned into a PURL - const purl = this.spec.type === 'version' ? npa.toPurl(this.spec) : this.spec - // Verify the statement subject matches the package, version - if (subject.name !== purl) { - throw Object.assign(new Error( - `${mani._id} package name and version (PURL): ${purl} ` + - `doesn't match what was signed: ${subject.name}` - ), { code: 'EATTESTATIONSUBJECT' }) - } - - // Verify the statement subject matches the tarball integrity - const integrityHexDigest = ssri.parse(this.integrity).hexDigest() - if (subject.sha512 !== integrityHexDigest) { - throw Object.assign(new Error( - `${mani._id} package integrity (hex digest): ` + - `${integrityHexDigest} ` + - `doesn't match what was signed: ${subject.sha512}` - ), { code: 'EATTESTATIONSUBJECT' }) - } - - try { - // Provenance attestations are signed with a signing certificate - // (including the key) so we don't need to return a public key. - // - // Publish attestations are signed with a keyid so we need to - // specify a public key from the keys endpoint: `registry-host.tld/-/npm/v1/keys` - const options = { - tufCachePath: this.tufCache, - tufForceCache: true, - keySelector: publicKey ? () => publicKey.pemkey : undefined, - } - await sigstore.verify(bundle, options) - } catch (e) { - throw Object.assign(new Error( - `${mani._id} failed to verify attestation: ${e.message}` - ), { - code: 'EATTESTATIONVERIFY', - predicateType, - keyid, - signature, - resolved: mani._resolved, - integrity: mani._integrity, - }) - } - } - mani._attestations = dist.attestations - } else { - mani._attestations = dist.attestations - } - } - } - - this.package = mani - return this.package - } - - [_.tarballFromResolved] () { - // we use a RemoteFetcher to get the actual tarball stream - return new RemoteFetcher(this.resolved, { - ...this.opts, - resolved: this.resolved, - pkgid: `registry:${this.spec.name}@${this.resolved}`, - })[_.tarballFromResolved]() - } - - get types () { - return [ - 'tag', - 'version', - 'range', - ] - } -} -module.exports = RegistryFetcher diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/remote.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/remote.js deleted file mode 100644 index bd321e65a1f18a..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/remote.js +++ /dev/null @@ -1,89 +0,0 @@ -const fetch = require('npm-registry-fetch') -const { Minipass } = require('minipass') -const Fetcher = require('./fetcher.js') -const FileFetcher = require('./file.js') -const _ = require('./util/protected.js') -const pacoteVersion = require('../package.json').version - -class RemoteFetcher extends Fetcher { - constructor (spec, opts) { - super(spec, opts) - this.resolved = this.spec.fetchSpec - const resolvedURL = new URL(this.resolved) - if (this.replaceRegistryHost !== 'never' - && (this.replaceRegistryHost === 'always' - || this.replaceRegistryHost === resolvedURL.host)) { - this.resolved = new URL(resolvedURL.pathname, this.registry).href - } - - // nam is a fermented pork sausage that is good to eat - const nameat = this.spec.name ? `${this.spec.name}@` : '' - this.pkgid = opts.pkgid ? opts.pkgid : `remote:${nameat}${this.resolved}` - } - - // Don't need to cache tarball fetches in pacote, because make-fetch-happen - // will write into cacache anyway. - get [_.cacheFetches] () { - return false - } - - [_.tarballFromResolved] () { - const stream = new Minipass() - stream.hasIntegrityEmitter = true - - const fetchOpts = { - ...this.opts, - headers: this.#headers(), - spec: this.spec, - integrity: this.integrity, - algorithms: [this.pickIntegrityAlgorithm()], - } - - // eslint-disable-next-line promise/always-return - fetch(this.resolved, fetchOpts).then(res => { - res.body.on('error', - /* istanbul ignore next - exceedingly rare and hard to simulate */ - er => stream.emit('error', er) - ) - - res.body.on('integrity', i => { - this.integrity = i - stream.emit('integrity', i) - }) - - res.body.pipe(stream) - }).catch(er => stream.emit('error', er)) - - return stream - } - - #headers () { - return { - // npm will override this, but ensure that we always send *something* - 'user-agent': this.opts.userAgent || - `pacote/${pacoteVersion} node/${process.version}`, - ...(this.opts.headers || {}), - 'pacote-version': pacoteVersion, - 'pacote-req-type': 'tarball', - 'pacote-pkg-id': this.pkgid, - ...(this.integrity ? { 'pacote-integrity': String(this.integrity) } - : {}), - ...(this.opts.headers || {}), - } - } - - get types () { - return ['remote'] - } - - // getting a packument and/or manifest is the same as with a file: spec. - // unpack the tarball stream, and then read from the package.json file. - packument () { - return FileFetcher.prototype.packument.apply(this) - } - - manifest () { - return FileFetcher.prototype.manifest.apply(this) - } -} -module.exports = RemoteFetcher diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/add-git-sha.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/add-git-sha.js deleted file mode 100644 index 843fe5b600cafa..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/add-git-sha.js +++ /dev/null @@ -1,15 +0,0 @@ -// add a sha to a git remote url spec -const addGitSha = (spec, sha) => { - if (spec.hosted) { - const h = spec.hosted - const opt = { noCommittish: true } - const base = h.https && h.auth ? h.https(opt) : h.shortcut(opt) - - return `${base}#${sha}` - } else { - // don't use new URL for this, because it doesn't handle scp urls - return spec.rawSpec.replace(/#.*$/, '') + `#${sha}` - } -} - -module.exports = addGitSha diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/cache-dir.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/cache-dir.js deleted file mode 100644 index ba5683a7bb5bf3..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/cache-dir.js +++ /dev/null @@ -1,15 +0,0 @@ -const { resolve } = require('node:path') -const { tmpdir, homedir } = require('node:os') - -module.exports = (fakePlatform = false) => { - const temp = tmpdir() - const uidOrPid = process.getuid ? process.getuid() : process.pid - const home = homedir() || resolve(temp, 'npm-' + uidOrPid) - const platform = fakePlatform || process.platform - const cacheExtra = platform === 'win32' ? 'npm-cache' : '.npm' - const cacheRoot = (platform === 'win32' && process.env.LOCALAPPDATA) || home - return { - cacache: resolve(cacheRoot, cacheExtra, '_cacache'), - tufcache: resolve(cacheRoot, cacheExtra, '_tuf'), - } -} diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/is-package-bin.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/is-package-bin.js deleted file mode 100644 index 49a3f73f537ce9..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/is-package-bin.js +++ /dev/null @@ -1,25 +0,0 @@ -// Function to determine whether a path is in the package.bin set. -// Used to prevent issues when people publish a package from a -// windows machine, and then install with --no-bin-links. -// -// Note: this is not possible in remote or file fetchers, since -// we don't have the manifest until AFTER we've unpacked. But the -// main use case is registry fetching with git a distant second, -// so that's an acceptable edge case to not handle. - -const binObj = (name, bin) => - typeof bin === 'string' ? { [name]: bin } : bin - -const hasBin = (pkg, path) => { - const bin = binObj(pkg.name, pkg.bin) - const p = path.replace(/^[^\\/]*\//, '') - for (const kv of Object.entries(bin)) { - if (kv[1] === p) { - return true - } - } - return false -} - -module.exports = (pkg, path) => - pkg && pkg.bin ? hasBin(pkg, path) : false diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/npm.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/npm.js deleted file mode 100644 index a3005c255565fb..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/npm.js +++ /dev/null @@ -1,14 +0,0 @@ -// run an npm command -const spawn = require('@npmcli/promise-spawn') - -module.exports = (npmBin, npmCommand, cwd, env, extra) => { - const isJS = npmBin.endsWith('.js') - const cmd = isJS ? process.execPath : npmBin - const args = (isJS ? [npmBin] : []).concat(npmCommand) - // when installing to run the `prepare` script for a git dep, we need - // to ensure that we don't run into a cycle of checking out packages - // in temp directories. this lets us link previously-seen repos that - // are also being prepared. - - return spawn(cmd, args, { cwd, env }, extra) -} diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/protected.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/protected.js deleted file mode 100644 index e05203b481e6aa..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/protected.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - cacheFetches: Symbol.for('pacote.Fetcher._cacheFetches'), - readPackageJson: Symbol.for('package.Fetcher._readPackageJson'), - tarballFromResolved: Symbol.for('pacote.Fetcher._tarballFromResolved'), -} diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/tar-create-options.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/tar-create-options.js deleted file mode 100644 index d070f0f7ba2d4e..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/tar-create-options.js +++ /dev/null @@ -1,31 +0,0 @@ -const isPackageBin = require('./is-package-bin.js') - -const tarCreateOptions = manifest => ({ - cwd: manifest._resolved, - prefix: 'package/', - portable: true, - gzip: { - // forcing the level to 9 seems to avoid some - // platform specific optimizations that cause - // integrity mismatch errors due to differing - // end results after compression - level: 9, - }, - - // ensure that package bins are always executable - // Note that npm-packlist is already filtering out - // anything that is not a regular file, ignored by - // .npmignore or package.json "files", etc. - filter: (path, stat) => { - if (isPackageBin(manifest, path)) { - stat.mode |= 0o111 - } - return true - }, - - // Provide a specific date in the 1980s for the benefit of zip, - // which is confounded by files dated at the Unix epoch 0. - mtime: new Date('1985-10-26T08:15:00.000Z'), -}) - -module.exports = tarCreateOptions diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/trailing-slashes.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/trailing-slashes.js deleted file mode 100644 index c50cb6173b92eb..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/lib/util/trailing-slashes.js +++ /dev/null @@ -1,10 +0,0 @@ -const removeTrailingSlashes = (input) => { - // in order to avoid regexp redos detection - let output = input - while (output.endsWith('/')) { - output = output.slice(0, -1) - } - return output -} - -module.exports = removeTrailingSlashes diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/package.json b/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/package.json deleted file mode 100644 index 335c7a6c87bd3c..00000000000000 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/node_modules/pacote/package.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "name": "pacote", - "version": "20.0.0", - "description": "JavaScript package downloader", - "author": "GitHub Inc.", - "bin": { - "pacote": "bin/index.js" - }, - "license": "ISC", - "main": "lib/index.js", - "scripts": { - "test": "tap", - "snap": "tap", - "lint": "npm run eslint", - "postlint": "template-oss-check", - "lintfix": "npm run eslint -- --fix", - "posttest": "npm run lint", - "template-oss-apply": "template-oss-apply --force", - "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" - }, - "tap": { - "timeout": 300, - "nyc-arg": [ - "--exclude", - "tap-snapshots/**" - ] - }, - "devDependencies": { - "@npmcli/arborist": "^7.1.0", - "@npmcli/eslint-config": "^5.0.0", - "@npmcli/template-oss": "4.23.3", - "hosted-git-info": "^8.0.0", - "mutate-fs": "^2.1.1", - "nock": "^13.2.4", - "npm-registry-mock": "^1.3.2", - "tap": "^16.0.1" - }, - "files": [ - "bin/", - "lib/" - ], - "keywords": [ - "packages", - "npm", - "git" - ], - "dependencies": { - "@npmcli/git": "^6.0.0", - "@npmcli/installed-package-contents": "^3.0.0", - "@npmcli/package-json": "^6.0.0", - "@npmcli/promise-spawn": "^8.0.0", - "@npmcli/run-script": "^9.0.0", - "cacache": "^19.0.0", - "fs-minipass": "^3.0.0", - "minipass": "^7.0.2", - "npm-package-arg": "^12.0.0", - "npm-packlist": "^9.0.0", - "npm-pick-manifest": "^10.0.0", - "npm-registry-fetch": "^18.0.0", - "proc-log": "^5.0.0", - "promise-retry": "^2.0.1", - "sigstore": "^3.0.0", - "ssri": "^12.0.0", - "tar": "^6.1.11" - }, - "engines": { - "node": "^18.17.0 || >=20.5.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/npm/pacote.git" - }, - "templateOSS": { - "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", - "windowsCI": false, - "publish": "true" - } -} diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json b/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json index df0b8f2f4faf1c..1343b37427304e 100644 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json +++ b/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/metavuln-calculator", - "version": "8.0.1", + "version": "9.0.0", "main": "lib/index.js", "files": [ "bin/", @@ -34,23 +34,23 @@ }, "devDependencies": { "@npmcli/eslint-config": "^5.0.0", - "@npmcli/template-oss": "4.23.3", + "@npmcli/template-oss": "4.23.4", "require-inject": "^1.4.4", "tap": "^16.0.1" }, "dependencies": { "cacache": "^19.0.0", "json-parse-even-better-errors": "^4.0.0", - "pacote": "^20.0.0", + "pacote": "^21.0.0", "proc-log": "^5.0.0", "semver": "^7.3.5" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.4", "publish": "true", "ciVersions": [ "16.14.0", diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/LICENSE b/deps/npm/node_modules/@sigstore/bundle/LICENSE similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/LICENSE rename to deps/npm/node_modules/@sigstore/bundle/LICENSE diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/build.js b/deps/npm/node_modules/@sigstore/bundle/dist/build.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/build.js rename to deps/npm/node_modules/@sigstore/bundle/dist/build.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/bundle.js b/deps/npm/node_modules/@sigstore/bundle/dist/bundle.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/bundle.js rename to deps/npm/node_modules/@sigstore/bundle/dist/bundle.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/error.js b/deps/npm/node_modules/@sigstore/bundle/dist/error.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/error.js rename to deps/npm/node_modules/@sigstore/bundle/dist/error.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/index.js b/deps/npm/node_modules/@sigstore/bundle/dist/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/index.js rename to deps/npm/node_modules/@sigstore/bundle/dist/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/serialized.js b/deps/npm/node_modules/@sigstore/bundle/dist/serialized.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/serialized.js rename to deps/npm/node_modules/@sigstore/bundle/dist/serialized.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/utility.js b/deps/npm/node_modules/@sigstore/bundle/dist/utility.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/utility.js rename to deps/npm/node_modules/@sigstore/bundle/dist/utility.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/validate.js b/deps/npm/node_modules/@sigstore/bundle/dist/validate.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/dist/validate.js rename to deps/npm/node_modules/@sigstore/bundle/dist/validate.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/package.json b/deps/npm/node_modules/@sigstore/bundle/package.json similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/bundle/package.json rename to deps/npm/node_modules/@sigstore/bundle/package.json diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/LICENSE b/deps/npm/node_modules/@sigstore/core/LICENSE similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/LICENSE rename to deps/npm/node_modules/@sigstore/core/LICENSE diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/asn1/error.js b/deps/npm/node_modules/@sigstore/core/dist/asn1/error.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/asn1/error.js rename to deps/npm/node_modules/@sigstore/core/dist/asn1/error.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/asn1/index.js b/deps/npm/node_modules/@sigstore/core/dist/asn1/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/asn1/index.js rename to deps/npm/node_modules/@sigstore/core/dist/asn1/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/asn1/length.js b/deps/npm/node_modules/@sigstore/core/dist/asn1/length.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/asn1/length.js rename to deps/npm/node_modules/@sigstore/core/dist/asn1/length.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/asn1/obj.js b/deps/npm/node_modules/@sigstore/core/dist/asn1/obj.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/asn1/obj.js rename to deps/npm/node_modules/@sigstore/core/dist/asn1/obj.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/asn1/parse.js b/deps/npm/node_modules/@sigstore/core/dist/asn1/parse.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/asn1/parse.js rename to deps/npm/node_modules/@sigstore/core/dist/asn1/parse.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/asn1/tag.js b/deps/npm/node_modules/@sigstore/core/dist/asn1/tag.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/asn1/tag.js rename to deps/npm/node_modules/@sigstore/core/dist/asn1/tag.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/crypto.js b/deps/npm/node_modules/@sigstore/core/dist/crypto.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/crypto.js rename to deps/npm/node_modules/@sigstore/core/dist/crypto.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/dsse.js b/deps/npm/node_modules/@sigstore/core/dist/dsse.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/dsse.js rename to deps/npm/node_modules/@sigstore/core/dist/dsse.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/encoding.js b/deps/npm/node_modules/@sigstore/core/dist/encoding.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/encoding.js rename to deps/npm/node_modules/@sigstore/core/dist/encoding.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/index.js b/deps/npm/node_modules/@sigstore/core/dist/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/index.js rename to deps/npm/node_modules/@sigstore/core/dist/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/json.js b/deps/npm/node_modules/@sigstore/core/dist/json.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/json.js rename to deps/npm/node_modules/@sigstore/core/dist/json.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/oid.js b/deps/npm/node_modules/@sigstore/core/dist/oid.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/oid.js rename to deps/npm/node_modules/@sigstore/core/dist/oid.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/pem.js b/deps/npm/node_modules/@sigstore/core/dist/pem.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/pem.js rename to deps/npm/node_modules/@sigstore/core/dist/pem.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/rfc3161/error.js b/deps/npm/node_modules/@sigstore/core/dist/rfc3161/error.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/rfc3161/error.js rename to deps/npm/node_modules/@sigstore/core/dist/rfc3161/error.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/rfc3161/index.js b/deps/npm/node_modules/@sigstore/core/dist/rfc3161/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/rfc3161/index.js rename to deps/npm/node_modules/@sigstore/core/dist/rfc3161/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/rfc3161/timestamp.js b/deps/npm/node_modules/@sigstore/core/dist/rfc3161/timestamp.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/rfc3161/timestamp.js rename to deps/npm/node_modules/@sigstore/core/dist/rfc3161/timestamp.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/rfc3161/tstinfo.js b/deps/npm/node_modules/@sigstore/core/dist/rfc3161/tstinfo.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/rfc3161/tstinfo.js rename to deps/npm/node_modules/@sigstore/core/dist/rfc3161/tstinfo.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/stream.js b/deps/npm/node_modules/@sigstore/core/dist/stream.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/stream.js rename to deps/npm/node_modules/@sigstore/core/dist/stream.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/x509/cert.js b/deps/npm/node_modules/@sigstore/core/dist/x509/cert.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/x509/cert.js rename to deps/npm/node_modules/@sigstore/core/dist/x509/cert.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/x509/ext.js b/deps/npm/node_modules/@sigstore/core/dist/x509/ext.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/x509/ext.js rename to deps/npm/node_modules/@sigstore/core/dist/x509/ext.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/x509/index.js b/deps/npm/node_modules/@sigstore/core/dist/x509/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/x509/index.js rename to deps/npm/node_modules/@sigstore/core/dist/x509/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/x509/sct.js b/deps/npm/node_modules/@sigstore/core/dist/x509/sct.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/dist/x509/sct.js rename to deps/npm/node_modules/@sigstore/core/dist/x509/sct.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/core/package.json b/deps/npm/node_modules/@sigstore/core/package.json similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/core/package.json rename to deps/npm/node_modules/@sigstore/core/package.json diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/LICENSE b/deps/npm/node_modules/@sigstore/sign/LICENSE similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/LICENSE rename to deps/npm/node_modules/@sigstore/sign/LICENSE diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/bundler/base.js b/deps/npm/node_modules/@sigstore/sign/dist/bundler/base.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/bundler/base.js rename to deps/npm/node_modules/@sigstore/sign/dist/bundler/base.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/bundler/bundle.js b/deps/npm/node_modules/@sigstore/sign/dist/bundler/bundle.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/bundler/bundle.js rename to deps/npm/node_modules/@sigstore/sign/dist/bundler/bundle.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/bundler/dsse.js b/deps/npm/node_modules/@sigstore/sign/dist/bundler/dsse.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/bundler/dsse.js rename to deps/npm/node_modules/@sigstore/sign/dist/bundler/dsse.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/bundler/index.js b/deps/npm/node_modules/@sigstore/sign/dist/bundler/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/bundler/index.js rename to deps/npm/node_modules/@sigstore/sign/dist/bundler/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/bundler/message.js b/deps/npm/node_modules/@sigstore/sign/dist/bundler/message.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/bundler/message.js rename to deps/npm/node_modules/@sigstore/sign/dist/bundler/message.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/error.js b/deps/npm/node_modules/@sigstore/sign/dist/error.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/error.js rename to deps/npm/node_modules/@sigstore/sign/dist/error.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/external/error.js b/deps/npm/node_modules/@sigstore/sign/dist/external/error.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/external/error.js rename to deps/npm/node_modules/@sigstore/sign/dist/external/error.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/external/fetch.js b/deps/npm/node_modules/@sigstore/sign/dist/external/fetch.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/external/fetch.js rename to deps/npm/node_modules/@sigstore/sign/dist/external/fetch.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/external/fulcio.js b/deps/npm/node_modules/@sigstore/sign/dist/external/fulcio.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/external/fulcio.js rename to deps/npm/node_modules/@sigstore/sign/dist/external/fulcio.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/external/rekor.js b/deps/npm/node_modules/@sigstore/sign/dist/external/rekor.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/external/rekor.js rename to deps/npm/node_modules/@sigstore/sign/dist/external/rekor.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/external/tsa.js b/deps/npm/node_modules/@sigstore/sign/dist/external/tsa.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/external/tsa.js rename to deps/npm/node_modules/@sigstore/sign/dist/external/tsa.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/identity/ci.js b/deps/npm/node_modules/@sigstore/sign/dist/identity/ci.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/identity/ci.js rename to deps/npm/node_modules/@sigstore/sign/dist/identity/ci.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/identity/index.js b/deps/npm/node_modules/@sigstore/sign/dist/identity/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/identity/index.js rename to deps/npm/node_modules/@sigstore/sign/dist/identity/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/identity/provider.js b/deps/npm/node_modules/@sigstore/sign/dist/identity/provider.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/identity/provider.js rename to deps/npm/node_modules/@sigstore/sign/dist/identity/provider.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/index.js b/deps/npm/node_modules/@sigstore/sign/dist/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/index.js rename to deps/npm/node_modules/@sigstore/sign/dist/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/signer/fulcio/ca.js b/deps/npm/node_modules/@sigstore/sign/dist/signer/fulcio/ca.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/signer/fulcio/ca.js rename to deps/npm/node_modules/@sigstore/sign/dist/signer/fulcio/ca.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/signer/fulcio/ephemeral.js b/deps/npm/node_modules/@sigstore/sign/dist/signer/fulcio/ephemeral.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/signer/fulcio/ephemeral.js rename to deps/npm/node_modules/@sigstore/sign/dist/signer/fulcio/ephemeral.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/signer/fulcio/index.js b/deps/npm/node_modules/@sigstore/sign/dist/signer/fulcio/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/signer/fulcio/index.js rename to deps/npm/node_modules/@sigstore/sign/dist/signer/fulcio/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/signer/index.js b/deps/npm/node_modules/@sigstore/sign/dist/signer/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/signer/index.js rename to deps/npm/node_modules/@sigstore/sign/dist/signer/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/signer/signer.js b/deps/npm/node_modules/@sigstore/sign/dist/signer/signer.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/signer/signer.js rename to deps/npm/node_modules/@sigstore/sign/dist/signer/signer.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/types/fetch.js b/deps/npm/node_modules/@sigstore/sign/dist/types/fetch.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/types/fetch.js rename to deps/npm/node_modules/@sigstore/sign/dist/types/fetch.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/util/index.js b/deps/npm/node_modules/@sigstore/sign/dist/util/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/util/index.js rename to deps/npm/node_modules/@sigstore/sign/dist/util/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/util/oidc.js b/deps/npm/node_modules/@sigstore/sign/dist/util/oidc.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/util/oidc.js rename to deps/npm/node_modules/@sigstore/sign/dist/util/oidc.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/util/ua.js b/deps/npm/node_modules/@sigstore/sign/dist/util/ua.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/util/ua.js rename to deps/npm/node_modules/@sigstore/sign/dist/util/ua.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/index.js b/deps/npm/node_modules/@sigstore/sign/dist/witness/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/index.js rename to deps/npm/node_modules/@sigstore/sign/dist/witness/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/tlog/client.js b/deps/npm/node_modules/@sigstore/sign/dist/witness/tlog/client.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/tlog/client.js rename to deps/npm/node_modules/@sigstore/sign/dist/witness/tlog/client.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/tlog/entry.js b/deps/npm/node_modules/@sigstore/sign/dist/witness/tlog/entry.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/tlog/entry.js rename to deps/npm/node_modules/@sigstore/sign/dist/witness/tlog/entry.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/tlog/index.js b/deps/npm/node_modules/@sigstore/sign/dist/witness/tlog/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/tlog/index.js rename to deps/npm/node_modules/@sigstore/sign/dist/witness/tlog/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/tsa/client.js b/deps/npm/node_modules/@sigstore/sign/dist/witness/tsa/client.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/tsa/client.js rename to deps/npm/node_modules/@sigstore/sign/dist/witness/tsa/client.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/tsa/index.js b/deps/npm/node_modules/@sigstore/sign/dist/witness/tsa/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/tsa/index.js rename to deps/npm/node_modules/@sigstore/sign/dist/witness/tsa/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/witness.js b/deps/npm/node_modules/@sigstore/sign/dist/witness/witness.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/dist/witness/witness.js rename to deps/npm/node_modules/@sigstore/sign/dist/witness/witness.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/package.json b/deps/npm/node_modules/@sigstore/sign/package.json similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/sign/package.json rename to deps/npm/node_modules/@sigstore/sign/package.json diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/bundle/dsse.js b/deps/npm/node_modules/@sigstore/verify/dist/bundle/dsse.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/bundle/dsse.js rename to deps/npm/node_modules/@sigstore/verify/dist/bundle/dsse.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/bundle/index.js b/deps/npm/node_modules/@sigstore/verify/dist/bundle/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/bundle/index.js rename to deps/npm/node_modules/@sigstore/verify/dist/bundle/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/bundle/message.js b/deps/npm/node_modules/@sigstore/verify/dist/bundle/message.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/bundle/message.js rename to deps/npm/node_modules/@sigstore/verify/dist/bundle/message.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/error.js b/deps/npm/node_modules/@sigstore/verify/dist/error.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/error.js rename to deps/npm/node_modules/@sigstore/verify/dist/error.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/index.js b/deps/npm/node_modules/@sigstore/verify/dist/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/index.js rename to deps/npm/node_modules/@sigstore/verify/dist/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/key/certificate.js b/deps/npm/node_modules/@sigstore/verify/dist/key/certificate.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/key/certificate.js rename to deps/npm/node_modules/@sigstore/verify/dist/key/certificate.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/key/index.js b/deps/npm/node_modules/@sigstore/verify/dist/key/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/key/index.js rename to deps/npm/node_modules/@sigstore/verify/dist/key/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/key/sct.js b/deps/npm/node_modules/@sigstore/verify/dist/key/sct.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/key/sct.js rename to deps/npm/node_modules/@sigstore/verify/dist/key/sct.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/policy.js b/deps/npm/node_modules/@sigstore/verify/dist/policy.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/policy.js rename to deps/npm/node_modules/@sigstore/verify/dist/policy.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/shared.types.js b/deps/npm/node_modules/@sigstore/verify/dist/shared.types.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/shared.types.js rename to deps/npm/node_modules/@sigstore/verify/dist/shared.types.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/timestamp/checkpoint.js b/deps/npm/node_modules/@sigstore/verify/dist/timestamp/checkpoint.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/timestamp/checkpoint.js rename to deps/npm/node_modules/@sigstore/verify/dist/timestamp/checkpoint.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/timestamp/index.js b/deps/npm/node_modules/@sigstore/verify/dist/timestamp/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/timestamp/index.js rename to deps/npm/node_modules/@sigstore/verify/dist/timestamp/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/timestamp/merkle.js b/deps/npm/node_modules/@sigstore/verify/dist/timestamp/merkle.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/timestamp/merkle.js rename to deps/npm/node_modules/@sigstore/verify/dist/timestamp/merkle.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/timestamp/set.js b/deps/npm/node_modules/@sigstore/verify/dist/timestamp/set.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/timestamp/set.js rename to deps/npm/node_modules/@sigstore/verify/dist/timestamp/set.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/timestamp/tsa.js b/deps/npm/node_modules/@sigstore/verify/dist/timestamp/tsa.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/timestamp/tsa.js rename to deps/npm/node_modules/@sigstore/verify/dist/timestamp/tsa.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/tlog/dsse.js b/deps/npm/node_modules/@sigstore/verify/dist/tlog/dsse.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/tlog/dsse.js rename to deps/npm/node_modules/@sigstore/verify/dist/tlog/dsse.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js b/deps/npm/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js rename to deps/npm/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/tlog/index.js b/deps/npm/node_modules/@sigstore/verify/dist/tlog/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/tlog/index.js rename to deps/npm/node_modules/@sigstore/verify/dist/tlog/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/tlog/intoto.js b/deps/npm/node_modules/@sigstore/verify/dist/tlog/intoto.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/tlog/intoto.js rename to deps/npm/node_modules/@sigstore/verify/dist/tlog/intoto.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/trust/filter.js b/deps/npm/node_modules/@sigstore/verify/dist/trust/filter.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/trust/filter.js rename to deps/npm/node_modules/@sigstore/verify/dist/trust/filter.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/trust/index.js b/deps/npm/node_modules/@sigstore/verify/dist/trust/index.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/trust/index.js rename to deps/npm/node_modules/@sigstore/verify/dist/trust/index.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/trust/trust.types.js b/deps/npm/node_modules/@sigstore/verify/dist/trust/trust.types.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/trust/trust.types.js rename to deps/npm/node_modules/@sigstore/verify/dist/trust/trust.types.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/verifier.js b/deps/npm/node_modules/@sigstore/verify/dist/verifier.js similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/dist/verifier.js rename to deps/npm/node_modules/@sigstore/verify/dist/verifier.js diff --git a/deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/package.json b/deps/npm/node_modules/@sigstore/verify/package.json similarity index 100% rename from deps/npm/node_modules/sigstore/node_modules/@sigstore/verify/package.json rename to deps/npm/node_modules/@sigstore/verify/package.json diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/LICENSE b/deps/npm/node_modules/@tufjs/models/LICENSE similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/LICENSE rename to deps/npm/node_modules/@tufjs/models/LICENSE diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/base.js b/deps/npm/node_modules/@tufjs/models/dist/base.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/base.js rename to deps/npm/node_modules/@tufjs/models/dist/base.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/delegations.js b/deps/npm/node_modules/@tufjs/models/dist/delegations.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/delegations.js rename to deps/npm/node_modules/@tufjs/models/dist/delegations.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/error.js b/deps/npm/node_modules/@tufjs/models/dist/error.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/error.js rename to deps/npm/node_modules/@tufjs/models/dist/error.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/file.js b/deps/npm/node_modules/@tufjs/models/dist/file.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/file.js rename to deps/npm/node_modules/@tufjs/models/dist/file.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/index.js b/deps/npm/node_modules/@tufjs/models/dist/index.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/index.js rename to deps/npm/node_modules/@tufjs/models/dist/index.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/key.js b/deps/npm/node_modules/@tufjs/models/dist/key.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/key.js rename to deps/npm/node_modules/@tufjs/models/dist/key.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/metadata.js b/deps/npm/node_modules/@tufjs/models/dist/metadata.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/metadata.js rename to deps/npm/node_modules/@tufjs/models/dist/metadata.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/role.js b/deps/npm/node_modules/@tufjs/models/dist/role.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/role.js rename to deps/npm/node_modules/@tufjs/models/dist/role.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/root.js b/deps/npm/node_modules/@tufjs/models/dist/root.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/root.js rename to deps/npm/node_modules/@tufjs/models/dist/root.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/signature.js b/deps/npm/node_modules/@tufjs/models/dist/signature.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/signature.js rename to deps/npm/node_modules/@tufjs/models/dist/signature.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/snapshot.js b/deps/npm/node_modules/@tufjs/models/dist/snapshot.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/snapshot.js rename to deps/npm/node_modules/@tufjs/models/dist/snapshot.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/targets.js b/deps/npm/node_modules/@tufjs/models/dist/targets.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/targets.js rename to deps/npm/node_modules/@tufjs/models/dist/targets.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/timestamp.js b/deps/npm/node_modules/@tufjs/models/dist/timestamp.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/timestamp.js rename to deps/npm/node_modules/@tufjs/models/dist/timestamp.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/utils/guard.js b/deps/npm/node_modules/@tufjs/models/dist/utils/guard.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/utils/guard.js rename to deps/npm/node_modules/@tufjs/models/dist/utils/guard.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/utils/index.js b/deps/npm/node_modules/@tufjs/models/dist/utils/index.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/utils/index.js rename to deps/npm/node_modules/@tufjs/models/dist/utils/index.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/utils/key.js b/deps/npm/node_modules/@tufjs/models/dist/utils/key.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/utils/key.js rename to deps/npm/node_modules/@tufjs/models/dist/utils/key.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/utils/oid.js b/deps/npm/node_modules/@tufjs/models/dist/utils/oid.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/utils/oid.js rename to deps/npm/node_modules/@tufjs/models/dist/utils/oid.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/utils/types.js b/deps/npm/node_modules/@tufjs/models/dist/utils/types.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/utils/types.js rename to deps/npm/node_modules/@tufjs/models/dist/utils/types.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/utils/verify.js b/deps/npm/node_modules/@tufjs/models/dist/utils/verify.js similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/dist/utils/verify.js rename to deps/npm/node_modules/@tufjs/models/dist/utils/verify.js diff --git a/deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/package.json b/deps/npm/node_modules/@tufjs/models/package.json similarity index 100% rename from deps/npm/node_modules/tuf-js/node_modules/@tufjs/models/package.json rename to deps/npm/node_modules/@tufjs/models/package.json diff --git a/deps/npm/node_modules/agent-base/dist/index.js b/deps/npm/node_modules/agent-base/dist/index.js index 69396356e74db7..c3c4099c73c027 100644 --- a/deps/npm/node_modules/agent-base/dist/index.js +++ b/deps/npm/node_modules/agent-base/dist/index.js @@ -133,8 +133,13 @@ class Agent extends http.Agent { .then((socket) => { this.decrementSockets(name, fakeSocket); if (socket instanceof http.Agent) { - // @ts-expect-error `addRequest()` isn't defined in `@types/node` - return socket.addRequest(req, connectOpts); + try { + // @ts-expect-error `addRequest()` isn't defined in `@types/node` + return socket.addRequest(req, connectOpts); + } + catch (err) { + return cb(err); + } } this[INTERNAL].currentSocket = socket; // @ts-expect-error `createSocket()` isn't defined in `@types/node` diff --git a/deps/npm/node_modules/agent-base/package.json b/deps/npm/node_modules/agent-base/package.json index 8e95171707fef1..175ee71fb70eae 100644 --- a/deps/npm/node_modules/agent-base/package.json +++ b/deps/npm/node_modules/agent-base/package.json @@ -1,6 +1,6 @@ { "name": "agent-base", - "version": "7.1.1", + "version": "7.1.3", "description": "Turn a function into an `http.Agent` instance", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -21,9 +21,6 @@ ], "author": "Nathan Rajlich (http://n8.io/)", "license": "MIT", - "dependencies": { - "debug": "^4.3.4" - }, "devDependencies": { "@types/debug": "^4.1.7", "@types/jest": "^29.5.1", @@ -34,7 +31,7 @@ "jest": "^29.5.0", "ts-jest": "^29.1.0", "typescript": "^5.0.4", - "ws": "^3.3.3", + "ws": "^5.2.4", "tsconfig": "0.0.0" }, "engines": { diff --git a/deps/npm/node_modules/aggregate-error/index.js b/deps/npm/node_modules/aggregate-error/index.js deleted file mode 100644 index ba5bf022116855..00000000000000 --- a/deps/npm/node_modules/aggregate-error/index.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; -const indentString = require('indent-string'); -const cleanStack = require('clean-stack'); - -const cleanInternalStack = stack => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, ''); - -class AggregateError extends Error { - constructor(errors) { - if (!Array.isArray(errors)) { - throw new TypeError(`Expected input to be an Array, got ${typeof errors}`); - } - - errors = [...errors].map(error => { - if (error instanceof Error) { - return error; - } - - if (error !== null && typeof error === 'object') { - // Handle plain error objects with message property and/or possibly other metadata - return Object.assign(new Error(error.message), error); - } - - return new Error(error); - }); - - let message = errors - .map(error => { - // The `stack` property is not standardized, so we can't assume it exists - return typeof error.stack === 'string' ? cleanInternalStack(cleanStack(error.stack)) : String(error); - }) - .join('\n'); - message = '\n' + indentString(message, 4); - super(message); - - this.name = 'AggregateError'; - - Object.defineProperty(this, '_errors', {value: errors}); - } - - * [Symbol.iterator]() { - for (const error of this._errors) { - yield error; - } - } -} - -module.exports = AggregateError; diff --git a/deps/npm/node_modules/aggregate-error/license b/deps/npm/node_modules/aggregate-error/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/deps/npm/node_modules/aggregate-error/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/aggregate-error/package.json b/deps/npm/node_modules/aggregate-error/package.json deleted file mode 100644 index 74fcc37611e642..00000000000000 --- a/deps/npm/node_modules/aggregate-error/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "aggregate-error", - "version": "3.1.0", - "description": "Create an error from multiple errors", - "license": "MIT", - "repository": "sindresorhus/aggregate-error", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "aggregate", - "error", - "combine", - "multiple", - "many", - "collection", - "iterable", - "iterator" - ], - "dependencies": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - }, - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.7.1", - "xo": "^0.25.3" - } -} diff --git a/deps/npm/node_modules/binary-extensions/index.js b/deps/npm/node_modules/binary-extensions/index.js index d46e4688671141..6c99c7eb54f175 100644 --- a/deps/npm/node_modules/binary-extensions/index.js +++ b/deps/npm/node_modules/binary-extensions/index.js @@ -1 +1,3 @@ -module.exports = require('./binary-extensions.json'); +import binaryExtensions from './binary-extensions.json' with {type: 'json'}; + +export default binaryExtensions; diff --git a/deps/npm/node_modules/binary-extensions/package.json b/deps/npm/node_modules/binary-extensions/package.json index 4710c339aeb2d5..0d309f782bb7ad 100644 --- a/deps/npm/node_modules/binary-extensions/package.json +++ b/deps/npm/node_modules/binary-extensions/package.json @@ -1,6 +1,6 @@ { "name": "binary-extensions", - "version": "2.3.0", + "version": "3.0.0", "description": "List of binary file extensions", "license": "MIT", "repository": "sindresorhus/binary-extensions", @@ -10,18 +10,23 @@ "email": "sindresorhus@gmail.com", "url": "https://sindresorhus.com" }, + "type": "module", + "exports": { + "types": "./index.d.ts", + "default": "./index.js" + }, "sideEffects": false, "engines": { - "node": ">=8" + "node": ">=18.20" }, "scripts": { - "test": "xo && ava && tsd" + "//test": "xo && ava && tsd", + "test": "ava && tsd" }, "files": [ "index.js", "index.d.ts", - "binary-extensions.json", - "binary-extensions.json.d.ts" + "binary-extensions.json" ], "keywords": [ "binary", @@ -33,8 +38,8 @@ "array" ], "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" + "ava": "^6.1.2", + "tsd": "^0.31.0", + "xo": "^0.58.0" } } diff --git a/deps/npm/node_modules/cacache/node_modules/p-map/index.js b/deps/npm/node_modules/cacache/node_modules/p-map/index.js deleted file mode 100644 index 2f7d91ccca4eda..00000000000000 --- a/deps/npm/node_modules/cacache/node_modules/p-map/index.js +++ /dev/null @@ -1,269 +0,0 @@ -export default async function pMap( - iterable, - mapper, - { - concurrency = Number.POSITIVE_INFINITY, - stopOnError = true, - signal, - } = {}, -) { - return new Promise((resolve, reject_) => { - if (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) { - throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`); - } - - if (typeof mapper !== 'function') { - throw new TypeError('Mapper function is required'); - } - - if (!((Number.isSafeInteger(concurrency) && concurrency >= 1) || concurrency === Number.POSITIVE_INFINITY)) { - throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`); - } - - const result = []; - const errors = []; - const skippedIndexesMap = new Map(); - let isRejected = false; - let isResolved = false; - let isIterableDone = false; - let resolvingCount = 0; - let currentIndex = 0; - const iterator = iterable[Symbol.iterator] === undefined ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator](); - - const reject = reason => { - isRejected = true; - isResolved = true; - reject_(reason); - }; - - if (signal) { - if (signal.aborted) { - reject(signal.reason); - } - - signal.addEventListener('abort', () => { - reject(signal.reason); - }); - } - - const next = async () => { - if (isResolved) { - return; - } - - const nextItem = await iterator.next(); - - const index = currentIndex; - currentIndex++; - - // Note: `iterator.next()` can be called many times in parallel. - // This can cause multiple calls to this `next()` function to - // receive a `nextItem` with `done === true`. - // The shutdown logic that rejects/resolves must be protected - // so it runs only one time as the `skippedIndex` logic is - // non-idempotent. - if (nextItem.done) { - isIterableDone = true; - - if (resolvingCount === 0 && !isResolved) { - if (!stopOnError && errors.length > 0) { - reject(new AggregateError(errors)); // eslint-disable-line unicorn/error-message - return; - } - - isResolved = true; - - if (skippedIndexesMap.size === 0) { - resolve(result); - return; - } - - const pureResult = []; - - // Support multiple `pMapSkip`'s. - for (const [index, value] of result.entries()) { - if (skippedIndexesMap.get(index) === pMapSkip) { - continue; - } - - pureResult.push(value); - } - - resolve(pureResult); - } - - return; - } - - resolvingCount++; - - // Intentionally detached - (async () => { - try { - const element = await nextItem.value; - - if (isResolved) { - return; - } - - const value = await mapper(element, index); - - // Use Map to stage the index of the element. - if (value === pMapSkip) { - skippedIndexesMap.set(index, value); - } - - result[index] = value; - - resolvingCount--; - await next(); - } catch (error) { - if (stopOnError) { - reject(error); - } else { - errors.push(error); - resolvingCount--; - - // In that case we can't really continue regardless of `stopOnError` state - // since an iterable is likely to continue throwing after it throws once. - // If we continue calling `next()` indefinitely we will likely end up - // in an infinite loop of failed iteration. - try { - await next(); - } catch (error) { - reject(error); - } - } - } - })(); - }; - - // Create the concurrent runners in a detached (non-awaited) - // promise. We need this so we can await the `next()` calls - // to stop creating runners before hitting the concurrency limit - // if the iterable has already been marked as done. - // NOTE: We *must* do this for async iterators otherwise we'll spin up - // infinite `next()` calls by default and never start the event loop. - (async () => { - for (let index = 0; index < concurrency; index++) { - try { - // eslint-disable-next-line no-await-in-loop - await next(); - } catch (error) { - reject(error); - break; - } - - if (isIterableDone || isRejected) { - break; - } - } - })(); - }); -} - -export function pMapIterable( - iterable, - mapper, - { - concurrency = Number.POSITIVE_INFINITY, - backpressure = concurrency, - } = {}, -) { - if (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) { - throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`); - } - - if (typeof mapper !== 'function') { - throw new TypeError('Mapper function is required'); - } - - if (!((Number.isSafeInteger(concurrency) && concurrency >= 1) || concurrency === Number.POSITIVE_INFINITY)) { - throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`); - } - - if (!((Number.isSafeInteger(backpressure) && backpressure >= concurrency) || backpressure === Number.POSITIVE_INFINITY)) { - throw new TypeError(`Expected \`backpressure\` to be an integer from \`concurrency\` (${concurrency}) and up or \`Infinity\`, got \`${backpressure}\` (${typeof backpressure})`); - } - - return { - async * [Symbol.asyncIterator]() { - const iterator = iterable[Symbol.asyncIterator] === undefined ? iterable[Symbol.iterator]() : iterable[Symbol.asyncIterator](); - - const promises = []; - let runningMappersCount = 0; - let isDone = false; - let index = 0; - - function trySpawn() { - if (isDone || !(runningMappersCount < concurrency && promises.length < backpressure)) { - return; - } - - const promise = (async () => { - const {done, value} = await iterator.next(); - - if (done) { - return {done: true}; - } - - runningMappersCount++; - - // Spawn if still below concurrency and backpressure limit - trySpawn(); - - try { - const returnValue = await mapper(await value, index++); - - runningMappersCount--; - - if (returnValue === pMapSkip) { - const index = promises.indexOf(promise); - - if (index > 0) { - promises.splice(index, 1); - } - } - - // Spawn if still below backpressure limit and just dropped below concurrency limit - trySpawn(); - - return {done: false, value: returnValue}; - } catch (error) { - isDone = true; - return {error}; - } - })(); - - promises.push(promise); - } - - trySpawn(); - - while (promises.length > 0) { - const {error, done, value} = await promises[0]; // eslint-disable-line no-await-in-loop - - promises.shift(); - - if (error) { - throw error; - } - - if (done) { - return; - } - - // Spawn if just dropped below backpressure limit and below the concurrency limit - trySpawn(); - - if (value === pMapSkip) { - continue; - } - - yield value; - } - }, - }; -} - -export const pMapSkip = Symbol('skip'); diff --git a/deps/npm/node_modules/cacache/node_modules/p-map/license b/deps/npm/node_modules/cacache/node_modules/p-map/license deleted file mode 100644 index fa7ceba3eb4a96..00000000000000 --- a/deps/npm/node_modules/cacache/node_modules/p-map/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (https://sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/cacache/node_modules/p-map/package.json b/deps/npm/node_modules/cacache/node_modules/p-map/package.json deleted file mode 100644 index ea58f599f3a035..00000000000000 --- a/deps/npm/node_modules/cacache/node_modules/p-map/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "p-map", - "version": "7.0.2", - "description": "Map over promises concurrently", - "license": "MIT", - "repository": "sindresorhus/p-map", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "type": "module", - "exports": { - "types": "./index.d.ts", - "default": "./index.js" - }, - "sideEffects": false, - "engines": { - "node": ">=18" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "promise", - "map", - "resolved", - "wait", - "collection", - "iterable", - "iterator", - "race", - "fulfilled", - "async", - "await", - "promises", - "concurrently", - "concurrency", - "parallel", - "bluebird" - ], - "devDependencies": { - "ava": "^5.2.0", - "chalk": "^5.3.0", - "delay": "^6.0.0", - "in-range": "^3.0.0", - "random-int": "^3.0.0", - "time-span": "^5.1.0", - "tsd": "^0.29.0", - "xo": "^0.56.0" - } -} diff --git a/deps/npm/node_modules/clean-stack/index.js b/deps/npm/node_modules/clean-stack/index.js deleted file mode 100644 index 8c1dcc4cd02a25..00000000000000 --- a/deps/npm/node_modules/clean-stack/index.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; -const os = require('os'); - -const extractPathRegex = /\s+at.*(?:\(|\s)(.*)\)?/; -const pathRegex = /^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/; -const homeDir = typeof os.homedir === 'undefined' ? '' : os.homedir(); - -module.exports = (stack, options) => { - options = Object.assign({pretty: false}, options); - - return stack.replace(/\\/g, '/') - .split('\n') - .filter(line => { - const pathMatches = line.match(extractPathRegex); - if (pathMatches === null || !pathMatches[1]) { - return true; - } - - const match = pathMatches[1]; - - // Electron - if ( - match.includes('.app/Contents/Resources/electron.asar') || - match.includes('.app/Contents/Resources/default_app.asar') - ) { - return false; - } - - return !pathRegex.test(match); - }) - .filter(line => line.trim() !== '') - .map(line => { - if (options.pretty) { - return line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~'))); - } - - return line; - }) - .join('\n'); -}; diff --git a/deps/npm/node_modules/clean-stack/license b/deps/npm/node_modules/clean-stack/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/deps/npm/node_modules/clean-stack/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/clean-stack/package.json b/deps/npm/node_modules/clean-stack/package.json deleted file mode 100644 index 719fdff55e7b6c..00000000000000 --- a/deps/npm/node_modules/clean-stack/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "clean-stack", - "version": "2.2.0", - "description": "Clean up error stack traces", - "license": "MIT", - "repository": "sindresorhus/clean-stack", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=6" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "clean", - "stack", - "trace", - "traces", - "error", - "err", - "electron" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - }, - "browser": { - "os": false - } -} diff --git a/deps/npm/node_modules/debug/package.json b/deps/npm/node_modules/debug/package.json index 2f782eb9aef450..60dfcf57cae407 100644 --- a/deps/npm/node_modules/debug/package.json +++ b/deps/npm/node_modules/debug/package.json @@ -1,6 +1,6 @@ { "name": "debug", - "version": "4.3.7", + "version": "4.4.0", "repository": { "type": "git", "url": "git://github.com/debug-js/debug.git" @@ -56,5 +56,10 @@ "browser": "./src/browser.js", "engines": { "node": ">=6.0" + }, + "xo": { + "rules": { + "import/extensions": "off" + } } } diff --git a/deps/npm/node_modules/debug/src/browser.js b/deps/npm/node_modules/debug/src/browser.js index 8d808e5889da5f..df8e179e8b5d9b 100644 --- a/deps/npm/node_modules/debug/src/browser.js +++ b/deps/npm/node_modules/debug/src/browser.js @@ -129,6 +129,7 @@ function useColors() { // Is webkit? http://stackoverflow.com/a/16459606/376773 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + // eslint-disable-next-line no-return-assign return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || // Is firebug? http://stackoverflow.com/a/398120/376773 (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || diff --git a/deps/npm/node_modules/debug/src/common.js b/deps/npm/node_modules/debug/src/common.js index e3291b20faa1a6..528c7ecf417cd5 100644 --- a/deps/npm/node_modules/debug/src/common.js +++ b/deps/npm/node_modules/debug/src/common.js @@ -166,24 +166,62 @@ function setup(env) { createDebug.names = []; createDebug.skips = []; - let i; - const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - const len = split.length; - - for (i = 0; i < len; i++) { - if (!split[i]) { - // ignore empty strings - continue; + const split = (typeof namespaces === 'string' ? namespaces : '') + .trim() + .replace(' ', ',') + .split(',') + .filter(Boolean); + + for (const ns of split) { + if (ns[0] === '-') { + createDebug.skips.push(ns.slice(1)); + } else { + createDebug.names.push(ns); } + } + } - namespaces = split[i].replace(/\*/g, '.*?'); - - if (namespaces[0] === '-') { - createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); + /** + * Checks if the given string matches a namespace template, honoring + * asterisks as wildcards. + * + * @param {String} search + * @param {String} template + * @return {Boolean} + */ + function matchesTemplate(search, template) { + let searchIndex = 0; + let templateIndex = 0; + let starIndex = -1; + let matchIndex = 0; + + while (searchIndex < search.length) { + if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) { + // Match character or proceed with wildcard + if (template[templateIndex] === '*') { + starIndex = templateIndex; + matchIndex = searchIndex; + templateIndex++; // Skip the '*' + } else { + searchIndex++; + templateIndex++; + } + } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition + // Backtrack to the last '*' and try to match more characters + templateIndex = starIndex + 1; + matchIndex++; + searchIndex = matchIndex; } else { - createDebug.names.push(new RegExp('^' + namespaces + '$')); + return false; // No match } } + + // Handle trailing '*' in template + while (templateIndex < template.length && template[templateIndex] === '*') { + templateIndex++; + } + + return templateIndex === template.length; } /** @@ -194,8 +232,8 @@ function setup(env) { */ function disable() { const namespaces = [ - ...createDebug.names.map(toNamespace), - ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ...createDebug.names, + ...createDebug.skips.map(namespace => '-' + namespace) ].join(','); createDebug.enable(''); return namespaces; @@ -209,21 +247,14 @@ function setup(env) { * @api public */ function enabled(name) { - if (name[name.length - 1] === '*') { - return true; - } - - let i; - let len; - - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { + for (const skip of createDebug.skips) { + if (matchesTemplate(name, skip)) { return false; } } - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { + for (const ns of createDebug.names) { + if (matchesTemplate(name, ns)) { return true; } } @@ -231,19 +262,6 @@ function setup(env) { return false; } - /** - * Convert regexp to namespace - * - * @param {RegExp} regxep - * @return {String} namespace - * @api private - */ - function toNamespace(regexp) { - return regexp.toString() - .substring(2, regexp.toString().length - 2) - .replace(/\.\*\?$/, '*'); - } - /** * Coerce `val`. * diff --git a/deps/npm/node_modules/diff/CONTRIBUTING.md b/deps/npm/node_modules/diff/CONTRIBUTING.md index c974cf678e2c5e..199c556c1ffb02 100644 --- a/deps/npm/node_modules/diff/CONTRIBUTING.md +++ b/deps/npm/node_modules/diff/CONTRIBUTING.md @@ -26,11 +26,15 @@ If you notice any problems, please report them to the GitHub issue tracker at ## Releasing -A full release may be completed with the following: +A full release may be completed by first updating the `"version"` property in package.json, then running the following: ``` yarn clean -yarn grunt -yarn grunt uglify +yarn grunt release yarn publish ``` + +After releasing, remember to: +* commit the `package.json` change and push it to GitHub +* create a new version tag on GitHub +* update `diff.js` on the `gh-pages` branch to the latest built version from the `dist/` folder. diff --git a/deps/npm/node_modules/diff/dist/diff.js b/deps/npm/node_modules/diff/dist/diff.js index 76232b293d549f..2c2c33344ecd25 100644 --- a/deps/npm/node_modules/diff/dist/diff.js +++ b/deps/npm/node_modules/diff/dist/diff.js @@ -1,66 +1,95 @@ +/*! + + diff v7.0.0 + +BSD 3-Clause License + +Copyright (c) 2009-2015, Kevin Decker +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +@license +*/ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.Diff = {})); -}(this, (function (exports) { 'use strict'; + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Diff = {})); +})(this, (function (exports) { 'use strict'; function Diff() {} Diff.prototype = { diff: function diff(oldString, newString) { var _options$timeout; - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var callback = options.callback; - if (typeof options === 'function') { callback = options; options = {}; } - - this.options = options; var self = this; - function done(value) { + value = self.postProcess(value, options); if (callback) { setTimeout(function () { - callback(undefined, value); + callback(value); }, 0); return true; } else { return value; } - } // Allow subclasses to massage the input prior to running - + } - oldString = this.castInput(oldString); - newString = this.castInput(newString); - oldString = this.removeEmpty(this.tokenize(oldString)); - newString = this.removeEmpty(this.tokenize(newString)); + // Allow subclasses to massage the input prior to running + oldString = this.castInput(oldString, options); + newString = this.castInput(newString, options); + oldString = this.removeEmpty(this.tokenize(oldString, options)); + newString = this.removeEmpty(this.tokenize(newString, options)); var newLen = newString.length, - oldLen = oldString.length; + oldLen = oldString.length; var editLength = 1; var maxEditLength = newLen + oldLen; - - if (options.maxEditLength) { + if (options.maxEditLength != null) { maxEditLength = Math.min(maxEditLength, options.maxEditLength); } - var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity; var abortAfterTimestamp = Date.now() + maxExecutionTime; var bestPath = [{ oldPos: -1, lastComponent: undefined - }]; // Seed editLength = 0, i.e. the content starts with the same values - - var newPos = this.extractCommon(bestPath[0], newString, oldString, 0); + }]; + // Seed editLength = 0, i.e. the content starts with the same values + var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options); if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) { // Identity per the equality and tokenizer - return done([{ - value: this.join(newString), - count: newString.length - }]); - } // Once we hit the right edge of the edit graph on some diagonal k, we can + return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken)); + } + + // Once we hit the right edge of the edit graph on some diagonal k, we can // definitely reach the end of the edit graph in no more than k edits, so // there's no point in considering any moves to diagonal k+1 any more (from // which we're guaranteed to need at least k+1 more edits). @@ -77,81 +106,67 @@ // where the new text simply appends d characters on the end of the // original text of length n, the true Myers algorithm will take O(n+d^2) // time while this optimization needs only O(n+d) time. - - var minDiagonalToConsider = -Infinity, - maxDiagonalToConsider = Infinity; // Main worker method. checks all permutations of a given edit length for acceptance. + maxDiagonalToConsider = Infinity; + // Main worker method. checks all permutations of a given edit length for acceptance. function execEditLength() { for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) { var basePath = void 0; var removePath = bestPath[diagonalPath - 1], - addPath = bestPath[diagonalPath + 1]; - + addPath = bestPath[diagonalPath + 1]; if (removePath) { // No one else is going to attempt to use this value, clear it bestPath[diagonalPath - 1] = undefined; } - var canAdd = false; - if (addPath) { // what newPos will be after we do an insertion: var addPathNewPos = addPath.oldPos - diagonalPath; canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen; } - var canRemove = removePath && removePath.oldPos + 1 < oldLen; - if (!canAdd && !canRemove) { // If this path is a terminal then prune bestPath[diagonalPath] = undefined; continue; - } // Select the diagonal that we want to branch from. We select the prior + } + + // Select the diagonal that we want to branch from. We select the prior // path whose position in the old string is the farthest from the origin // and does not pass the bounds of the diff graph - // TODO: Remove the `+ 1` here to make behavior match Myers algorithm - // and prefer to order removals before insertions. - - - if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) { - basePath = self.addToPath(addPath, true, undefined, 0); + if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) { + basePath = self.addToPath(addPath, true, false, 0, options); } else { - basePath = self.addToPath(removePath, undefined, true, 1); + basePath = self.addToPath(removePath, false, true, 1, options); } - - newPos = self.extractCommon(basePath, newString, oldString, diagonalPath); - + newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options); if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) { // If we have hit the end of both strings, then we are done return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken)); } else { bestPath[diagonalPath] = basePath; - if (basePath.oldPos + 1 >= oldLen) { maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1); } - if (newPos + 1 >= newLen) { minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1); } } } - editLength++; - } // Performs the length of edit iteration. Is a bit fugly as this has to support the + } + + // Performs the length of edit iteration. Is a bit fugly as this has to support the // sync and async mode which is never fun. Loops over execEditLength until a value // is produced, or until the edit length exceeds options.maxEditLength (if given), // in which case it will return undefined. - - if (callback) { (function exec() { setTimeout(function () { if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) { return callback(); } - if (!execEditLength()) { exec(); } @@ -160,17 +175,15 @@ } else { while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) { var ret = execEditLength(); - if (ret) { return ret; } } } }, - addToPath: function addToPath(path, added, removed, oldPosInc) { + addToPath: function addToPath(path, added, removed, oldPosInc, options) { var last = path.lastComponent; - - if (last && last.added === added && last.removed === removed) { + if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) { return { oldPos: path.oldPos + oldPosInc, lastComponent: { @@ -192,80 +205,83 @@ }; } }, - extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { + extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) { var newLen = newString.length, - oldLen = oldString.length, - oldPos = basePath.oldPos, - newPos = oldPos - diagonalPath, - commonCount = 0; - - while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { + oldLen = oldString.length, + oldPos = basePath.oldPos, + newPos = oldPos - diagonalPath, + commonCount = 0; + while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) { newPos++; oldPos++; commonCount++; + if (options.oneChangePerToken) { + basePath.lastComponent = { + count: 1, + previousComponent: basePath.lastComponent, + added: false, + removed: false + }; + } } - - if (commonCount) { + if (commonCount && !options.oneChangePerToken) { basePath.lastComponent = { count: commonCount, - previousComponent: basePath.lastComponent + previousComponent: basePath.lastComponent, + added: false, + removed: false }; } - basePath.oldPos = oldPos; return newPos; }, - equals: function equals(left, right) { - if (this.options.comparator) { - return this.options.comparator(left, right); + equals: function equals(left, right, options) { + if (options.comparator) { + return options.comparator(left, right); } else { - return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); + return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase(); } }, removeEmpty: function removeEmpty(array) { var ret = []; - for (var i = 0; i < array.length; i++) { if (array[i]) { ret.push(array[i]); } } - return ret; }, castInput: function castInput(value) { return value; }, tokenize: function tokenize(value) { - return value.split(''); + return Array.from(value); }, join: function join(chars) { return chars.join(''); + }, + postProcess: function postProcess(changeObjects) { + return changeObjects; } }; - function buildValues(diff, lastComponent, newString, oldString, useLongestToken) { // First we convert our linked list of components in reverse order to an // array in the right order: var components = []; var nextComponent; - while (lastComponent) { components.push(lastComponent); nextComponent = lastComponent.previousComponent; delete lastComponent.previousComponent; lastComponent = nextComponent; } - components.reverse(); var componentPos = 0, - componentLen = components.length, - newPos = 0, - oldPos = 0; - + componentLen = components.length, + newPos = 0, + oldPos = 0; for (; componentPos < componentLen; componentPos++) { var component = components[componentPos]; - if (!component.removed) { if (!component.added && useLongestToken) { var value = newString.slice(newPos, newPos + component.count); @@ -277,36 +293,17 @@ } else { component.value = diff.join(newString.slice(newPos, newPos + component.count)); } + newPos += component.count; - newPos += component.count; // Common case - + // Common case if (!component.added) { oldPos += component.count; } } else { component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); - oldPos += component.count; // Reverse add and remove so removes are output first to match common convention - // The diffing algorithm is tied to add then remove output and this is the simplest - // route to get the desired output with minimal overhead. - - if (componentPos && components[componentPos - 1].added) { - var tmp = components[componentPos - 1]; - components[componentPos - 1] = components[componentPos]; - components[componentPos] = tmp; - } + oldPos += component.count; } - } // Special case handle for when one terminal is ignored (i.e. whitespace). - // For this case we merge the terminal into the prior string and drop the change. - // This is only available for string mode. - - - var finalComponent = components[componentLen - 1]; - - if (componentLen > 1 && typeof finalComponent.value === 'string' && (finalComponent.added || finalComponent.removed) && diff.equals('', finalComponent.value)) { - components[componentLen - 2].value += finalComponent.value; - components.pop(); } - return components; } @@ -315,21 +312,114 @@ return characterDiff.diff(oldStr, newStr, options); } - function generateOptions(options, defaults) { - if (typeof options === 'function') { - defaults.callback = options; - } else if (options) { - for (var name in options) { - /* istanbul ignore else */ - if (options.hasOwnProperty(name)) { - defaults[name] = options[name]; - } + function longestCommonPrefix(str1, str2) { + var i; + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[i] != str2[i]) { + return str1.slice(0, i); } } + return str1.slice(0, i); + } + function longestCommonSuffix(str1, str2) { + var i; - return defaults; + // Unlike longestCommonPrefix, we need a special case to handle all scenarios + // where we return the empty string since str1.slice(-0) will return the + // entire string. + if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) { + return ''; + } + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) { + return str1.slice(-i); + } + } + return str1.slice(-i); + } + function replacePrefix(string, oldPrefix, newPrefix) { + if (string.slice(0, oldPrefix.length) != oldPrefix) { + throw Error("string ".concat(JSON.stringify(string), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug")); + } + return newPrefix + string.slice(oldPrefix.length); + } + function replaceSuffix(string, oldSuffix, newSuffix) { + if (!oldSuffix) { + return string + newSuffix; + } + if (string.slice(-oldSuffix.length) != oldSuffix) { + throw Error("string ".concat(JSON.stringify(string), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug")); + } + return string.slice(0, -oldSuffix.length) + newSuffix; + } + function removePrefix(string, oldPrefix) { + return replacePrefix(string, oldPrefix, ''); + } + function removeSuffix(string, oldSuffix) { + return replaceSuffix(string, oldSuffix, ''); + } + function maximumOverlap(string1, string2) { + return string2.slice(0, overlapCount(string1, string2)); } + // Nicked from https://stackoverflow.com/a/60422853/1709587 + function overlapCount(a, b) { + // Deal with cases where the strings differ in length + var startA = 0; + if (a.length > b.length) { + startA = a.length - b.length; + } + var endB = b.length; + if (a.length < b.length) { + endB = a.length; + } + // Create a back-reference for each index + // that should be followed in case of a mismatch. + // We only need B to make these references: + var map = Array(endB); + var k = 0; // Index that lags behind j + map[0] = 0; + for (var j = 1; j < endB; j++) { + if (b[j] == b[k]) { + map[j] = map[k]; // skip over the same character (optional optimisation) + } else { + map[j] = k; + } + while (k > 0 && b[j] != b[k]) { + k = map[k]; + } + if (b[j] == b[k]) { + k++; + } + } + // Phase 2: use these references while iterating over A + k = 0; + for (var i = startA; i < a.length; i++) { + while (k > 0 && a[i] != b[k]) { + k = map[k]; + } + if (a[i] == b[k]) { + k++; + } + } + return k; + } + + /** + * Returns true if the string consistently uses Windows line endings. + */ + function hasOnlyWinLineEndings(string) { + return string.includes('\r\n') && !string.startsWith('\n') && !string.match(/[^\r]\n/); + } + + /** + * Returns true if the string consistently uses Unix line endings. + */ + function hasOnlyUnixLineEndings(string) { + return !string.includes('\r\n') && string.includes('\n'); + } + + // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode // // Ranges and exceptions: // Latin-1 Supplement, 0080–00FF @@ -347,82 +437,330 @@ // - U+02DC ˜ ˜ Small Tilde // - U+02DD ˝ ˝ Double Acute Accent // Latin Extended Additional, 1E00–1EFF + var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}"; - var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; - var reWhitespace = /\S/; + // Each token is one of the following: + // - A punctuation mark plus the surrounding whitespace + // - A word plus the surrounding whitespace + // - Pure whitespace (but only in the special case where this the entire text + // is just whitespace) + // + // We have to include surrounding whitespace in the tokens because the two + // alternative approaches produce horribly broken results: + // * If we just discard the whitespace, we can't fully reproduce the original + // text from the sequence of tokens and any attempt to render the diff will + // get the whitespace wrong. + // * If we have separate tokens for whitespace, then in a typical text every + // second token will be a single space character. But this often results in + // the optimal diff between two texts being a perverse one that preserves + // the spaces between words but deletes and reinserts actual common words. + // See https://github.com/kpdecker/jsdiff/issues/160#issuecomment-1866099640 + // for an example. + // + // Keeping the surrounding whitespace of course has implications for .equals + // and .join, not just .tokenize. + + // This regex does NOT fully implement the tokenization rules described above. + // Instead, it gives runs of whitespace their own "token". The tokenize method + // then handles stitching whitespace tokens onto adjacent word or punctuation + // tokens. + var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), 'ug'); var wordDiff = new Diff(); - - wordDiff.equals = function (left, right) { - if (this.options.ignoreCase) { + wordDiff.equals = function (left, right, options) { + if (options.ignoreCase) { left = left.toLowerCase(); right = right.toLowerCase(); } - - return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); + return left.trim() === right.trim(); }; - wordDiff.tokenize = function (value) { - // All whitespace symbols except newline group into one token, each newline - in separate token - var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set. - - for (var i = 0; i < tokens.length - 1; i++) { - // If we have an empty string in the next field and we have only word chars before and after, merge - if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { - tokens[i] += tokens[i + 2]; - tokens.splice(i + 1, 2); - i--; + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var parts; + if (options.intlSegmenter) { + if (options.intlSegmenter.resolvedOptions().granularity != 'word') { + throw new Error('The segmenter passed must have a granularity of "word"'); } + parts = Array.from(options.intlSegmenter.segment(value), function (segment) { + return segment.segment; + }); + } else { + parts = value.match(tokenizeIncludingWhitespace) || []; } - + var tokens = []; + var prevPart = null; + parts.forEach(function (part) { + if (/\s/.test(part)) { + if (prevPart == null) { + tokens.push(part); + } else { + tokens.push(tokens.pop() + part); + } + } else if (/\s/.test(prevPart)) { + if (tokens[tokens.length - 1] == prevPart) { + tokens.push(tokens.pop() + part); + } else { + tokens.push(prevPart + part); + } + } else { + tokens.push(part); + } + prevPart = part; + }); return tokens; }; - - function diffWords(oldStr, newStr, options) { - options = generateOptions(options, { - ignoreWhitespace: true + wordDiff.join = function (tokens) { + // Tokens being joined here will always have appeared consecutively in the + // same text, so we can simply strip off the leading whitespace from all the + // tokens except the first (and except any whitespace-only tokens - but such + // a token will always be the first and only token anyway) and then join them + // and the whitespace around words and punctuation will end up correct. + return tokens.map(function (token, i) { + if (i == 0) { + return token; + } else { + return token.replace(/^\s+/, ''); + } + }).join(''); + }; + wordDiff.postProcess = function (changes, options) { + if (!changes || options.oneChangePerToken) { + return changes; + } + var lastKeep = null; + // Change objects representing any insertion or deletion since the last + // "keep" change object. There can be at most one of each. + var insertion = null; + var deletion = null; + changes.forEach(function (change) { + if (change.added) { + insertion = change; + } else if (change.removed) { + deletion = change; + } else { + if (insertion || deletion) { + // May be false at start of text + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change); + } + lastKeep = change; + insertion = null; + deletion = null; + } }); + if (insertion || deletion) { + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null); + } + return changes; + }; + function diffWords(oldStr, newStr, options) { + // This option has never been documented and never will be (it's clearer to + // just call `diffWordsWithSpace` directly if you need that behavior), but + // has existed in jsdiff for a long time, so we retain support for it here + // for the sake of backwards compatibility. + if ((options === null || options === void 0 ? void 0 : options.ignoreWhitespace) != null && !options.ignoreWhitespace) { + return diffWordsWithSpace(oldStr, newStr, options); + } return wordDiff.diff(oldStr, newStr, options); } + function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) { + // Before returning, we tidy up the leading and trailing whitespace of the + // change objects to eliminate cases where trailing whitespace in one object + // is repeated as leading whitespace in the next. + // Below are examples of the outcomes we want here to explain the code. + // I=insert, K=keep, D=delete + // 1. diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want: K:'foo ' D:'bar ' K:'baz' + // + // 2. Diffing 'foo bar baz' vs 'foo qux baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' I:' qux ' K:' baz' + // After cleanup, we want K:'foo ' D:'bar' I:'qux' K:' baz' + // + // 3. Diffing 'foo\nbar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:'\nbar ' K:' baz' + // After cleanup, we want K'foo' D:'\nbar' K:' baz' + // + // 4. Diffing 'foo baz' vs 'foo\nbar baz' + // Prior to cleanup, we have K:'foo\n' I:'\nbar ' K:' baz' + // After cleanup, we ideally want K'foo' I:'\nbar' K:' baz' + // but don't actually manage this currently (the pre-cleanup change + // objects don't contain enough information to make it possible). + // + // 5. Diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want K:'foo ' D:' bar ' K:'baz' + // + // Our handling is unavoidably imperfect in the case where there's a single + // indel between keeps and the whitespace has changed. For instance, consider + // diffing 'foo\tbar\nbaz' vs 'foo baz'. Unless we create an extra change + // object to represent the insertion of the space character (which isn't even + // a token), we have no way to avoid losing information about the texts' + // original whitespace in the result we return. Still, we do our best to + // output something that will look sensible if we e.g. print it with + // insertions in green and deletions in red. + + // Between two "keep" change objects (or before the first or after the last + // change object), we can have either: + // * A "delete" followed by an "insert" + // * Just an "insert" + // * Just a "delete" + // We handle the three cases separately. + if (deletion && insertion) { + var oldWsPrefix = deletion.value.match(/^\s*/)[0]; + var oldWsSuffix = deletion.value.match(/\s*$/)[0]; + var newWsPrefix = insertion.value.match(/^\s*/)[0]; + var newWsSuffix = insertion.value.match(/\s*$/)[0]; + if (startKeep) { + var commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix); + startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix); + deletion.value = removePrefix(deletion.value, commonWsPrefix); + insertion.value = removePrefix(insertion.value, commonWsPrefix); + } + if (endKeep) { + var commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix); + endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix); + deletion.value = removeSuffix(deletion.value, commonWsSuffix); + insertion.value = removeSuffix(insertion.value, commonWsSuffix); + } + } else if (insertion) { + // The whitespaces all reflect what was in the new text rather than + // the old, so we essentially have no information about whitespace + // insertion or deletion. We just want to dedupe the whitespace. + // We do that by having each change object keep its trailing + // whitespace and deleting duplicate leading whitespace where + // present. + if (startKeep) { + insertion.value = insertion.value.replace(/^\s*/, ''); + } + if (endKeep) { + endKeep.value = endKeep.value.replace(/^\s*/, ''); + } + // otherwise we've got a deletion and no insertion + } else if (startKeep && endKeep) { + var newWsFull = endKeep.value.match(/^\s*/)[0], + delWsStart = deletion.value.match(/^\s*/)[0], + delWsEnd = deletion.value.match(/\s*$/)[0]; + + // Any whitespace that comes straight after startKeep in both the old and + // new texts, assign to startKeep and remove from the deletion. + var newWsStart = longestCommonPrefix(newWsFull, delWsStart); + deletion.value = removePrefix(deletion.value, newWsStart); + + // Any whitespace that comes straight before endKeep in both the old and + // new texts, and hasn't already been assigned to startKeep, assign to + // endKeep and remove from the deletion. + var newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd); + deletion.value = removeSuffix(deletion.value, newWsEnd); + endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd); + + // If there's any whitespace from the new text that HASN'T already been + // assigned, assign it to the start: + startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length)); + } else if (endKeep) { + // We are at the start of the text. Preserve all the whitespace on + // endKeep, and just remove whitespace from the end of deletion to the + // extent that it overlaps with the start of endKeep. + var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0]; + var deletionWsSuffix = deletion.value.match(/\s*$/)[0]; + var overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix); + deletion.value = removeSuffix(deletion.value, overlap); + } else if (startKeep) { + // We are at the END of the text. Preserve all the whitespace on + // startKeep, and just remove whitespace from the start of deletion to + // the extent that it overlaps with the end of startKeep. + var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0]; + var deletionWsPrefix = deletion.value.match(/^\s*/)[0]; + var _overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix); + deletion.value = removePrefix(deletion.value, _overlap); + } + } + var wordWithSpaceDiff = new Diff(); + wordWithSpaceDiff.tokenize = function (value) { + // Slightly different to the tokenizeIncludingWhitespace regex used above in + // that this one treats each individual newline as a distinct tokens, rather + // than merging them into other surrounding whitespace. This was requested + // in https://github.com/kpdecker/jsdiff/issues/180 & + // https://github.com/kpdecker/jsdiff/issues/211 + var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), 'ug'); + return value.match(regex) || []; + }; function diffWordsWithSpace(oldStr, newStr, options) { - return wordDiff.diff(oldStr, newStr, options); + return wordWithSpaceDiff.diff(oldStr, newStr, options); } - var lineDiff = new Diff(); + function generateOptions(options, defaults) { + if (typeof options === 'function') { + defaults.callback = options; + } else if (options) { + for (var name in options) { + /* istanbul ignore else */ + if (options.hasOwnProperty(name)) { + defaults[name] = options[name]; + } + } + } + return defaults; + } - lineDiff.tokenize = function (value) { - if (this.options.stripTrailingCr) { + var lineDiff = new Diff(); + lineDiff.tokenize = function (value, options) { + if (options.stripTrailingCr) { // remove one \r before \n to match GNU diff's --strip-trailing-cr behavior value = value.replace(/\r\n/g, '\n'); } - var retLines = [], - linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line + linesAndNewlines = value.split(/(\n|\r\n)/); + // Ignore the final empty token that occurs if the string ends with a new line if (!linesAndNewlines[linesAndNewlines.length - 1]) { linesAndNewlines.pop(); - } // Merge the content and line separators into single tokens - + } + // Merge the content and line separators into single tokens for (var i = 0; i < linesAndNewlines.length; i++) { var line = linesAndNewlines[i]; - - if (i % 2 && !this.options.newlineIsToken) { + if (i % 2 && !options.newlineIsToken) { retLines[retLines.length - 1] += line; } else { - if (this.options.ignoreWhitespace) { - line = line.trim(); - } - retLines.push(line); } } - return retLines; }; - + lineDiff.equals = function (left, right, options) { + // If we're ignoring whitespace, we need to normalise lines by stripping + // whitespace before checking equality. (This has an annoying interaction + // with newlineIsToken that requires special handling: if newlines get their + // own token, then we DON'T want to trim the *newline* tokens down to empty + // strings, since this would cause us to treat whitespace-only line content + // as equal to a separator between lines, which would be weird and + // inconsistent with the documented behavior of the options.) + if (options.ignoreWhitespace) { + if (!options.newlineIsToken || !left.includes('\n')) { + left = left.trim(); + } + if (!options.newlineIsToken || !right.includes('\n')) { + right = right.trim(); + } + } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) { + if (left.endsWith('\n')) { + left = left.slice(0, -1); + } + if (right.endsWith('\n')) { + right = right.slice(0, -1); + } + } + return Diff.prototype.equals.call(this, left, right, options); + }; function diffLines(oldStr, newStr, callback) { return lineDiff.diff(oldStr, newStr, callback); } + + // Kept for backwards compatibility. This is a rather arbitrary wrapper method + // that just calls `diffLines` with `ignoreWhitespace: true`. It's confusing to + // have two ways to do exactly the same thing in the API, so we no longer + // document this one (library users should explicitly use `diffLines` with + // `ignoreWhitespace: true` instead) but we keep it around to maintain + // compatibility with code that used old versions. function diffTrimmedLines(oldStr, newStr, callback) { var options = generateOptions(callback, { ignoreWhitespace: true @@ -431,42 +769,67 @@ } var sentenceDiff = new Diff(); - sentenceDiff.tokenize = function (value) { return value.split(/(\S.+?[.!?])(?=\s+|$)/); }; - function diffSentences(oldStr, newStr, callback) { return sentenceDiff.diff(oldStr, newStr, callback); } var cssDiff = new Diff(); - cssDiff.tokenize = function (value) { return value.split(/([{}:;,]|\s+)/); }; - function diffCss(oldStr, newStr, callback) { return cssDiff.diff(oldStr, newStr, callback); } - function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; + function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function (r) { + return Object.getOwnPropertyDescriptor(e, r).enumerable; + })), t.push.apply(t, o); } - - return _typeof(obj); + return t; } + function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { + _defineProperty(e, r, t[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); + }); + } + return e; + } + function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : i + ""; + } + function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); + } function _defineProperty(obj, key, value) { + key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, @@ -477,56 +840,17 @@ } else { obj[key] = value; } - return obj; } - - function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - if (enumerableOnly) symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - keys.push.apply(keys, symbols); - } - - return keys; - } - - function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; - } - function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); @@ -535,238 +859,263 @@ if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - return arr2; } - function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - var objectPrototypeToString = Object.prototype.toString; - var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a + var jsonDiff = new Diff(); + // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: - jsonDiff.useLongestToken = true; jsonDiff.tokenize = lineDiff.tokenize; - - jsonDiff.castInput = function (value) { - var _this$options = this.options, - undefinedReplacement = _this$options.undefinedReplacement, - _this$options$stringi = _this$options.stringifyReplacer, - stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) { - return typeof v === 'undefined' ? undefinedReplacement : v; - } : _this$options$stringi; + jsonDiff.castInput = function (value, options) { + var undefinedReplacement = options.undefinedReplacement, + _options$stringifyRep = options.stringifyReplacer, + stringifyReplacer = _options$stringifyRep === void 0 ? function (k, v) { + return typeof v === 'undefined' ? undefinedReplacement : v; + } : _options$stringifyRep; return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); }; - - jsonDiff.equals = function (left, right) { - return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')); + jsonDiff.equals = function (left, right, options) { + return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'), options); }; - function diffJson(oldObj, newObj, options) { return jsonDiff.diff(oldObj, newObj, options); - } // This function handles the presence of circular references by bailing out when encountering an - // object that is already on the "stack" of items being processed. Accepts an optional replacer + } + // This function handles the presence of circular references by bailing out when encountering an + // object that is already on the "stack" of items being processed. Accepts an optional replacer function canonicalize(obj, stack, replacementStack, replacer, key) { stack = stack || []; replacementStack = replacementStack || []; - if (replacer) { obj = replacer(key, obj); } - var i; - for (i = 0; i < stack.length; i += 1) { if (stack[i] === obj) { return replacementStack[i]; } } - var canonicalizedObj; - - if ('[object Array]' === objectPrototypeToString.call(obj)) { + if ('[object Array]' === Object.prototype.toString.call(obj)) { stack.push(obj); canonicalizedObj = new Array(obj.length); replacementStack.push(canonicalizedObj); - for (i = 0; i < obj.length; i += 1) { canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); } - stack.pop(); replacementStack.pop(); return canonicalizedObj; } - if (obj && obj.toJSON) { obj = obj.toJSON(); } - if (_typeof(obj) === 'object' && obj !== null) { stack.push(obj); canonicalizedObj = {}; replacementStack.push(canonicalizedObj); - var sortedKeys = [], - _key; - + _key; for (_key in obj) { /* istanbul ignore else */ - if (obj.hasOwnProperty(_key)) { + if (Object.prototype.hasOwnProperty.call(obj, _key)) { sortedKeys.push(_key); } } - sortedKeys.sort(); - for (i = 0; i < sortedKeys.length; i += 1) { _key = sortedKeys[i]; canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); } - stack.pop(); replacementStack.pop(); } else { canonicalizedObj = obj; } - return canonicalizedObj; } var arrayDiff = new Diff(); - arrayDiff.tokenize = function (value) { return value.slice(); }; - arrayDiff.join = arrayDiff.removeEmpty = function (value) { return value; }; - function diffArrays(oldArr, newArr, callback) { return arrayDiff.diff(oldArr, newArr, callback); } - function parsePatch(uniDiff) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [], - list = [], - i = 0; + function unixToWin(patch) { + if (Array.isArray(patch)) { + return patch.map(unixToWin); + } + return _objectSpread2(_objectSpread2({}, patch), {}, { + hunks: patch.hunks.map(function (hunk) { + return _objectSpread2(_objectSpread2({}, hunk), {}, { + lines: hunk.lines.map(function (line, i) { + var _hunk$lines; + return line.startsWith('\\') || line.endsWith('\r') || (_hunk$lines = hunk.lines[i + 1]) !== null && _hunk$lines !== void 0 && _hunk$lines.startsWith('\\') ? line : line + '\r'; + }) + }); + }) + }); + } + function winToUnix(patch) { + if (Array.isArray(patch)) { + return patch.map(winToUnix); + } + return _objectSpread2(_objectSpread2({}, patch), {}, { + hunks: patch.hunks.map(function (hunk) { + return _objectSpread2(_objectSpread2({}, hunk), {}, { + lines: hunk.lines.map(function (line) { + return line.endsWith('\r') ? line.substring(0, line.length - 1) : line; + }) + }); + }) + }); + } + + /** + * Returns true if the patch consistently uses Unix line endings (or only involves one line and has + * no line endings). + */ + function isUnix(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return !patch.some(function (index) { + return index.hunks.some(function (hunk) { + return hunk.lines.some(function (line) { + return !line.startsWith('\\') && line.endsWith('\r'); + }); + }); + }); + } + + /** + * Returns true if the patch uses Windows line endings and only Windows line endings. + */ + function isWin(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return patch.some(function (index) { + return index.hunks.some(function (hunk) { + return hunk.lines.some(function (line) { + return line.endsWith('\r'); + }); + }); + }) && patch.every(function (index) { + return index.hunks.every(function (hunk) { + return hunk.lines.every(function (line, i) { + var _hunk$lines2; + return line.startsWith('\\') || line.endsWith('\r') || ((_hunk$lines2 = hunk.lines[i + 1]) === null || _hunk$lines2 === void 0 ? void 0 : _hunk$lines2.startsWith('\\')); + }); + }); + }); + } + function parsePatch(uniDiff) { + var diffstr = uniDiff.split(/\n/), + list = [], + i = 0; function parseIndex() { var index = {}; - list.push(index); // Parse diff metadata + list.push(index); + // Parse diff metadata while (i < diffstr.length) { - var line = diffstr[i]; // File header found, end parsing diff metadata + var line = diffstr[i]; + // File header found, end parsing diff metadata if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { break; - } // Diff index - + } + // Diff index var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); - if (header) { index.index = header[1]; } - i++; - } // Parse file headers if they are defined. Unified diff requires them, but - // there's no technical issues to have an isolated hunk without file header - + } + // Parse file headers if they are defined. Unified diff requires them, but + // there's no technical issues to have an isolated hunk without file header + parseFileHeader(index); parseFileHeader(index); - parseFileHeader(index); // Parse hunks + // Parse hunks index.hunks = []; - while (i < diffstr.length) { var _line = diffstr[i]; - - if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) { + if (/^(Index:\s|diff\s|\-\-\-\s|\+\+\+\s|===================================================================)/.test(_line)) { break; } else if (/^@@/.test(_line)) { index.hunks.push(parseHunk()); - } else if (_line && options.strict) { - // Ignore unexpected content unless in strict mode + } else if (_line) { throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); } else { i++; } } - } // Parses the --- and +++ headers, if none are found, no lines - // are consumed. - + } + // Parses the --- and +++ headers, if none are found, no lines + // are consumed. function parseFileHeader(index) { - var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]); - + var fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]); if (fileHeader) { var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; var data = fileHeader[2].split('\t', 2); var fileName = data[0].replace(/\\\\/g, '\\'); - if (/^".*"$/.test(fileName)) { fileName = fileName.substr(1, fileName.length - 2); } - index[keyPrefix + 'FileName'] = fileName; index[keyPrefix + 'Header'] = (data[1] || '').trim(); i++; } - } // Parses a hunk - // This assumes that we are at the start of a hunk. - + } + // Parses a hunk + // This assumes that we are at the start of a hunk. function parseHunk() { var chunkHeaderIndex = i, - chunkHeaderLine = diffstr[i++], - chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); + chunkHeaderLine = diffstr[i++], + chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); var hunk = { oldStart: +chunkHeader[1], oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2], newStart: +chunkHeader[3], newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4], - lines: [], - linedelimiters: [] - }; // Unified Diff Format quirk: If the chunk size is 0, + lines: [] + }; + + // Unified Diff Format quirk: If the chunk size is 0, // the first number is one lower than one would expect. // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 - if (hunk.oldLines === 0) { hunk.oldStart += 1; } - if (hunk.newLines === 0) { hunk.newStart += 1; } - var addCount = 0, - removeCount = 0; - - for (; i < diffstr.length; i++) { - // Lines starting with '---' could be mistaken for the "remove line" operation - // But they could be the header for the next file. Therefore prune such cases out. - if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) { - break; - } - + removeCount = 0; + for (; i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || (_diffstr$i = diffstr[i]) !== null && _diffstr$i !== void 0 && _diffstr$i.startsWith('\\')); i++) { + var _diffstr$i; var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; - if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { hunk.lines.push(diffstr[i]); - hunk.linedelimiters.push(delimiters[i] || '\n'); - if (operation === '+') { addCount++; } else if (operation === '-') { @@ -776,37 +1125,30 @@ removeCount++; } } else { - break; + throw new Error("Hunk at line ".concat(chunkHeaderIndex + 1, " contained invalid line ").concat(diffstr[i])); } - } // Handle the empty block count case - + } + // Handle the empty block count case if (!addCount && hunk.newLines === 1) { hunk.newLines = 0; } - if (!removeCount && hunk.oldLines === 1) { hunk.oldLines = 0; - } // Perform optional sanity checking - - - if (options.strict) { - if (addCount !== hunk.newLines) { - throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - - if (removeCount !== hunk.oldLines) { - throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } } + // Perform sanity checking + if (addCount !== hunk.newLines) { + throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + if (removeCount !== hunk.oldLines) { + throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } return hunk; } - while (i < diffstr.length) { parseIndex(); } - return list; } @@ -815,210 +1157,275 @@ // start of 2, this will iterate 2, 3, 1, 4, 0. function distanceIterator (start, minLine, maxLine) { var wantForward = true, - backwardExhausted = false, - forwardExhausted = false, - localOffset = 1; + backwardExhausted = false, + forwardExhausted = false, + localOffset = 1; return function iterator() { if (wantForward && !forwardExhausted) { if (backwardExhausted) { localOffset++; } else { wantForward = false; - } // Check if trying to fit beyond text length, and if not, check it fits - // after offset location (or desired location on first iteration) - + } + // Check if trying to fit beyond text length, and if not, check it fits + // after offset location (or desired location on first iteration) if (start + localOffset <= maxLine) { - return localOffset; + return start + localOffset; } - forwardExhausted = true; } - if (!backwardExhausted) { if (!forwardExhausted) { wantForward = true; - } // Check if trying to fit before text beginning, and if not, check it fits - // before offset location - + } + // Check if trying to fit before text beginning, and if not, check it fits + // before offset location if (minLine <= start - localOffset) { - return -localOffset++; + return start - localOffset++; } - backwardExhausted = true; return iterator(); - } // We tried to fit hunk before text beginning and beyond text length, then - // hunk can't fit on the text. Return undefined + } + // We tried to fit hunk before text beginning and beyond text length, then + // hunk can't fit on the text. Return undefined }; } function applyPatch(source, uniDiff) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - if (typeof uniDiff === 'string') { uniDiff = parsePatch(uniDiff); } - if (Array.isArray(uniDiff)) { if (uniDiff.length > 1) { throw new Error('applyPatch only works with a single input.'); } - uniDiff = uniDiff[0]; - } // Apply the diff to the input - - - var lines = source.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [], - hunks = uniDiff.hunks, - compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { - return line === patchContent; - }, - errorCount = 0, - fuzzFactor = options.fuzzFactor || 0, - minLine = 0, - offset = 0, - removeEOFNL, - addEOFNL; - /** - * Checks if the hunk exactly fits on the provided location - */ + } + if (options.autoConvertLineEndings || options.autoConvertLineEndings == null) { + if (hasOnlyWinLineEndings(source) && isUnix(uniDiff)) { + uniDiff = unixToWin(uniDiff); + } else if (hasOnlyUnixLineEndings(source) && isWin(uniDiff)) { + uniDiff = winToUnix(uniDiff); + } + } + // Apply the diff to the input + var lines = source.split('\n'), + hunks = uniDiff.hunks, + compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { + return line === patchContent; + }, + fuzzFactor = options.fuzzFactor || 0, + minLine = 0; + if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) { + throw new Error('fuzzFactor must be a non-negative integer'); + } - function hunkFits(hunk, toPos) { - for (var j = 0; j < hunk.lines.length; j++) { - var line = hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line; + // Special case for empty patch. + if (!hunks.length) { + return source; + } - if (operation === ' ' || operation === '-') { - // Context sanity check - if (!compareLine(toPos + 1, lines[toPos], operation, content)) { - errorCount++; + // Before anything else, handle EOFNL insertion/removal. If the patch tells us to make a change + // to the EOFNL that is redundant/impossible - i.e. to remove a newline that's not there, or add a + // newline that already exists - then we either return false and fail to apply the patch (if + // fuzzFactor is 0) or simply ignore the problem and do nothing (if fuzzFactor is >0). + // If we do need to remove/add a newline at EOF, this will always be in the final hunk: + var prevLine = '', + removeEOFNL = false, + addEOFNL = false; + for (var i = 0; i < hunks[hunks.length - 1].lines.length; i++) { + var line = hunks[hunks.length - 1].lines[i]; + if (line[0] == '\\') { + if (prevLine[0] == '+') { + removeEOFNL = true; + } else if (prevLine[0] == '-') { + addEOFNL = true; + } + } + prevLine = line; + } + if (removeEOFNL) { + if (addEOFNL) { + // This means the final line gets changed but doesn't have a trailing newline in either the + // original or patched version. In that case, we do nothing if fuzzFactor > 0, and if + // fuzzFactor is 0, we simply validate that the source file has no trailing newline. + if (!fuzzFactor && lines[lines.length - 1] == '') { + return false; + } + } else if (lines[lines.length - 1] == '') { + lines.pop(); + } else if (!fuzzFactor) { + return false; + } + } else if (addEOFNL) { + if (lines[lines.length - 1] != '') { + lines.push(''); + } else if (!fuzzFactor) { + return false; + } + } - if (errorCount > fuzzFactor) { - return false; + /** + * Checks if the hunk can be made to fit at the provided location with at most `maxErrors` + * insertions, substitutions, or deletions, while ensuring also that: + * - lines deleted in the hunk match exactly, and + * - wherever an insertion operation or block of insertion operations appears in the hunk, the + * immediately preceding and following lines of context match exactly + * + * `toPos` should be set such that lines[toPos] is meant to match hunkLines[0]. + * + * If the hunk can be applied, returns an object with properties `oldLineLastI` and + * `replacementLines`. Otherwise, returns null. + */ + function applyHunk(hunkLines, toPos, maxErrors) { + var hunkLinesI = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + var lastContextLineMatched = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var patchedLines = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : []; + var patchedLinesLength = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0; + var nConsecutiveOldContextLines = 0; + var nextContextLineMustMatch = false; + for (; hunkLinesI < hunkLines.length; hunkLinesI++) { + var hunkLine = hunkLines[hunkLinesI], + operation = hunkLine.length > 0 ? hunkLine[0] : ' ', + content = hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine; + if (operation === '-') { + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + toPos++; + nConsecutiveOldContextLines = 0; + } else { + if (!maxErrors || lines[toPos] == null) { + return null; } + patchedLines[patchedLinesLength] = lines[toPos]; + return applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1); + } + } + if (operation === '+') { + if (!lastContextLineMatched) { + return null; } + patchedLines[patchedLinesLength] = content; + patchedLinesLength++; + nConsecutiveOldContextLines = 0; + nextContextLineMustMatch = true; + } + if (operation === ' ') { + nConsecutiveOldContextLines++; + patchedLines[patchedLinesLength] = lines[toPos]; + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + patchedLinesLength++; + lastContextLineMatched = true; + nextContextLineMustMatch = false; + toPos++; + } else { + if (nextContextLineMustMatch || !maxErrors) { + return null; + } - toPos++; + // Consider 3 possibilities in sequence: + // 1. lines contains a *substitution* not included in the patch context, or + // 2. lines contains an *insertion* not included in the patch context, or + // 3. lines contains a *deletion* not included in the patch context + // The first two options are of course only possible if the line from lines is non-null - + // i.e. only option 3 is possible if we've overrun the end of the old file. + return lines[toPos] && (applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength + 1) || applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1)) || applyHunk(hunkLines, toPos, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength); + } } } - return true; - } // Search best fit offsets for each hunk based on the previous ones - - - for (var i = 0; i < hunks.length; i++) { - var hunk = hunks[i], - maxLine = lines.length - hunk.oldLines, - localOffset = 0, - toPos = offset + hunk.oldStart - 1; - var iterator = distanceIterator(toPos, minLine, maxLine); + // Before returning, trim any unmodified context lines off the end of patchedLines and reduce + // toPos (and thus oldLineLastI) accordingly. This allows later hunks to be applied to a region + // that starts in this hunk's trailing context. + patchedLinesLength -= nConsecutiveOldContextLines; + toPos -= nConsecutiveOldContextLines; + patchedLines.length = patchedLinesLength; + return { + patchedLines: patchedLines, + oldLineLastI: toPos - 1 + }; + } + var resultLines = []; - for (; localOffset !== undefined; localOffset = iterator()) { - if (hunkFits(hunk, toPos + localOffset)) { - hunk.offset = offset += localOffset; + // Search best fit offsets for each hunk based on the previous ones + var prevHunkOffset = 0; + for (var _i = 0; _i < hunks.length; _i++) { + var hunk = hunks[_i]; + var hunkResult = void 0; + var maxLine = lines.length - hunk.oldLines + fuzzFactor; + var toPos = void 0; + for (var maxErrors = 0; maxErrors <= fuzzFactor; maxErrors++) { + toPos = hunk.oldStart + prevHunkOffset - 1; + var iterator = distanceIterator(toPos, minLine, maxLine); + for (; toPos !== undefined; toPos = iterator()) { + hunkResult = applyHunk(hunk.lines, toPos, maxErrors); + if (hunkResult) { + break; + } + } + if (hunkResult) { break; } } - - if (localOffset === undefined) { + if (!hunkResult) { return false; - } // Set lower text limit to end of the current hunk, so next ones don't try - // to fit over already patched text - - - minLine = hunk.offset + hunk.oldStart + hunk.oldLines; - } // Apply patch hunks - - - var diffOffset = 0; - - for (var _i = 0; _i < hunks.length; _i++) { - var _hunk = hunks[_i], - _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1; - - diffOffset += _hunk.newLines - _hunk.oldLines; + } - for (var j = 0; j < _hunk.lines.length; j++) { - var line = _hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line, - delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n'; + // Copy everything from the end of where we applied the last hunk to the start of this hunk + for (var _i2 = minLine; _i2 < toPos; _i2++) { + resultLines.push(lines[_i2]); + } - if (operation === ' ') { - _toPos++; - } else if (operation === '-') { - lines.splice(_toPos, 1); - delimiters.splice(_toPos, 1); - /* istanbul ignore else */ - } else if (operation === '+') { - lines.splice(_toPos, 0, content); - delimiters.splice(_toPos, 0, delimiter); - _toPos++; - } else if (operation === '\\') { - var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null; - - if (previousOperation === '+') { - removeEOFNL = true; - } else if (previousOperation === '-') { - addEOFNL = true; - } - } + // Add the lines produced by applying the hunk: + for (var _i3 = 0; _i3 < hunkResult.patchedLines.length; _i3++) { + var _line = hunkResult.patchedLines[_i3]; + resultLines.push(_line); } - } // Handle EOFNL insertion/removal + // Set lower text limit to end of the current hunk, so next ones don't try + // to fit over already patched text + minLine = hunkResult.oldLineLastI + 1; - if (removeEOFNL) { - while (!lines[lines.length - 1]) { - lines.pop(); - delimiters.pop(); - } - } else if (addEOFNL) { - lines.push(''); - delimiters.push('\n'); + // Note the offset between where the patch said the hunk should've applied and where we + // applied it, so we can adjust future hunks accordingly: + prevHunkOffset = toPos + 1 - hunk.oldStart; } - for (var _k = 0; _k < lines.length - 1; _k++) { - lines[_k] = lines[_k] + delimiters[_k]; + // Copy over the rest of the lines from the old text + for (var _i4 = minLine; _i4 < lines.length; _i4++) { + resultLines.push(lines[_i4]); } + return resultLines.join('\n'); + } - return lines.join(''); - } // Wrapper that supports multiple file patches via callbacks. - + // Wrapper that supports multiple file patches via callbacks. function applyPatches(uniDiff, options) { if (typeof uniDiff === 'string') { uniDiff = parsePatch(uniDiff); } - var currentIndex = 0; - function processIndex() { var index = uniDiff[currentIndex++]; - if (!index) { return options.complete(); } - options.loadFile(index, function (err, data) { if (err) { return options.complete(err); } - var updatedContent = applyPatch(data, index, options); options.patched(index, updatedContent, function (err) { if (err) { return options.complete(err); } - processIndex(); }); }); } - processIndex(); } @@ -1026,206 +1433,238 @@ if (!options) { options = {}; } - + if (typeof options === 'function') { + options = { + callback: options + }; + } if (typeof options.context === 'undefined') { options.context = 4; } - - var diff = diffLines(oldStr, newStr, options); - - if (!diff) { - return; + if (options.newlineIsToken) { + throw new Error('newlineIsToken may not be used with patch-generation functions, only with diffing functions'); } - - diff.push({ - value: '', - lines: [] - }); // Append an empty value to make cleanup easier - - function contextLines(lines) { - return lines.map(function (entry) { - return ' ' + entry; - }); + if (!options.callback) { + return diffLinesResultToPatch(diffLines(oldStr, newStr, options)); + } else { + var _options = options, + _callback = _options.callback; + diffLines(oldStr, newStr, _objectSpread2(_objectSpread2({}, options), {}, { + callback: function callback(diff) { + var patch = diffLinesResultToPatch(diff); + _callback(patch); + } + })); } + function diffLinesResultToPatch(diff) { + // STEP 1: Build up the patch with no "\ No newline at end of file" lines and with the arrays + // of lines containing trailing newline characters. We'll tidy up later... - var hunks = []; - var oldRangeStart = 0, + if (!diff) { + return; + } + diff.push({ + value: '', + lines: [] + }); // Append an empty value to make cleanup easier + + function contextLines(lines) { + return lines.map(function (entry) { + return ' ' + entry; + }); + } + var hunks = []; + var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1; - - var _loop = function _loop(i) { - var current = diff[i], - lines = current.lines || current.value.replace(/\n$/, '').split('\n'); - current.lines = lines; - - if (current.added || current.removed) { - var _curRange; - - // If we have previous context, start with that - if (!oldRangeStart) { - var prev = diff[i - 1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; + var _loop = function _loop() { + var current = diff[i], + lines = current.lines || splitLines(current.value); + current.lines = lines; + if (current.added || current.removed) { + var _curRange; + // If we have previous context, start with that + if (!oldRangeStart) { + var prev = diff[i - 1]; + oldRangeStart = oldLine; + newRangeStart = newLine; + if (prev) { + curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; + oldRangeStart -= curRange.length; + newRangeStart -= curRange.length; + } } - } // Output our changes - - (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { - return (current.added ? '+' : '-') + entry; - }))); // Track the updated file position + // Output our changes + (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { + return (current.added ? '+' : '-') + entry; + }))); - - if (current.added) { - newLine += lines.length; + // Track the updated file position + if (current.added) { + newLine += lines.length; + } else { + oldLine += lines.length; + } } else { + // Identical context lines. Track line changes + if (oldRangeStart) { + // Close out any changes that have been output (or join overlapping) + if (lines.length <= options.context * 2 && i < diff.length - 2) { + var _curRange2; + // Overlapping + (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); + } else { + var _curRange3; + // end the range and output + var contextSize = Math.min(lines.length, options.context); + (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); + var _hunk = { + oldStart: oldRangeStart, + oldLines: oldLine - oldRangeStart + contextSize, + newStart: newRangeStart, + newLines: newLine - newRangeStart + contextSize, + lines: curRange + }; + hunks.push(_hunk); + oldRangeStart = 0; + newRangeStart = 0; + curRange = []; + } + } oldLine += lines.length; + newLine += lines.length; } - } else { - // Identical context lines. Track line changes - if (oldRangeStart) { - // Close out any changes that have been output (or join overlapping) - if (lines.length <= options.context * 2 && i < diff.length - 2) { - var _curRange2; - - // Overlapping - (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); - } else { - var _curRange3; - - // end the range and output - var contextSize = Math.min(lines.length, options.context); - - (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); - - var hunk = { - oldStart: oldRangeStart, - oldLines: oldLine - oldRangeStart + contextSize, - newStart: newRangeStart, - newLines: newLine - newRangeStart + contextSize, - lines: curRange - }; - - if (i >= diff.length - 2 && lines.length <= options.context) { - // EOF is inside this hunk - var oldEOFNewline = /\n$/.test(oldStr); - var newEOFNewline = /\n$/.test(newStr); - var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines; - - if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) { - // special case: old has no eol and no trailing context; no-nl can end up before adds - // however, if the old file is empty, do not output the no-nl line - curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file'); - } - - if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) { - curRange.push('\\ No newline at end of file'); - } - } + }; + for (var i = 0; i < diff.length; i++) { + _loop(); + } - hunks.push(hunk); - oldRangeStart = 0; - newRangeStart = 0; - curRange = []; + // Step 2: eliminate the trailing `\n` from each line of each hunk, and, where needed, add + // "\ No newline at end of file". + for (var _i = 0, _hunks = hunks; _i < _hunks.length; _i++) { + var hunk = _hunks[_i]; + for (var _i2 = 0; _i2 < hunk.lines.length; _i2++) { + if (hunk.lines[_i2].endsWith('\n')) { + hunk.lines[_i2] = hunk.lines[_i2].slice(0, -1); + } else { + hunk.lines.splice(_i2 + 1, 0, '\\ No newline at end of file'); + _i2++; // Skip the line we just added, then continue iterating } } - - oldLine += lines.length; - newLine += lines.length; } - }; - - for (var i = 0; i < diff.length; i++) { - _loop(i); + return { + oldFileName: oldFileName, + newFileName: newFileName, + oldHeader: oldHeader, + newHeader: newHeader, + hunks: hunks + }; } - - return { - oldFileName: oldFileName, - newFileName: newFileName, - oldHeader: oldHeader, - newHeader: newHeader, - hunks: hunks - }; } function formatPatch(diff) { if (Array.isArray(diff)) { return diff.map(formatPatch).join('\n'); } - var ret = []; - if (diff.oldFileName == diff.newFileName) { ret.push('Index: ' + diff.oldFileName); } - ret.push('==================================================================='); ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); - for (var i = 0; i < diff.hunks.length; i++) { - var hunk = diff.hunks[i]; // Unified Diff Format quirk: If the chunk size is 0, + var hunk = diff.hunks[i]; + // Unified Diff Format quirk: If the chunk size is 0, // the first number is one lower than one would expect. // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 - if (hunk.oldLines === 0) { hunk.oldStart -= 1; } - if (hunk.newLines === 0) { hunk.newStart -= 1; } - ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); ret.push.apply(ret, hunk.lines); } - return ret.join('\n') + '\n'; } function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options)); + var _options2; + if (typeof options === 'function') { + options = { + callback: options + }; + } + if (!((_options2 = options) !== null && _options2 !== void 0 && _options2.callback)) { + var patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); + if (!patchObj) { + return; + } + return formatPatch(patchObj); + } else { + var _options3 = options, + _callback2 = _options3.callback; + structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, _objectSpread2(_objectSpread2({}, options), {}, { + callback: function callback(patchObj) { + if (!patchObj) { + _callback2(); + } else { + _callback2(formatPatch(patchObj)); + } + } + })); + } } function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); } + /** + * Split `text` into an array of lines, including the trailing newline character (where present) + */ + function splitLines(text) { + var hasTrailingNl = text.endsWith('\n'); + var result = text.split('\n').map(function (line) { + return line + '\n'; + }); + if (hasTrailingNl) { + result.pop(); + } else { + result.push(result.pop().slice(0, -1)); + } + return result; + } + function arrayEqual(a, b) { if (a.length !== b.length) { return false; } - return arrayStartsWith(a, b); } function arrayStartsWith(array, start) { if (start.length > array.length) { return false; } - for (var i = 0; i < start.length; i++) { if (start[i] !== array[i]) { return false; } } - return true; } function calcLineCount(hunk) { var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines), - oldLines = _calcOldNewLineCount.oldLines, - newLines = _calcOldNewLineCount.newLines; - + oldLines = _calcOldNewLineCount.oldLines, + newLines = _calcOldNewLineCount.newLines; if (oldLines !== undefined) { hunk.oldLines = oldLines; } else { delete hunk.oldLines; } - if (newLines !== undefined) { hunk.newLines = newLines; } else { @@ -1235,14 +1674,14 @@ function merge(mine, theirs, base) { mine = loadPatch(mine, base); theirs = loadPatch(theirs, base); - var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning. + var ret = {}; + + // For index we just let it pass through as it doesn't have any necessary meaning. // Leaving sanity checks on this to the API consumer that may know more about the // meaning in their own context. - if (mine.index || theirs.index) { ret.index = mine.index || theirs.index; } - if (mine.newFileName || theirs.newFileName) { if (!fileNameChanged(mine)) { // No header or no change in ours, use theirs (and ours if theirs does not exist) @@ -1264,21 +1703,18 @@ ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); } } - ret.hunks = []; var mineIndex = 0, - theirsIndex = 0, - mineOffset = 0, - theirsOffset = 0; - + theirsIndex = 0, + mineOffset = 0, + theirsOffset = 0; while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { var mineCurrent = mine.hunks[mineIndex] || { - oldStart: Infinity - }, - theirsCurrent = theirs.hunks[theirsIndex] || { - oldStart: Infinity - }; - + oldStart: Infinity + }, + theirsCurrent = theirs.hunks[theirsIndex] || { + oldStart: Infinity + }; if (hunkBefore(mineCurrent, theirsCurrent)) { // This patch does not overlap with any of the others, yay. ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); @@ -1304,30 +1740,23 @@ ret.hunks.push(mergedHunk); } } - return ret; } - function loadPatch(param, base) { if (typeof param === 'string') { if (/^@@/m.test(param) || /^Index:/m.test(param)) { return parsePatch(param)[0]; } - if (!base) { throw new Error('Must provide a base reference or pass in a patch'); } - return structuredPatch(undefined, undefined, base, param); } - return param; } - function fileNameChanged(patch) { return patch.newFileName && patch.newFileName !== patch.oldFileName; } - function selectField(index, mine, theirs) { if (mine === theirs) { return mine; @@ -1339,11 +1768,9 @@ }; } } - function hunkBefore(test, check) { return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; } - function cloneHunk(hunk, offset) { return { oldStart: hunk.oldStart, @@ -1353,39 +1780,37 @@ lines: hunk.lines }; } - function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { // This will generally result in a conflicted hunk, but there are cases where the context // is the only overlap where we can successfully merge the content here. var mine = { - offset: mineOffset, - lines: mineLines, - index: 0 - }, - their = { - offset: theirOffset, - lines: theirLines, - index: 0 - }; // Handle any leading content + offset: mineOffset, + lines: mineLines, + index: 0 + }, + their = { + offset: theirOffset, + lines: theirLines, + index: 0 + }; + // Handle any leading content insertLeading(hunk, mine, their); - insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each. + insertLeading(hunk, their, mine); + // Now in the overlap content. Scan through and select the best changes from each. while (mine.index < mine.lines.length && their.index < their.lines.length) { var mineCurrent = mine.lines[mine.index], - theirCurrent = their.lines[their.index]; - + theirCurrent = their.lines[their.index]; if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { // Both modified ... mutualChange(hunk, mine, their); } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { var _hunk$lines; - // Mine inserted (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine))); } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { var _hunk$lines2; - // Theirs inserted (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their))); } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { @@ -1403,57 +1828,44 @@ // Context mismatch conflict(hunk, collectChange(mine), collectChange(their)); } - } // Now push anything that may be remaining - + } + // Now push anything that may be remaining insertTrailing(hunk, mine); insertTrailing(hunk, their); calcLineCount(hunk); } - function mutualChange(hunk, mine, their) { var myChanges = collectChange(mine), - theirChanges = collectChange(their); - + theirChanges = collectChange(their); if (allRemoves(myChanges) && allRemoves(theirChanges)) { // Special case for remove changes that are supersets of one another if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { var _hunk$lines3; - (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges)); - return; } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { var _hunk$lines4; - (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges)); - return; } } else if (arrayEqual(myChanges, theirChanges)) { var _hunk$lines5; - (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges)); - return; } - conflict(hunk, myChanges, theirChanges); } - function removal(hunk, mine, their, swap) { var myChanges = collectChange(mine), - theirChanges = collectContext(their, myChanges); - + theirChanges = collectContext(their, myChanges); if (theirChanges.merged) { var _hunk$lines6; - (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged)); } else { conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); } } - function conflict(hunk, mine, their) { hunk.conflict = true; hunk.lines.push({ @@ -1462,7 +1874,6 @@ theirs: their }); } - function insertLeading(hunk, insert, their) { while (insert.offset < their.offset && insert.index < insert.lines.length) { var line = insert.lines[insert.index++]; @@ -1470,25 +1881,22 @@ insert.offset++; } } - function insertTrailing(hunk, insert) { while (insert.index < insert.lines.length) { var line = insert.lines[insert.index++]; hunk.lines.push(line); } } - function collectChange(state) { var ret = [], - operation = state.lines[state.index][0]; - + operation = state.lines[state.index][0]; while (state.index < state.lines.length) { - var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. + var line = state.lines[state.index]; + // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. if (operation === '-' && line[0] === '+') { operation = '+'; } - if (operation === line[0]) { ret.push(line); state.index++; @@ -1496,39 +1904,35 @@ break; } } - return ret; } - function collectContext(state, matchChanges) { var changes = [], - merged = [], - matchIndex = 0, - contextChanges = false, - conflicted = false; - + merged = [], + matchIndex = 0, + contextChanges = false, + conflicted = false; while (matchIndex < matchChanges.length && state.index < state.lines.length) { var change = state.lines[state.index], - match = matchChanges[matchIndex]; // Once we've hit our add, then we are done + match = matchChanges[matchIndex]; + // Once we've hit our add, then we are done if (match[0] === '+') { break; } - contextChanges = contextChanges || change[0] !== ' '; merged.push(match); - matchIndex++; // Consume any additions in the other block as a conflict to attempt - // to pull in the remaining context after this + matchIndex++; + // Consume any additions in the other block as a conflict to attempt + // to pull in the remaining context after this if (change[0] === '+') { conflicted = true; - while (change[0] === '+') { changes.push(change); change = state.lines[++state.index]; } } - if (match.substr(1) === change.substr(1)) { changes.push(change); state.index++; @@ -1536,44 +1940,35 @@ conflicted = true; } } - if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { conflicted = true; } - if (conflicted) { return changes; } - while (matchIndex < matchChanges.length) { merged.push(matchChanges[matchIndex++]); } - return { merged: merged, changes: changes }; } - function allRemoves(changes) { return changes.reduce(function (prev, change) { return prev && change[0] === '-'; }, true); } - function skipRemoveSuperset(state, removeChanges, delta) { for (var i = 0; i < delta; i++) { var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); - if (state.lines[state.index + i] !== ' ' + changeContent) { return false; } } - state.index += delta; return true; } - function calcOldNewLineCount(lines) { var oldLines = 0; var newLines = 0; @@ -1581,7 +1976,6 @@ if (typeof line !== 'string') { var myCount = calcOldNewLineCount(line.mine); var theirCount = calcOldNewLineCount(line.theirs); - if (oldLines !== undefined) { if (myCount.oldLines === theirCount.oldLines) { oldLines += myCount.oldLines; @@ -1589,7 +1983,6 @@ oldLines = undefined; } } - if (newLines !== undefined) { if (myCount.newLines === theirCount.newLines) { newLines += myCount.newLines; @@ -1601,7 +1994,6 @@ if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { newLines++; } - if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { oldLines++; } @@ -1617,7 +2009,6 @@ if (Array.isArray(structuredPatch)) { return structuredPatch.map(reversePatch).reverse(); } - return _objectSpread2(_objectSpread2({}, structuredPatch), {}, { oldFileName: structuredPatch.newFileName, oldHeader: structuredPatch.newHeader, @@ -1629,16 +2020,13 @@ oldStart: hunk.newStart, newLines: hunk.oldLines, newStart: hunk.oldStart, - linedelimiters: hunk.linedelimiters, lines: hunk.lines.map(function (l) { if (l.startsWith('-')) { return "+".concat(l.slice(1)); } - if (l.startsWith('+')) { return "-".concat(l.slice(1)); } - return l; }) }; @@ -1649,12 +2037,10 @@ // See: http://code.google.com/p/google-diff-match-patch/wiki/API function convertChangesToDMP(changes) { var ret = [], - change, - operation; - + change, + operation; for (var i = 0; i < changes.length; i++) { change = changes[i]; - if (change.added) { operation = 1; } else if (change.removed) { @@ -1662,37 +2048,29 @@ } else { operation = 0; } - ret.push([operation, change.value]); } - return ret; } function convertChangesToXML(changes) { var ret = []; - for (var i = 0; i < changes.length; i++) { var change = changes[i]; - if (change.added) { ret.push(''); } else if (change.removed) { ret.push(''); } - ret.push(escapeHTML(change.value)); - if (change.added) { ret.push(''); } else if (change.removed) { ret.push(''); } } - return ret.join(''); } - function escapeHTML(s) { var n = s; n = n.replace(/&/g, '&'); @@ -1725,6 +2103,4 @@ exports.reversePatch = reversePatch; exports.structuredPatch = structuredPatch; - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); +})); diff --git a/deps/npm/node_modules/diff/dist/diff.min.js b/deps/npm/node_modules/diff/dist/diff.min.js index 078bcc5c2e6a73..4d96b763e537a1 100644 --- a/deps/npm/node_modules/diff/dist/diff.min.js +++ b/deps/npm/node_modules/diff/dist/diff.min.js @@ -1 +1,37 @@ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).Diff={})}(this,function(e){"use strict";function t(){}t.prototype={diff:function(s,a,e){var n,t=2=c&&f<=v+1)return d([{value:this.join(a),count:a.length}]);var m=-1/0,g=1/0;function w(){for(var e=Math.max(m,-p);e<=Math.min(g,p);e+=2){var n=void 0,t=h[e-1],r=h[e+1];t&&(h[e-1]=void 0);var i,o=!1;r&&(i=r.oldPos-e,o=r&&0<=i&&i=c&&f<=v+1)return d(function(e,n,t,r,i){var o,l=[];for(;n;)l.push(n),o=n.previousComponent,delete n.previousComponent,n=o;l.reverse();for(var s=0,a=l.length,u=0,d=0;se.length?t:e}),p.value=e.join(c)):p.value=e.join(t.slice(u,u+p.count)),u+=p.count,p.added||(d+=p.count))}var h=l[a-1];1=c&&(g=Math.min(g,e-1)),f<=v+1&&(m=Math.max(m,e+1))}else h[e]=void 0}p++}if(r)!function e(){setTimeout(function(){return il?r():void(w()||e())},0)}();else for(;p<=i&&Date.now()<=l;){var y=w();if(y)return y}},addToPath:function(e,n,t,r){var i=e.lastComponent;return i&&i.added===n&&i.removed===t?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:n,removed:t,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:n,removed:t,previousComponent:i}}},extractCommon:function(e,n,t,r){for(var i=n.length,o=t.length,l=e.oldPos,s=l-r,a=0;s+1e.length)&&(n=e.length);for(var t=0,r=new Array(n);t=c.length-2&&a.length<=f.context&&(i=/\n$/.test(u),o=/\n$/.test(d),l=0==a.length&&m.length>r.oldLines,!i&&l&&0e.length)return!1;for(var t=0;t"):i.removed&&t.push(""),t.push((n=i.value,n.replace(/&/g,"&").replace(//g,">").replace(/"/g,"""))),i.added?t.push(""):i.removed&&t.push("")}return t.join("")},e.createPatch=function(e,n,t,r,i,o){return b(e,e,n,t,r,i,o)},e.createTwoFilesPatch=b,e.diffArrays=function(e,n,t){return g.diff(e,n,t)},e.diffChars=function(e,n,t){return r.diff(e,n,t)},e.diffCss=function(e,n,t){return d.diff(e,n,t)},e.diffJson=function(e,n,t){return v.diff(e,n,t)},e.diffLines=L,e.diffSentences=function(e,n,t){return u.diff(e,n,t)},e.diffTrimmedLines=function(e,n,t){var r=i(t,{ignoreWhitespace:!0});return a.diff(e,n,r)},e.diffWords=function(e,n,t){return t=i(t,{ignoreWhitespace:!0}),s.diff(e,n,t)},e.diffWordsWithSpace=function(e,n,t){return s.diff(e,n,t)},e.formatPatch=S,e.merge=function(e,n,t){e=N(e,t),n=N(n,t);var r={};(e.index||n.index)&&(r.index=e.index||n.index),(e.newFileName||n.newFileName)&&(P(e)?P(n)?(r.oldFileName=j(r,e.oldFileName,n.oldFileName),r.newFileName=j(r,e.newFileName,n.newFileName),r.oldHeader=j(r,e.oldHeader,n.oldHeader),r.newHeader=j(r,e.newHeader,n.newHeader)):(r.oldFileName=e.oldFileName,r.newFileName=e.newFileName,r.oldHeader=e.oldHeader,r.newHeader=e.newHeader):(r.oldFileName=n.oldFileName||e.oldFileName,r.newFileName=n.newFileName||e.newFileName,r.oldHeader=n.oldHeader||e.oldHeader,r.newHeader=n.newHeader||e.newHeader)),r.hunks=[];for(var i=0,o=0,l=0,s=0;i +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +@license +*/ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).Diff={})}(this,function(e){"use strict";function r(){}function w(e,n,t,r,i){for(var o,l=[];n;)l.push(n),o=n.previousComponent,delete n.previousComponent,n=o;l.reverse();for(var a=0,u=l.length,s=0,f=0;ae.length?n:e}),d.value=e.join(c)):d.value=e.join(t.slice(s,s+d.count)),s+=d.count,d.added||(f+=d.count))}return l}r.prototype={diff:function(l,a){var u=2=d&&c<=v+1)return f(w(s,p[0].lastComponent,a,l,s.useLongestToken));var g=-1/0,m=1/0;function i(){for(var e=Math.max(g,-h);e<=Math.min(m,h);e+=2){var n=void 0,t=p[e-1],r=p[e+1],i=(t&&(p[e-1]=void 0),!1),o=(r&&(o=r.oldPos-e,i=r&&0<=o&&o=d&&c<=v+1)return f(w(s,n.lastComponent,a,l,s.useLongestToken));(p[e]=n).oldPos+1>=d&&(m=Math.min(m,e-1)),c<=v+1&&(g=Math.max(g,e+1))}else p[e]=void 0}h++}if(n)!function e(){setTimeout(function(){if(tr)return n();i()||e()},0)}();else for(;h<=t&&Date.now()<=r;){var o=i();if(o)return o}},addToPath:function(e,n,t,r,i){var o=e.lastComponent;return o&&!i.oneChangePerToken&&o.added===n&&o.removed===t?{oldPos:e.oldPos+r,lastComponent:{count:o.count+1,added:n,removed:t,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:n,removed:t,previousComponent:o}}},extractCommon:function(e,n,t,r,i){for(var o=n.length,l=t.length,a=e.oldPos,u=a-r,s=0;u+1n.length&&(t=e.length-n.length);var r=n.length;e.lengthe.length)&&(n=e.length);for(var t=0,r=new Array(n);te.length)return!1;for(var t=0;t"):r.removed&&n.push(""),n.push(r.value.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")),r.added?n.push(""):r.removed&&n.push("")}return n.join("")},e.createPatch=function(e,n,t,r,i,o){return M(e,e,n,t,r,i,o)},e.createTwoFilesPatch=M,e.diffArrays=function(e,n,t){return F.diff(e,n,t)},e.diffChars=function(e,n,t){return I.diff(e,n,t)},e.diffCss=function(e,n,t){return m.diff(e,n,t)},e.diffJson=function(e,n,t){return x.diff(e,n,t)},e.diffLines=y,e.diffSentences=function(e,n,t){return g.diff(e,n,t)},e.diffTrimmedLines=function(e,n,t){return t=function(e,n){if("function"==typeof e)n.callback=e;else if(e)for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}(t,{ignoreWhitespace:!0}),v.diff(e,n,t)},e.diffWords=function(e,n,t){return null==(null==t?void 0:t.ignoreWhitespace)||t.ignoreWhitespace?i.diff(e,n,t):a(e,n,t)},e.diffWordsWithSpace=a,e.formatPatch=E,e.merge=function(e,n,t){e=J(e,t),n=J(n,t);for(var r={},i=((e.index||n.index)&&(r.index=e.index||n.index),(e.newFileName||n.newFileName)&&(q(e)?q(n)?(r.oldFileName=H(r,e.oldFileName,n.oldFileName),r.newFileName=H(r,e.newFileName,n.newFileName),r.oldHeader=H(r,e.oldHeader,n.oldHeader),r.newHeader=H(r,e.newHeader,n.newHeader)):(r.oldFileName=e.oldFileName,r.newFileName=e.newFileName,r.oldHeader=e.oldHeader,r.newHeader=e.newHeader):(r.oldFileName=n.oldFileName||e.oldFileName,r.newFileName=n.newFileName||e.newFileName,r.oldHeader=n.oldHeader||e.oldHeader,r.newHeader=n.newHeader||e.newHeader)),r.hunks=[],0),o=0,l=0,a=0;i'); } else if (change.removed) { ret.push(''); } - ret.push(escapeHTML(change.value)); - if (change.added) { ret.push(''); } else if (change.removed) { ret.push(''); } } - return ret.join(''); } - function escapeHTML(s) { var n = s; n = n.replace(/&/g, '&'); @@ -39,4 +32,4 @@ function escapeHTML(s) { n = n.replace(/"/g, '"'); return n; } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L3htbC5qcyJdLCJuYW1lcyI6WyJjb252ZXJ0Q2hhbmdlc1RvWE1MIiwiY2hhbmdlcyIsInJldCIsImkiLCJsZW5ndGgiLCJjaGFuZ2UiLCJhZGRlZCIsInB1c2giLCJyZW1vdmVkIiwiZXNjYXBlSFRNTCIsInZhbHVlIiwiam9pbiI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UFRLENBQUM7SUFDcEI7RUFDRjtFQUNBLE9BQU9MLEdBQUcsQ0FBQ1MsSUFBSSxDQUFDLEVBQUUsQ0FBQztBQUNyQjtBQUVBLFNBQVNGLFVBQVVBLENBQUNHLENBQUMsRUFBRTtFQUNyQixJQUFJQyxDQUFDLEdBQUdELENBQUM7RUFDVEMsQ0FBQyxHQUFHQSxDQUFDLENBQUNDLE9BQU8sQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDO0VBQzVCRCxDQUFDLEdBQUdBLENBQUMsQ0FBQ0MsT0FBTyxDQUFDLElBQUksRUFBRSxNQUFNLENBQUM7RUFDM0JELENBQUMsR0FBR0EsQ0FBQyxDQUFDQyxPQUFPLENBQUMsSUFBSSxFQUFFLE1BQU0sQ0FBQztFQUMzQkQsQ0FBQyxHQUFHQSxDQUFDLENBQUNDLE9BQU8sQ0FBQyxJQUFJLEVBQUUsUUFBUSxDQUFDO0VBRTdCLE9BQU9ELENBQUM7QUFDViIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/deps/npm/node_modules/diff/lib/diff/array.js b/deps/npm/node_modules/diff/lib/diff/array.js index 19e36809893c1d..bd0802db42ec22 100644 --- a/deps/npm/node_modules/diff/lib/diff/array.js +++ b/deps/npm/node_modules/diff/lib/diff/array.js @@ -4,20 +4,21 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.diffArrays = diffArrays; exports.arrayDiff = void 0; - +exports.diffArrays = diffArrays; /*istanbul ignore end*/ var /*istanbul ignore start*/ _base = _interopRequireDefault(require("./base")) /*istanbul ignore end*/ ; - /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - /*istanbul ignore end*/ -var arrayDiff = new +var arrayDiff = +/*istanbul ignore start*/ +exports.arrayDiff = +/*istanbul ignore end*/ +new /*istanbul ignore start*/ _base /*istanbul ignore end*/ @@ -26,20 +27,13 @@ _base "default" /*istanbul ignore end*/ ](); - -/*istanbul ignore start*/ -exports.arrayDiff = arrayDiff; - -/*istanbul ignore end*/ arrayDiff.tokenize = function (value) { return value.slice(); }; - arrayDiff.join = arrayDiff.removeEmpty = function (value) { return value; }; - function diffArrays(oldArr, newArr, callback) { return arrayDiff.diff(oldArr, newArr, callback); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2FycmF5LmpzIl0sIm5hbWVzIjpbImFycmF5RGlmZiIsIkRpZmYiLCJ0b2tlbml6ZSIsInZhbHVlIiwic2xpY2UiLCJqb2luIiwicmVtb3ZlRW1wdHkiLCJkaWZmQXJyYXlzIiwib2xkQXJyIiwibmV3QXJyIiwiY2FsbGJhY2siLCJkaWZmIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTs7Ozs7QUFFTyxJQUFNQSxTQUFTLEdBQUc7QUFBSUM7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUEsQ0FBSixFQUFsQjs7Ozs7O0FBQ1BELFNBQVMsQ0FBQ0UsUUFBVixHQUFxQixVQUFTQyxLQUFULEVBQWdCO0FBQ25DLFNBQU9BLEtBQUssQ0FBQ0MsS0FBTixFQUFQO0FBQ0QsQ0FGRDs7QUFHQUosU0FBUyxDQUFDSyxJQUFWLEdBQWlCTCxTQUFTLENBQUNNLFdBQVYsR0FBd0IsVUFBU0gsS0FBVCxFQUFnQjtBQUN2RCxTQUFPQSxLQUFQO0FBQ0QsQ0FGRDs7QUFJTyxTQUFTSSxVQUFULENBQW9CQyxNQUFwQixFQUE0QkMsTUFBNUIsRUFBb0NDLFFBQXBDLEVBQThDO0FBQUUsU0FBT1YsU0FBUyxDQUFDVyxJQUFWLENBQWVILE1BQWYsRUFBdUJDLE1BQXZCLEVBQStCQyxRQUEvQixDQUFQO0FBQWtEIiwic291cmNlc0NvbnRlbnQiOlsiaW1w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ib/diff/base.js index 428e7fd97e8193..d2b4b447f51fe9 100644 --- a/deps/npm/node_modules/diff/lib/diff/base.js +++ b/deps/npm/node_modules/diff/lib/diff/base.js @@ -5,56 +5,47 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = Diff; - /*istanbul ignore end*/ function Diff() {} - Diff.prototype = { /*istanbul ignore start*/ - /*istanbul ignore end*/ diff: function diff(oldString, newString) { /*istanbul ignore start*/ var _options$timeout; - var /*istanbul ignore end*/ options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var callback = options.callback; - if (typeof options === 'function') { callback = options; options = {}; } - - this.options = options; var self = this; - function done(value) { + value = self.postProcess(value, options); if (callback) { setTimeout(function () { - callback(undefined, value); + callback(value); }, 0); return true; } else { return value; } - } // Allow subclasses to massage the input prior to running - + } - oldString = this.castInput(oldString); - newString = this.castInput(newString); - oldString = this.removeEmpty(this.tokenize(oldString)); - newString = this.removeEmpty(this.tokenize(newString)); + // Allow subclasses to massage the input prior to running + oldString = this.castInput(oldString, options); + newString = this.castInput(newString, options); + oldString = this.removeEmpty(this.tokenize(oldString, options)); + newString = this.removeEmpty(this.tokenize(newString, options)); var newLen = newString.length, - oldLen = oldString.length; + oldLen = oldString.length; var editLength = 1; var maxEditLength = newLen + oldLen; - - if (options.maxEditLength) { + if (options.maxEditLength != null) { maxEditLength = Math.min(maxEditLength, options.maxEditLength); } - var maxExecutionTime = /*istanbul ignore start*/ (_options$timeout = @@ -64,17 +55,16 @@ Diff.prototype = { var bestPath = [{ oldPos: -1, lastComponent: undefined - }]; // Seed editLength = 0, i.e. the content starts with the same values - - var newPos = this.extractCommon(bestPath[0], newString, oldString, 0); + }]; + // Seed editLength = 0, i.e. the content starts with the same values + var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options); if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) { // Identity per the equality and tokenizer - return done([{ - value: this.join(newString), - count: newString.length - }]); - } // Once we hit the right edge of the edit graph on some diagonal k, we can + return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken)); + } + + // Once we hit the right edge of the edit graph on some diagonal k, we can // definitely reach the end of the edit graph in no more than k edits, so // there's no point in considering any moves to diagonal k+1 any more (from // which we're guaranteed to need at least k+1 more edits). @@ -91,11 +81,10 @@ Diff.prototype = { // where the new text simply appends d characters on the end of the // original text of length n, the true Myers algorithm will take O(n+d^2) // time while this optimization needs only O(n+d) time. - - var minDiagonalToConsider = -Infinity, - maxDiagonalToConsider = Infinity; // Main worker method. checks all permutations of a given edit length for acceptance. + maxDiagonalToConsider = Infinity; + // Main worker method. checks all permutations of a given edit length for acceptance. function execEditLength() { for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) { var basePath = @@ -104,72 +93,59 @@ Diff.prototype = { /*istanbul ignore end*/ ; var removePath = bestPath[diagonalPath - 1], - addPath = bestPath[diagonalPath + 1]; - + addPath = bestPath[diagonalPath + 1]; if (removePath) { // No one else is going to attempt to use this value, clear it bestPath[diagonalPath - 1] = undefined; } - var canAdd = false; - if (addPath) { // what newPos will be after we do an insertion: var addPathNewPos = addPath.oldPos - diagonalPath; canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen; } - var canRemove = removePath && removePath.oldPos + 1 < oldLen; - if (!canAdd && !canRemove) { // If this path is a terminal then prune bestPath[diagonalPath] = undefined; continue; - } // Select the diagonal that we want to branch from. We select the prior + } + + // Select the diagonal that we want to branch from. We select the prior // path whose position in the old string is the farthest from the origin // and does not pass the bounds of the diff graph - // TODO: Remove the `+ 1` here to make behavior match Myers algorithm - // and prefer to order removals before insertions. - - - if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) { - basePath = self.addToPath(addPath, true, undefined, 0); + if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) { + basePath = self.addToPath(addPath, true, false, 0, options); } else { - basePath = self.addToPath(removePath, undefined, true, 1); + basePath = self.addToPath(removePath, false, true, 1, options); } - - newPos = self.extractCommon(basePath, newString, oldString, diagonalPath); - + newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options); if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) { // If we have hit the end of both strings, then we are done return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken)); } else { bestPath[diagonalPath] = basePath; - if (basePath.oldPos + 1 >= oldLen) { maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1); } - if (newPos + 1 >= newLen) { minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1); } } } - editLength++; - } // Performs the length of edit iteration. Is a bit fugly as this has to support the + } + + // Performs the length of edit iteration. Is a bit fugly as this has to support the // sync and async mode which is never fun. Loops over execEditLength until a value // is produced, or until the edit length exceeds options.maxEditLength (if given), // in which case it will return undefined. - - if (callback) { (function exec() { setTimeout(function () { if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) { return callback(); } - if (!execEditLength()) { exec(); } @@ -178,21 +154,17 @@ Diff.prototype = { } else { while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) { var ret = execEditLength(); - if (ret) { return ret; } } } }, - /*istanbul ignore start*/ - /*istanbul ignore end*/ - addToPath: function addToPath(path, added, removed, oldPosInc) { + addToPath: function addToPath(path, added, removed, oldPosInc, options) { var last = path.lastComponent; - - if (last && last.added === added && last.removed === removed) { + if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) { return { oldPos: path.oldPos + oldPosInc, lastComponent: { @@ -214,104 +186,97 @@ Diff.prototype = { }; } }, - /*istanbul ignore start*/ - /*istanbul ignore end*/ - extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { + extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) { var newLen = newString.length, - oldLen = oldString.length, - oldPos = basePath.oldPos, - newPos = oldPos - diagonalPath, - commonCount = 0; - - while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { + oldLen = oldString.length, + oldPos = basePath.oldPos, + newPos = oldPos - diagonalPath, + commonCount = 0; + while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) { newPos++; oldPos++; commonCount++; + if (options.oneChangePerToken) { + basePath.lastComponent = { + count: 1, + previousComponent: basePath.lastComponent, + added: false, + removed: false + }; + } } - - if (commonCount) { + if (commonCount && !options.oneChangePerToken) { basePath.lastComponent = { count: commonCount, - previousComponent: basePath.lastComponent + previousComponent: basePath.lastComponent, + added: false, + removed: false }; } - basePath.oldPos = oldPos; return newPos; }, - /*istanbul ignore start*/ - /*istanbul ignore end*/ - equals: function equals(left, right) { - if (this.options.comparator) { - return this.options.comparator(left, right); + equals: function equals(left, right, options) { + if (options.comparator) { + return options.comparator(left, right); } else { - return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); + return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase(); } }, - /*istanbul ignore start*/ - /*istanbul ignore end*/ removeEmpty: function removeEmpty(array) { var ret = []; - for (var i = 0; i < array.length; i++) { if (array[i]) { ret.push(array[i]); } } - return ret; }, - /*istanbul ignore start*/ - /*istanbul ignore end*/ castInput: function castInput(value) { return value; }, - /*istanbul ignore start*/ - /*istanbul ignore end*/ tokenize: function tokenize(value) { - return value.split(''); + return Array.from(value); }, - /*istanbul ignore start*/ - /*istanbul ignore end*/ join: function join(chars) { return chars.join(''); + }, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + postProcess: function postProcess(changeObjects) { + return changeObjects; } }; - function buildValues(diff, lastComponent, newString, oldString, useLongestToken) { // First we convert our linked list of components in reverse order to an // array in the right order: var components = []; var nextComponent; - while (lastComponent) { components.push(lastComponent); nextComponent = lastComponent.previousComponent; delete lastComponent.previousComponent; lastComponent = nextComponent; } - components.reverse(); var componentPos = 0, - componentLen = components.length, - newPos = 0, - oldPos = 0; - + componentLen = components.length, + newPos = 0, + oldPos = 0; for (; componentPos < componentLen; componentPos++) { var component = components[componentPos]; - if (!component.removed) { if (!component.added && useLongestToken) { var value = newString.slice(newPos, newPos + component.count); @@ -323,36 +288,17 @@ function buildValues(diff, lastComponent, newString, oldString, useLongestToken) } else { component.value = diff.join(newString.slice(newPos, newPos + component.count)); } + newPos += component.count; - newPos += component.count; // Common case - + // Common case if (!component.added) { oldPos += component.count; } } else { component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); - oldPos += component.count; // Reverse add and remove so removes are output first to match common convention - // The diffing algorithm is tied to add then remove output and this is the simplest - // route to get the desired output with minimal overhead. - - if (componentPos && components[componentPos - 1].added) { - var tmp = components[componentPos - 1]; - components[componentPos - 1] = components[componentPos]; - components[componentPos] = tmp; - } + oldPos += component.count; } - } // Special case handle for when one terminal is ignored (i.e. whitespace). - // For this case we merge the terminal into the prior string and drop the change. - // This is only available for string mode. - - - var finalComponent = components[componentLen - 1]; - - if (componentLen > 1 && typeof finalComponent.value === 'string' && (finalComponent.added || finalComponent.removed) && diff.equals('', finalComponent.value)) { - components[componentLen - 2].value += finalComponent.value; - components.pop(); } - return components; } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOlsiRGlmZiIsInByb3RvdHlwZSIsImRpZmYiLCJvbGRTdHJpbmciLCJuZXdTdHJpbmciLCJvcHRpb25zIiwiY2FsbGJhY2siLCJzZWxmIiwiZG9uZSIsInZhbHVlIiwic2V0VGltZW91dCIsInVuZGVmaW5lZCIsImNhc3RJbnB1dCIsInJlbW92ZUVtcHR5IiwidG9rZW5pemUiLCJuZXdMZW4iLCJsZW5ndGgiLCJvbGRMZW4iLCJlZGl0TGVuZ3RoIiwibWF4RWRpdExlbmd0aCIsIk1hdGgiLCJtaW4iLCJtYXhFeGVjdXRpb25UaW1lIiwidGltZW91dCIsIkluZmluaXR5IiwiYWJvcnRBZnRlclRpbWVz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9uZW50c1tjb21wb25lbnRQb3NdO1xuICAgICAgICBjb21wb25lbnRzW2NvbXBvbmVudFBvc10gPSB0bXA7XG4gICAgICB9XG4gICAgfVxuICB9XG5cbiAgLy8gU3BlY2lhbCBjYXNlIGhhbmRsZSBmb3Igd2hlbiBvbmUgdGVybWluYWwgaXMgaWdub3JlZCAoaS5lLiB3aGl0ZXNwYWNlKS5cbiAgLy8gRm9yIHRoaXMgY2FzZSB3ZSBtZXJnZSB0aGUgdGVybWluYWwgaW50byB0aGUgcHJpb3Igc3RyaW5nIGFuZCBkcm9wIHRoZSBjaGFuZ2UuXG4gIC8vIFRoaXMgaXMgb25seSBhdmFpbGFibGUgZm9yIHN0cmluZyBtb2RlLlxuICBsZXQgZmluYWxDb21wb25lbnQgPSBjb21wb25lbnRzW2NvbXBvbmVudExlbiAtIDFdO1xuICBpZiAoY29tcG9uZW50TGVuID4gMVxuICAgICAgJiYgdHlwZW9mIGZpbmFsQ29tcG9uZW50LnZhbHVlID09PSAnc3RyaW5nJ1xuICAgICAgJiYgKGZpbmFsQ29tcG9uZW50LmFkZGVkIHx8IGZpbmFsQ29tcG9uZW50LnJlbW92ZWQpXG4gICAgICAmJiBkaWZmLmVxdWFscygnJywgZmluYWxDb21wb25lbnQudmFsdWUpKSB7XG4gICAgY29tcG9uZW50c1tjb21wb25lbnRMZW4gLSAyXS52YWx1ZSArPSBmaW5hbENvbXBvbmVudC52YWx1ZTtcbiAgICBjb21wb25lbnRzLnBvcCgpO1xuICB9XG5cbiAgcmV0dXJuIGNvbXBvbmVudHM7XG59XG4iXX0= +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJEaWZmIiwicHJvdG90eXBlIiwiZGlmZiIsIm9sZFN0cmluZyIsIm5ld1N0cmluZyIsIl9vcHRpb25zJHRpbWVvdXQiLCJvcHRpb25zIiwiYXJndW1lbnRzIiwibGVuZ3RoIiwidW5kZWZpbmVkIiwiY2FsbGJhY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RUFBRUEsTUFBTSxHQUFHOEMsU0FBUyxDQUFDdEIsS0FBSyxDQUFDLENBQUM7TUFDaEY7TUFDQXhCLE1BQU0sSUFBSThDLFNBQVMsQ0FBQ3RCLEtBQUs7O01BRXpCO01BQ0EsSUFBSSxDQUFDc0IsU0FBUyxDQUFDM0IsS0FBSyxFQUFFO1FBQ3BCckIsTUFBTSxJQUFJZ0QsU0FBUyxDQUFDdEIsS0FBSztNQUMzQjtJQUNGLENBQUMsTUFBTTtNQUNMc0IsU0FBUyxDQUFDbkUsS0FBSyxHQUFHWCxJQUFJLENBQUNzRSxJQUFJLENBQUNyRSxTQUFTLENBQUM4RSxLQUFLLENBQUNqRCxNQUFNLEVBQUVBLE1BQU0sR0FBR2dELFNBQVMsQ0FBQ3RCLEtBQUssQ0FBQyxDQUFDO01BQzlFMUIsTUFBTSxJQUFJZ0QsU0FBUyxDQUFDdEIsS0FBSztJQUMzQjtFQUNGO0VBRUEsT0FBT2lCLFVBQVU7QUFDbkIiLCJpZ25vcmVMaXN0IjpbXX0= diff --git a/deps/npm/node_modules/diff/lib/diff/character.js b/deps/npm/node_modules/diff/lib/diff/character.js index 7ddfa205e394a9..6a3cf1c4d76d8d 100644 --- a/deps/npm/node_modules/diff/lib/diff/character.js +++ b/deps/npm/node_modules/diff/lib/diff/character.js @@ -4,20 +4,21 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.diffChars = diffChars; exports.characterDiff = void 0; - +exports.diffChars = diffChars; /*istanbul ignore end*/ var /*istanbul ignore start*/ _base = _interopRequireDefault(require("./base")) /*istanbul ignore end*/ ; - /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - /*istanbul ignore end*/ -var characterDiff = new +var characterDiff = +/*istanbul ignore start*/ +exports.characterDiff = +/*istanbul ignore end*/ +new /*istanbul ignore start*/ _base /*istanbul ignore end*/ @@ -26,12 +27,7 @@ _base "default" /*istanbul ignore end*/ ](); - -/*istanbul ignore start*/ -exports.characterDiff = characterDiff; - -/*istanbul ignore end*/ function diffChars(oldStr, newStr, options) { return characterDiff.diff(oldStr, newStr, options); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2NoYXJhY3Rlci5qcyJdLCJuYW1lcyI6WyJjaGFyYWN0ZXJEaWZmIiwiRGlmZiIsImRpZmZDaGFycyIsIm9sZFN0ciIsIm5ld1N0ciIsIm9wdGlvbnMiLCJkaWZmIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTs7Ozs7QUFFTyxJQUFNQSxhQUFhLEdBQUc7QUFBSUM7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUEsQ0FBSixFQUF0Qjs7Ozs7O0FBQ0EsU0FBU0MsU0FBVCxDQUFtQkMsTUFBbkIsRUFBMkJDLE1BQTNCLEVBQW1DQyxPQUFuQyxFQUE0QztBQUFFLFNBQU9MLGFBQWEsQ0FBQ00sSUFBZCxDQUFtQkgsTUFBbkIsRUFBMkJDLE1BQTNCLEVBQW1DQyxPQUFuQyxDQUFQO0FBQXFEIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IERpZmYgZnJvbSAnLi9iYXNlJztcblxuZXhwb3J0IGNvbnN0IGNoYXJhY3RlckRpZmYgPSBuZXcgRGlmZigpO1xuZXhwb3J0IGZ1bmN0aW9uIGRpZmZDaGFycyhvbGRTdHIsIG5ld1N0ciwgb3B0aW9ucykgeyByZXR1cm4gY2hhcmFjdGVyRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTsgfVxuIl19 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfYmFzZSIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJ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node_modules/diff/lib/diff/css.js b/deps/npm/node_modules/diff/lib/diff/css.js index e3ad1fcba5f0eb..63218278183472 100644 --- a/deps/npm/node_modules/diff/lib/diff/css.js +++ b/deps/npm/node_modules/diff/lib/diff/css.js @@ -4,20 +4,21 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.diffCss = diffCss; exports.cssDiff = void 0; - +exports.diffCss = diffCss; /*istanbul ignore end*/ var /*istanbul ignore start*/ _base = _interopRequireDefault(require("./base")) /*istanbul ignore end*/ ; - /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - /*istanbul ignore end*/ -var cssDiff = new +var cssDiff = +/*istanbul ignore start*/ +exports.cssDiff = +/*istanbul ignore end*/ +new /*istanbul ignore start*/ _base /*istanbul ignore end*/ @@ -26,16 +27,10 @@ _base "default" /*istanbul ignore end*/ ](); - -/*istanbul ignore start*/ -exports.cssDiff = cssDiff; - -/*istanbul ignore end*/ cssDiff.tokenize = function (value) { return value.split(/([{}:;,]|\s+)/); }; - function diffCss(oldStr, newStr, callback) { return cssDiff.diff(oldStr, newStr, callback); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Nzcy5qcyJdLCJuYW1lcyI6WyJjc3NEaWZmIiwiRGlmZiIsInRva2VuaXplIiwidmFsdWUiLCJzcGxpdCIsImRpZmZDc3MiLCJvbGRTdHIiLCJuZXdTdHIiLCJjYWxsYmFjayIsImRpZmYiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBOzs7OztBQUVPLElBQU1BLE9BQU8sR0FBRztBQUFJQztBQUFBQTtBQUFBQTtBQUFBQTtBQUFBQTtBQUFBQTtBQUFBQTtBQUFBQSxDQUFKLEVBQWhCOzs7Ozs7QUFDUEQsT0FBTyxDQUFDRSxRQUFSLEdBQW1CLFVB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100644 --- a/deps/npm/node_modules/diff/lib/diff/json.js +++ b/deps/npm/node_modules/diff/lib/diff/json.js @@ -4,30 +4,28 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.diffJson = diffJson; exports.canonicalize = canonicalize; +exports.diffJson = diffJson; exports.jsonDiff = void 0; - /*istanbul ignore end*/ var /*istanbul ignore start*/ _base = _interopRequireDefault(require("./base")) /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _line = require("./line") /*istanbul ignore end*/ ; - /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +/*istanbul ignore end*/ +var jsonDiff = +/*istanbul ignore start*/ +exports.jsonDiff = /*istanbul ignore end*/ -var objectPrototypeToString = Object.prototype.toString; -var jsonDiff = new +new /*istanbul ignore start*/ _base /*istanbul ignore end*/ @@ -35,13 +33,9 @@ _base /*istanbul ignore start*/ "default" /*istanbul ignore end*/ -](); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a +](); +// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: - -/*istanbul ignore start*/ -exports.jsonDiff = jsonDiff; - -/*istanbul ignore end*/ jsonDiff.useLongestToken = true; jsonDiff.tokenize = /*istanbul ignore start*/ @@ -52,26 +46,28 @@ _line lineDiff /*istanbul ignore end*/ .tokenize; - -jsonDiff.castInput = function (value) { - /*istanbul ignore start*/ - var _this$options = - /*istanbul ignore end*/ - this.options, - undefinedReplacement = _this$options.undefinedReplacement, - _this$options$stringi = _this$options.stringifyReplacer, - stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) - /*istanbul ignore start*/ - { - return ( - /*istanbul ignore end*/ - typeof v === 'undefined' ? undefinedReplacement : v - ); - } : _this$options$stringi; +jsonDiff.castInput = function (value, options) { + var + /*istanbul ignore start*/ + /*istanbul ignore end*/ + undefinedReplacement = options.undefinedReplacement, + /*istanbul ignore start*/ + _options$stringifyRep = + /*istanbul ignore end*/ + options.stringifyReplacer, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + stringifyReplacer = _options$stringifyRep === void 0 ? function (k, v) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + typeof v === 'undefined' ? undefinedReplacement : v + ); + } : _options$stringifyRep; return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); }; - -jsonDiff.equals = function (left, right) { +jsonDiff.equals = function (left, right, options) { return ( /*istanbul ignore start*/ _base @@ -80,52 +76,42 @@ jsonDiff.equals = function (left, right) { /*istanbul ignore start*/ "default" /*istanbul ignore end*/ - ].prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')) + ].prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'), options) ); }; - function diffJson(oldObj, newObj, options) { return jsonDiff.diff(oldObj, newObj, options); -} // This function handles the presence of circular references by bailing out when encountering an -// object that is already on the "stack" of items being processed. Accepts an optional replacer - +} +// This function handles the presence of circular references by bailing out when encountering an +// object that is already on the "stack" of items being processed. Accepts an optional replacer function canonicalize(obj, stack, replacementStack, replacer, key) { stack = stack || []; replacementStack = replacementStack || []; - if (replacer) { obj = replacer(key, obj); } - var i; - for (i = 0; i < stack.length; i += 1) { if (stack[i] === obj) { return replacementStack[i]; } } - var canonicalizedObj; - - if ('[object Array]' === objectPrototypeToString.call(obj)) { + if ('[object Array]' === Object.prototype.toString.call(obj)) { stack.push(obj); canonicalizedObj = new Array(obj.length); replacementStack.push(canonicalizedObj); - for (i = 0; i < obj.length; i += 1) { canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); } - stack.pop(); replacementStack.pop(); return canonicalizedObj; } - if (obj && obj.toJSON) { obj = obj.toJSON(); } - if ( /*istanbul ignore start*/ _typeof( @@ -134,30 +120,24 @@ function canonicalize(obj, stack, replacementStack, replacer, key) { stack.push(obj); canonicalizedObj = {}; replacementStack.push(canonicalizedObj); - var sortedKeys = [], - _key; - + _key; for (_key in obj) { /* istanbul ignore else */ - if (obj.hasOwnProperty(_key)) { + if (Object.prototype.hasOwnProperty.call(obj, _key)) { sortedKeys.push(_key); } } - sortedKeys.sort(); - for (i = 0; i < sortedKeys.length; i += 1) { _key = sortedKeys[i]; canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); } - stack.pop(); replacementStack.pop(); } else { canonicalizedObj = obj; } - return canonicalizedObj; } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2pzb24uanMiXSwibmFtZXMiOlsib2JqZWN0UHJvdG90eXBlVG9TdHJpbmciLCJPYmplY3QiLCJwcm90b3R5cGUiLCJ0b1N0cmluZyIsImpzb25EaWZmIiwiRGlmZiIsInVzZUxvbmdlc3RUb2tlbiIsInRva2VuaXplIiwibGluZURpZmYiLCJjYXN0SW5wdXQiLCJ2YWx1ZSIsIm9wdGlvbnMiLCJ1bmRlZmluZWRSZXBsYWNlbWVudCIsInN0cmluZ2lmeVJlcGxhY2VyIiwiayIsInYiLCJKU09OIiwic3RyaW5naWZ5IiwiY2Fub25pY2FsaXplIiwiZXF1YWxzIiwibGVmdCIsInJpZ2h0IiwiY2FsbCIsInJlcGxhY2UiLCJk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yxHQUFHLENBQUMsQ0FBQztJQUNYVixnQkFBZ0IsQ0FBQ1UsR0FBRyxDQUFDLENBQUM7RUFDeEIsQ0FBQyxNQUFNO0lBQ0xMLGdCQUFnQixHQUFHeEMsR0FBRztFQUN4QjtFQUNBLE9BQU93QyxnQkFBZ0I7QUFDekIiLCJpZ25vcmVMaXN0IjpbXX0= diff --git a/deps/npm/node_modules/diff/lib/diff/line.js b/deps/npm/node_modules/diff/lib/diff/line.js index 30bc74d2383d20..71f3f2471d1094 100644 --- a/deps/npm/node_modules/diff/lib/diff/line.js +++ b/deps/npm/node_modules/diff/lib/diff/line.js @@ -7,24 +7,24 @@ Object.defineProperty(exports, "__esModule", { exports.diffLines = diffLines; exports.diffTrimmedLines = diffTrimmedLines; exports.lineDiff = void 0; - /*istanbul ignore end*/ var /*istanbul ignore start*/ _base = _interopRequireDefault(require("./base")) /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _params = require("../util/params") /*istanbul ignore end*/ ; - /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - /*istanbul ignore end*/ -var lineDiff = new +var lineDiff = +/*istanbul ignore start*/ +exports.lineDiff = +/*istanbul ignore end*/ +new /*istanbul ignore start*/ _base /*istanbul ignore end*/ @@ -33,52 +33,79 @@ _base "default" /*istanbul ignore end*/ ](); - -/*istanbul ignore start*/ -exports.lineDiff = lineDiff; - -/*istanbul ignore end*/ -lineDiff.tokenize = function (value) { - if (this.options.stripTrailingCr) { +lineDiff.tokenize = function (value, options) { + if (options.stripTrailingCr) { // remove one \r before \n to match GNU diff's --strip-trailing-cr behavior value = value.replace(/\r\n/g, '\n'); } - var retLines = [], - linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line + linesAndNewlines = value.split(/(\n|\r\n)/); + // Ignore the final empty token that occurs if the string ends with a new line if (!linesAndNewlines[linesAndNewlines.length - 1]) { linesAndNewlines.pop(); - } // Merge the content and line separators into single tokens - + } + // Merge the content and line separators into single tokens for (var i = 0; i < linesAndNewlines.length; i++) { var line = linesAndNewlines[i]; - - if (i % 2 && !this.options.newlineIsToken) { + if (i % 2 && !options.newlineIsToken) { retLines[retLines.length - 1] += line; } else { - if (this.options.ignoreWhitespace) { - line = line.trim(); - } - retLines.push(line); } } - return retLines; }; - +lineDiff.equals = function (left, right, options) { + // If we're ignoring whitespace, we need to normalise lines by stripping + // whitespace before checking equality. (This has an annoying interaction + // with newlineIsToken that requires special handling: if newlines get their + // own token, then we DON'T want to trim the *newline* tokens down to empty + // strings, since this would cause us to treat whitespace-only line content + // as equal to a separator between lines, which would be weird and + // inconsistent with the documented behavior of the options.) + if (options.ignoreWhitespace) { + if (!options.newlineIsToken || !left.includes('\n')) { + left = left.trim(); + } + if (!options.newlineIsToken || !right.includes('\n')) { + right = right.trim(); + } + } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) { + if (left.endsWith('\n')) { + left = left.slice(0, -1); + } + if (right.endsWith('\n')) { + right = right.slice(0, -1); + } + } + return ( + /*istanbul ignore start*/ + _base + /*istanbul ignore end*/ + [ + /*istanbul ignore start*/ + "default" + /*istanbul ignore end*/ + ].prototype.equals.call(this, left, right, options) + ); +}; function diffLines(oldStr, newStr, callback) { return lineDiff.diff(oldStr, newStr, callback); } +// Kept for backwards compatibility. This is a rather arbitrary wrapper method +// that just calls `diffLines` with `ignoreWhitespace: true`. It's confusing to +// have two ways to do exactly the same thing in the API, so we no longer +// document this one (library users should explicitly use `diffLines` with +// `ignoreWhitespace: true` instead) but we keep it around to maintain +// compatibility with code that used old versions. function diffTrimmedLines(oldStr, newStr, callback) { var options = /*istanbul ignore start*/ (0, /*istanbul ignore end*/ - /*istanbul ignore start*/ _params /*istanbul ignore end*/ @@ -91,4 +118,4 @@ function diffTrimmedLines(oldStr, newStr, callback) { }); return lineDiff.diff(oldStr, newStr, options); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY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6f58f9f9..66d8ece2669383 100644 --- a/deps/npm/node_modules/diff/lib/diff/sentence.js +++ b/deps/npm/node_modules/diff/lib/diff/sentence.js @@ -6,18 +6,19 @@ Object.defineProperty(exports, "__esModule", { }); exports.diffSentences = diffSentences; exports.sentenceDiff = void 0; - /*istanbul ignore end*/ var /*istanbul ignore start*/ _base = _interopRequireDefault(require("./base")) /*istanbul ignore end*/ ; - /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - /*istanbul ignore end*/ -var sentenceDiff = new +var sentenceDiff = +/*istanbul ignore start*/ +exports.sentenceDiff = +/*istanbul ignore end*/ +new /*istanbul ignore start*/ _base /*istanbul ignore end*/ @@ -26,16 +27,10 @@ _base "default" /*istanbul ignore end*/ ](); - -/*istanbul ignore start*/ -exports.sentenceDiff = sentenceDiff; - -/*istanbul ignore end*/ sentenceDiff.tokenize = function (value) { return value.split(/(\S.+?[.!?])(?=\s+|$)/); }; - function diffSentences(oldStr, newStr, callback) { return sentenceDiff.diff(oldStr, newStr, callback); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3NlbnRlbmNlLmpzIl0sIm5hbWVzIjpbInNlbnRlbmNlRGlmZiIsIkRpZmYiLCJ0b2tlbml6ZSIsInZhbHVlIiwic3BsaXQiLCJkaWZmU2VudGVuY2VzIiwib2xkU3RyIiwibmV3U3RyIiwiY2FsbGJhY2siLCJkaWZmIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTs7Ozs7QUFHTyxJQUFNQSxZQUFZLEdBQUc7QUFBSUM7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUEsQ0FBSixFQUFyQjs7Ozs7O0FBQ1BELFlBQVksQ0FBQ0UsUUFBYixHQUF3QixVQUFTQyxLQ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FBUSxDQUFDO0FBQUUiLCJpZ25vcmVMaXN0IjpbXX0= diff --git a/deps/npm/node_modules/diff/lib/diff/word.js b/deps/npm/node_modules/diff/lib/diff/word.js index cef7fe17befe60..64919db4f6ff9e 100644 --- a/deps/npm/node_modules/diff/lib/diff/word.js +++ b/deps/npm/node_modules/diff/lib/diff/word.js @@ -6,23 +6,19 @@ Object.defineProperty(exports, "__esModule", { }); exports.diffWords = diffWords; exports.diffWordsWithSpace = diffWordsWithSpace; -exports.wordDiff = void 0; - +exports.wordWithSpaceDiff = exports.wordDiff = void 0; /*istanbul ignore end*/ var /*istanbul ignore start*/ _base = _interopRequireDefault(require("./base")) /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ -_params = require("../util/params") +_string = require("../util/string") /*istanbul ignore end*/ ; - /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - /*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode // @@ -42,9 +38,43 @@ _params = require("../util/params") // - U+02DC ˜ ˜ Small Tilde // - U+02DD ˝ ˝ Double Acute Accent // Latin Extended Additional, 1E00–1EFF -var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; -var reWhitespace = /\S/; -var wordDiff = new +var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}"; + +// Each token is one of the following: +// - A punctuation mark plus the surrounding whitespace +// - A word plus the surrounding whitespace +// - Pure whitespace (but only in the special case where this the entire text +// is just whitespace) +// +// We have to include surrounding whitespace in the tokens because the two +// alternative approaches produce horribly broken results: +// * If we just discard the whitespace, we can't fully reproduce the original +// text from the sequence of tokens and any attempt to render the diff will +// get the whitespace wrong. +// * If we have separate tokens for whitespace, then in a typical text every +// second token will be a single space character. But this often results in +// the optimal diff between two texts being a perverse one that preserves +// the spaces between words but deletes and reinserts actual common words. +// See https://github.com/kpdecker/jsdiff/issues/160#issuecomment-1866099640 +// for an example. +// +// Keeping the surrounding whitespace of course has implications for .equals +// and .join, not just .tokenize. + +// This regex does NOT fully implement the tokenization rules described above. +// Instead, it gives runs of whitespace their own "token". The tokenize method +// then handles stitching whitespace tokens onto adjacent word or punctuation +// tokens. +var tokenizeIncludingWhitespace = new RegExp( +/*istanbul ignore start*/ +"[".concat( +/*istanbul ignore end*/ +extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), 'ug'); +var wordDiff = +/*istanbul ignore start*/ +exports.wordDiff = +/*istanbul ignore end*/ +new /*istanbul ignore start*/ _base /*istanbul ignore end*/ @@ -53,56 +83,461 @@ _base "default" /*istanbul ignore end*/ ](); - -/*istanbul ignore start*/ -exports.wordDiff = wordDiff; - -/*istanbul ignore end*/ -wordDiff.equals = function (left, right) { - if (this.options.ignoreCase) { +wordDiff.equals = function (left, right, options) { + if (options.ignoreCase) { left = left.toLowerCase(); right = right.toLowerCase(); } - - return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); + return left.trim() === right.trim(); }; - wordDiff.tokenize = function (value) { - // All whitespace symbols except newline group into one token, each newline - in separate token - var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set. - - for (var i = 0; i < tokens.length - 1; i++) { - // If we have an empty string in the next field and we have only word chars before and after, merge - if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { - tokens[i] += tokens[i + 2]; - tokens.splice(i + 1, 2); - i--; + /*istanbul ignore start*/ + var + /*istanbul ignore end*/ + options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var parts; + if (options.intlSegmenter) { + if (options.intlSegmenter.resolvedOptions().granularity != 'word') { + throw new Error('The segmenter passed must have a granularity of "word"'); } + parts = Array.from(options.intlSegmenter.segment(value), function (segment) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + segment.segment + ); + }); + } else { + parts = value.match(tokenizeIncludingWhitespace) || []; } - + var tokens = []; + var prevPart = null; + parts.forEach(function (part) { + if (/\s/.test(part)) { + if (prevPart == null) { + tokens.push(part); + } else { + tokens.push(tokens.pop() + part); + } + } else if (/\s/.test(prevPart)) { + if (tokens[tokens.length - 1] == prevPart) { + tokens.push(tokens.pop() + part); + } else { + tokens.push(prevPart + part); + } + } else { + tokens.push(part); + } + prevPart = part; + }); return tokens; }; - +wordDiff.join = function (tokens) { + // Tokens being joined here will always have appeared consecutively in the + // same text, so we can simply strip off the leading whitespace from all the + // tokens except the first (and except any whitespace-only tokens - but such + // a token will always be the first and only token anyway) and then join them + // and the whitespace around words and punctuation will end up correct. + return tokens.map(function (token, i) { + if (i == 0) { + return token; + } else { + return token.replace(/^\s+/, ''); + } + }).join(''); +}; +wordDiff.postProcess = function (changes, options) { + if (!changes || options.oneChangePerToken) { + return changes; + } + var lastKeep = null; + // Change objects representing any insertion or deletion since the last + // "keep" change object. There can be at most one of each. + var insertion = null; + var deletion = null; + changes.forEach(function (change) { + if (change.added) { + insertion = change; + } else if (change.removed) { + deletion = change; + } else { + if (insertion || deletion) { + // May be false at start of text + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change); + } + lastKeep = change; + insertion = null; + deletion = null; + } + }); + if (insertion || deletion) { + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null); + } + return changes; +}; function diffWords(oldStr, newStr, options) { - options = - /*istanbul ignore start*/ - (0, - /*istanbul ignore end*/ - + // This option has never been documented and never will be (it's clearer to + // just call `diffWordsWithSpace` directly if you need that behavior), but + // has existed in jsdiff for a long time, so we retain support for it here + // for the sake of backwards compatibility. + if ( /*istanbul ignore start*/ - _params + ( /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - generateOptions) - /*istanbul ignore end*/ - (options, { - ignoreWhitespace: true - }); + options === null || options === void 0 ? void 0 : options.ignoreWhitespace) != null && !options.ignoreWhitespace) { + return diffWordsWithSpace(oldStr, newStr, options); + } return wordDiff.diff(oldStr, newStr, options); } +function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) { + // Before returning, we tidy up the leading and trailing whitespace of the + // change objects to eliminate cases where trailing whitespace in one object + // is repeated as leading whitespace in the next. + // Below are examples of the outcomes we want here to explain the code. + // I=insert, K=keep, D=delete + // 1. diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want: K:'foo ' D:'bar ' K:'baz' + // + // 2. Diffing 'foo bar baz' vs 'foo qux baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' I:' qux ' K:' baz' + // After cleanup, we want K:'foo ' D:'bar' I:'qux' K:' baz' + // + // 3. Diffing 'foo\nbar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:'\nbar ' K:' baz' + // After cleanup, we want K'foo' D:'\nbar' K:' baz' + // + // 4. Diffing 'foo baz' vs 'foo\nbar baz' + // Prior to cleanup, we have K:'foo\n' I:'\nbar ' K:' baz' + // After cleanup, we ideally want K'foo' I:'\nbar' K:' baz' + // but don't actually manage this currently (the pre-cleanup change + // objects don't contain enough information to make it possible). + // + // 5. Diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want K:'foo ' D:' bar ' K:'baz' + // + // Our handling is unavoidably imperfect in the case where there's a single + // indel between keeps and the whitespace has changed. For instance, consider + // diffing 'foo\tbar\nbaz' vs 'foo baz'. Unless we create an extra change + // object to represent the insertion of the space character (which isn't even + // a token), we have no way to avoid losing information about the texts' + // original whitespace in the result we return. Still, we do our best to + // output something that will look sensible if we e.g. print it with + // insertions in green and deletions in red. + // Between two "keep" change objects (or before the first or after the last + // change object), we can have either: + // * A "delete" followed by an "insert" + // * Just an "insert" + // * Just a "delete" + // We handle the three cases separately. + if (deletion && insertion) { + var oldWsPrefix = deletion.value.match(/^\s*/)[0]; + var oldWsSuffix = deletion.value.match(/\s*$/)[0]; + var newWsPrefix = insertion.value.match(/^\s*/)[0]; + var newWsSuffix = insertion.value.match(/\s*$/)[0]; + if (startKeep) { + var commonWsPrefix = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + longestCommonPrefix) + /*istanbul ignore end*/ + (oldWsPrefix, newWsPrefix); + startKeep.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + replaceSuffix) + /*istanbul ignore end*/ + (startKeep.value, newWsPrefix, commonWsPrefix); + deletion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removePrefix) + /*istanbul ignore end*/ + (deletion.value, commonWsPrefix); + insertion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removePrefix) + /*istanbul ignore end*/ + (insertion.value, commonWsPrefix); + } + if (endKeep) { + var commonWsSuffix = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + longestCommonSuffix) + /*istanbul ignore end*/ + (oldWsSuffix, newWsSuffix); + endKeep.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + replacePrefix) + /*istanbul ignore end*/ + (endKeep.value, newWsSuffix, commonWsSuffix); + deletion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removeSuffix) + /*istanbul ignore end*/ + (deletion.value, commonWsSuffix); + insertion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removeSuffix) + /*istanbul ignore end*/ + (insertion.value, commonWsSuffix); + } + } else if (insertion) { + // The whitespaces all reflect what was in the new text rather than + // the old, so we essentially have no information about whitespace + // insertion or deletion. We just want to dedupe the whitespace. + // We do that by having each change object keep its trailing + // whitespace and deleting duplicate leading whitespace where + // present. + if (startKeep) { + insertion.value = insertion.value.replace(/^\s*/, ''); + } + if (endKeep) { + endKeep.value = endKeep.value.replace(/^\s*/, ''); + } + // otherwise we've got a deletion and no insertion + } else if (startKeep && endKeep) { + var newWsFull = endKeep.value.match(/^\s*/)[0], + delWsStart = deletion.value.match(/^\s*/)[0], + delWsEnd = deletion.value.match(/\s*$/)[0]; + + // Any whitespace that comes straight after startKeep in both the old and + // new texts, assign to startKeep and remove from the deletion. + var newWsStart = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + longestCommonPrefix) + /*istanbul ignore end*/ + (newWsFull, delWsStart); + deletion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removePrefix) + /*istanbul ignore end*/ + (deletion.value, newWsStart); + + // Any whitespace that comes straight before endKeep in both the old and + // new texts, and hasn't already been assigned to startKeep, assign to + // endKeep and remove from the deletion. + var newWsEnd = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + longestCommonSuffix) + /*istanbul ignore end*/ + ( + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removePrefix) + /*istanbul ignore end*/ + (newWsFull, newWsStart), delWsEnd); + deletion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removeSuffix) + /*istanbul ignore end*/ + (deletion.value, newWsEnd); + endKeep.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + replacePrefix) + /*istanbul ignore end*/ + (endKeep.value, newWsFull, newWsEnd); + + // If there's any whitespace from the new text that HASN'T already been + // assigned, assign it to the start: + startKeep.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + replaceSuffix) + /*istanbul ignore end*/ + (startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length)); + } else if (endKeep) { + // We are at the start of the text. Preserve all the whitespace on + // endKeep, and just remove whitespace from the end of deletion to the + // extent that it overlaps with the start of endKeep. + var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0]; + var deletionWsSuffix = deletion.value.match(/\s*$/)[0]; + var overlap = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + maximumOverlap) + /*istanbul ignore end*/ + (deletionWsSuffix, endKeepWsPrefix); + deletion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removeSuffix) + /*istanbul ignore end*/ + (deletion.value, overlap); + } else if (startKeep) { + // We are at the END of the text. Preserve all the whitespace on + // startKeep, and just remove whitespace from the start of deletion to + // the extent that it overlaps with the end of startKeep. + var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0]; + var deletionWsPrefix = deletion.value.match(/^\s*/)[0]; + var _overlap = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + maximumOverlap) + /*istanbul ignore end*/ + (startKeepWsSuffix, deletionWsPrefix); + deletion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removePrefix) + /*istanbul ignore end*/ + (deletion.value, _overlap); + } +} +var wordWithSpaceDiff = +/*istanbul ignore start*/ +exports.wordWithSpaceDiff = +/*istanbul ignore end*/ +new +/*istanbul ignore start*/ +_base +/*istanbul ignore end*/ +[ +/*istanbul ignore start*/ +"default" +/*istanbul ignore end*/ +](); +wordWithSpaceDiff.tokenize = function (value) { + // Slightly different to the tokenizeIncludingWhitespace regex used above in + // that this one treats each individual newline as a distinct tokens, rather + // than merging them into other surrounding whitespace. This was requested + // in https://github.com/kpdecker/jsdiff/issues/180 & + // https://github.com/kpdecker/jsdiff/issues/211 + var regex = new RegExp( + /*istanbul ignore start*/ + "(\\r?\\n)|[".concat( + /*istanbul ignore end*/ + extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), 'ug'); + return value.match(regex) || []; +}; function diffWordsWithSpace(oldStr, newStr, options) { - return wordDiff.diff(oldStr, newStr, options); + return wordWithSpaceDiff.diff(oldStr, newStr, options); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3dvcmQuanMiXSwibmFtZXMiOlsiZXh0ZW5kZWRXb3JkQ2hhcnMiLCJyZVdoaXRlc3BhY2UiLCJ3b3JkRGlmZiIsIkRpZmYiLCJlcXVhbHMiLCJsZWZ0IiwicmlnaHQiLCJvcHRpb25zIiwiaWdub3JlQ2FzZSIsInRvTG93ZXJDYXNlIiwiaWdub3Jl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/diff/lib/index.es6.js b/deps/npm/node_modules/diff/lib/index.es6.js index a0ace0182ab14e..6e872723d85817 100644 --- a/deps/npm/node_modules/diff/lib/index.es6.js +++ b/deps/npm/node_modules/diff/lib/index.es6.js @@ -2,59 +2,52 @@ function Diff() {} Diff.prototype = { diff: function diff(oldString, newString) { var _options$timeout; - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var callback = options.callback; - if (typeof options === 'function') { callback = options; options = {}; } - - this.options = options; var self = this; - function done(value) { + value = self.postProcess(value, options); if (callback) { setTimeout(function () { - callback(undefined, value); + callback(value); }, 0); return true; } else { return value; } - } // Allow subclasses to massage the input prior to running - + } - oldString = this.castInput(oldString); - newString = this.castInput(newString); - oldString = this.removeEmpty(this.tokenize(oldString)); - newString = this.removeEmpty(this.tokenize(newString)); + // Allow subclasses to massage the input prior to running + oldString = this.castInput(oldString, options); + newString = this.castInput(newString, options); + oldString = this.removeEmpty(this.tokenize(oldString, options)); + newString = this.removeEmpty(this.tokenize(newString, options)); var newLen = newString.length, - oldLen = oldString.length; + oldLen = oldString.length; var editLength = 1; var maxEditLength = newLen + oldLen; - - if (options.maxEditLength) { + if (options.maxEditLength != null) { maxEditLength = Math.min(maxEditLength, options.maxEditLength); } - var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity; var abortAfterTimestamp = Date.now() + maxExecutionTime; var bestPath = [{ oldPos: -1, lastComponent: undefined - }]; // Seed editLength = 0, i.e. the content starts with the same values - - var newPos = this.extractCommon(bestPath[0], newString, oldString, 0); + }]; + // Seed editLength = 0, i.e. the content starts with the same values + var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options); if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) { // Identity per the equality and tokenizer - return done([{ - value: this.join(newString), - count: newString.length - }]); - } // Once we hit the right edge of the edit graph on some diagonal k, we can + return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken)); + } + + // Once we hit the right edge of the edit graph on some diagonal k, we can // definitely reach the end of the edit graph in no more than k edits, so // there's no point in considering any moves to diagonal k+1 any more (from // which we're guaranteed to need at least k+1 more edits). @@ -71,81 +64,67 @@ Diff.prototype = { // where the new text simply appends d characters on the end of the // original text of length n, the true Myers algorithm will take O(n+d^2) // time while this optimization needs only O(n+d) time. - - var minDiagonalToConsider = -Infinity, - maxDiagonalToConsider = Infinity; // Main worker method. checks all permutations of a given edit length for acceptance. + maxDiagonalToConsider = Infinity; + // Main worker method. checks all permutations of a given edit length for acceptance. function execEditLength() { for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) { var basePath = void 0; var removePath = bestPath[diagonalPath - 1], - addPath = bestPath[diagonalPath + 1]; - + addPath = bestPath[diagonalPath + 1]; if (removePath) { // No one else is going to attempt to use this value, clear it bestPath[diagonalPath - 1] = undefined; } - var canAdd = false; - if (addPath) { // what newPos will be after we do an insertion: var addPathNewPos = addPath.oldPos - diagonalPath; canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen; } - var canRemove = removePath && removePath.oldPos + 1 < oldLen; - if (!canAdd && !canRemove) { // If this path is a terminal then prune bestPath[diagonalPath] = undefined; continue; - } // Select the diagonal that we want to branch from. We select the prior + } + + // Select the diagonal that we want to branch from. We select the prior // path whose position in the old string is the farthest from the origin // and does not pass the bounds of the diff graph - // TODO: Remove the `+ 1` here to make behavior match Myers algorithm - // and prefer to order removals before insertions. - - - if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) { - basePath = self.addToPath(addPath, true, undefined, 0); + if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) { + basePath = self.addToPath(addPath, true, false, 0, options); } else { - basePath = self.addToPath(removePath, undefined, true, 1); + basePath = self.addToPath(removePath, false, true, 1, options); } - - newPos = self.extractCommon(basePath, newString, oldString, diagonalPath); - + newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options); if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) { // If we have hit the end of both strings, then we are done return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken)); } else { bestPath[diagonalPath] = basePath; - if (basePath.oldPos + 1 >= oldLen) { maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1); } - if (newPos + 1 >= newLen) { minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1); } } } - editLength++; - } // Performs the length of edit iteration. Is a bit fugly as this has to support the + } + + // Performs the length of edit iteration. Is a bit fugly as this has to support the // sync and async mode which is never fun. Loops over execEditLength until a value // is produced, or until the edit length exceeds options.maxEditLength (if given), // in which case it will return undefined. - - if (callback) { (function exec() { setTimeout(function () { if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) { return callback(); } - if (!execEditLength()) { exec(); } @@ -154,17 +133,15 @@ Diff.prototype = { } else { while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) { var ret = execEditLength(); - if (ret) { return ret; } } } }, - addToPath: function addToPath(path, added, removed, oldPosInc) { + addToPath: function addToPath(path, added, removed, oldPosInc, options) { var last = path.lastComponent; - - if (last && last.added === added && last.removed === removed) { + if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) { return { oldPos: path.oldPos + oldPosInc, lastComponent: { @@ -186,80 +163,83 @@ Diff.prototype = { }; } }, - extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { + extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) { var newLen = newString.length, - oldLen = oldString.length, - oldPos = basePath.oldPos, - newPos = oldPos - diagonalPath, - commonCount = 0; - - while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { + oldLen = oldString.length, + oldPos = basePath.oldPos, + newPos = oldPos - diagonalPath, + commonCount = 0; + while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) { newPos++; oldPos++; commonCount++; + if (options.oneChangePerToken) { + basePath.lastComponent = { + count: 1, + previousComponent: basePath.lastComponent, + added: false, + removed: false + }; + } } - - if (commonCount) { + if (commonCount && !options.oneChangePerToken) { basePath.lastComponent = { count: commonCount, - previousComponent: basePath.lastComponent + previousComponent: basePath.lastComponent, + added: false, + removed: false }; } - basePath.oldPos = oldPos; return newPos; }, - equals: function equals(left, right) { - if (this.options.comparator) { - return this.options.comparator(left, right); + equals: function equals(left, right, options) { + if (options.comparator) { + return options.comparator(left, right); } else { - return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); + return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase(); } }, removeEmpty: function removeEmpty(array) { var ret = []; - for (var i = 0; i < array.length; i++) { if (array[i]) { ret.push(array[i]); } } - return ret; }, castInput: function castInput(value) { return value; }, tokenize: function tokenize(value) { - return value.split(''); + return Array.from(value); }, join: function join(chars) { return chars.join(''); + }, + postProcess: function postProcess(changeObjects) { + return changeObjects; } }; - function buildValues(diff, lastComponent, newString, oldString, useLongestToken) { // First we convert our linked list of components in reverse order to an // array in the right order: var components = []; var nextComponent; - while (lastComponent) { components.push(lastComponent); nextComponent = lastComponent.previousComponent; delete lastComponent.previousComponent; lastComponent = nextComponent; } - components.reverse(); var componentPos = 0, - componentLen = components.length, - newPos = 0, - oldPos = 0; - + componentLen = components.length, + newPos = 0, + oldPos = 0; for (; componentPos < componentLen; componentPos++) { var component = components[componentPos]; - if (!component.removed) { if (!component.added && useLongestToken) { var value = newString.slice(newPos, newPos + component.count); @@ -271,36 +251,17 @@ function buildValues(diff, lastComponent, newString, oldString, useLongestToken) } else { component.value = diff.join(newString.slice(newPos, newPos + component.count)); } + newPos += component.count; - newPos += component.count; // Common case - + // Common case if (!component.added) { oldPos += component.count; } } else { component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); - oldPos += component.count; // Reverse add and remove so removes are output first to match common convention - // The diffing algorithm is tied to add then remove output and this is the simplest - // route to get the desired output with minimal overhead. - - if (componentPos && components[componentPos - 1].added) { - var tmp = components[componentPos - 1]; - components[componentPos - 1] = components[componentPos]; - components[componentPos] = tmp; - } + oldPos += component.count; } - } // Special case handle for when one terminal is ignored (i.e. whitespace). - // For this case we merge the terminal into the prior string and drop the change. - // This is only available for string mode. - - - var finalComponent = components[componentLen - 1]; - - if (componentLen > 1 && typeof finalComponent.value === 'string' && (finalComponent.added || finalComponent.removed) && diff.equals('', finalComponent.value)) { - components[componentLen - 2].value += finalComponent.value; - components.pop(); } - return components; } @@ -309,21 +270,114 @@ function diffChars(oldStr, newStr, options) { return characterDiff.diff(oldStr, newStr, options); } -function generateOptions(options, defaults) { - if (typeof options === 'function') { - defaults.callback = options; - } else if (options) { - for (var name in options) { - /* istanbul ignore else */ - if (options.hasOwnProperty(name)) { - defaults[name] = options[name]; - } +function longestCommonPrefix(str1, str2) { + var i; + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[i] != str2[i]) { + return str1.slice(0, i); } } + return str1.slice(0, i); +} +function longestCommonSuffix(str1, str2) { + var i; - return defaults; + // Unlike longestCommonPrefix, we need a special case to handle all scenarios + // where we return the empty string since str1.slice(-0) will return the + // entire string. + if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) { + return ''; + } + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) { + return str1.slice(-i); + } + } + return str1.slice(-i); +} +function replacePrefix(string, oldPrefix, newPrefix) { + if (string.slice(0, oldPrefix.length) != oldPrefix) { + throw Error("string ".concat(JSON.stringify(string), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug")); + } + return newPrefix + string.slice(oldPrefix.length); +} +function replaceSuffix(string, oldSuffix, newSuffix) { + if (!oldSuffix) { + return string + newSuffix; + } + if (string.slice(-oldSuffix.length) != oldSuffix) { + throw Error("string ".concat(JSON.stringify(string), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug")); + } + return string.slice(0, -oldSuffix.length) + newSuffix; +} +function removePrefix(string, oldPrefix) { + return replacePrefix(string, oldPrefix, ''); +} +function removeSuffix(string, oldSuffix) { + return replaceSuffix(string, oldSuffix, ''); +} +function maximumOverlap(string1, string2) { + return string2.slice(0, overlapCount(string1, string2)); +} + +// Nicked from https://stackoverflow.com/a/60422853/1709587 +function overlapCount(a, b) { + // Deal with cases where the strings differ in length + var startA = 0; + if (a.length > b.length) { + startA = a.length - b.length; + } + var endB = b.length; + if (a.length < b.length) { + endB = a.length; + } + // Create a back-reference for each index + // that should be followed in case of a mismatch. + // We only need B to make these references: + var map = Array(endB); + var k = 0; // Index that lags behind j + map[0] = 0; + for (var j = 1; j < endB; j++) { + if (b[j] == b[k]) { + map[j] = map[k]; // skip over the same character (optional optimisation) + } else { + map[j] = k; + } + while (k > 0 && b[j] != b[k]) { + k = map[k]; + } + if (b[j] == b[k]) { + k++; + } + } + // Phase 2: use these references while iterating over A + k = 0; + for (var i = startA; i < a.length; i++) { + while (k > 0 && a[i] != b[k]) { + k = map[k]; + } + if (a[i] == b[k]) { + k++; + } + } + return k; +} + +/** + * Returns true if the string consistently uses Windows line endings. + */ +function hasOnlyWinLineEndings(string) { + return string.includes('\r\n') && !string.startsWith('\n') && !string.match(/[^\r]\n/); +} + +/** + * Returns true if the string consistently uses Unix line endings. + */ +function hasOnlyUnixLineEndings(string) { + return !string.includes('\r\n') && string.includes('\n'); } +// Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode // // Ranges and exceptions: // Latin-1 Supplement, 0080–00FF @@ -341,82 +395,330 @@ function generateOptions(options, defaults) { // - U+02DC ˜ ˜ Small Tilde // - U+02DD ˝ ˝ Double Acute Accent // Latin Extended Additional, 1E00–1EFF +var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}"; -var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; -var reWhitespace = /\S/; +// Each token is one of the following: +// - A punctuation mark plus the surrounding whitespace +// - A word plus the surrounding whitespace +// - Pure whitespace (but only in the special case where this the entire text +// is just whitespace) +// +// We have to include surrounding whitespace in the tokens because the two +// alternative approaches produce horribly broken results: +// * If we just discard the whitespace, we can't fully reproduce the original +// text from the sequence of tokens and any attempt to render the diff will +// get the whitespace wrong. +// * If we have separate tokens for whitespace, then in a typical text every +// second token will be a single space character. But this often results in +// the optimal diff between two texts being a perverse one that preserves +// the spaces between words but deletes and reinserts actual common words. +// See https://github.com/kpdecker/jsdiff/issues/160#issuecomment-1866099640 +// for an example. +// +// Keeping the surrounding whitespace of course has implications for .equals +// and .join, not just .tokenize. + +// This regex does NOT fully implement the tokenization rules described above. +// Instead, it gives runs of whitespace their own "token". The tokenize method +// then handles stitching whitespace tokens onto adjacent word or punctuation +// tokens. +var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), 'ug'); var wordDiff = new Diff(); - -wordDiff.equals = function (left, right) { - if (this.options.ignoreCase) { +wordDiff.equals = function (left, right, options) { + if (options.ignoreCase) { left = left.toLowerCase(); right = right.toLowerCase(); } - - return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); + return left.trim() === right.trim(); }; - wordDiff.tokenize = function (value) { - // All whitespace symbols except newline group into one token, each newline - in separate token - var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set. - - for (var i = 0; i < tokens.length - 1; i++) { - // If we have an empty string in the next field and we have only word chars before and after, merge - if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { - tokens[i] += tokens[i + 2]; - tokens.splice(i + 1, 2); - i--; + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var parts; + if (options.intlSegmenter) { + if (options.intlSegmenter.resolvedOptions().granularity != 'word') { + throw new Error('The segmenter passed must have a granularity of "word"'); } + parts = Array.from(options.intlSegmenter.segment(value), function (segment) { + return segment.segment; + }); + } else { + parts = value.match(tokenizeIncludingWhitespace) || []; } - + var tokens = []; + var prevPart = null; + parts.forEach(function (part) { + if (/\s/.test(part)) { + if (prevPart == null) { + tokens.push(part); + } else { + tokens.push(tokens.pop() + part); + } + } else if (/\s/.test(prevPart)) { + if (tokens[tokens.length - 1] == prevPart) { + tokens.push(tokens.pop() + part); + } else { + tokens.push(prevPart + part); + } + } else { + tokens.push(part); + } + prevPart = part; + }); return tokens; }; - -function diffWords(oldStr, newStr, options) { - options = generateOptions(options, { - ignoreWhitespace: true +wordDiff.join = function (tokens) { + // Tokens being joined here will always have appeared consecutively in the + // same text, so we can simply strip off the leading whitespace from all the + // tokens except the first (and except any whitespace-only tokens - but such + // a token will always be the first and only token anyway) and then join them + // and the whitespace around words and punctuation will end up correct. + return tokens.map(function (token, i) { + if (i == 0) { + return token; + } else { + return token.replace(/^\s+/, ''); + } + }).join(''); +}; +wordDiff.postProcess = function (changes, options) { + if (!changes || options.oneChangePerToken) { + return changes; + } + var lastKeep = null; + // Change objects representing any insertion or deletion since the last + // "keep" change object. There can be at most one of each. + var insertion = null; + var deletion = null; + changes.forEach(function (change) { + if (change.added) { + insertion = change; + } else if (change.removed) { + deletion = change; + } else { + if (insertion || deletion) { + // May be false at start of text + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change); + } + lastKeep = change; + insertion = null; + deletion = null; + } }); + if (insertion || deletion) { + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null); + } + return changes; +}; +function diffWords(oldStr, newStr, options) { + // This option has never been documented and never will be (it's clearer to + // just call `diffWordsWithSpace` directly if you need that behavior), but + // has existed in jsdiff for a long time, so we retain support for it here + // for the sake of backwards compatibility. + if ((options === null || options === void 0 ? void 0 : options.ignoreWhitespace) != null && !options.ignoreWhitespace) { + return diffWordsWithSpace(oldStr, newStr, options); + } return wordDiff.diff(oldStr, newStr, options); } +function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) { + // Before returning, we tidy up the leading and trailing whitespace of the + // change objects to eliminate cases where trailing whitespace in one object + // is repeated as leading whitespace in the next. + // Below are examples of the outcomes we want here to explain the code. + // I=insert, K=keep, D=delete + // 1. diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want: K:'foo ' D:'bar ' K:'baz' + // + // 2. Diffing 'foo bar baz' vs 'foo qux baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' I:' qux ' K:' baz' + // After cleanup, we want K:'foo ' D:'bar' I:'qux' K:' baz' + // + // 3. Diffing 'foo\nbar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:'\nbar ' K:' baz' + // After cleanup, we want K'foo' D:'\nbar' K:' baz' + // + // 4. Diffing 'foo baz' vs 'foo\nbar baz' + // Prior to cleanup, we have K:'foo\n' I:'\nbar ' K:' baz' + // After cleanup, we ideally want K'foo' I:'\nbar' K:' baz' + // but don't actually manage this currently (the pre-cleanup change + // objects don't contain enough information to make it possible). + // + // 5. Diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want K:'foo ' D:' bar ' K:'baz' + // + // Our handling is unavoidably imperfect in the case where there's a single + // indel between keeps and the whitespace has changed. For instance, consider + // diffing 'foo\tbar\nbaz' vs 'foo baz'. Unless we create an extra change + // object to represent the insertion of the space character (which isn't even + // a token), we have no way to avoid losing information about the texts' + // original whitespace in the result we return. Still, we do our best to + // output something that will look sensible if we e.g. print it with + // insertions in green and deletions in red. + + // Between two "keep" change objects (or before the first or after the last + // change object), we can have either: + // * A "delete" followed by an "insert" + // * Just an "insert" + // * Just a "delete" + // We handle the three cases separately. + if (deletion && insertion) { + var oldWsPrefix = deletion.value.match(/^\s*/)[0]; + var oldWsSuffix = deletion.value.match(/\s*$/)[0]; + var newWsPrefix = insertion.value.match(/^\s*/)[0]; + var newWsSuffix = insertion.value.match(/\s*$/)[0]; + if (startKeep) { + var commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix); + startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix); + deletion.value = removePrefix(deletion.value, commonWsPrefix); + insertion.value = removePrefix(insertion.value, commonWsPrefix); + } + if (endKeep) { + var commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix); + endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix); + deletion.value = removeSuffix(deletion.value, commonWsSuffix); + insertion.value = removeSuffix(insertion.value, commonWsSuffix); + } + } else if (insertion) { + // The whitespaces all reflect what was in the new text rather than + // the old, so we essentially have no information about whitespace + // insertion or deletion. We just want to dedupe the whitespace. + // We do that by having each change object keep its trailing + // whitespace and deleting duplicate leading whitespace where + // present. + if (startKeep) { + insertion.value = insertion.value.replace(/^\s*/, ''); + } + if (endKeep) { + endKeep.value = endKeep.value.replace(/^\s*/, ''); + } + // otherwise we've got a deletion and no insertion + } else if (startKeep && endKeep) { + var newWsFull = endKeep.value.match(/^\s*/)[0], + delWsStart = deletion.value.match(/^\s*/)[0], + delWsEnd = deletion.value.match(/\s*$/)[0]; + + // Any whitespace that comes straight after startKeep in both the old and + // new texts, assign to startKeep and remove from the deletion. + var newWsStart = longestCommonPrefix(newWsFull, delWsStart); + deletion.value = removePrefix(deletion.value, newWsStart); + + // Any whitespace that comes straight before endKeep in both the old and + // new texts, and hasn't already been assigned to startKeep, assign to + // endKeep and remove from the deletion. + var newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd); + deletion.value = removeSuffix(deletion.value, newWsEnd); + endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd); + + // If there's any whitespace from the new text that HASN'T already been + // assigned, assign it to the start: + startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length)); + } else if (endKeep) { + // We are at the start of the text. Preserve all the whitespace on + // endKeep, and just remove whitespace from the end of deletion to the + // extent that it overlaps with the start of endKeep. + var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0]; + var deletionWsSuffix = deletion.value.match(/\s*$/)[0]; + var overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix); + deletion.value = removeSuffix(deletion.value, overlap); + } else if (startKeep) { + // We are at the END of the text. Preserve all the whitespace on + // startKeep, and just remove whitespace from the start of deletion to + // the extent that it overlaps with the end of startKeep. + var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0]; + var deletionWsPrefix = deletion.value.match(/^\s*/)[0]; + var _overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix); + deletion.value = removePrefix(deletion.value, _overlap); + } +} +var wordWithSpaceDiff = new Diff(); +wordWithSpaceDiff.tokenize = function (value) { + // Slightly different to the tokenizeIncludingWhitespace regex used above in + // that this one treats each individual newline as a distinct tokens, rather + // than merging them into other surrounding whitespace. This was requested + // in https://github.com/kpdecker/jsdiff/issues/180 & + // https://github.com/kpdecker/jsdiff/issues/211 + var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), 'ug'); + return value.match(regex) || []; +}; function diffWordsWithSpace(oldStr, newStr, options) { - return wordDiff.diff(oldStr, newStr, options); + return wordWithSpaceDiff.diff(oldStr, newStr, options); } -var lineDiff = new Diff(); +function generateOptions(options, defaults) { + if (typeof options === 'function') { + defaults.callback = options; + } else if (options) { + for (var name in options) { + /* istanbul ignore else */ + if (options.hasOwnProperty(name)) { + defaults[name] = options[name]; + } + } + } + return defaults; +} -lineDiff.tokenize = function (value) { - if (this.options.stripTrailingCr) { +var lineDiff = new Diff(); +lineDiff.tokenize = function (value, options) { + if (options.stripTrailingCr) { // remove one \r before \n to match GNU diff's --strip-trailing-cr behavior value = value.replace(/\r\n/g, '\n'); } - var retLines = [], - linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line + linesAndNewlines = value.split(/(\n|\r\n)/); + // Ignore the final empty token that occurs if the string ends with a new line if (!linesAndNewlines[linesAndNewlines.length - 1]) { linesAndNewlines.pop(); - } // Merge the content and line separators into single tokens - + } + // Merge the content and line separators into single tokens for (var i = 0; i < linesAndNewlines.length; i++) { var line = linesAndNewlines[i]; - - if (i % 2 && !this.options.newlineIsToken) { + if (i % 2 && !options.newlineIsToken) { retLines[retLines.length - 1] += line; } else { - if (this.options.ignoreWhitespace) { - line = line.trim(); - } - retLines.push(line); } } - return retLines; }; - +lineDiff.equals = function (left, right, options) { + // If we're ignoring whitespace, we need to normalise lines by stripping + // whitespace before checking equality. (This has an annoying interaction + // with newlineIsToken that requires special handling: if newlines get their + // own token, then we DON'T want to trim the *newline* tokens down to empty + // strings, since this would cause us to treat whitespace-only line content + // as equal to a separator between lines, which would be weird and + // inconsistent with the documented behavior of the options.) + if (options.ignoreWhitespace) { + if (!options.newlineIsToken || !left.includes('\n')) { + left = left.trim(); + } + if (!options.newlineIsToken || !right.includes('\n')) { + right = right.trim(); + } + } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) { + if (left.endsWith('\n')) { + left = left.slice(0, -1); + } + if (right.endsWith('\n')) { + right = right.slice(0, -1); + } + } + return Diff.prototype.equals.call(this, left, right, options); +}; function diffLines(oldStr, newStr, callback) { return lineDiff.diff(oldStr, newStr, callback); } + +// Kept for backwards compatibility. This is a rather arbitrary wrapper method +// that just calls `diffLines` with `ignoreWhitespace: true`. It's confusing to +// have two ways to do exactly the same thing in the API, so we no longer +// document this one (library users should explicitly use `diffLines` with +// `ignoreWhitespace: true` instead) but we keep it around to maintain +// compatibility with code that used old versions. function diffTrimmedLines(oldStr, newStr, callback) { var options = generateOptions(callback, { ignoreWhitespace: true @@ -425,42 +727,67 @@ function diffTrimmedLines(oldStr, newStr, callback) { } var sentenceDiff = new Diff(); - sentenceDiff.tokenize = function (value) { return value.split(/(\S.+?[.!?])(?=\s+|$)/); }; - function diffSentences(oldStr, newStr, callback) { return sentenceDiff.diff(oldStr, newStr, callback); } var cssDiff = new Diff(); - cssDiff.tokenize = function (value) { return value.split(/([{}:;,]|\s+)/); }; - function diffCss(oldStr, newStr, callback) { return cssDiff.diff(oldStr, newStr, callback); } -function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; +function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function (r) { + return Object.getOwnPropertyDescriptor(e, r).enumerable; + })), t.push.apply(t, o); } - - return _typeof(obj); + return t; +} +function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { + _defineProperty(e, r, t[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); + }); + } + return e; +} +function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} +function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : i + ""; } +function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); +} function _defineProperty(obj, key, value) { + key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, @@ -471,56 +798,17 @@ function _defineProperty(obj, key, value) { } else { obj[key] = value; } - return obj; } - -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - if (enumerableOnly) symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - keys.push.apply(keys, symbols); - } - - return keys; -} - -function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; -} - function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); @@ -529,238 +817,263 @@ function _unsupportedIterableToArray(o, minLen) { if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - return arr2; } - function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -var objectPrototypeToString = Object.prototype.toString; -var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a +var jsonDiff = new Diff(); +// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: - jsonDiff.useLongestToken = true; jsonDiff.tokenize = lineDiff.tokenize; - -jsonDiff.castInput = function (value) { - var _this$options = this.options, - undefinedReplacement = _this$options.undefinedReplacement, - _this$options$stringi = _this$options.stringifyReplacer, - stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) { - return typeof v === 'undefined' ? undefinedReplacement : v; - } : _this$options$stringi; +jsonDiff.castInput = function (value, options) { + var undefinedReplacement = options.undefinedReplacement, + _options$stringifyRep = options.stringifyReplacer, + stringifyReplacer = _options$stringifyRep === void 0 ? function (k, v) { + return typeof v === 'undefined' ? undefinedReplacement : v; + } : _options$stringifyRep; return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); }; - -jsonDiff.equals = function (left, right) { - return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')); +jsonDiff.equals = function (left, right, options) { + return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'), options); }; - function diffJson(oldObj, newObj, options) { return jsonDiff.diff(oldObj, newObj, options); -} // This function handles the presence of circular references by bailing out when encountering an -// object that is already on the "stack" of items being processed. Accepts an optional replacer +} +// This function handles the presence of circular references by bailing out when encountering an +// object that is already on the "stack" of items being processed. Accepts an optional replacer function canonicalize(obj, stack, replacementStack, replacer, key) { stack = stack || []; replacementStack = replacementStack || []; - if (replacer) { obj = replacer(key, obj); } - var i; - for (i = 0; i < stack.length; i += 1) { if (stack[i] === obj) { return replacementStack[i]; } } - var canonicalizedObj; - - if ('[object Array]' === objectPrototypeToString.call(obj)) { + if ('[object Array]' === Object.prototype.toString.call(obj)) { stack.push(obj); canonicalizedObj = new Array(obj.length); replacementStack.push(canonicalizedObj); - for (i = 0; i < obj.length; i += 1) { canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); } - stack.pop(); replacementStack.pop(); return canonicalizedObj; } - if (obj && obj.toJSON) { obj = obj.toJSON(); } - if (_typeof(obj) === 'object' && obj !== null) { stack.push(obj); canonicalizedObj = {}; replacementStack.push(canonicalizedObj); - var sortedKeys = [], - _key; - + _key; for (_key in obj) { /* istanbul ignore else */ - if (obj.hasOwnProperty(_key)) { + if (Object.prototype.hasOwnProperty.call(obj, _key)) { sortedKeys.push(_key); } } - sortedKeys.sort(); - for (i = 0; i < sortedKeys.length; i += 1) { _key = sortedKeys[i]; canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); } - stack.pop(); replacementStack.pop(); } else { canonicalizedObj = obj; } - return canonicalizedObj; } var arrayDiff = new Diff(); - arrayDiff.tokenize = function (value) { return value.slice(); }; - arrayDiff.join = arrayDiff.removeEmpty = function (value) { return value; }; - function diffArrays(oldArr, newArr, callback) { return arrayDiff.diff(oldArr, newArr, callback); } -function parsePatch(uniDiff) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [], - list = [], - i = 0; +function unixToWin(patch) { + if (Array.isArray(patch)) { + return patch.map(unixToWin); + } + return _objectSpread2(_objectSpread2({}, patch), {}, { + hunks: patch.hunks.map(function (hunk) { + return _objectSpread2(_objectSpread2({}, hunk), {}, { + lines: hunk.lines.map(function (line, i) { + var _hunk$lines; + return line.startsWith('\\') || line.endsWith('\r') || (_hunk$lines = hunk.lines[i + 1]) !== null && _hunk$lines !== void 0 && _hunk$lines.startsWith('\\') ? line : line + '\r'; + }) + }); + }) + }); +} +function winToUnix(patch) { + if (Array.isArray(patch)) { + return patch.map(winToUnix); + } + return _objectSpread2(_objectSpread2({}, patch), {}, { + hunks: patch.hunks.map(function (hunk) { + return _objectSpread2(_objectSpread2({}, hunk), {}, { + lines: hunk.lines.map(function (line) { + return line.endsWith('\r') ? line.substring(0, line.length - 1) : line; + }) + }); + }) + }); +} + +/** + * Returns true if the patch consistently uses Unix line endings (or only involves one line and has + * no line endings). + */ +function isUnix(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return !patch.some(function (index) { + return index.hunks.some(function (hunk) { + return hunk.lines.some(function (line) { + return !line.startsWith('\\') && line.endsWith('\r'); + }); + }); + }); +} + +/** + * Returns true if the patch uses Windows line endings and only Windows line endings. + */ +function isWin(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return patch.some(function (index) { + return index.hunks.some(function (hunk) { + return hunk.lines.some(function (line) { + return line.endsWith('\r'); + }); + }); + }) && patch.every(function (index) { + return index.hunks.every(function (hunk) { + return hunk.lines.every(function (line, i) { + var _hunk$lines2; + return line.startsWith('\\') || line.endsWith('\r') || ((_hunk$lines2 = hunk.lines[i + 1]) === null || _hunk$lines2 === void 0 ? void 0 : _hunk$lines2.startsWith('\\')); + }); + }); + }); +} +function parsePatch(uniDiff) { + var diffstr = uniDiff.split(/\n/), + list = [], + i = 0; function parseIndex() { var index = {}; - list.push(index); // Parse diff metadata + list.push(index); + // Parse diff metadata while (i < diffstr.length) { - var line = diffstr[i]; // File header found, end parsing diff metadata + var line = diffstr[i]; + // File header found, end parsing diff metadata if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { break; - } // Diff index - + } + // Diff index var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); - if (header) { index.index = header[1]; } - i++; - } // Parse file headers if they are defined. Unified diff requires them, but - // there's no technical issues to have an isolated hunk without file header - + } + // Parse file headers if they are defined. Unified diff requires them, but + // there's no technical issues to have an isolated hunk without file header + parseFileHeader(index); parseFileHeader(index); - parseFileHeader(index); // Parse hunks + // Parse hunks index.hunks = []; - while (i < diffstr.length) { var _line = diffstr[i]; - - if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) { + if (/^(Index:\s|diff\s|\-\-\-\s|\+\+\+\s|===================================================================)/.test(_line)) { break; } else if (/^@@/.test(_line)) { index.hunks.push(parseHunk()); - } else if (_line && options.strict) { - // Ignore unexpected content unless in strict mode + } else if (_line) { throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); } else { i++; } } - } // Parses the --- and +++ headers, if none are found, no lines - // are consumed. - + } + // Parses the --- and +++ headers, if none are found, no lines + // are consumed. function parseFileHeader(index) { - var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]); - + var fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]); if (fileHeader) { var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; var data = fileHeader[2].split('\t', 2); var fileName = data[0].replace(/\\\\/g, '\\'); - if (/^".*"$/.test(fileName)) { fileName = fileName.substr(1, fileName.length - 2); } - index[keyPrefix + 'FileName'] = fileName; index[keyPrefix + 'Header'] = (data[1] || '').trim(); i++; } - } // Parses a hunk - // This assumes that we are at the start of a hunk. - + } + // Parses a hunk + // This assumes that we are at the start of a hunk. function parseHunk() { var chunkHeaderIndex = i, - chunkHeaderLine = diffstr[i++], - chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); + chunkHeaderLine = diffstr[i++], + chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); var hunk = { oldStart: +chunkHeader[1], oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2], newStart: +chunkHeader[3], newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4], - lines: [], - linedelimiters: [] - }; // Unified Diff Format quirk: If the chunk size is 0, + lines: [] + }; + + // Unified Diff Format quirk: If the chunk size is 0, // the first number is one lower than one would expect. // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 - if (hunk.oldLines === 0) { hunk.oldStart += 1; } - if (hunk.newLines === 0) { hunk.newStart += 1; } - var addCount = 0, - removeCount = 0; - - for (; i < diffstr.length; i++) { - // Lines starting with '---' could be mistaken for the "remove line" operation - // But they could be the header for the next file. Therefore prune such cases out. - if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) { - break; - } - + removeCount = 0; + for (; i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || (_diffstr$i = diffstr[i]) !== null && _diffstr$i !== void 0 && _diffstr$i.startsWith('\\')); i++) { + var _diffstr$i; var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; - if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { hunk.lines.push(diffstr[i]); - hunk.linedelimiters.push(delimiters[i] || '\n'); - if (operation === '+') { addCount++; } else if (operation === '-') { @@ -770,37 +1083,30 @@ function parsePatch(uniDiff) { removeCount++; } } else { - break; + throw new Error("Hunk at line ".concat(chunkHeaderIndex + 1, " contained invalid line ").concat(diffstr[i])); } - } // Handle the empty block count case - + } + // Handle the empty block count case if (!addCount && hunk.newLines === 1) { hunk.newLines = 0; } - if (!removeCount && hunk.oldLines === 1) { hunk.oldLines = 0; - } // Perform optional sanity checking - - - if (options.strict) { - if (addCount !== hunk.newLines) { - throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - - if (removeCount !== hunk.oldLines) { - throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } } + // Perform sanity checking + if (addCount !== hunk.newLines) { + throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + if (removeCount !== hunk.oldLines) { + throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } return hunk; } - while (i < diffstr.length) { parseIndex(); } - return list; } @@ -809,210 +1115,275 @@ function parsePatch(uniDiff) { // start of 2, this will iterate 2, 3, 1, 4, 0. function distanceIterator (start, minLine, maxLine) { var wantForward = true, - backwardExhausted = false, - forwardExhausted = false, - localOffset = 1; + backwardExhausted = false, + forwardExhausted = false, + localOffset = 1; return function iterator() { if (wantForward && !forwardExhausted) { if (backwardExhausted) { localOffset++; } else { wantForward = false; - } // Check if trying to fit beyond text length, and if not, check it fits - // after offset location (or desired location on first iteration) - + } + // Check if trying to fit beyond text length, and if not, check it fits + // after offset location (or desired location on first iteration) if (start + localOffset <= maxLine) { - return localOffset; + return start + localOffset; } - forwardExhausted = true; } - if (!backwardExhausted) { if (!forwardExhausted) { wantForward = true; - } // Check if trying to fit before text beginning, and if not, check it fits - // before offset location - + } + // Check if trying to fit before text beginning, and if not, check it fits + // before offset location if (minLine <= start - localOffset) { - return -localOffset++; + return start - localOffset++; } - backwardExhausted = true; return iterator(); - } // We tried to fit hunk before text beginning and beyond text length, then - // hunk can't fit on the text. Return undefined + } + // We tried to fit hunk before text beginning and beyond text length, then + // hunk can't fit on the text. Return undefined }; } function applyPatch(source, uniDiff) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - if (typeof uniDiff === 'string') { uniDiff = parsePatch(uniDiff); } - if (Array.isArray(uniDiff)) { if (uniDiff.length > 1) { throw new Error('applyPatch only works with a single input.'); } - uniDiff = uniDiff[0]; - } // Apply the diff to the input - - - var lines = source.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [], - hunks = uniDiff.hunks, - compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { - return line === patchContent; - }, - errorCount = 0, - fuzzFactor = options.fuzzFactor || 0, - minLine = 0, - offset = 0, - removeEOFNL, - addEOFNL; - /** - * Checks if the hunk exactly fits on the provided location - */ + } + if (options.autoConvertLineEndings || options.autoConvertLineEndings == null) { + if (hasOnlyWinLineEndings(source) && isUnix(uniDiff)) { + uniDiff = unixToWin(uniDiff); + } else if (hasOnlyUnixLineEndings(source) && isWin(uniDiff)) { + uniDiff = winToUnix(uniDiff); + } + } + // Apply the diff to the input + var lines = source.split('\n'), + hunks = uniDiff.hunks, + compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { + return line === patchContent; + }, + fuzzFactor = options.fuzzFactor || 0, + minLine = 0; + if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) { + throw new Error('fuzzFactor must be a non-negative integer'); + } - function hunkFits(hunk, toPos) { - for (var j = 0; j < hunk.lines.length; j++) { - var line = hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line; + // Special case for empty patch. + if (!hunks.length) { + return source; + } - if (operation === ' ' || operation === '-') { - // Context sanity check - if (!compareLine(toPos + 1, lines[toPos], operation, content)) { - errorCount++; + // Before anything else, handle EOFNL insertion/removal. If the patch tells us to make a change + // to the EOFNL that is redundant/impossible - i.e. to remove a newline that's not there, or add a + // newline that already exists - then we either return false and fail to apply the patch (if + // fuzzFactor is 0) or simply ignore the problem and do nothing (if fuzzFactor is >0). + // If we do need to remove/add a newline at EOF, this will always be in the final hunk: + var prevLine = '', + removeEOFNL = false, + addEOFNL = false; + for (var i = 0; i < hunks[hunks.length - 1].lines.length; i++) { + var line = hunks[hunks.length - 1].lines[i]; + if (line[0] == '\\') { + if (prevLine[0] == '+') { + removeEOFNL = true; + } else if (prevLine[0] == '-') { + addEOFNL = true; + } + } + prevLine = line; + } + if (removeEOFNL) { + if (addEOFNL) { + // This means the final line gets changed but doesn't have a trailing newline in either the + // original or patched version. In that case, we do nothing if fuzzFactor > 0, and if + // fuzzFactor is 0, we simply validate that the source file has no trailing newline. + if (!fuzzFactor && lines[lines.length - 1] == '') { + return false; + } + } else if (lines[lines.length - 1] == '') { + lines.pop(); + } else if (!fuzzFactor) { + return false; + } + } else if (addEOFNL) { + if (lines[lines.length - 1] != '') { + lines.push(''); + } else if (!fuzzFactor) { + return false; + } + } - if (errorCount > fuzzFactor) { - return false; + /** + * Checks if the hunk can be made to fit at the provided location with at most `maxErrors` + * insertions, substitutions, or deletions, while ensuring also that: + * - lines deleted in the hunk match exactly, and + * - wherever an insertion operation or block of insertion operations appears in the hunk, the + * immediately preceding and following lines of context match exactly + * + * `toPos` should be set such that lines[toPos] is meant to match hunkLines[0]. + * + * If the hunk can be applied, returns an object with properties `oldLineLastI` and + * `replacementLines`. Otherwise, returns null. + */ + function applyHunk(hunkLines, toPos, maxErrors) { + var hunkLinesI = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + var lastContextLineMatched = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var patchedLines = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : []; + var patchedLinesLength = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0; + var nConsecutiveOldContextLines = 0; + var nextContextLineMustMatch = false; + for (; hunkLinesI < hunkLines.length; hunkLinesI++) { + var hunkLine = hunkLines[hunkLinesI], + operation = hunkLine.length > 0 ? hunkLine[0] : ' ', + content = hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine; + if (operation === '-') { + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + toPos++; + nConsecutiveOldContextLines = 0; + } else { + if (!maxErrors || lines[toPos] == null) { + return null; } + patchedLines[patchedLinesLength] = lines[toPos]; + return applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1); } + } + if (operation === '+') { + if (!lastContextLineMatched) { + return null; + } + patchedLines[patchedLinesLength] = content; + patchedLinesLength++; + nConsecutiveOldContextLines = 0; + nextContextLineMustMatch = true; + } + if (operation === ' ') { + nConsecutiveOldContextLines++; + patchedLines[patchedLinesLength] = lines[toPos]; + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + patchedLinesLength++; + lastContextLineMatched = true; + nextContextLineMustMatch = false; + toPos++; + } else { + if (nextContextLineMustMatch || !maxErrors) { + return null; + } - toPos++; + // Consider 3 possibilities in sequence: + // 1. lines contains a *substitution* not included in the patch context, or + // 2. lines contains an *insertion* not included in the patch context, or + // 3. lines contains a *deletion* not included in the patch context + // The first two options are of course only possible if the line from lines is non-null - + // i.e. only option 3 is possible if we've overrun the end of the old file. + return lines[toPos] && (applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength + 1) || applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1)) || applyHunk(hunkLines, toPos, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength); + } } } - return true; - } // Search best fit offsets for each hunk based on the previous ones - - - for (var i = 0; i < hunks.length; i++) { - var hunk = hunks[i], - maxLine = lines.length - hunk.oldLines, - localOffset = 0, - toPos = offset + hunk.oldStart - 1; - var iterator = distanceIterator(toPos, minLine, maxLine); + // Before returning, trim any unmodified context lines off the end of patchedLines and reduce + // toPos (and thus oldLineLastI) accordingly. This allows later hunks to be applied to a region + // that starts in this hunk's trailing context. + patchedLinesLength -= nConsecutiveOldContextLines; + toPos -= nConsecutiveOldContextLines; + patchedLines.length = patchedLinesLength; + return { + patchedLines: patchedLines, + oldLineLastI: toPos - 1 + }; + } + var resultLines = []; - for (; localOffset !== undefined; localOffset = iterator()) { - if (hunkFits(hunk, toPos + localOffset)) { - hunk.offset = offset += localOffset; + // Search best fit offsets for each hunk based on the previous ones + var prevHunkOffset = 0; + for (var _i = 0; _i < hunks.length; _i++) { + var hunk = hunks[_i]; + var hunkResult = void 0; + var maxLine = lines.length - hunk.oldLines + fuzzFactor; + var toPos = void 0; + for (var maxErrors = 0; maxErrors <= fuzzFactor; maxErrors++) { + toPos = hunk.oldStart + prevHunkOffset - 1; + var iterator = distanceIterator(toPos, minLine, maxLine); + for (; toPos !== undefined; toPos = iterator()) { + hunkResult = applyHunk(hunk.lines, toPos, maxErrors); + if (hunkResult) { + break; + } + } + if (hunkResult) { break; } } - - if (localOffset === undefined) { + if (!hunkResult) { return false; - } // Set lower text limit to end of the current hunk, so next ones don't try - // to fit over already patched text - - - minLine = hunk.offset + hunk.oldStart + hunk.oldLines; - } // Apply patch hunks - - - var diffOffset = 0; - - for (var _i = 0; _i < hunks.length; _i++) { - var _hunk = hunks[_i], - _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1; - - diffOffset += _hunk.newLines - _hunk.oldLines; + } - for (var j = 0; j < _hunk.lines.length; j++) { - var line = _hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line, - delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n'; + // Copy everything from the end of where we applied the last hunk to the start of this hunk + for (var _i2 = minLine; _i2 < toPos; _i2++) { + resultLines.push(lines[_i2]); + } - if (operation === ' ') { - _toPos++; - } else if (operation === '-') { - lines.splice(_toPos, 1); - delimiters.splice(_toPos, 1); - /* istanbul ignore else */ - } else if (operation === '+') { - lines.splice(_toPos, 0, content); - delimiters.splice(_toPos, 0, delimiter); - _toPos++; - } else if (operation === '\\') { - var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null; - - if (previousOperation === '+') { - removeEOFNL = true; - } else if (previousOperation === '-') { - addEOFNL = true; - } - } + // Add the lines produced by applying the hunk: + for (var _i3 = 0; _i3 < hunkResult.patchedLines.length; _i3++) { + var _line = hunkResult.patchedLines[_i3]; + resultLines.push(_line); } - } // Handle EOFNL insertion/removal + // Set lower text limit to end of the current hunk, so next ones don't try + // to fit over already patched text + minLine = hunkResult.oldLineLastI + 1; - if (removeEOFNL) { - while (!lines[lines.length - 1]) { - lines.pop(); - delimiters.pop(); - } - } else if (addEOFNL) { - lines.push(''); - delimiters.push('\n'); + // Note the offset between where the patch said the hunk should've applied and where we + // applied it, so we can adjust future hunks accordingly: + prevHunkOffset = toPos + 1 - hunk.oldStart; } - for (var _k = 0; _k < lines.length - 1; _k++) { - lines[_k] = lines[_k] + delimiters[_k]; + // Copy over the rest of the lines from the old text + for (var _i4 = minLine; _i4 < lines.length; _i4++) { + resultLines.push(lines[_i4]); } + return resultLines.join('\n'); +} - return lines.join(''); -} // Wrapper that supports multiple file patches via callbacks. - +// Wrapper that supports multiple file patches via callbacks. function applyPatches(uniDiff, options) { if (typeof uniDiff === 'string') { uniDiff = parsePatch(uniDiff); } - var currentIndex = 0; - function processIndex() { var index = uniDiff[currentIndex++]; - if (!index) { return options.complete(); } - options.loadFile(index, function (err, data) { if (err) { return options.complete(err); } - var updatedContent = applyPatch(data, index, options); options.patched(index, updatedContent, function (err) { if (err) { return options.complete(err); } - processIndex(); }); }); } - processIndex(); } @@ -1020,206 +1391,238 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne if (!options) { options = {}; } - + if (typeof options === 'function') { + options = { + callback: options + }; + } if (typeof options.context === 'undefined') { options.context = 4; } - - var diff = diffLines(oldStr, newStr, options); - - if (!diff) { - return; + if (options.newlineIsToken) { + throw new Error('newlineIsToken may not be used with patch-generation functions, only with diffing functions'); } - - diff.push({ - value: '', - lines: [] - }); // Append an empty value to make cleanup easier - - function contextLines(lines) { - return lines.map(function (entry) { - return ' ' + entry; - }); + if (!options.callback) { + return diffLinesResultToPatch(diffLines(oldStr, newStr, options)); + } else { + var _options = options, + _callback = _options.callback; + diffLines(oldStr, newStr, _objectSpread2(_objectSpread2({}, options), {}, { + callback: function callback(diff) { + var patch = diffLinesResultToPatch(diff); + _callback(patch); + } + })); } + function diffLinesResultToPatch(diff) { + // STEP 1: Build up the patch with no "\ No newline at end of file" lines and with the arrays + // of lines containing trailing newline characters. We'll tidy up later... - var hunks = []; - var oldRangeStart = 0, + if (!diff) { + return; + } + diff.push({ + value: '', + lines: [] + }); // Append an empty value to make cleanup easier + + function contextLines(lines) { + return lines.map(function (entry) { + return ' ' + entry; + }); + } + var hunks = []; + var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1; - - var _loop = function _loop(i) { - var current = diff[i], - lines = current.lines || current.value.replace(/\n$/, '').split('\n'); - current.lines = lines; - - if (current.added || current.removed) { - var _curRange; - - // If we have previous context, start with that - if (!oldRangeStart) { - var prev = diff[i - 1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; + var _loop = function _loop() { + var current = diff[i], + lines = current.lines || splitLines(current.value); + current.lines = lines; + if (current.added || current.removed) { + var _curRange; + // If we have previous context, start with that + if (!oldRangeStart) { + var prev = diff[i - 1]; + oldRangeStart = oldLine; + newRangeStart = newLine; + if (prev) { + curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; + oldRangeStart -= curRange.length; + newRangeStart -= curRange.length; + } } - } // Output our changes + // Output our changes + (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { + return (current.added ? '+' : '-') + entry; + }))); - (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { - return (current.added ? '+' : '-') + entry; - }))); // Track the updated file position - - - if (current.added) { - newLine += lines.length; + // Track the updated file position + if (current.added) { + newLine += lines.length; + } else { + oldLine += lines.length; + } } else { + // Identical context lines. Track line changes + if (oldRangeStart) { + // Close out any changes that have been output (or join overlapping) + if (lines.length <= options.context * 2 && i < diff.length - 2) { + var _curRange2; + // Overlapping + (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); + } else { + var _curRange3; + // end the range and output + var contextSize = Math.min(lines.length, options.context); + (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); + var _hunk = { + oldStart: oldRangeStart, + oldLines: oldLine - oldRangeStart + contextSize, + newStart: newRangeStart, + newLines: newLine - newRangeStart + contextSize, + lines: curRange + }; + hunks.push(_hunk); + oldRangeStart = 0; + newRangeStart = 0; + curRange = []; + } + } oldLine += lines.length; + newLine += lines.length; } - } else { - // Identical context lines. Track line changes - if (oldRangeStart) { - // Close out any changes that have been output (or join overlapping) - if (lines.length <= options.context * 2 && i < diff.length - 2) { - var _curRange2; - - // Overlapping - (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); - } else { - var _curRange3; - - // end the range and output - var contextSize = Math.min(lines.length, options.context); - - (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); - - var hunk = { - oldStart: oldRangeStart, - oldLines: oldLine - oldRangeStart + contextSize, - newStart: newRangeStart, - newLines: newLine - newRangeStart + contextSize, - lines: curRange - }; - - if (i >= diff.length - 2 && lines.length <= options.context) { - // EOF is inside this hunk - var oldEOFNewline = /\n$/.test(oldStr); - var newEOFNewline = /\n$/.test(newStr); - var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines; - - if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) { - // special case: old has no eol and no trailing context; no-nl can end up before adds - // however, if the old file is empty, do not output the no-nl line - curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file'); - } - - if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) { - curRange.push('\\ No newline at end of file'); - } - } + }; + for (var i = 0; i < diff.length; i++) { + _loop(); + } - hunks.push(hunk); - oldRangeStart = 0; - newRangeStart = 0; - curRange = []; + // Step 2: eliminate the trailing `\n` from each line of each hunk, and, where needed, add + // "\ No newline at end of file". + for (var _i = 0, _hunks = hunks; _i < _hunks.length; _i++) { + var hunk = _hunks[_i]; + for (var _i2 = 0; _i2 < hunk.lines.length; _i2++) { + if (hunk.lines[_i2].endsWith('\n')) { + hunk.lines[_i2] = hunk.lines[_i2].slice(0, -1); + } else { + hunk.lines.splice(_i2 + 1, 0, '\\ No newline at end of file'); + _i2++; // Skip the line we just added, then continue iterating } } - - oldLine += lines.length; - newLine += lines.length; } - }; - - for (var i = 0; i < diff.length; i++) { - _loop(i); + return { + oldFileName: oldFileName, + newFileName: newFileName, + oldHeader: oldHeader, + newHeader: newHeader, + hunks: hunks + }; } - - return { - oldFileName: oldFileName, - newFileName: newFileName, - oldHeader: oldHeader, - newHeader: newHeader, - hunks: hunks - }; } function formatPatch(diff) { if (Array.isArray(diff)) { return diff.map(formatPatch).join('\n'); } - var ret = []; - if (diff.oldFileName == diff.newFileName) { ret.push('Index: ' + diff.oldFileName); } - ret.push('==================================================================='); ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); - for (var i = 0; i < diff.hunks.length; i++) { - var hunk = diff.hunks[i]; // Unified Diff Format quirk: If the chunk size is 0, + var hunk = diff.hunks[i]; + // Unified Diff Format quirk: If the chunk size is 0, // the first number is one lower than one would expect. // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 - if (hunk.oldLines === 0) { hunk.oldStart -= 1; } - if (hunk.newLines === 0) { hunk.newStart -= 1; } - ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); ret.push.apply(ret, hunk.lines); } - return ret.join('\n') + '\n'; } function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options)); + var _options2; + if (typeof options === 'function') { + options = { + callback: options + }; + } + if (!((_options2 = options) !== null && _options2 !== void 0 && _options2.callback)) { + var patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); + if (!patchObj) { + return; + } + return formatPatch(patchObj); + } else { + var _options3 = options, + _callback2 = _options3.callback; + structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, _objectSpread2(_objectSpread2({}, options), {}, { + callback: function callback(patchObj) { + if (!patchObj) { + _callback2(); + } else { + _callback2(formatPatch(patchObj)); + } + } + })); + } } function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); } +/** + * Split `text` into an array of lines, including the trailing newline character (where present) + */ +function splitLines(text) { + var hasTrailingNl = text.endsWith('\n'); + var result = text.split('\n').map(function (line) { + return line + '\n'; + }); + if (hasTrailingNl) { + result.pop(); + } else { + result.push(result.pop().slice(0, -1)); + } + return result; +} + function arrayEqual(a, b) { if (a.length !== b.length) { return false; } - return arrayStartsWith(a, b); } function arrayStartsWith(array, start) { if (start.length > array.length) { return false; } - for (var i = 0; i < start.length; i++) { if (start[i] !== array[i]) { return false; } } - return true; } function calcLineCount(hunk) { var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines), - oldLines = _calcOldNewLineCount.oldLines, - newLines = _calcOldNewLineCount.newLines; - + oldLines = _calcOldNewLineCount.oldLines, + newLines = _calcOldNewLineCount.newLines; if (oldLines !== undefined) { hunk.oldLines = oldLines; } else { delete hunk.oldLines; } - if (newLines !== undefined) { hunk.newLines = newLines; } else { @@ -1229,14 +1632,14 @@ function calcLineCount(hunk) { function merge(mine, theirs, base) { mine = loadPatch(mine, base); theirs = loadPatch(theirs, base); - var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning. + var ret = {}; + + // For index we just let it pass through as it doesn't have any necessary meaning. // Leaving sanity checks on this to the API consumer that may know more about the // meaning in their own context. - if (mine.index || theirs.index) { ret.index = mine.index || theirs.index; } - if (mine.newFileName || theirs.newFileName) { if (!fileNameChanged(mine)) { // No header or no change in ours, use theirs (and ours if theirs does not exist) @@ -1258,21 +1661,18 @@ function merge(mine, theirs, base) { ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); } } - ret.hunks = []; var mineIndex = 0, - theirsIndex = 0, - mineOffset = 0, - theirsOffset = 0; - + theirsIndex = 0, + mineOffset = 0, + theirsOffset = 0; while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { var mineCurrent = mine.hunks[mineIndex] || { - oldStart: Infinity - }, - theirsCurrent = theirs.hunks[theirsIndex] || { - oldStart: Infinity - }; - + oldStart: Infinity + }, + theirsCurrent = theirs.hunks[theirsIndex] || { + oldStart: Infinity + }; if (hunkBefore(mineCurrent, theirsCurrent)) { // This patch does not overlap with any of the others, yay. ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); @@ -1298,30 +1698,23 @@ function merge(mine, theirs, base) { ret.hunks.push(mergedHunk); } } - return ret; } - function loadPatch(param, base) { if (typeof param === 'string') { if (/^@@/m.test(param) || /^Index:/m.test(param)) { return parsePatch(param)[0]; } - if (!base) { throw new Error('Must provide a base reference or pass in a patch'); } - return structuredPatch(undefined, undefined, base, param); } - return param; } - function fileNameChanged(patch) { return patch.newFileName && patch.newFileName !== patch.oldFileName; } - function selectField(index, mine, theirs) { if (mine === theirs) { return mine; @@ -1333,11 +1726,9 @@ function selectField(index, mine, theirs) { }; } } - function hunkBefore(test, check) { return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; } - function cloneHunk(hunk, offset) { return { oldStart: hunk.oldStart, @@ -1347,39 +1738,37 @@ function cloneHunk(hunk, offset) { lines: hunk.lines }; } - function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { // This will generally result in a conflicted hunk, but there are cases where the context // is the only overlap where we can successfully merge the content here. var mine = { - offset: mineOffset, - lines: mineLines, - index: 0 - }, - their = { - offset: theirOffset, - lines: theirLines, - index: 0 - }; // Handle any leading content + offset: mineOffset, + lines: mineLines, + index: 0 + }, + their = { + offset: theirOffset, + lines: theirLines, + index: 0 + }; + // Handle any leading content insertLeading(hunk, mine, their); - insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each. + insertLeading(hunk, their, mine); + // Now in the overlap content. Scan through and select the best changes from each. while (mine.index < mine.lines.length && their.index < their.lines.length) { var mineCurrent = mine.lines[mine.index], - theirCurrent = their.lines[their.index]; - + theirCurrent = their.lines[their.index]; if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { // Both modified ... mutualChange(hunk, mine, their); } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { var _hunk$lines; - // Mine inserted (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine))); } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { var _hunk$lines2; - // Theirs inserted (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their))); } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { @@ -1397,57 +1786,44 @@ function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { // Context mismatch conflict(hunk, collectChange(mine), collectChange(their)); } - } // Now push anything that may be remaining - + } + // Now push anything that may be remaining insertTrailing(hunk, mine); insertTrailing(hunk, their); calcLineCount(hunk); } - function mutualChange(hunk, mine, their) { var myChanges = collectChange(mine), - theirChanges = collectChange(their); - + theirChanges = collectChange(their); if (allRemoves(myChanges) && allRemoves(theirChanges)) { // Special case for remove changes that are supersets of one another if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { var _hunk$lines3; - (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges)); - return; } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { var _hunk$lines4; - (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges)); - return; } } else if (arrayEqual(myChanges, theirChanges)) { var _hunk$lines5; - (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges)); - return; } - conflict(hunk, myChanges, theirChanges); } - function removal(hunk, mine, their, swap) { var myChanges = collectChange(mine), - theirChanges = collectContext(their, myChanges); - + theirChanges = collectContext(their, myChanges); if (theirChanges.merged) { var _hunk$lines6; - (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged)); } else { conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); } } - function conflict(hunk, mine, their) { hunk.conflict = true; hunk.lines.push({ @@ -1456,7 +1832,6 @@ function conflict(hunk, mine, their) { theirs: their }); } - function insertLeading(hunk, insert, their) { while (insert.offset < their.offset && insert.index < insert.lines.length) { var line = insert.lines[insert.index++]; @@ -1464,25 +1839,22 @@ function insertLeading(hunk, insert, their) { insert.offset++; } } - function insertTrailing(hunk, insert) { while (insert.index < insert.lines.length) { var line = insert.lines[insert.index++]; hunk.lines.push(line); } } - function collectChange(state) { var ret = [], - operation = state.lines[state.index][0]; - + operation = state.lines[state.index][0]; while (state.index < state.lines.length) { - var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. + var line = state.lines[state.index]; + // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. if (operation === '-' && line[0] === '+') { operation = '+'; } - if (operation === line[0]) { ret.push(line); state.index++; @@ -1490,39 +1862,35 @@ function collectChange(state) { break; } } - return ret; } - function collectContext(state, matchChanges) { var changes = [], - merged = [], - matchIndex = 0, - contextChanges = false, - conflicted = false; - + merged = [], + matchIndex = 0, + contextChanges = false, + conflicted = false; while (matchIndex < matchChanges.length && state.index < state.lines.length) { var change = state.lines[state.index], - match = matchChanges[matchIndex]; // Once we've hit our add, then we are done + match = matchChanges[matchIndex]; + // Once we've hit our add, then we are done if (match[0] === '+') { break; } - contextChanges = contextChanges || change[0] !== ' '; merged.push(match); - matchIndex++; // Consume any additions in the other block as a conflict to attempt - // to pull in the remaining context after this + matchIndex++; + // Consume any additions in the other block as a conflict to attempt + // to pull in the remaining context after this if (change[0] === '+') { conflicted = true; - while (change[0] === '+') { changes.push(change); change = state.lines[++state.index]; } } - if (match.substr(1) === change.substr(1)) { changes.push(change); state.index++; @@ -1530,44 +1898,35 @@ function collectContext(state, matchChanges) { conflicted = true; } } - if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { conflicted = true; } - if (conflicted) { return changes; } - while (matchIndex < matchChanges.length) { merged.push(matchChanges[matchIndex++]); } - return { merged: merged, changes: changes }; } - function allRemoves(changes) { return changes.reduce(function (prev, change) { return prev && change[0] === '-'; }, true); } - function skipRemoveSuperset(state, removeChanges, delta) { for (var i = 0; i < delta; i++) { var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); - if (state.lines[state.index + i] !== ' ' + changeContent) { return false; } } - state.index += delta; return true; } - function calcOldNewLineCount(lines) { var oldLines = 0; var newLines = 0; @@ -1575,7 +1934,6 @@ function calcOldNewLineCount(lines) { if (typeof line !== 'string') { var myCount = calcOldNewLineCount(line.mine); var theirCount = calcOldNewLineCount(line.theirs); - if (oldLines !== undefined) { if (myCount.oldLines === theirCount.oldLines) { oldLines += myCount.oldLines; @@ -1583,7 +1941,6 @@ function calcOldNewLineCount(lines) { oldLines = undefined; } } - if (newLines !== undefined) { if (myCount.newLines === theirCount.newLines) { newLines += myCount.newLines; @@ -1595,7 +1952,6 @@ function calcOldNewLineCount(lines) { if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { newLines++; } - if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { oldLines++; } @@ -1611,7 +1967,6 @@ function reversePatch(structuredPatch) { if (Array.isArray(structuredPatch)) { return structuredPatch.map(reversePatch).reverse(); } - return _objectSpread2(_objectSpread2({}, structuredPatch), {}, { oldFileName: structuredPatch.newFileName, oldHeader: structuredPatch.newHeader, @@ -1623,16 +1978,13 @@ function reversePatch(structuredPatch) { oldStart: hunk.newStart, newLines: hunk.oldLines, newStart: hunk.oldStart, - linedelimiters: hunk.linedelimiters, lines: hunk.lines.map(function (l) { if (l.startsWith('-')) { return "+".concat(l.slice(1)); } - if (l.startsWith('+')) { return "-".concat(l.slice(1)); } - return l; }) }; @@ -1643,12 +1995,10 @@ function reversePatch(structuredPatch) { // See: http://code.google.com/p/google-diff-match-patch/wiki/API function convertChangesToDMP(changes) { var ret = [], - change, - operation; - + change, + operation; for (var i = 0; i < changes.length; i++) { change = changes[i]; - if (change.added) { operation = 1; } else if (change.removed) { @@ -1656,37 +2006,29 @@ function convertChangesToDMP(changes) { } else { operation = 0; } - ret.push([operation, change.value]); } - return ret; } function convertChangesToXML(changes) { var ret = []; - for (var i = 0; i < changes.length; i++) { var change = changes[i]; - if (change.added) { ret.push(''); } else if (change.removed) { ret.push(''); } - ret.push(escapeHTML(change.value)); - if (change.added) { ret.push(''); } else if (change.removed) { ret.push(''); } } - return ret.join(''); } - function escapeHTML(s) { var n = s; n = n.replace(/&/g, '&'); diff --git a/deps/npm/node_modules/diff/lib/index.js b/deps/npm/node_modules/diff/lib/index.js index 09d885e1182926..518b3dee33d30c 100644 --- a/deps/npm/node_modules/diff/lib/index.js +++ b/deps/npm/node_modules/diff/lib/index.js @@ -10,225 +10,208 @@ Object.defineProperty(exports, "Diff", { return _base["default"]; } }); -Object.defineProperty(exports, "diffChars", { +Object.defineProperty(exports, "applyPatch", { enumerable: true, get: function get() { - return _character.diffChars; + return _apply.applyPatch; } }); -Object.defineProperty(exports, "diffWords", { +Object.defineProperty(exports, "applyPatches", { enumerable: true, get: function get() { - return _word.diffWords; + return _apply.applyPatches; } }); -Object.defineProperty(exports, "diffWordsWithSpace", { +Object.defineProperty(exports, "canonicalize", { enumerable: true, get: function get() { - return _word.diffWordsWithSpace; + return _json.canonicalize; } }); -Object.defineProperty(exports, "diffLines", { +Object.defineProperty(exports, "convertChangesToDMP", { enumerable: true, get: function get() { - return _line.diffLines; + return _dmp.convertChangesToDMP; } }); -Object.defineProperty(exports, "diffTrimmedLines", { +Object.defineProperty(exports, "convertChangesToXML", { enumerable: true, get: function get() { - return _line.diffTrimmedLines; + return _xml.convertChangesToXML; } }); -Object.defineProperty(exports, "diffSentences", { +Object.defineProperty(exports, "createPatch", { enumerable: true, get: function get() { - return _sentence.diffSentences; + return _create.createPatch; } }); -Object.defineProperty(exports, "diffCss", { +Object.defineProperty(exports, "createTwoFilesPatch", { enumerable: true, get: function get() { - return _css.diffCss; + return _create.createTwoFilesPatch; } }); -Object.defineProperty(exports, "diffJson", { +Object.defineProperty(exports, "diffArrays", { enumerable: true, get: function get() { - return _json.diffJson; + return _array.diffArrays; } }); -Object.defineProperty(exports, "canonicalize", { +Object.defineProperty(exports, "diffChars", { enumerable: true, get: function get() { - return _json.canonicalize; + return _character.diffChars; } }); -Object.defineProperty(exports, "diffArrays", { +Object.defineProperty(exports, "diffCss", { enumerable: true, get: function get() { - return _array.diffArrays; + return _css.diffCss; } }); -Object.defineProperty(exports, "applyPatch", { +Object.defineProperty(exports, "diffJson", { enumerable: true, get: function get() { - return _apply.applyPatch; + return _json.diffJson; } }); -Object.defineProperty(exports, "applyPatches", { +Object.defineProperty(exports, "diffLines", { enumerable: true, get: function get() { - return _apply.applyPatches; + return _line.diffLines; } }); -Object.defineProperty(exports, "parsePatch", { +Object.defineProperty(exports, "diffSentences", { enumerable: true, get: function get() { - return _parse.parsePatch; + return _sentence.diffSentences; } }); -Object.defineProperty(exports, "merge", { +Object.defineProperty(exports, "diffTrimmedLines", { enumerable: true, get: function get() { - return _merge.merge; + return _line.diffTrimmedLines; } }); -Object.defineProperty(exports, "reversePatch", { +Object.defineProperty(exports, "diffWords", { enumerable: true, get: function get() { - return _reverse.reversePatch; + return _word.diffWords; } }); -Object.defineProperty(exports, "structuredPatch", { +Object.defineProperty(exports, "diffWordsWithSpace", { enumerable: true, get: function get() { - return _create.structuredPatch; + return _word.diffWordsWithSpace; } }); -Object.defineProperty(exports, "createTwoFilesPatch", { +Object.defineProperty(exports, "formatPatch", { enumerable: true, get: function get() { - return _create.createTwoFilesPatch; + return _create.formatPatch; } }); -Object.defineProperty(exports, "createPatch", { +Object.defineProperty(exports, "merge", { enumerable: true, get: function get() { - return _create.createPatch; + return _merge.merge; } }); -Object.defineProperty(exports, "formatPatch", { +Object.defineProperty(exports, "parsePatch", { enumerable: true, get: function get() { - return _create.formatPatch; + return _parse.parsePatch; } }); -Object.defineProperty(exports, "convertChangesToDMP", { +Object.defineProperty(exports, "reversePatch", { enumerable: true, get: function get() { - return _dmp.convertChangesToDMP; + return _reverse.reversePatch; } }); -Object.defineProperty(exports, "convertChangesToXML", { +Object.defineProperty(exports, "structuredPatch", { enumerable: true, get: function get() { - return _xml.convertChangesToXML; + return _create.structuredPatch; } }); - /*istanbul ignore end*/ var /*istanbul ignore start*/ _base = _interopRequireDefault(require("./diff/base")) /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _character = require("./diff/character") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _word = require("./diff/word") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _line = require("./diff/line") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _sentence = require("./diff/sentence") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _css = require("./diff/css") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _json = require("./diff/json") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _array = require("./diff/array") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _apply = require("./patch/apply") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _parse = require("./patch/parse") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _merge = require("./patch/merge") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _reverse = require("./patch/reverse") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _create = require("./patch/create") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _dmp = require("./convert/dmp") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _xml = require("./convert/xml") /*istanbul ignore end*/ ; - /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - /*istanbul ignore end*/ -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi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FBQTtBQUVBO0FBQUE7QUFBQUssSUFBQSxHQUFBTCxPQUFBO0FBQUE7QUFBQTtBQUNBO0FBQUE7QUFBQU0sS0FBQSxHQUFBTixPQUFBO0FBQUE7QUFBQTtBQUVBO0FBQUE7QUFBQU8sTUFBQSxHQUFBUCxPQUFBO0FBQUE7QUFBQTtBQUVBO0FBQUE7QUFBQVEsTUFBQSxHQUFBUixPQUFBO0FBQUE7QUFBQTtBQUNBO0FBQUE7QUFBQVMsTUFBQSxHQUFBVCxPQUFBO0FBQUE7QUFBQTtBQUNBO0FBQUE7QUFBQVUsTUFBQSxHQUFBVixPQUFBO0FBQUE7QUFBQTtBQUNBO0FBQUE7QUFBQVcsUUFBQSxHQUFBWCxPQUFBO0FBQUE7QUFBQTtBQUNBO0FBQUE7QUFBQVksT0FBQSxHQUFBWixPQUFBO0FBQUE7QUFBQTtBQUVBO0FBQUE7QUFBQWEsSUFBQSxHQUFBYixPQUFBO0FBQUE7QUFBQTtBQUNBO0FBQUE7QUFBQWMsSUFBQSxHQUFBZCxPQUFBO0FBQUE7QUFBQTtBQUFrRCxtQ0FBQUQsdUJBQUFnQixHQUFBLFdBQUFBLEdBQUEsSUFBQUEsR0FBQSxDQUFBQyxVQUFBLEdBQUFELEdBQUEsZ0JBQUFBLEdBQUE7QUFBQSIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/deps/npm/node_modules/diff/lib/index.mjs b/deps/npm/node_modules/diff/lib/index.mjs index a0ace0182ab14e..6e872723d85817 100644 --- a/deps/npm/node_modules/diff/lib/index.mjs +++ b/deps/npm/node_modules/diff/lib/index.mjs @@ -2,59 +2,52 @@ function Diff() {} Diff.prototype = { diff: function diff(oldString, newString) { var _options$timeout; - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var callback = options.callback; - if (typeof options === 'function') { callback = options; options = {}; } - - this.options = options; var self = this; - function done(value) { + value = self.postProcess(value, options); if (callback) { setTimeout(function () { - callback(undefined, value); + callback(value); }, 0); return true; } else { return value; } - } // Allow subclasses to massage the input prior to running - + } - oldString = this.castInput(oldString); - newString = this.castInput(newString); - oldString = this.removeEmpty(this.tokenize(oldString)); - newString = this.removeEmpty(this.tokenize(newString)); + // Allow subclasses to massage the input prior to running + oldString = this.castInput(oldString, options); + newString = this.castInput(newString, options); + oldString = this.removeEmpty(this.tokenize(oldString, options)); + newString = this.removeEmpty(this.tokenize(newString, options)); var newLen = newString.length, - oldLen = oldString.length; + oldLen = oldString.length; var editLength = 1; var maxEditLength = newLen + oldLen; - - if (options.maxEditLength) { + if (options.maxEditLength != null) { maxEditLength = Math.min(maxEditLength, options.maxEditLength); } - var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity; var abortAfterTimestamp = Date.now() + maxExecutionTime; var bestPath = [{ oldPos: -1, lastComponent: undefined - }]; // Seed editLength = 0, i.e. the content starts with the same values - - var newPos = this.extractCommon(bestPath[0], newString, oldString, 0); + }]; + // Seed editLength = 0, i.e. the content starts with the same values + var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options); if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) { // Identity per the equality and tokenizer - return done([{ - value: this.join(newString), - count: newString.length - }]); - } // Once we hit the right edge of the edit graph on some diagonal k, we can + return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken)); + } + + // Once we hit the right edge of the edit graph on some diagonal k, we can // definitely reach the end of the edit graph in no more than k edits, so // there's no point in considering any moves to diagonal k+1 any more (from // which we're guaranteed to need at least k+1 more edits). @@ -71,81 +64,67 @@ Diff.prototype = { // where the new text simply appends d characters on the end of the // original text of length n, the true Myers algorithm will take O(n+d^2) // time while this optimization needs only O(n+d) time. - - var minDiagonalToConsider = -Infinity, - maxDiagonalToConsider = Infinity; // Main worker method. checks all permutations of a given edit length for acceptance. + maxDiagonalToConsider = Infinity; + // Main worker method. checks all permutations of a given edit length for acceptance. function execEditLength() { for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) { var basePath = void 0; var removePath = bestPath[diagonalPath - 1], - addPath = bestPath[diagonalPath + 1]; - + addPath = bestPath[diagonalPath + 1]; if (removePath) { // No one else is going to attempt to use this value, clear it bestPath[diagonalPath - 1] = undefined; } - var canAdd = false; - if (addPath) { // what newPos will be after we do an insertion: var addPathNewPos = addPath.oldPos - diagonalPath; canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen; } - var canRemove = removePath && removePath.oldPos + 1 < oldLen; - if (!canAdd && !canRemove) { // If this path is a terminal then prune bestPath[diagonalPath] = undefined; continue; - } // Select the diagonal that we want to branch from. We select the prior + } + + // Select the diagonal that we want to branch from. We select the prior // path whose position in the old string is the farthest from the origin // and does not pass the bounds of the diff graph - // TODO: Remove the `+ 1` here to make behavior match Myers algorithm - // and prefer to order removals before insertions. - - - if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) { - basePath = self.addToPath(addPath, true, undefined, 0); + if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) { + basePath = self.addToPath(addPath, true, false, 0, options); } else { - basePath = self.addToPath(removePath, undefined, true, 1); + basePath = self.addToPath(removePath, false, true, 1, options); } - - newPos = self.extractCommon(basePath, newString, oldString, diagonalPath); - + newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options); if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) { // If we have hit the end of both strings, then we are done return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken)); } else { bestPath[diagonalPath] = basePath; - if (basePath.oldPos + 1 >= oldLen) { maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1); } - if (newPos + 1 >= newLen) { minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1); } } } - editLength++; - } // Performs the length of edit iteration. Is a bit fugly as this has to support the + } + + // Performs the length of edit iteration. Is a bit fugly as this has to support the // sync and async mode which is never fun. Loops over execEditLength until a value // is produced, or until the edit length exceeds options.maxEditLength (if given), // in which case it will return undefined. - - if (callback) { (function exec() { setTimeout(function () { if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) { return callback(); } - if (!execEditLength()) { exec(); } @@ -154,17 +133,15 @@ Diff.prototype = { } else { while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) { var ret = execEditLength(); - if (ret) { return ret; } } } }, - addToPath: function addToPath(path, added, removed, oldPosInc) { + addToPath: function addToPath(path, added, removed, oldPosInc, options) { var last = path.lastComponent; - - if (last && last.added === added && last.removed === removed) { + if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) { return { oldPos: path.oldPos + oldPosInc, lastComponent: { @@ -186,80 +163,83 @@ Diff.prototype = { }; } }, - extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { + extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) { var newLen = newString.length, - oldLen = oldString.length, - oldPos = basePath.oldPos, - newPos = oldPos - diagonalPath, - commonCount = 0; - - while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { + oldLen = oldString.length, + oldPos = basePath.oldPos, + newPos = oldPos - diagonalPath, + commonCount = 0; + while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) { newPos++; oldPos++; commonCount++; + if (options.oneChangePerToken) { + basePath.lastComponent = { + count: 1, + previousComponent: basePath.lastComponent, + added: false, + removed: false + }; + } } - - if (commonCount) { + if (commonCount && !options.oneChangePerToken) { basePath.lastComponent = { count: commonCount, - previousComponent: basePath.lastComponent + previousComponent: basePath.lastComponent, + added: false, + removed: false }; } - basePath.oldPos = oldPos; return newPos; }, - equals: function equals(left, right) { - if (this.options.comparator) { - return this.options.comparator(left, right); + equals: function equals(left, right, options) { + if (options.comparator) { + return options.comparator(left, right); } else { - return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); + return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase(); } }, removeEmpty: function removeEmpty(array) { var ret = []; - for (var i = 0; i < array.length; i++) { if (array[i]) { ret.push(array[i]); } } - return ret; }, castInput: function castInput(value) { return value; }, tokenize: function tokenize(value) { - return value.split(''); + return Array.from(value); }, join: function join(chars) { return chars.join(''); + }, + postProcess: function postProcess(changeObjects) { + return changeObjects; } }; - function buildValues(diff, lastComponent, newString, oldString, useLongestToken) { // First we convert our linked list of components in reverse order to an // array in the right order: var components = []; var nextComponent; - while (lastComponent) { components.push(lastComponent); nextComponent = lastComponent.previousComponent; delete lastComponent.previousComponent; lastComponent = nextComponent; } - components.reverse(); var componentPos = 0, - componentLen = components.length, - newPos = 0, - oldPos = 0; - + componentLen = components.length, + newPos = 0, + oldPos = 0; for (; componentPos < componentLen; componentPos++) { var component = components[componentPos]; - if (!component.removed) { if (!component.added && useLongestToken) { var value = newString.slice(newPos, newPos + component.count); @@ -271,36 +251,17 @@ function buildValues(diff, lastComponent, newString, oldString, useLongestToken) } else { component.value = diff.join(newString.slice(newPos, newPos + component.count)); } + newPos += component.count; - newPos += component.count; // Common case - + // Common case if (!component.added) { oldPos += component.count; } } else { component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); - oldPos += component.count; // Reverse add and remove so removes are output first to match common convention - // The diffing algorithm is tied to add then remove output and this is the simplest - // route to get the desired output with minimal overhead. - - if (componentPos && components[componentPos - 1].added) { - var tmp = components[componentPos - 1]; - components[componentPos - 1] = components[componentPos]; - components[componentPos] = tmp; - } + oldPos += component.count; } - } // Special case handle for when one terminal is ignored (i.e. whitespace). - // For this case we merge the terminal into the prior string and drop the change. - // This is only available for string mode. - - - var finalComponent = components[componentLen - 1]; - - if (componentLen > 1 && typeof finalComponent.value === 'string' && (finalComponent.added || finalComponent.removed) && diff.equals('', finalComponent.value)) { - components[componentLen - 2].value += finalComponent.value; - components.pop(); } - return components; } @@ -309,21 +270,114 @@ function diffChars(oldStr, newStr, options) { return characterDiff.diff(oldStr, newStr, options); } -function generateOptions(options, defaults) { - if (typeof options === 'function') { - defaults.callback = options; - } else if (options) { - for (var name in options) { - /* istanbul ignore else */ - if (options.hasOwnProperty(name)) { - defaults[name] = options[name]; - } +function longestCommonPrefix(str1, str2) { + var i; + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[i] != str2[i]) { + return str1.slice(0, i); } } + return str1.slice(0, i); +} +function longestCommonSuffix(str1, str2) { + var i; - return defaults; + // Unlike longestCommonPrefix, we need a special case to handle all scenarios + // where we return the empty string since str1.slice(-0) will return the + // entire string. + if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) { + return ''; + } + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) { + return str1.slice(-i); + } + } + return str1.slice(-i); +} +function replacePrefix(string, oldPrefix, newPrefix) { + if (string.slice(0, oldPrefix.length) != oldPrefix) { + throw Error("string ".concat(JSON.stringify(string), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug")); + } + return newPrefix + string.slice(oldPrefix.length); +} +function replaceSuffix(string, oldSuffix, newSuffix) { + if (!oldSuffix) { + return string + newSuffix; + } + if (string.slice(-oldSuffix.length) != oldSuffix) { + throw Error("string ".concat(JSON.stringify(string), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug")); + } + return string.slice(0, -oldSuffix.length) + newSuffix; +} +function removePrefix(string, oldPrefix) { + return replacePrefix(string, oldPrefix, ''); +} +function removeSuffix(string, oldSuffix) { + return replaceSuffix(string, oldSuffix, ''); +} +function maximumOverlap(string1, string2) { + return string2.slice(0, overlapCount(string1, string2)); +} + +// Nicked from https://stackoverflow.com/a/60422853/1709587 +function overlapCount(a, b) { + // Deal with cases where the strings differ in length + var startA = 0; + if (a.length > b.length) { + startA = a.length - b.length; + } + var endB = b.length; + if (a.length < b.length) { + endB = a.length; + } + // Create a back-reference for each index + // that should be followed in case of a mismatch. + // We only need B to make these references: + var map = Array(endB); + var k = 0; // Index that lags behind j + map[0] = 0; + for (var j = 1; j < endB; j++) { + if (b[j] == b[k]) { + map[j] = map[k]; // skip over the same character (optional optimisation) + } else { + map[j] = k; + } + while (k > 0 && b[j] != b[k]) { + k = map[k]; + } + if (b[j] == b[k]) { + k++; + } + } + // Phase 2: use these references while iterating over A + k = 0; + for (var i = startA; i < a.length; i++) { + while (k > 0 && a[i] != b[k]) { + k = map[k]; + } + if (a[i] == b[k]) { + k++; + } + } + return k; +} + +/** + * Returns true if the string consistently uses Windows line endings. + */ +function hasOnlyWinLineEndings(string) { + return string.includes('\r\n') && !string.startsWith('\n') && !string.match(/[^\r]\n/); +} + +/** + * Returns true if the string consistently uses Unix line endings. + */ +function hasOnlyUnixLineEndings(string) { + return !string.includes('\r\n') && string.includes('\n'); } +// Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode // // Ranges and exceptions: // Latin-1 Supplement, 0080–00FF @@ -341,82 +395,330 @@ function generateOptions(options, defaults) { // - U+02DC ˜ ˜ Small Tilde // - U+02DD ˝ ˝ Double Acute Accent // Latin Extended Additional, 1E00–1EFF +var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}"; -var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; -var reWhitespace = /\S/; +// Each token is one of the following: +// - A punctuation mark plus the surrounding whitespace +// - A word plus the surrounding whitespace +// - Pure whitespace (but only in the special case where this the entire text +// is just whitespace) +// +// We have to include surrounding whitespace in the tokens because the two +// alternative approaches produce horribly broken results: +// * If we just discard the whitespace, we can't fully reproduce the original +// text from the sequence of tokens and any attempt to render the diff will +// get the whitespace wrong. +// * If we have separate tokens for whitespace, then in a typical text every +// second token will be a single space character. But this often results in +// the optimal diff between two texts being a perverse one that preserves +// the spaces between words but deletes and reinserts actual common words. +// See https://github.com/kpdecker/jsdiff/issues/160#issuecomment-1866099640 +// for an example. +// +// Keeping the surrounding whitespace of course has implications for .equals +// and .join, not just .tokenize. + +// This regex does NOT fully implement the tokenization rules described above. +// Instead, it gives runs of whitespace their own "token". The tokenize method +// then handles stitching whitespace tokens onto adjacent word or punctuation +// tokens. +var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), 'ug'); var wordDiff = new Diff(); - -wordDiff.equals = function (left, right) { - if (this.options.ignoreCase) { +wordDiff.equals = function (left, right, options) { + if (options.ignoreCase) { left = left.toLowerCase(); right = right.toLowerCase(); } - - return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); + return left.trim() === right.trim(); }; - wordDiff.tokenize = function (value) { - // All whitespace symbols except newline group into one token, each newline - in separate token - var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set. - - for (var i = 0; i < tokens.length - 1; i++) { - // If we have an empty string in the next field and we have only word chars before and after, merge - if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { - tokens[i] += tokens[i + 2]; - tokens.splice(i + 1, 2); - i--; + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var parts; + if (options.intlSegmenter) { + if (options.intlSegmenter.resolvedOptions().granularity != 'word') { + throw new Error('The segmenter passed must have a granularity of "word"'); } + parts = Array.from(options.intlSegmenter.segment(value), function (segment) { + return segment.segment; + }); + } else { + parts = value.match(tokenizeIncludingWhitespace) || []; } - + var tokens = []; + var prevPart = null; + parts.forEach(function (part) { + if (/\s/.test(part)) { + if (prevPart == null) { + tokens.push(part); + } else { + tokens.push(tokens.pop() + part); + } + } else if (/\s/.test(prevPart)) { + if (tokens[tokens.length - 1] == prevPart) { + tokens.push(tokens.pop() + part); + } else { + tokens.push(prevPart + part); + } + } else { + tokens.push(part); + } + prevPart = part; + }); return tokens; }; - -function diffWords(oldStr, newStr, options) { - options = generateOptions(options, { - ignoreWhitespace: true +wordDiff.join = function (tokens) { + // Tokens being joined here will always have appeared consecutively in the + // same text, so we can simply strip off the leading whitespace from all the + // tokens except the first (and except any whitespace-only tokens - but such + // a token will always be the first and only token anyway) and then join them + // and the whitespace around words and punctuation will end up correct. + return tokens.map(function (token, i) { + if (i == 0) { + return token; + } else { + return token.replace(/^\s+/, ''); + } + }).join(''); +}; +wordDiff.postProcess = function (changes, options) { + if (!changes || options.oneChangePerToken) { + return changes; + } + var lastKeep = null; + // Change objects representing any insertion or deletion since the last + // "keep" change object. There can be at most one of each. + var insertion = null; + var deletion = null; + changes.forEach(function (change) { + if (change.added) { + insertion = change; + } else if (change.removed) { + deletion = change; + } else { + if (insertion || deletion) { + // May be false at start of text + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change); + } + lastKeep = change; + insertion = null; + deletion = null; + } }); + if (insertion || deletion) { + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null); + } + return changes; +}; +function diffWords(oldStr, newStr, options) { + // This option has never been documented and never will be (it's clearer to + // just call `diffWordsWithSpace` directly if you need that behavior), but + // has existed in jsdiff for a long time, so we retain support for it here + // for the sake of backwards compatibility. + if ((options === null || options === void 0 ? void 0 : options.ignoreWhitespace) != null && !options.ignoreWhitespace) { + return diffWordsWithSpace(oldStr, newStr, options); + } return wordDiff.diff(oldStr, newStr, options); } +function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) { + // Before returning, we tidy up the leading and trailing whitespace of the + // change objects to eliminate cases where trailing whitespace in one object + // is repeated as leading whitespace in the next. + // Below are examples of the outcomes we want here to explain the code. + // I=insert, K=keep, D=delete + // 1. diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want: K:'foo ' D:'bar ' K:'baz' + // + // 2. Diffing 'foo bar baz' vs 'foo qux baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' I:' qux ' K:' baz' + // After cleanup, we want K:'foo ' D:'bar' I:'qux' K:' baz' + // + // 3. Diffing 'foo\nbar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:'\nbar ' K:' baz' + // After cleanup, we want K'foo' D:'\nbar' K:' baz' + // + // 4. Diffing 'foo baz' vs 'foo\nbar baz' + // Prior to cleanup, we have K:'foo\n' I:'\nbar ' K:' baz' + // After cleanup, we ideally want K'foo' I:'\nbar' K:' baz' + // but don't actually manage this currently (the pre-cleanup change + // objects don't contain enough information to make it possible). + // + // 5. Diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want K:'foo ' D:' bar ' K:'baz' + // + // Our handling is unavoidably imperfect in the case where there's a single + // indel between keeps and the whitespace has changed. For instance, consider + // diffing 'foo\tbar\nbaz' vs 'foo baz'. Unless we create an extra change + // object to represent the insertion of the space character (which isn't even + // a token), we have no way to avoid losing information about the texts' + // original whitespace in the result we return. Still, we do our best to + // output something that will look sensible if we e.g. print it with + // insertions in green and deletions in red. + + // Between two "keep" change objects (or before the first or after the last + // change object), we can have either: + // * A "delete" followed by an "insert" + // * Just an "insert" + // * Just a "delete" + // We handle the three cases separately. + if (deletion && insertion) { + var oldWsPrefix = deletion.value.match(/^\s*/)[0]; + var oldWsSuffix = deletion.value.match(/\s*$/)[0]; + var newWsPrefix = insertion.value.match(/^\s*/)[0]; + var newWsSuffix = insertion.value.match(/\s*$/)[0]; + if (startKeep) { + var commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix); + startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix); + deletion.value = removePrefix(deletion.value, commonWsPrefix); + insertion.value = removePrefix(insertion.value, commonWsPrefix); + } + if (endKeep) { + var commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix); + endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix); + deletion.value = removeSuffix(deletion.value, commonWsSuffix); + insertion.value = removeSuffix(insertion.value, commonWsSuffix); + } + } else if (insertion) { + // The whitespaces all reflect what was in the new text rather than + // the old, so we essentially have no information about whitespace + // insertion or deletion. We just want to dedupe the whitespace. + // We do that by having each change object keep its trailing + // whitespace and deleting duplicate leading whitespace where + // present. + if (startKeep) { + insertion.value = insertion.value.replace(/^\s*/, ''); + } + if (endKeep) { + endKeep.value = endKeep.value.replace(/^\s*/, ''); + } + // otherwise we've got a deletion and no insertion + } else if (startKeep && endKeep) { + var newWsFull = endKeep.value.match(/^\s*/)[0], + delWsStart = deletion.value.match(/^\s*/)[0], + delWsEnd = deletion.value.match(/\s*$/)[0]; + + // Any whitespace that comes straight after startKeep in both the old and + // new texts, assign to startKeep and remove from the deletion. + var newWsStart = longestCommonPrefix(newWsFull, delWsStart); + deletion.value = removePrefix(deletion.value, newWsStart); + + // Any whitespace that comes straight before endKeep in both the old and + // new texts, and hasn't already been assigned to startKeep, assign to + // endKeep and remove from the deletion. + var newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd); + deletion.value = removeSuffix(deletion.value, newWsEnd); + endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd); + + // If there's any whitespace from the new text that HASN'T already been + // assigned, assign it to the start: + startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length)); + } else if (endKeep) { + // We are at the start of the text. Preserve all the whitespace on + // endKeep, and just remove whitespace from the end of deletion to the + // extent that it overlaps with the start of endKeep. + var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0]; + var deletionWsSuffix = deletion.value.match(/\s*$/)[0]; + var overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix); + deletion.value = removeSuffix(deletion.value, overlap); + } else if (startKeep) { + // We are at the END of the text. Preserve all the whitespace on + // startKeep, and just remove whitespace from the start of deletion to + // the extent that it overlaps with the end of startKeep. + var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0]; + var deletionWsPrefix = deletion.value.match(/^\s*/)[0]; + var _overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix); + deletion.value = removePrefix(deletion.value, _overlap); + } +} +var wordWithSpaceDiff = new Diff(); +wordWithSpaceDiff.tokenize = function (value) { + // Slightly different to the tokenizeIncludingWhitespace regex used above in + // that this one treats each individual newline as a distinct tokens, rather + // than merging them into other surrounding whitespace. This was requested + // in https://github.com/kpdecker/jsdiff/issues/180 & + // https://github.com/kpdecker/jsdiff/issues/211 + var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), 'ug'); + return value.match(regex) || []; +}; function diffWordsWithSpace(oldStr, newStr, options) { - return wordDiff.diff(oldStr, newStr, options); + return wordWithSpaceDiff.diff(oldStr, newStr, options); } -var lineDiff = new Diff(); +function generateOptions(options, defaults) { + if (typeof options === 'function') { + defaults.callback = options; + } else if (options) { + for (var name in options) { + /* istanbul ignore else */ + if (options.hasOwnProperty(name)) { + defaults[name] = options[name]; + } + } + } + return defaults; +} -lineDiff.tokenize = function (value) { - if (this.options.stripTrailingCr) { +var lineDiff = new Diff(); +lineDiff.tokenize = function (value, options) { + if (options.stripTrailingCr) { // remove one \r before \n to match GNU diff's --strip-trailing-cr behavior value = value.replace(/\r\n/g, '\n'); } - var retLines = [], - linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line + linesAndNewlines = value.split(/(\n|\r\n)/); + // Ignore the final empty token that occurs if the string ends with a new line if (!linesAndNewlines[linesAndNewlines.length - 1]) { linesAndNewlines.pop(); - } // Merge the content and line separators into single tokens - + } + // Merge the content and line separators into single tokens for (var i = 0; i < linesAndNewlines.length; i++) { var line = linesAndNewlines[i]; - - if (i % 2 && !this.options.newlineIsToken) { + if (i % 2 && !options.newlineIsToken) { retLines[retLines.length - 1] += line; } else { - if (this.options.ignoreWhitespace) { - line = line.trim(); - } - retLines.push(line); } } - return retLines; }; - +lineDiff.equals = function (left, right, options) { + // If we're ignoring whitespace, we need to normalise lines by stripping + // whitespace before checking equality. (This has an annoying interaction + // with newlineIsToken that requires special handling: if newlines get their + // own token, then we DON'T want to trim the *newline* tokens down to empty + // strings, since this would cause us to treat whitespace-only line content + // as equal to a separator between lines, which would be weird and + // inconsistent with the documented behavior of the options.) + if (options.ignoreWhitespace) { + if (!options.newlineIsToken || !left.includes('\n')) { + left = left.trim(); + } + if (!options.newlineIsToken || !right.includes('\n')) { + right = right.trim(); + } + } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) { + if (left.endsWith('\n')) { + left = left.slice(0, -1); + } + if (right.endsWith('\n')) { + right = right.slice(0, -1); + } + } + return Diff.prototype.equals.call(this, left, right, options); +}; function diffLines(oldStr, newStr, callback) { return lineDiff.diff(oldStr, newStr, callback); } + +// Kept for backwards compatibility. This is a rather arbitrary wrapper method +// that just calls `diffLines` with `ignoreWhitespace: true`. It's confusing to +// have two ways to do exactly the same thing in the API, so we no longer +// document this one (library users should explicitly use `diffLines` with +// `ignoreWhitespace: true` instead) but we keep it around to maintain +// compatibility with code that used old versions. function diffTrimmedLines(oldStr, newStr, callback) { var options = generateOptions(callback, { ignoreWhitespace: true @@ -425,42 +727,67 @@ function diffTrimmedLines(oldStr, newStr, callback) { } var sentenceDiff = new Diff(); - sentenceDiff.tokenize = function (value) { return value.split(/(\S.+?[.!?])(?=\s+|$)/); }; - function diffSentences(oldStr, newStr, callback) { return sentenceDiff.diff(oldStr, newStr, callback); } var cssDiff = new Diff(); - cssDiff.tokenize = function (value) { return value.split(/([{}:;,]|\s+)/); }; - function diffCss(oldStr, newStr, callback) { return cssDiff.diff(oldStr, newStr, callback); } -function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; +function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function (r) { + return Object.getOwnPropertyDescriptor(e, r).enumerable; + })), t.push.apply(t, o); } - - return _typeof(obj); + return t; +} +function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { + _defineProperty(e, r, t[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); + }); + } + return e; +} +function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} +function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : i + ""; } +function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); +} function _defineProperty(obj, key, value) { + key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, @@ -471,56 +798,17 @@ function _defineProperty(obj, key, value) { } else { obj[key] = value; } - return obj; } - -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - if (enumerableOnly) symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - keys.push.apply(keys, symbols); - } - - return keys; -} - -function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; -} - function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); @@ -529,238 +817,263 @@ function _unsupportedIterableToArray(o, minLen) { if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - return arr2; } - function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -var objectPrototypeToString = Object.prototype.toString; -var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a +var jsonDiff = new Diff(); +// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: - jsonDiff.useLongestToken = true; jsonDiff.tokenize = lineDiff.tokenize; - -jsonDiff.castInput = function (value) { - var _this$options = this.options, - undefinedReplacement = _this$options.undefinedReplacement, - _this$options$stringi = _this$options.stringifyReplacer, - stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) { - return typeof v === 'undefined' ? undefinedReplacement : v; - } : _this$options$stringi; +jsonDiff.castInput = function (value, options) { + var undefinedReplacement = options.undefinedReplacement, + _options$stringifyRep = options.stringifyReplacer, + stringifyReplacer = _options$stringifyRep === void 0 ? function (k, v) { + return typeof v === 'undefined' ? undefinedReplacement : v; + } : _options$stringifyRep; return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); }; - -jsonDiff.equals = function (left, right) { - return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')); +jsonDiff.equals = function (left, right, options) { + return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'), options); }; - function diffJson(oldObj, newObj, options) { return jsonDiff.diff(oldObj, newObj, options); -} // This function handles the presence of circular references by bailing out when encountering an -// object that is already on the "stack" of items being processed. Accepts an optional replacer +} +// This function handles the presence of circular references by bailing out when encountering an +// object that is already on the "stack" of items being processed. Accepts an optional replacer function canonicalize(obj, stack, replacementStack, replacer, key) { stack = stack || []; replacementStack = replacementStack || []; - if (replacer) { obj = replacer(key, obj); } - var i; - for (i = 0; i < stack.length; i += 1) { if (stack[i] === obj) { return replacementStack[i]; } } - var canonicalizedObj; - - if ('[object Array]' === objectPrototypeToString.call(obj)) { + if ('[object Array]' === Object.prototype.toString.call(obj)) { stack.push(obj); canonicalizedObj = new Array(obj.length); replacementStack.push(canonicalizedObj); - for (i = 0; i < obj.length; i += 1) { canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); } - stack.pop(); replacementStack.pop(); return canonicalizedObj; } - if (obj && obj.toJSON) { obj = obj.toJSON(); } - if (_typeof(obj) === 'object' && obj !== null) { stack.push(obj); canonicalizedObj = {}; replacementStack.push(canonicalizedObj); - var sortedKeys = [], - _key; - + _key; for (_key in obj) { /* istanbul ignore else */ - if (obj.hasOwnProperty(_key)) { + if (Object.prototype.hasOwnProperty.call(obj, _key)) { sortedKeys.push(_key); } } - sortedKeys.sort(); - for (i = 0; i < sortedKeys.length; i += 1) { _key = sortedKeys[i]; canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); } - stack.pop(); replacementStack.pop(); } else { canonicalizedObj = obj; } - return canonicalizedObj; } var arrayDiff = new Diff(); - arrayDiff.tokenize = function (value) { return value.slice(); }; - arrayDiff.join = arrayDiff.removeEmpty = function (value) { return value; }; - function diffArrays(oldArr, newArr, callback) { return arrayDiff.diff(oldArr, newArr, callback); } -function parsePatch(uniDiff) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [], - list = [], - i = 0; +function unixToWin(patch) { + if (Array.isArray(patch)) { + return patch.map(unixToWin); + } + return _objectSpread2(_objectSpread2({}, patch), {}, { + hunks: patch.hunks.map(function (hunk) { + return _objectSpread2(_objectSpread2({}, hunk), {}, { + lines: hunk.lines.map(function (line, i) { + var _hunk$lines; + return line.startsWith('\\') || line.endsWith('\r') || (_hunk$lines = hunk.lines[i + 1]) !== null && _hunk$lines !== void 0 && _hunk$lines.startsWith('\\') ? line : line + '\r'; + }) + }); + }) + }); +} +function winToUnix(patch) { + if (Array.isArray(patch)) { + return patch.map(winToUnix); + } + return _objectSpread2(_objectSpread2({}, patch), {}, { + hunks: patch.hunks.map(function (hunk) { + return _objectSpread2(_objectSpread2({}, hunk), {}, { + lines: hunk.lines.map(function (line) { + return line.endsWith('\r') ? line.substring(0, line.length - 1) : line; + }) + }); + }) + }); +} + +/** + * Returns true if the patch consistently uses Unix line endings (or only involves one line and has + * no line endings). + */ +function isUnix(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return !patch.some(function (index) { + return index.hunks.some(function (hunk) { + return hunk.lines.some(function (line) { + return !line.startsWith('\\') && line.endsWith('\r'); + }); + }); + }); +} + +/** + * Returns true if the patch uses Windows line endings and only Windows line endings. + */ +function isWin(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return patch.some(function (index) { + return index.hunks.some(function (hunk) { + return hunk.lines.some(function (line) { + return line.endsWith('\r'); + }); + }); + }) && patch.every(function (index) { + return index.hunks.every(function (hunk) { + return hunk.lines.every(function (line, i) { + var _hunk$lines2; + return line.startsWith('\\') || line.endsWith('\r') || ((_hunk$lines2 = hunk.lines[i + 1]) === null || _hunk$lines2 === void 0 ? void 0 : _hunk$lines2.startsWith('\\')); + }); + }); + }); +} +function parsePatch(uniDiff) { + var diffstr = uniDiff.split(/\n/), + list = [], + i = 0; function parseIndex() { var index = {}; - list.push(index); // Parse diff metadata + list.push(index); + // Parse diff metadata while (i < diffstr.length) { - var line = diffstr[i]; // File header found, end parsing diff metadata + var line = diffstr[i]; + // File header found, end parsing diff metadata if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { break; - } // Diff index - + } + // Diff index var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); - if (header) { index.index = header[1]; } - i++; - } // Parse file headers if they are defined. Unified diff requires them, but - // there's no technical issues to have an isolated hunk without file header - + } + // Parse file headers if they are defined. Unified diff requires them, but + // there's no technical issues to have an isolated hunk without file header + parseFileHeader(index); parseFileHeader(index); - parseFileHeader(index); // Parse hunks + // Parse hunks index.hunks = []; - while (i < diffstr.length) { var _line = diffstr[i]; - - if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) { + if (/^(Index:\s|diff\s|\-\-\-\s|\+\+\+\s|===================================================================)/.test(_line)) { break; } else if (/^@@/.test(_line)) { index.hunks.push(parseHunk()); - } else if (_line && options.strict) { - // Ignore unexpected content unless in strict mode + } else if (_line) { throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); } else { i++; } } - } // Parses the --- and +++ headers, if none are found, no lines - // are consumed. - + } + // Parses the --- and +++ headers, if none are found, no lines + // are consumed. function parseFileHeader(index) { - var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]); - + var fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]); if (fileHeader) { var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; var data = fileHeader[2].split('\t', 2); var fileName = data[0].replace(/\\\\/g, '\\'); - if (/^".*"$/.test(fileName)) { fileName = fileName.substr(1, fileName.length - 2); } - index[keyPrefix + 'FileName'] = fileName; index[keyPrefix + 'Header'] = (data[1] || '').trim(); i++; } - } // Parses a hunk - // This assumes that we are at the start of a hunk. - + } + // Parses a hunk + // This assumes that we are at the start of a hunk. function parseHunk() { var chunkHeaderIndex = i, - chunkHeaderLine = diffstr[i++], - chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); + chunkHeaderLine = diffstr[i++], + chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); var hunk = { oldStart: +chunkHeader[1], oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2], newStart: +chunkHeader[3], newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4], - lines: [], - linedelimiters: [] - }; // Unified Diff Format quirk: If the chunk size is 0, + lines: [] + }; + + // Unified Diff Format quirk: If the chunk size is 0, // the first number is one lower than one would expect. // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 - if (hunk.oldLines === 0) { hunk.oldStart += 1; } - if (hunk.newLines === 0) { hunk.newStart += 1; } - var addCount = 0, - removeCount = 0; - - for (; i < diffstr.length; i++) { - // Lines starting with '---' could be mistaken for the "remove line" operation - // But they could be the header for the next file. Therefore prune such cases out. - if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) { - break; - } - + removeCount = 0; + for (; i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || (_diffstr$i = diffstr[i]) !== null && _diffstr$i !== void 0 && _diffstr$i.startsWith('\\')); i++) { + var _diffstr$i; var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; - if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { hunk.lines.push(diffstr[i]); - hunk.linedelimiters.push(delimiters[i] || '\n'); - if (operation === '+') { addCount++; } else if (operation === '-') { @@ -770,37 +1083,30 @@ function parsePatch(uniDiff) { removeCount++; } } else { - break; + throw new Error("Hunk at line ".concat(chunkHeaderIndex + 1, " contained invalid line ").concat(diffstr[i])); } - } // Handle the empty block count case - + } + // Handle the empty block count case if (!addCount && hunk.newLines === 1) { hunk.newLines = 0; } - if (!removeCount && hunk.oldLines === 1) { hunk.oldLines = 0; - } // Perform optional sanity checking - - - if (options.strict) { - if (addCount !== hunk.newLines) { - throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - - if (removeCount !== hunk.oldLines) { - throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } } + // Perform sanity checking + if (addCount !== hunk.newLines) { + throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + if (removeCount !== hunk.oldLines) { + throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } return hunk; } - while (i < diffstr.length) { parseIndex(); } - return list; } @@ -809,210 +1115,275 @@ function parsePatch(uniDiff) { // start of 2, this will iterate 2, 3, 1, 4, 0. function distanceIterator (start, minLine, maxLine) { var wantForward = true, - backwardExhausted = false, - forwardExhausted = false, - localOffset = 1; + backwardExhausted = false, + forwardExhausted = false, + localOffset = 1; return function iterator() { if (wantForward && !forwardExhausted) { if (backwardExhausted) { localOffset++; } else { wantForward = false; - } // Check if trying to fit beyond text length, and if not, check it fits - // after offset location (or desired location on first iteration) - + } + // Check if trying to fit beyond text length, and if not, check it fits + // after offset location (or desired location on first iteration) if (start + localOffset <= maxLine) { - return localOffset; + return start + localOffset; } - forwardExhausted = true; } - if (!backwardExhausted) { if (!forwardExhausted) { wantForward = true; - } // Check if trying to fit before text beginning, and if not, check it fits - // before offset location - + } + // Check if trying to fit before text beginning, and if not, check it fits + // before offset location if (minLine <= start - localOffset) { - return -localOffset++; + return start - localOffset++; } - backwardExhausted = true; return iterator(); - } // We tried to fit hunk before text beginning and beyond text length, then - // hunk can't fit on the text. Return undefined + } + // We tried to fit hunk before text beginning and beyond text length, then + // hunk can't fit on the text. Return undefined }; } function applyPatch(source, uniDiff) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - if (typeof uniDiff === 'string') { uniDiff = parsePatch(uniDiff); } - if (Array.isArray(uniDiff)) { if (uniDiff.length > 1) { throw new Error('applyPatch only works with a single input.'); } - uniDiff = uniDiff[0]; - } // Apply the diff to the input - - - var lines = source.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [], - hunks = uniDiff.hunks, - compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { - return line === patchContent; - }, - errorCount = 0, - fuzzFactor = options.fuzzFactor || 0, - minLine = 0, - offset = 0, - removeEOFNL, - addEOFNL; - /** - * Checks if the hunk exactly fits on the provided location - */ + } + if (options.autoConvertLineEndings || options.autoConvertLineEndings == null) { + if (hasOnlyWinLineEndings(source) && isUnix(uniDiff)) { + uniDiff = unixToWin(uniDiff); + } else if (hasOnlyUnixLineEndings(source) && isWin(uniDiff)) { + uniDiff = winToUnix(uniDiff); + } + } + // Apply the diff to the input + var lines = source.split('\n'), + hunks = uniDiff.hunks, + compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { + return line === patchContent; + }, + fuzzFactor = options.fuzzFactor || 0, + minLine = 0; + if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) { + throw new Error('fuzzFactor must be a non-negative integer'); + } - function hunkFits(hunk, toPos) { - for (var j = 0; j < hunk.lines.length; j++) { - var line = hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line; + // Special case for empty patch. + if (!hunks.length) { + return source; + } - if (operation === ' ' || operation === '-') { - // Context sanity check - if (!compareLine(toPos + 1, lines[toPos], operation, content)) { - errorCount++; + // Before anything else, handle EOFNL insertion/removal. If the patch tells us to make a change + // to the EOFNL that is redundant/impossible - i.e. to remove a newline that's not there, or add a + // newline that already exists - then we either return false and fail to apply the patch (if + // fuzzFactor is 0) or simply ignore the problem and do nothing (if fuzzFactor is >0). + // If we do need to remove/add a newline at EOF, this will always be in the final hunk: + var prevLine = '', + removeEOFNL = false, + addEOFNL = false; + for (var i = 0; i < hunks[hunks.length - 1].lines.length; i++) { + var line = hunks[hunks.length - 1].lines[i]; + if (line[0] == '\\') { + if (prevLine[0] == '+') { + removeEOFNL = true; + } else if (prevLine[0] == '-') { + addEOFNL = true; + } + } + prevLine = line; + } + if (removeEOFNL) { + if (addEOFNL) { + // This means the final line gets changed but doesn't have a trailing newline in either the + // original or patched version. In that case, we do nothing if fuzzFactor > 0, and if + // fuzzFactor is 0, we simply validate that the source file has no trailing newline. + if (!fuzzFactor && lines[lines.length - 1] == '') { + return false; + } + } else if (lines[lines.length - 1] == '') { + lines.pop(); + } else if (!fuzzFactor) { + return false; + } + } else if (addEOFNL) { + if (lines[lines.length - 1] != '') { + lines.push(''); + } else if (!fuzzFactor) { + return false; + } + } - if (errorCount > fuzzFactor) { - return false; + /** + * Checks if the hunk can be made to fit at the provided location with at most `maxErrors` + * insertions, substitutions, or deletions, while ensuring also that: + * - lines deleted in the hunk match exactly, and + * - wherever an insertion operation or block of insertion operations appears in the hunk, the + * immediately preceding and following lines of context match exactly + * + * `toPos` should be set such that lines[toPos] is meant to match hunkLines[0]. + * + * If the hunk can be applied, returns an object with properties `oldLineLastI` and + * `replacementLines`. Otherwise, returns null. + */ + function applyHunk(hunkLines, toPos, maxErrors) { + var hunkLinesI = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + var lastContextLineMatched = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var patchedLines = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : []; + var patchedLinesLength = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0; + var nConsecutiveOldContextLines = 0; + var nextContextLineMustMatch = false; + for (; hunkLinesI < hunkLines.length; hunkLinesI++) { + var hunkLine = hunkLines[hunkLinesI], + operation = hunkLine.length > 0 ? hunkLine[0] : ' ', + content = hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine; + if (operation === '-') { + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + toPos++; + nConsecutiveOldContextLines = 0; + } else { + if (!maxErrors || lines[toPos] == null) { + return null; } + patchedLines[patchedLinesLength] = lines[toPos]; + return applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1); } + } + if (operation === '+') { + if (!lastContextLineMatched) { + return null; + } + patchedLines[patchedLinesLength] = content; + patchedLinesLength++; + nConsecutiveOldContextLines = 0; + nextContextLineMustMatch = true; + } + if (operation === ' ') { + nConsecutiveOldContextLines++; + patchedLines[patchedLinesLength] = lines[toPos]; + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + patchedLinesLength++; + lastContextLineMatched = true; + nextContextLineMustMatch = false; + toPos++; + } else { + if (nextContextLineMustMatch || !maxErrors) { + return null; + } - toPos++; + // Consider 3 possibilities in sequence: + // 1. lines contains a *substitution* not included in the patch context, or + // 2. lines contains an *insertion* not included in the patch context, or + // 3. lines contains a *deletion* not included in the patch context + // The first two options are of course only possible if the line from lines is non-null - + // i.e. only option 3 is possible if we've overrun the end of the old file. + return lines[toPos] && (applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength + 1) || applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1)) || applyHunk(hunkLines, toPos, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength); + } } } - return true; - } // Search best fit offsets for each hunk based on the previous ones - - - for (var i = 0; i < hunks.length; i++) { - var hunk = hunks[i], - maxLine = lines.length - hunk.oldLines, - localOffset = 0, - toPos = offset + hunk.oldStart - 1; - var iterator = distanceIterator(toPos, minLine, maxLine); + // Before returning, trim any unmodified context lines off the end of patchedLines and reduce + // toPos (and thus oldLineLastI) accordingly. This allows later hunks to be applied to a region + // that starts in this hunk's trailing context. + patchedLinesLength -= nConsecutiveOldContextLines; + toPos -= nConsecutiveOldContextLines; + patchedLines.length = patchedLinesLength; + return { + patchedLines: patchedLines, + oldLineLastI: toPos - 1 + }; + } + var resultLines = []; - for (; localOffset !== undefined; localOffset = iterator()) { - if (hunkFits(hunk, toPos + localOffset)) { - hunk.offset = offset += localOffset; + // Search best fit offsets for each hunk based on the previous ones + var prevHunkOffset = 0; + for (var _i = 0; _i < hunks.length; _i++) { + var hunk = hunks[_i]; + var hunkResult = void 0; + var maxLine = lines.length - hunk.oldLines + fuzzFactor; + var toPos = void 0; + for (var maxErrors = 0; maxErrors <= fuzzFactor; maxErrors++) { + toPos = hunk.oldStart + prevHunkOffset - 1; + var iterator = distanceIterator(toPos, minLine, maxLine); + for (; toPos !== undefined; toPos = iterator()) { + hunkResult = applyHunk(hunk.lines, toPos, maxErrors); + if (hunkResult) { + break; + } + } + if (hunkResult) { break; } } - - if (localOffset === undefined) { + if (!hunkResult) { return false; - } // Set lower text limit to end of the current hunk, so next ones don't try - // to fit over already patched text - - - minLine = hunk.offset + hunk.oldStart + hunk.oldLines; - } // Apply patch hunks - - - var diffOffset = 0; - - for (var _i = 0; _i < hunks.length; _i++) { - var _hunk = hunks[_i], - _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1; - - diffOffset += _hunk.newLines - _hunk.oldLines; + } - for (var j = 0; j < _hunk.lines.length; j++) { - var line = _hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line, - delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n'; + // Copy everything from the end of where we applied the last hunk to the start of this hunk + for (var _i2 = minLine; _i2 < toPos; _i2++) { + resultLines.push(lines[_i2]); + } - if (operation === ' ') { - _toPos++; - } else if (operation === '-') { - lines.splice(_toPos, 1); - delimiters.splice(_toPos, 1); - /* istanbul ignore else */ - } else if (operation === '+') { - lines.splice(_toPos, 0, content); - delimiters.splice(_toPos, 0, delimiter); - _toPos++; - } else if (operation === '\\') { - var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null; - - if (previousOperation === '+') { - removeEOFNL = true; - } else if (previousOperation === '-') { - addEOFNL = true; - } - } + // Add the lines produced by applying the hunk: + for (var _i3 = 0; _i3 < hunkResult.patchedLines.length; _i3++) { + var _line = hunkResult.patchedLines[_i3]; + resultLines.push(_line); } - } // Handle EOFNL insertion/removal + // Set lower text limit to end of the current hunk, so next ones don't try + // to fit over already patched text + minLine = hunkResult.oldLineLastI + 1; - if (removeEOFNL) { - while (!lines[lines.length - 1]) { - lines.pop(); - delimiters.pop(); - } - } else if (addEOFNL) { - lines.push(''); - delimiters.push('\n'); + // Note the offset between where the patch said the hunk should've applied and where we + // applied it, so we can adjust future hunks accordingly: + prevHunkOffset = toPos + 1 - hunk.oldStart; } - for (var _k = 0; _k < lines.length - 1; _k++) { - lines[_k] = lines[_k] + delimiters[_k]; + // Copy over the rest of the lines from the old text + for (var _i4 = minLine; _i4 < lines.length; _i4++) { + resultLines.push(lines[_i4]); } + return resultLines.join('\n'); +} - return lines.join(''); -} // Wrapper that supports multiple file patches via callbacks. - +// Wrapper that supports multiple file patches via callbacks. function applyPatches(uniDiff, options) { if (typeof uniDiff === 'string') { uniDiff = parsePatch(uniDiff); } - var currentIndex = 0; - function processIndex() { var index = uniDiff[currentIndex++]; - if (!index) { return options.complete(); } - options.loadFile(index, function (err, data) { if (err) { return options.complete(err); } - var updatedContent = applyPatch(data, index, options); options.patched(index, updatedContent, function (err) { if (err) { return options.complete(err); } - processIndex(); }); }); } - processIndex(); } @@ -1020,206 +1391,238 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne if (!options) { options = {}; } - + if (typeof options === 'function') { + options = { + callback: options + }; + } if (typeof options.context === 'undefined') { options.context = 4; } - - var diff = diffLines(oldStr, newStr, options); - - if (!diff) { - return; + if (options.newlineIsToken) { + throw new Error('newlineIsToken may not be used with patch-generation functions, only with diffing functions'); } - - diff.push({ - value: '', - lines: [] - }); // Append an empty value to make cleanup easier - - function contextLines(lines) { - return lines.map(function (entry) { - return ' ' + entry; - }); + if (!options.callback) { + return diffLinesResultToPatch(diffLines(oldStr, newStr, options)); + } else { + var _options = options, + _callback = _options.callback; + diffLines(oldStr, newStr, _objectSpread2(_objectSpread2({}, options), {}, { + callback: function callback(diff) { + var patch = diffLinesResultToPatch(diff); + _callback(patch); + } + })); } + function diffLinesResultToPatch(diff) { + // STEP 1: Build up the patch with no "\ No newline at end of file" lines and with the arrays + // of lines containing trailing newline characters. We'll tidy up later... - var hunks = []; - var oldRangeStart = 0, + if (!diff) { + return; + } + diff.push({ + value: '', + lines: [] + }); // Append an empty value to make cleanup easier + + function contextLines(lines) { + return lines.map(function (entry) { + return ' ' + entry; + }); + } + var hunks = []; + var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1; - - var _loop = function _loop(i) { - var current = diff[i], - lines = current.lines || current.value.replace(/\n$/, '').split('\n'); - current.lines = lines; - - if (current.added || current.removed) { - var _curRange; - - // If we have previous context, start with that - if (!oldRangeStart) { - var prev = diff[i - 1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; + var _loop = function _loop() { + var current = diff[i], + lines = current.lines || splitLines(current.value); + current.lines = lines; + if (current.added || current.removed) { + var _curRange; + // If we have previous context, start with that + if (!oldRangeStart) { + var prev = diff[i - 1]; + oldRangeStart = oldLine; + newRangeStart = newLine; + if (prev) { + curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; + oldRangeStart -= curRange.length; + newRangeStart -= curRange.length; + } } - } // Output our changes + // Output our changes + (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { + return (current.added ? '+' : '-') + entry; + }))); - (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { - return (current.added ? '+' : '-') + entry; - }))); // Track the updated file position - - - if (current.added) { - newLine += lines.length; + // Track the updated file position + if (current.added) { + newLine += lines.length; + } else { + oldLine += lines.length; + } } else { + // Identical context lines. Track line changes + if (oldRangeStart) { + // Close out any changes that have been output (or join overlapping) + if (lines.length <= options.context * 2 && i < diff.length - 2) { + var _curRange2; + // Overlapping + (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); + } else { + var _curRange3; + // end the range and output + var contextSize = Math.min(lines.length, options.context); + (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); + var _hunk = { + oldStart: oldRangeStart, + oldLines: oldLine - oldRangeStart + contextSize, + newStart: newRangeStart, + newLines: newLine - newRangeStart + contextSize, + lines: curRange + }; + hunks.push(_hunk); + oldRangeStart = 0; + newRangeStart = 0; + curRange = []; + } + } oldLine += lines.length; + newLine += lines.length; } - } else { - // Identical context lines. Track line changes - if (oldRangeStart) { - // Close out any changes that have been output (or join overlapping) - if (lines.length <= options.context * 2 && i < diff.length - 2) { - var _curRange2; - - // Overlapping - (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); - } else { - var _curRange3; - - // end the range and output - var contextSize = Math.min(lines.length, options.context); - - (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); - - var hunk = { - oldStart: oldRangeStart, - oldLines: oldLine - oldRangeStart + contextSize, - newStart: newRangeStart, - newLines: newLine - newRangeStart + contextSize, - lines: curRange - }; - - if (i >= diff.length - 2 && lines.length <= options.context) { - // EOF is inside this hunk - var oldEOFNewline = /\n$/.test(oldStr); - var newEOFNewline = /\n$/.test(newStr); - var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines; - - if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) { - // special case: old has no eol and no trailing context; no-nl can end up before adds - // however, if the old file is empty, do not output the no-nl line - curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file'); - } - - if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) { - curRange.push('\\ No newline at end of file'); - } - } + }; + for (var i = 0; i < diff.length; i++) { + _loop(); + } - hunks.push(hunk); - oldRangeStart = 0; - newRangeStart = 0; - curRange = []; + // Step 2: eliminate the trailing `\n` from each line of each hunk, and, where needed, add + // "\ No newline at end of file". + for (var _i = 0, _hunks = hunks; _i < _hunks.length; _i++) { + var hunk = _hunks[_i]; + for (var _i2 = 0; _i2 < hunk.lines.length; _i2++) { + if (hunk.lines[_i2].endsWith('\n')) { + hunk.lines[_i2] = hunk.lines[_i2].slice(0, -1); + } else { + hunk.lines.splice(_i2 + 1, 0, '\\ No newline at end of file'); + _i2++; // Skip the line we just added, then continue iterating } } - - oldLine += lines.length; - newLine += lines.length; } - }; - - for (var i = 0; i < diff.length; i++) { - _loop(i); + return { + oldFileName: oldFileName, + newFileName: newFileName, + oldHeader: oldHeader, + newHeader: newHeader, + hunks: hunks + }; } - - return { - oldFileName: oldFileName, - newFileName: newFileName, - oldHeader: oldHeader, - newHeader: newHeader, - hunks: hunks - }; } function formatPatch(diff) { if (Array.isArray(diff)) { return diff.map(formatPatch).join('\n'); } - var ret = []; - if (diff.oldFileName == diff.newFileName) { ret.push('Index: ' + diff.oldFileName); } - ret.push('==================================================================='); ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); - for (var i = 0; i < diff.hunks.length; i++) { - var hunk = diff.hunks[i]; // Unified Diff Format quirk: If the chunk size is 0, + var hunk = diff.hunks[i]; + // Unified Diff Format quirk: If the chunk size is 0, // the first number is one lower than one would expect. // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 - if (hunk.oldLines === 0) { hunk.oldStart -= 1; } - if (hunk.newLines === 0) { hunk.newStart -= 1; } - ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); ret.push.apply(ret, hunk.lines); } - return ret.join('\n') + '\n'; } function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options)); + var _options2; + if (typeof options === 'function') { + options = { + callback: options + }; + } + if (!((_options2 = options) !== null && _options2 !== void 0 && _options2.callback)) { + var patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); + if (!patchObj) { + return; + } + return formatPatch(patchObj); + } else { + var _options3 = options, + _callback2 = _options3.callback; + structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, _objectSpread2(_objectSpread2({}, options), {}, { + callback: function callback(patchObj) { + if (!patchObj) { + _callback2(); + } else { + _callback2(formatPatch(patchObj)); + } + } + })); + } } function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); } +/** + * Split `text` into an array of lines, including the trailing newline character (where present) + */ +function splitLines(text) { + var hasTrailingNl = text.endsWith('\n'); + var result = text.split('\n').map(function (line) { + return line + '\n'; + }); + if (hasTrailingNl) { + result.pop(); + } else { + result.push(result.pop().slice(0, -1)); + } + return result; +} + function arrayEqual(a, b) { if (a.length !== b.length) { return false; } - return arrayStartsWith(a, b); } function arrayStartsWith(array, start) { if (start.length > array.length) { return false; } - for (var i = 0; i < start.length; i++) { if (start[i] !== array[i]) { return false; } } - return true; } function calcLineCount(hunk) { var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines), - oldLines = _calcOldNewLineCount.oldLines, - newLines = _calcOldNewLineCount.newLines; - + oldLines = _calcOldNewLineCount.oldLines, + newLines = _calcOldNewLineCount.newLines; if (oldLines !== undefined) { hunk.oldLines = oldLines; } else { delete hunk.oldLines; } - if (newLines !== undefined) { hunk.newLines = newLines; } else { @@ -1229,14 +1632,14 @@ function calcLineCount(hunk) { function merge(mine, theirs, base) { mine = loadPatch(mine, base); theirs = loadPatch(theirs, base); - var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning. + var ret = {}; + + // For index we just let it pass through as it doesn't have any necessary meaning. // Leaving sanity checks on this to the API consumer that may know more about the // meaning in their own context. - if (mine.index || theirs.index) { ret.index = mine.index || theirs.index; } - if (mine.newFileName || theirs.newFileName) { if (!fileNameChanged(mine)) { // No header or no change in ours, use theirs (and ours if theirs does not exist) @@ -1258,21 +1661,18 @@ function merge(mine, theirs, base) { ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); } } - ret.hunks = []; var mineIndex = 0, - theirsIndex = 0, - mineOffset = 0, - theirsOffset = 0; - + theirsIndex = 0, + mineOffset = 0, + theirsOffset = 0; while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { var mineCurrent = mine.hunks[mineIndex] || { - oldStart: Infinity - }, - theirsCurrent = theirs.hunks[theirsIndex] || { - oldStart: Infinity - }; - + oldStart: Infinity + }, + theirsCurrent = theirs.hunks[theirsIndex] || { + oldStart: Infinity + }; if (hunkBefore(mineCurrent, theirsCurrent)) { // This patch does not overlap with any of the others, yay. ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); @@ -1298,30 +1698,23 @@ function merge(mine, theirs, base) { ret.hunks.push(mergedHunk); } } - return ret; } - function loadPatch(param, base) { if (typeof param === 'string') { if (/^@@/m.test(param) || /^Index:/m.test(param)) { return parsePatch(param)[0]; } - if (!base) { throw new Error('Must provide a base reference or pass in a patch'); } - return structuredPatch(undefined, undefined, base, param); } - return param; } - function fileNameChanged(patch) { return patch.newFileName && patch.newFileName !== patch.oldFileName; } - function selectField(index, mine, theirs) { if (mine === theirs) { return mine; @@ -1333,11 +1726,9 @@ function selectField(index, mine, theirs) { }; } } - function hunkBefore(test, check) { return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; } - function cloneHunk(hunk, offset) { return { oldStart: hunk.oldStart, @@ -1347,39 +1738,37 @@ function cloneHunk(hunk, offset) { lines: hunk.lines }; } - function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { // This will generally result in a conflicted hunk, but there are cases where the context // is the only overlap where we can successfully merge the content here. var mine = { - offset: mineOffset, - lines: mineLines, - index: 0 - }, - their = { - offset: theirOffset, - lines: theirLines, - index: 0 - }; // Handle any leading content + offset: mineOffset, + lines: mineLines, + index: 0 + }, + their = { + offset: theirOffset, + lines: theirLines, + index: 0 + }; + // Handle any leading content insertLeading(hunk, mine, their); - insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each. + insertLeading(hunk, their, mine); + // Now in the overlap content. Scan through and select the best changes from each. while (mine.index < mine.lines.length && their.index < their.lines.length) { var mineCurrent = mine.lines[mine.index], - theirCurrent = their.lines[their.index]; - + theirCurrent = their.lines[their.index]; if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { // Both modified ... mutualChange(hunk, mine, their); } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { var _hunk$lines; - // Mine inserted (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine))); } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { var _hunk$lines2; - // Theirs inserted (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their))); } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { @@ -1397,57 +1786,44 @@ function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { // Context mismatch conflict(hunk, collectChange(mine), collectChange(their)); } - } // Now push anything that may be remaining - + } + // Now push anything that may be remaining insertTrailing(hunk, mine); insertTrailing(hunk, their); calcLineCount(hunk); } - function mutualChange(hunk, mine, their) { var myChanges = collectChange(mine), - theirChanges = collectChange(their); - + theirChanges = collectChange(their); if (allRemoves(myChanges) && allRemoves(theirChanges)) { // Special case for remove changes that are supersets of one another if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { var _hunk$lines3; - (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges)); - return; } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { var _hunk$lines4; - (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges)); - return; } } else if (arrayEqual(myChanges, theirChanges)) { var _hunk$lines5; - (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges)); - return; } - conflict(hunk, myChanges, theirChanges); } - function removal(hunk, mine, their, swap) { var myChanges = collectChange(mine), - theirChanges = collectContext(their, myChanges); - + theirChanges = collectContext(their, myChanges); if (theirChanges.merged) { var _hunk$lines6; - (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged)); } else { conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); } } - function conflict(hunk, mine, their) { hunk.conflict = true; hunk.lines.push({ @@ -1456,7 +1832,6 @@ function conflict(hunk, mine, their) { theirs: their }); } - function insertLeading(hunk, insert, their) { while (insert.offset < their.offset && insert.index < insert.lines.length) { var line = insert.lines[insert.index++]; @@ -1464,25 +1839,22 @@ function insertLeading(hunk, insert, their) { insert.offset++; } } - function insertTrailing(hunk, insert) { while (insert.index < insert.lines.length) { var line = insert.lines[insert.index++]; hunk.lines.push(line); } } - function collectChange(state) { var ret = [], - operation = state.lines[state.index][0]; - + operation = state.lines[state.index][0]; while (state.index < state.lines.length) { - var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. + var line = state.lines[state.index]; + // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. if (operation === '-' && line[0] === '+') { operation = '+'; } - if (operation === line[0]) { ret.push(line); state.index++; @@ -1490,39 +1862,35 @@ function collectChange(state) { break; } } - return ret; } - function collectContext(state, matchChanges) { var changes = [], - merged = [], - matchIndex = 0, - contextChanges = false, - conflicted = false; - + merged = [], + matchIndex = 0, + contextChanges = false, + conflicted = false; while (matchIndex < matchChanges.length && state.index < state.lines.length) { var change = state.lines[state.index], - match = matchChanges[matchIndex]; // Once we've hit our add, then we are done + match = matchChanges[matchIndex]; + // Once we've hit our add, then we are done if (match[0] === '+') { break; } - contextChanges = contextChanges || change[0] !== ' '; merged.push(match); - matchIndex++; // Consume any additions in the other block as a conflict to attempt - // to pull in the remaining context after this + matchIndex++; + // Consume any additions in the other block as a conflict to attempt + // to pull in the remaining context after this if (change[0] === '+') { conflicted = true; - while (change[0] === '+') { changes.push(change); change = state.lines[++state.index]; } } - if (match.substr(1) === change.substr(1)) { changes.push(change); state.index++; @@ -1530,44 +1898,35 @@ function collectContext(state, matchChanges) { conflicted = true; } } - if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { conflicted = true; } - if (conflicted) { return changes; } - while (matchIndex < matchChanges.length) { merged.push(matchChanges[matchIndex++]); } - return { merged: merged, changes: changes }; } - function allRemoves(changes) { return changes.reduce(function (prev, change) { return prev && change[0] === '-'; }, true); } - function skipRemoveSuperset(state, removeChanges, delta) { for (var i = 0; i < delta; i++) { var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); - if (state.lines[state.index + i] !== ' ' + changeContent) { return false; } } - state.index += delta; return true; } - function calcOldNewLineCount(lines) { var oldLines = 0; var newLines = 0; @@ -1575,7 +1934,6 @@ function calcOldNewLineCount(lines) { if (typeof line !== 'string') { var myCount = calcOldNewLineCount(line.mine); var theirCount = calcOldNewLineCount(line.theirs); - if (oldLines !== undefined) { if (myCount.oldLines === theirCount.oldLines) { oldLines += myCount.oldLines; @@ -1583,7 +1941,6 @@ function calcOldNewLineCount(lines) { oldLines = undefined; } } - if (newLines !== undefined) { if (myCount.newLines === theirCount.newLines) { newLines += myCount.newLines; @@ -1595,7 +1952,6 @@ function calcOldNewLineCount(lines) { if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { newLines++; } - if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { oldLines++; } @@ -1611,7 +1967,6 @@ function reversePatch(structuredPatch) { if (Array.isArray(structuredPatch)) { return structuredPatch.map(reversePatch).reverse(); } - return _objectSpread2(_objectSpread2({}, structuredPatch), {}, { oldFileName: structuredPatch.newFileName, oldHeader: structuredPatch.newHeader, @@ -1623,16 +1978,13 @@ function reversePatch(structuredPatch) { oldStart: hunk.newStart, newLines: hunk.oldLines, newStart: hunk.oldStart, - linedelimiters: hunk.linedelimiters, lines: hunk.lines.map(function (l) { if (l.startsWith('-')) { return "+".concat(l.slice(1)); } - if (l.startsWith('+')) { return "-".concat(l.slice(1)); } - return l; }) }; @@ -1643,12 +1995,10 @@ function reversePatch(structuredPatch) { // See: http://code.google.com/p/google-diff-match-patch/wiki/API function convertChangesToDMP(changes) { var ret = [], - change, - operation; - + change, + operation; for (var i = 0; i < changes.length; i++) { change = changes[i]; - if (change.added) { operation = 1; } else if (change.removed) { @@ -1656,37 +2006,29 @@ function convertChangesToDMP(changes) { } else { operation = 0; } - ret.push([operation, change.value]); } - return ret; } function convertChangesToXML(changes) { var ret = []; - for (var i = 0; i < changes.length; i++) { var change = changes[i]; - if (change.added) { ret.push(''); } else if (change.removed) { ret.push(''); } - ret.push(escapeHTML(change.value)); - if (change.added) { ret.push(''); } else if (change.removed) { ret.push(''); } } - return ret.join(''); } - function escapeHTML(s) { var n = s; n = n.replace(/&/g, '&'); diff --git a/deps/npm/node_modules/diff/lib/patch/apply.js b/deps/npm/node_modules/diff/lib/patch/apply.js index cefea04dae73b0..619def1f48efa5 100644 --- a/deps/npm/node_modules/diff/lib/patch/apply.js +++ b/deps/npm/node_modules/diff/lib/patch/apply.js @@ -6,35 +6,39 @@ Object.defineProperty(exports, "__esModule", { }); exports.applyPatch = applyPatch; exports.applyPatches = applyPatches; - /*istanbul ignore end*/ var /*istanbul ignore start*/ +_string = require("../util/string") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_lineEndings = require("./line-endings") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ _parse = require("./parse") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _distanceIterator = _interopRequireDefault(require("../util/distance-iterator")) /*istanbul ignore end*/ ; - /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - /*istanbul ignore end*/ function applyPatch(source, uniDiff) { /*istanbul ignore start*/ var /*istanbul ignore end*/ options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - if (typeof uniDiff === 'string') { uniDiff = /*istanbul ignore start*/ (0, /*istanbul ignore end*/ - /*istanbul ignore start*/ _parse /*istanbul ignore end*/ @@ -44,160 +48,318 @@ function applyPatch(source, uniDiff) { /*istanbul ignore end*/ (uniDiff); } - if (Array.isArray(uniDiff)) { if (uniDiff.length > 1) { throw new Error('applyPatch only works with a single input.'); } - uniDiff = uniDiff[0]; - } // Apply the diff to the input - - - var lines = source.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [], - hunks = uniDiff.hunks, - compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) - /*istanbul ignore start*/ - { - return ( + } + if (options.autoConvertLineEndings || options.autoConvertLineEndings == null) { + if ( + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + hasOnlyWinLineEndings) + /*istanbul ignore end*/ + (source) && + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _lineEndings + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + isUnix) + /*istanbul ignore end*/ + (uniDiff)) { + uniDiff = + /*istanbul ignore start*/ + (0, /*istanbul ignore end*/ - line === patchContent - ); - }, - errorCount = 0, - fuzzFactor = options.fuzzFactor || 0, - minLine = 0, - offset = 0, - removeEOFNL, - addEOFNL; - /** - * Checks if the hunk exactly fits on the provided location - */ - - - function hunkFits(hunk, toPos) { - for (var j = 0; j < hunk.lines.length; j++) { - var line = hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line; + /*istanbul ignore start*/ + _lineEndings + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + unixToWin) + /*istanbul ignore end*/ + (uniDiff); + } else if ( + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + hasOnlyUnixLineEndings) + /*istanbul ignore end*/ + (source) && + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _lineEndings + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + isWin) + /*istanbul ignore end*/ + (uniDiff)) { + uniDiff = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _lineEndings + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + winToUnix) + /*istanbul ignore end*/ + (uniDiff); + } + } - if (operation === ' ' || operation === '-') { - // Context sanity check - if (!compareLine(toPos + 1, lines[toPos], operation, content)) { - errorCount++; + // Apply the diff to the input + var lines = source.split('\n'), + hunks = uniDiff.hunks, + compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + line === patchContent + ); + }, + fuzzFactor = options.fuzzFactor || 0, + minLine = 0; + if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) { + throw new Error('fuzzFactor must be a non-negative integer'); + } - if (errorCount > fuzzFactor) { - return false; - } - } + // Special case for empty patch. + if (!hunks.length) { + return source; + } - toPos++; + // Before anything else, handle EOFNL insertion/removal. If the patch tells us to make a change + // to the EOFNL that is redundant/impossible - i.e. to remove a newline that's not there, or add a + // newline that already exists - then we either return false and fail to apply the patch (if + // fuzzFactor is 0) or simply ignore the problem and do nothing (if fuzzFactor is >0). + // If we do need to remove/add a newline at EOF, this will always be in the final hunk: + var prevLine = '', + removeEOFNL = false, + addEOFNL = false; + for (var i = 0; i < hunks[hunks.length - 1].lines.length; i++) { + var line = hunks[hunks.length - 1].lines[i]; + if (line[0] == '\\') { + if (prevLine[0] == '+') { + removeEOFNL = true; + } else if (prevLine[0] == '-') { + addEOFNL = true; } } + prevLine = line; + } + if (removeEOFNL) { + if (addEOFNL) { + // This means the final line gets changed but doesn't have a trailing newline in either the + // original or patched version. In that case, we do nothing if fuzzFactor > 0, and if + // fuzzFactor is 0, we simply validate that the source file has no trailing newline. + if (!fuzzFactor && lines[lines.length - 1] == '') { + return false; + } + } else if (lines[lines.length - 1] == '') { + lines.pop(); + } else if (!fuzzFactor) { + return false; + } + } else if (addEOFNL) { + if (lines[lines.length - 1] != '') { + lines.push(''); + } else if (!fuzzFactor) { + return false; + } + } - return true; - } // Search best fit offsets for each hunk based on the previous ones - - - for (var i = 0; i < hunks.length; i++) { - var hunk = hunks[i], - maxLine = lines.length - hunk.oldLines, - localOffset = 0, - toPos = offset + hunk.oldStart - 1; - var iterator = + /** + * Checks if the hunk can be made to fit at the provided location with at most `maxErrors` + * insertions, substitutions, or deletions, while ensuring also that: + * - lines deleted in the hunk match exactly, and + * - wherever an insertion operation or block of insertion operations appears in the hunk, the + * immediately preceding and following lines of context match exactly + * + * `toPos` should be set such that lines[toPos] is meant to match hunkLines[0]. + * + * If the hunk can be applied, returns an object with properties `oldLineLastI` and + * `replacementLines`. Otherwise, returns null. + */ + function applyHunk(hunkLines, toPos, maxErrors) { /*istanbul ignore start*/ - (0, + var /*istanbul ignore end*/ - + hunkLinesI = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + /*istanbul ignore start*/ + var + /*istanbul ignore end*/ + lastContextLineMatched = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; /*istanbul ignore start*/ - _distanceIterator + var /*istanbul ignore end*/ - [ + patchedLines = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : []; /*istanbul ignore start*/ - "default" + var /*istanbul ignore end*/ - ])(toPos, minLine, maxLine); + patchedLinesLength = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0; + var nConsecutiveOldContextLines = 0; + var nextContextLineMustMatch = false; + for (; hunkLinesI < hunkLines.length; hunkLinesI++) { + var hunkLine = hunkLines[hunkLinesI], + operation = hunkLine.length > 0 ? hunkLine[0] : ' ', + content = hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine; + if (operation === '-') { + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + toPos++; + nConsecutiveOldContextLines = 0; + } else { + if (!maxErrors || lines[toPos] == null) { + return null; + } + patchedLines[patchedLinesLength] = lines[toPos]; + return applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1); + } + } + if (operation === '+') { + if (!lastContextLineMatched) { + return null; + } + patchedLines[patchedLinesLength] = content; + patchedLinesLength++; + nConsecutiveOldContextLines = 0; + nextContextLineMustMatch = true; + } + if (operation === ' ') { + nConsecutiveOldContextLines++; + patchedLines[patchedLinesLength] = lines[toPos]; + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + patchedLinesLength++; + lastContextLineMatched = true; + nextContextLineMustMatch = false; + toPos++; + } else { + if (nextContextLineMustMatch || !maxErrors) { + return null; + } - for (; localOffset !== undefined; localOffset = iterator()) { - if (hunkFits(hunk, toPos + localOffset)) { - hunk.offset = offset += localOffset; - break; + // Consider 3 possibilities in sequence: + // 1. lines contains a *substitution* not included in the patch context, or + // 2. lines contains an *insertion* not included in the patch context, or + // 3. lines contains a *deletion* not included in the patch context + // The first two options are of course only possible if the line from lines is non-null - + // i.e. only option 3 is possible if we've overrun the end of the old file. + return lines[toPos] && (applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength + 1) || applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1)) || applyHunk(hunkLines, toPos, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength); + } } } - if (localOffset === undefined) { - return false; - } // Set lower text limit to end of the current hunk, so next ones don't try - // to fit over already patched text - - - minLine = hunk.offset + hunk.oldStart + hunk.oldLines; - } // Apply patch hunks - - - var diffOffset = 0; + // Before returning, trim any unmodified context lines off the end of patchedLines and reduce + // toPos (and thus oldLineLastI) accordingly. This allows later hunks to be applied to a region + // that starts in this hunk's trailing context. + patchedLinesLength -= nConsecutiveOldContextLines; + toPos -= nConsecutiveOldContextLines; + patchedLines.length = patchedLinesLength; + return { + patchedLines: patchedLines, + oldLineLastI: toPos - 1 + }; + } + var resultLines = []; + // Search best fit offsets for each hunk based on the previous ones + var prevHunkOffset = 0; for (var _i = 0; _i < hunks.length; _i++) { - var _hunk = hunks[_i], - _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1; - - diffOffset += _hunk.newLines - _hunk.oldLines; - - for (var j = 0; j < _hunk.lines.length; j++) { - var line = _hunk.lines[j], - operation = line.length > 0 ? line[0] : ' ', - content = line.length > 0 ? line.substr(1) : line, - delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n'; - - if (operation === ' ') { - _toPos++; - } else if (operation === '-') { - lines.splice(_toPos, 1); - delimiters.splice(_toPos, 1); - /* istanbul ignore else */ - } else if (operation === '+') { - lines.splice(_toPos, 0, content); - delimiters.splice(_toPos, 0, delimiter); - _toPos++; - } else if (operation === '\\') { - var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null; - - if (previousOperation === '+') { - removeEOFNL = true; - } else if (previousOperation === '-') { - addEOFNL = true; + var hunk = hunks[_i]; + var hunkResult = + /*istanbul ignore start*/ + void 0 + /*istanbul ignore end*/ + ; + var maxLine = lines.length - hunk.oldLines + fuzzFactor; + var toPos = + /*istanbul ignore start*/ + void 0 + /*istanbul ignore end*/ + ; + for (var maxErrors = 0; maxErrors <= fuzzFactor; maxErrors++) { + toPos = hunk.oldStart + prevHunkOffset - 1; + var iterator = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _distanceIterator + /*istanbul ignore end*/ + [ + /*istanbul ignore start*/ + "default" + /*istanbul ignore end*/ + ])(toPos, minLine, maxLine); + for (; toPos !== undefined; toPos = iterator()) { + hunkResult = applyHunk(hunk.lines, toPos, maxErrors); + if (hunkResult) { + break; } } + if (hunkResult) { + break; + } + } + if (!hunkResult) { + return false; } - } // Handle EOFNL insertion/removal + // Copy everything from the end of where we applied the last hunk to the start of this hunk + for (var _i2 = minLine; _i2 < toPos; _i2++) { + resultLines.push(lines[_i2]); + } - if (removeEOFNL) { - while (!lines[lines.length - 1]) { - lines.pop(); - delimiters.pop(); + // Add the lines produced by applying the hunk: + for (var _i3 = 0; _i3 < hunkResult.patchedLines.length; _i3++) { + var _line = hunkResult.patchedLines[_i3]; + resultLines.push(_line); } - } else if (addEOFNL) { - lines.push(''); - delimiters.push('\n'); - } - for (var _k = 0; _k < lines.length - 1; _k++) { - lines[_k] = lines[_k] + delimiters[_k]; - } + // Set lower text limit to end of the current hunk, so next ones don't try + // to fit over already patched text + minLine = hunkResult.oldLineLastI + 1; - return lines.join(''); -} // Wrapper that supports multiple file patches via callbacks. + // Note the offset between where the patch said the hunk should've applied and where we + // applied it, so we can adjust future hunks accordingly: + prevHunkOffset = toPos + 1 - hunk.oldStart; + } + // Copy over the rest of the lines from the old text + for (var _i4 = minLine; _i4 < lines.length; _i4++) { + resultLines.push(lines[_i4]); + } + return resultLines.join('\n'); +} +// Wrapper that supports multiple file patches via callbacks. function applyPatches(uniDiff, options) { if (typeof uniDiff === 'string') { uniDiff = /*istanbul ignore start*/ (0, /*istanbul ignore end*/ - /*istanbul ignore start*/ _parse /*istanbul ignore end*/ @@ -207,32 +369,25 @@ function applyPatches(uniDiff, options) { /*istanbul ignore end*/ (uniDiff); } - var currentIndex = 0; - function processIndex() { var index = uniDiff[currentIndex++]; - if (!index) { return options.complete(); } - options.loadFile(index, function (err, data) { if (err) { return options.complete(err); } - var updatedContent = applyPatch(data, index, options); options.patched(index, updatedContent, function (err) { if (err) { return options.complete(err); } - processIndex(); }); }); } - processIndex(); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6WyJhcHBseVBhdGNoIiwic291cmNlIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJwYXJzZVBhdGNoIiwiQXJyYXkiLCJpc0FycmF5IiwibGVuZ3RoIiwiRXJyb3IiLCJsaW5lcyIsInNwbGl0IiwiZGVsaW1pdGVycyIsIm1hdGNoIiwiaHVua3MiLCJjb21wYXJlTGluZSIsImxpbmVOdW1iZXIiLCJsaW5lIiwib3BlcmF0aW9uIiwicGF0Y2hDb250ZW50IiwiZXJyb3JDb3VudCIsImZ1enpGYWN0b3IiLCJtaW5MaW5lIiwib2Zmc2V0IiwicmVtb3ZlRU9GTkwiLCJhZGRFT0ZOTCIsImh1bmtGaXRzIiwiaHVuayIsInRvUG9zIiwiaiIsImNvbnRlbnQiLCJzdWJzdHIiLCJpIiwibWF4TGluZSIsIm9sZExpbmVzIiwibG9jYWxPZmZzZXQiLCJvbGRTdGFydCIsIml0ZXJhdG9yIiwiZGlzdGFuY2VJdGVyYXRvciIsInVuZGVmaW5lZ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EaWZmID0gcGFyc2VQYXRjaCh1bmlEaWZmKTtcbiAgfVxuXG4gIGxldCBjdXJyZW50SW5kZXggPSAwO1xuICBmdW5jdGlvbiBwcm9jZXNzSW5kZXgoKSB7XG4gICAgbGV0IGluZGV4ID0gdW5pRGlmZltjdXJyZW50SW5kZXgrK107XG4gICAgaWYgKCFpbmRleCkge1xuICAgICAgcmV0dXJuIG9wdGlvbnMuY29tcGxldGUoKTtcbiAgICB9XG5cbiAgICBvcHRpb25zLmxvYWRGaWxlKGluZGV4LCBmdW5jdGlvbihlcnIsIGRhdGEpIHtcbiAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgcmV0dXJuIG9wdGlvbnMuY29tcGxldGUoZXJyKTtcbiAgICAgIH1cblxuICAgICAgbGV0IHVwZGF0ZWRDb250ZW50ID0gYXBwbHlQYXRjaChkYXRhLCBpbmRleCwgb3B0aW9ucyk7XG4gICAgICBvcHRpb25zLnBhdGNoZWQoaW5kZXgsIHVwZGF0ZWRDb250ZW50LCBmdW5jdGlvbihlcnIpIHtcbiAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgIHJldHVybiBvcHRpb25zLmNvbXBsZXRlKGVycik7XG4gICAgICAgIH1cblxuICAgICAgICBwcm9jZXNzSW5kZXgoKTtcbiAgICAgIH0pO1xuICAgIH0pO1xuICB9XG4gIHByb2Nlc3NJbmRleCgpO1xufVxuIl19 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfc3RyaW5nIiwicmVxdWlyZSIsIl9saW5lRW5kaW5ncyIsIl9wYXJzZSIsIl9kaXN0YW5jZUl0ZXJhdG9yIiwiX2ludGVyb3BSZXF1aXJlRGVmYXVsdCIsIm9iaiIsIl9fZXNNb2R1bGUiLCJhcHBseVBhdGNoIiwic291cmNlIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJhcmd1bWVudHMiLCJsZW5ndGgiLCJ1bmRlZmluZWQiLCJwYXJzZVBhdG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IoMSkgOiBodW5rTGluZSk7XG5cbiAgICAgIGlmIChvcGVyYXRpb24gPT09ICctJykge1xuICAgICAgICBpZiAoY29tcGFyZUxpbmUodG9Qb3MgKyAxLCBsaW5lc1t0b1Bvc10sIG9wZXJhdGlvbiwgY29udGVudCkpIHtcbiAgICAgICAgICB0b1BvcysrO1xuICAgICAgICAgIG5Db25zZWN1dGl2ZU9sZENvbnRleHRMaW5lcyA9IDA7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgaWYgKCFtYXhFcnJvcnMgfHwgbGluZXNbdG9Qb3NdID09IG51bGwpIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICAgIH1cbiAgICAgICAgICBwYXRjaGVkTGluZXNbcGF0Y2hlZExpbmVzTGVuZ3RoXSA9IGxpbmVzW3RvUG9zXTtcbiAgICAgICAgICByZXR1cm4gYXBwbHlIdW5rKFxuICAgICAgICAgICAgaHVua0xpbmVzLFxuICAgICAgICAgICAgdG9Qb3MgKyAxLFxuICAgICAgICAgICAgbWF4RXJyb3JzIC0gMSxcbiAgICAgICAgICAgIGh1bmtMaW5lc0ksXG4gICAgICAgICAgICBmYWxzZSxcbiAgICAgICAgICAgIHBhdGNoZWRMaW5lcyxcbiAgICAgICAgICAgIHBhdGNoZWRMaW5lc0xlbmd0aCArIDEsXG4gICAgICAgICAgKTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBpZiAob3BlcmF0aW9uID09PSAnKycpIHtcbiAgICAgICAgaWYgKCFsYXN0Q29udGV4dExpbmVNYXRjaGVkKSB7XG4gICAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICAgIH1cbiAgICAgICAgcGF0Y2hlZExpbmVzW3BhdGNoZWRMaW5lc0xlbmd0aF0gPSBjb250ZW50O1xuICAgICAgICBwYXRjaGVkTGluZXNMZW5ndGgrKztcbiAgICAgICAgbkNvbnNlY3V0aXZlT2xkQ29udGV4dExpbmVzID0gMDtcbiAgICAgICAgbmV4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3B0aW9ucyBhcmUgb2YgY291cnNlIG9ubHkgcG9zc2libGUgaWYgdGhlIGxpbmUgZnJvbSBsaW5lcyBpcyBub24tbnVsbCAtXG4gICAgICAgICAgLy8gaS5lLiBvbmx5IG9wdGlvbiAzIGlzIHBvc3NpYmxlIGlmIHdlJ3ZlIG92ZXJydW4gdGhlIGVuZCBvZiB0aGUgb2xkIGZpbGUuXG4gICAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgIGxpbmVzW3RvUG9zXSAmJiAoXG4gICAgICAgICAgICAgIGFwcGx5SHVuayhcbiAgICAgICAgICAgICAgICBodW5rTGluZXMsXG4gICAgICAgICAgICAgICAgdG9Qb3MgKyAxLFxuICAgICAgICAgICAgICAgIG1heEVycm9ycyAtIDEsXG4gICAgICAgICAgICAgICAgaHVua0xpbmVzSSArIDEsXG4gICAgICAgICAgICAgICAgZmFsc2UsXG4gICAgICAgICAgICAgICAgcGF0Y2hlZExpbmVzLFxuICAgICAgICAgICAgICAgIHBhdGNoZWRMaW5lc0xlbmd0aCArIDFcbiAgICAgICAgICAgICAgKSB8fCBhcHBseUh1bmsoXG4gICAgICAgICAgICAgICAgaHVua0xpbmVzLFxuICAgICAgICAgICAgICAgIHRvUG9zICsgMSxcbiAgICAgICAgICAgICAgICBtYXhFcnJvcnMgLSAxLFxuICAgICAgICAgICAgICAgIGh1bmtMaW5lc0ksXG4gICAgICAgICAgICAgICAgZmFsc2UsXG4gICAgICAgICAgICAgICAgcGF0Y2hlZExpbmVzLFxuICAgICAgICAgICAgICAgIHBhdGNoZWRMaW5lc0xlbmd0aCArIDFcbiAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKSB8fCBhcHBseUh1bmsoXG4gICAgICAgICAgICAgIGh1bmtMaW5lcyxcbiAgICAgICAgICAgICAgdG9Qb3MsXG4gICAgICAgICAgICAgIG1heEVycm9ycyAtIDEsXG4gICAgICAgICAgICAgIGh1bmtMaW5lc0kgKyAxLFxuICAgICAgICAgICAgICBmYWxz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EsQ0FBQ0wsT0FBTyxDQUFDO0VBQy9CO0VBRUEsSUFBSTJELFlBQVksR0FBRyxDQUFDO0VBQ3BCLFNBQVNDLFlBQVlBLENBQUEsRUFBRztJQUN0QixJQUFJQyxLQUFLLEdBQUc3RCxPQUFPLENBQUMyRCxZQUFZLEVBQUUsQ0FBQztJQUNuQyxJQUFJLENBQUNFLEtBQUssRUFBRTtNQUNWLE9BQU81RCxPQUFPLENBQUM2RCxRQUFRLENBQUMsQ0FBQztJQUMzQjtJQUVBN0QsT0FBTyxDQUFDOEQsUUFBUSxDQUFDRixLQUFLLEVBQUUsVUFBU0csR0FBRyxFQUFFQyxJQUFJLEVBQUU7TUFDMUMsSUFBSUQsR0FBRyxFQUFFO1FBQ1AsT0FBTy9ELE9BQU8sQ0FBQzZELFFBQVEsQ0FBQ0UsR0FBRyxDQUFDO01BQzlCO01BRUEsSUFBSUUsY0FBYyxHQUFHcEUsVUFBVSxDQUFDbUUsSUFBSSxFQUFFSixLQUFLLEVBQUU1RCxPQUFPLENBQUM7TUFDckRBLE9BQU8sQ0FBQ2tFLE9BQU8sQ0FBQ04sS0FBSyxFQUFFSyxjQUFjLEVBQUUsVUFBU0YsR0FBRyxFQUFFO1FBQ25ELElBQUlBLEdBQUcsRUFBRTtVQUNQLE9BQU8vRCxPQUFPLENBQUM2RCxRQUFRLENBQUNFLEdBQUcsQ0FBQztRQUM5QjtRQUVBSixZQUFZLENBQUMsQ0FBQztNQUNoQixDQUFDLENBQUM7SUFDSixDQUFDLENBQUM7RUFDSjtFQUNBQSxZQUFZLENBQUMsQ0FBQztBQUNoQiIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/deps/npm/node_modules/diff/lib/patch/create.js b/deps/npm/node_modules/diff/lib/patch/create.js index 45be1512a5a088..10ec2d46ff6e8c 100644 --- a/deps/npm/node_modules/diff/lib/patch/create.js +++ b/deps/npm/node_modules/diff/lib/patch/create.js @@ -4,273 +4,366 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.structuredPatch = structuredPatch; -exports.formatPatch = formatPatch; -exports.createTwoFilesPatch = createTwoFilesPatch; exports.createPatch = createPatch; - +exports.createTwoFilesPatch = createTwoFilesPatch; +exports.formatPatch = formatPatch; +exports.structuredPatch = structuredPatch; /*istanbul ignore end*/ var /*istanbul ignore start*/ _line = require("../diff/line") /*istanbul ignore end*/ ; - -/*istanbul ignore start*/ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - +/*istanbul ignore start*/ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } - +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } +function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*istanbul ignore end*/ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { if (!options) { options = {}; } - + if (typeof options === 'function') { + options = { + callback: options + }; + } if (typeof options.context === 'undefined') { options.context = 4; } - - var diff = - /*istanbul ignore start*/ - (0, - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - _line - /*istanbul ignore end*/ - . - /*istanbul ignore start*/ - diffLines) - /*istanbul ignore end*/ - (oldStr, newStr, options); - - if (!diff) { - return; - } - - diff.push({ - value: '', - lines: [] - }); // Append an empty value to make cleanup easier - - function contextLines(lines) { - return lines.map(function (entry) { - return ' ' + entry; - }); + if (options.newlineIsToken) { + throw new Error('newlineIsToken may not be used with patch-generation functions, only with diffing functions'); } - - var hunks = []; - var oldRangeStart = 0, - newRangeStart = 0, - curRange = [], - oldLine = 1, - newLine = 1; - - /*istanbul ignore start*/ - var _loop = function _loop( - /*istanbul ignore end*/ - i) { - var current = diff[i], - lines = current.lines || current.value.replace(/\n$/, '').split('\n'); - current.lines = lines; - - if (current.added || current.removed) { - /*istanbul ignore start*/ - var _curRange; - - /*istanbul ignore end*/ - // If we have previous context, start with that - if (!oldRangeStart) { - var prev = diff[i - 1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; - } - } // Output our changes - - - /*istanbul ignore start*/ - - /*istanbul ignore end*/ - + if (!options.callback) { + return diffLinesResultToPatch( + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _line + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + diffLines) + /*istanbul ignore end*/ + (oldStr, newStr, options)); + } else { + var /*istanbul ignore start*/ - (_curRange = + _options = /*istanbul ignore end*/ - curRange).push.apply( + options, /*istanbul ignore start*/ - _curRange /*istanbul ignore end*/ - , + _callback = _options.callback; + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _line + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + diffLines) + /*istanbul ignore end*/ + (oldStr, newStr, + /*istanbul ignore start*/ + _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + options), {}, { + callback: function /*istanbul ignore start*/ - _toConsumableArray( + callback /*istanbul ignore end*/ - lines.map(function (entry) { - return (current.added ? '+' : '-') + entry; - }))); // Track the updated file position - - - if (current.added) { - newLine += lines.length; - } else { - oldLine += lines.length; + (diff) { + var patch = diffLinesResultToPatch(diff); + _callback(patch); } - } else { - // Identical context lines. Track line changes - if (oldRangeStart) { - // Close out any changes that have been output (or join overlapping) - if (lines.length <= options.context * 2 && i < diff.length - 2) { - /*istanbul ignore start*/ - var _curRange2; - - /*istanbul ignore end*/ - // Overlapping - - /*istanbul ignore start*/ + })); + } + function diffLinesResultToPatch(diff) { + // STEP 1: Build up the patch with no "\ No newline at end of file" lines and with the arrays + // of lines containing trailing newline characters. We'll tidy up later... - /*istanbul ignore end*/ + if (!diff) { + return; + } + diff.push({ + value: '', + lines: [] + }); // Append an empty value to make cleanup easier + + function contextLines(lines) { + return lines.map(function (entry) { + return ' ' + entry; + }); + } + var hunks = []; + var oldRangeStart = 0, + newRangeStart = 0, + curRange = [], + oldLine = 1, + newLine = 1; + /*istanbul ignore start*/ + var _loop = function _loop() + /*istanbul ignore end*/ + { + var current = diff[i], + lines = current.lines || splitLines(current.value); + current.lines = lines; + if (current.added || current.removed) { + /*istanbul ignore start*/ + var _curRange; + /*istanbul ignore end*/ + // If we have previous context, start with that + if (!oldRangeStart) { + var prev = diff[i - 1]; + oldRangeStart = oldLine; + newRangeStart = newLine; + if (prev) { + curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; + oldRangeStart -= curRange.length; + newRangeStart -= curRange.length; + } + } - /*istanbul ignore start*/ - (_curRange2 = - /*istanbul ignore end*/ - curRange).push.apply( - /*istanbul ignore start*/ - _curRange2 - /*istanbul ignore end*/ - , - /*istanbul ignore start*/ - _toConsumableArray( - /*istanbul ignore end*/ - contextLines(lines))); + // Output our changes + /*istanbul ignore start*/ + /*istanbul ignore end*/ + /*istanbul ignore start*/ + (_curRange = + /*istanbul ignore end*/ + curRange).push.apply( + /*istanbul ignore start*/ + _curRange + /*istanbul ignore end*/ + , + /*istanbul ignore start*/ + _toConsumableArray( + /*istanbul ignore end*/ + lines.map(function (entry) { + return (current.added ? '+' : '-') + entry; + }))); + + // Track the updated file position + if (current.added) { + newLine += lines.length; } else { - /*istanbul ignore start*/ - var _curRange3; - - /*istanbul ignore end*/ - // end the range and output - var contextSize = Math.min(lines.length, options.context); - - /*istanbul ignore start*/ - - /*istanbul ignore end*/ - - /*istanbul ignore start*/ - (_curRange3 = - /*istanbul ignore end*/ - curRange).push.apply( - /*istanbul ignore start*/ - _curRange3 - /*istanbul ignore end*/ - , - /*istanbul ignore start*/ - _toConsumableArray( - /*istanbul ignore end*/ - contextLines(lines.slice(0, contextSize)))); - - var hunk = { - oldStart: oldRangeStart, - oldLines: oldLine - oldRangeStart + contextSize, - newStart: newRangeStart, - newLines: newLine - newRangeStart + contextSize, - lines: curRange - }; - - if (i >= diff.length - 2 && lines.length <= options.context) { - // EOF is inside this hunk - var oldEOFNewline = /\n$/.test(oldStr); - var newEOFNewline = /\n$/.test(newStr); - var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines; - - if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) { - // special case: old has no eol and no trailing context; no-nl can end up before adds - // however, if the old file is empty, do not output the no-nl line - curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file'); - } - - if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) { - curRange.push('\\ No newline at end of file'); - } + oldLine += lines.length; + } + } else { + // Identical context lines. Track line changes + if (oldRangeStart) { + // Close out any changes that have been output (or join overlapping) + if (lines.length <= options.context * 2 && i < diff.length - 2) { + /*istanbul ignore start*/ + var _curRange2; + /*istanbul ignore end*/ + // Overlapping + /*istanbul ignore start*/ + /*istanbul ignore end*/ + /*istanbul ignore start*/ + (_curRange2 = + /*istanbul ignore end*/ + curRange).push.apply( + /*istanbul ignore start*/ + _curRange2 + /*istanbul ignore end*/ + , + /*istanbul ignore start*/ + _toConsumableArray( + /*istanbul ignore end*/ + contextLines(lines))); + } else { + /*istanbul ignore start*/ + var _curRange3; + /*istanbul ignore end*/ + // end the range and output + var contextSize = Math.min(lines.length, options.context); + /*istanbul ignore start*/ + /*istanbul ignore end*/ + /*istanbul ignore start*/ + (_curRange3 = + /*istanbul ignore end*/ + curRange).push.apply( + /*istanbul ignore start*/ + _curRange3 + /*istanbul ignore end*/ + , + /*istanbul ignore start*/ + _toConsumableArray( + /*istanbul ignore end*/ + contextLines(lines.slice(0, contextSize)))); + var _hunk = { + oldStart: oldRangeStart, + oldLines: oldLine - oldRangeStart + contextSize, + newStart: newRangeStart, + newLines: newLine - newRangeStart + contextSize, + lines: curRange + }; + hunks.push(_hunk); + oldRangeStart = 0; + newRangeStart = 0; + curRange = []; } - - hunks.push(hunk); - oldRangeStart = 0; - newRangeStart = 0; - curRange = []; } + oldLine += lines.length; + newLine += lines.length; } - - oldLine += lines.length; - newLine += lines.length; + }; + for (var i = 0; i < diff.length; i++) + /*istanbul ignore start*/ + { + _loop(); } - }; - for (var i = 0; i < diff.length; i++) { + // Step 2: eliminate the trailing `\n` from each line of each hunk, and, where needed, add + // "\ No newline at end of file". + /*istanbul ignore end*/ + for ( + /*istanbul ignore start*/ + var _i = 0, _hunks = + /*istanbul ignore end*/ + hunks; + /*istanbul ignore start*/ + _i < _hunks.length + /*istanbul ignore end*/ + ; /*istanbul ignore start*/ - _loop( + _i++ /*istanbul ignore end*/ - i); + ) { + var hunk = + /*istanbul ignore start*/ + _hunks[_i] + /*istanbul ignore end*/ + ; + for (var _i2 = 0; _i2 < hunk.lines.length; _i2++) { + if (hunk.lines[_i2].endsWith('\n')) { + hunk.lines[_i2] = hunk.lines[_i2].slice(0, -1); + } else { + hunk.lines.splice(_i2 + 1, 0, '\\ No newline at end of file'); + _i2++; // Skip the line we just added, then continue iterating + } + } + } + return { + oldFileName: oldFileName, + newFileName: newFileName, + oldHeader: oldHeader, + newHeader: newHeader, + hunks: hunks + }; } - - return { - oldFileName: oldFileName, - newFileName: newFileName, - oldHeader: oldHeader, - newHeader: newHeader, - hunks: hunks - }; } - function formatPatch(diff) { if (Array.isArray(diff)) { return diff.map(formatPatch).join('\n'); } - var ret = []; - if (diff.oldFileName == diff.newFileName) { ret.push('Index: ' + diff.oldFileName); } - ret.push('==================================================================='); ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); - for (var i = 0; i < diff.hunks.length; i++) { - var hunk = diff.hunks[i]; // Unified Diff Format quirk: If the chunk size is 0, + var hunk = diff.hunks[i]; + // Unified Diff Format quirk: If the chunk size is 0, // the first number is one lower than one would expect. // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 - if (hunk.oldLines === 0) { hunk.oldStart -= 1; } - if (hunk.newLines === 0) { hunk.newStart -= 1; } - ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); ret.push.apply(ret, hunk.lines); } - return ret.join('\n') + '\n'; } - function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { - return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options)); + /*istanbul ignore start*/ + var _options2; + /*istanbul ignore end*/ + if (typeof options === 'function') { + options = { + callback: options + }; + } + if (! + /*istanbul ignore start*/ + ((_options2 = + /*istanbul ignore end*/ + options) !== null && _options2 !== void 0 && + /*istanbul ignore start*/ + _options2 + /*istanbul ignore end*/ + .callback)) { + var patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); + if (!patchObj) { + return; + } + return formatPatch(patchObj); + } else { + var + /*istanbul ignore start*/ + _options3 = + /*istanbul ignore end*/ + options, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + _callback2 = _options3.callback; + structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, + /*istanbul ignore start*/ + _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + options), {}, { + callback: function + /*istanbul ignore start*/ + callback + /*istanbul ignore end*/ + (patchObj) { + if (!patchObj) { + _callback2(); + } else { + _callback2(formatPatch(patchObj)); + } + } + })); + } } - function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9jcmVhdGUuanMiXSwibmFtZXMiOlsic3RydWN0dXJlZFBhdGNoIiwib2xkRmlsZU5hbWUiLCJuZXdGaWxlTmFtZSIsIm9sZFN0ciIsIm5ld1N0ciIsIm9sZEhlYWRlciIsIm5ld0hlYWRlciIsIm9wdGlvbnMiLCJjb250ZXh0IiwiZGlmZiIsImRpZmZMaW5lcyIsInB1c2giLCJ2YWx1ZSIsImxpbmVzIiwiY29udGV4dExpbmVzIiwibWFwIiwiZW50cnkiLCJodW5rcyIsIm9sZFJhbmdlU3RhcnQiLCJuZXdSYW5nZVN0YXJ0IiwiY3VyUmFuZ2UiLCJvbGRMaW5lIiwibmV3TGluZSIsImkiLCJjdXJyZW50IiwicmVwbGFjZSIsInNwbGl0IiwiYWRkZWQiLCJyZW1vdmVkIiwicHJldiIsInNsaWNlIiwibGVuZ3RoIiwiY29udGV4dFNpemUiLCJNYXRoIiwibWluIiwiaHVuayIsIm9sZFN0YXJ0Iiwib2xkTGluZXMiLCJuZXdTdGFydCIsIm5ld0xpbmVzIiwib2xkRU9GTmV3bGluZSIsInRlc3QiLCJuZXdFT0ZOZXdsaW5lIiwibm9ObEJlZm9yZUFkZHMiLCJzcGxpY2UiLCJmb3JtYXRQYXRjaCIsIkFycmF5IiwiaXNBcnJheSIsImpvaW4iLCJyZXQiLCJhcHBseSIsImNyZWF0ZVR3b0ZpbGVzUGF0Y2giLCJjcmVhdGVQYXRjaCIsImZpbGVOYW1lIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7QUFFTyxTQUFTQSxlQUFULENBQXlCQyxXQUF6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AgcmV0LnB1c2goJz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0nKTtcbiAgcmV0LnB1c2goJy0tLSAnICsgZGlmZi5vbGRGaWxlTmFtZSArICh0eXBlb2YgZGlmZi5vbGRIZWFkZXIgPT09ICd1bmRlZmluZWQnID8gJycgOiAnXFx0JyArIGRpZmYub2xkSGVhZGVyKSk7XG4gIHJldC5wdXNoKCcrKysgJyArIGRpZmYubmV3RmlsZU5hbWUgKyAodHlwZW9mIGRpZmYubmV3SGVhZGVyID09PSAndW5kZWZpbmVkJyA/ICcnIDogJ1xcdCcgKyBkaWZmLm5ld0hlYWRlcikpO1xuXG4gIGZvciAobGV0IGkgPSAwOyBpIDwgZGlmZi5odW5rcy5sZW5ndGg7IGkrKykge1xuICAgIGNvbnN0IGh1bmsgPSBkaWZmLmh1bmtzW2ldO1xuICAgIC8vIFVuaWZpZWQgRGlmZiBGb3JtYXQgcXVpcms6IElmIHRoZSBjaHVuayBzaXplIGlzIDAsXG4gICAgLy8gdGhlIGZpcnN0IG51bWJlciBpcyBvbmUgbG93ZXIgdGhhbiBvbmUgd291bGQgZXhwZWN0LlxuICAgIC8vIGh0dHBzOi8vd3d3LmFydGltYS5jb20vd2VibG9ncy92aWV3cG9zdC5qc3A/dGhyZWFkPTE2NDI5M1xuICAgIGlmIChodW5rLm9sZExpbmVzID09PSAwKSB7XG4gICAgICBodW5rLm9sZFN0YXJ0IC09IDE7XG4gICAgfVxuICAgIGlmIChodW5rLm5ld0xpbmVzID09PSAwKSB7XG4gICAgICBodW5rLm5ld1N0YXJ0IC09IDE7XG4gICAgfVxuICAgIHJldC5wdXNoKFxuICAgICAgJ0BAIC0nICsgaHVuay5vbGRTdGFydCArICcsJyArIGh1bmsub2xkTGluZXNcbiAgICAgICsgJyArJyArIGh1bmsubmV3U3RhcnQgKyAnLCcgKyBodW5rLm5ld0xpbmVzXG4gICAgICArICcgQEAnXG4gICAgKTtcbiAgICByZXQucHVzaC5hcHBseShyZXQsIGh1bmsubGluZXMpO1xuICB9XG5cbiAgcmV0dXJuIHJldC5qb2luKCdcXG4nKSArICdcXG4nO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gY3JlYXRlVHdvRmlsZXNQYXRjaChvbGRGaWxlTmFtZSwgbmV3RmlsZU5hbWUsIG9sZFN0ciwgbmV3U3RyLCBvbGRIZWFkZXIsIG5ld0hlYWRlciwgb3B0aW9ucykge1xuICByZXR1cm4gZm9ybWF0UGF0Y2goc3RydWN0dXJlZFBhdGNoKG9sZEZpbGVOYW1lLCBuZXdGaWxlTmFtZSwgb2xkU3RyLCBuZXdTdHIsIG9sZEhlYWRlciwgbmV3SGVhZGVyLCBvcHRpb25zKSk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBjcmVhdGVQYXRjaChmaWxlTmFtZSwgb2xkU3RyLCBuZXdTdHIsIG9sZEhlYWRlciwgbmV3SGVhZGVyLCBvcHRpb25zKSB7XG4gIHJldHVybiBjcmVhdGVUd29GaWxlc1BhdGNoKGZpbGVOYW1lLCBmaWxlTmFtZSwgb2xkU3RyLCBuZXdTdHIsIG9sZEhlYWRlciwgbmV3SGVhZGVyLCBvcHRpb25zKTtcbn1cbiJdfQ== + +/** + * Split `text` into an array of lines, including the trailing newline character (where present) + */ +function splitLines(text) { + var hasTrailingNl = text.endsWith('\n'); + var result = text.split('\n').map(function (line) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + line + '\n' + ); + }); + if (hasTrailingNl) { + result.pop(); + } else { + result.push(result.pop().slice(0, -1)); + } + return result; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfbGluZSIsInJlcXVpcmUiLCJfdHlwZW9mIiwibyIsIlN5bWJvbCIsIml0ZXJhdG9yIiwiY29uc3RydWN0b3IiLCJwcm90b3R5cGUiLCJfdG9Db25zdW1hYmxlQXJyYXkiLCJhcnIiL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gICAgICAgICBjdXJSYW5nZS5wdXNoKC4uLiBjb250ZXh0TGluZXMobGluZXMpKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgLy8gZW5kIHRoZSByYW5nZSBhbmQgb3V0cHV0XG4gICAgICAgICAgICBsZXQgY29udGV4dFNpemUgPSBNYXRoLm1pbihsaW5lcy5sZW5ndGgsIG9wdGlvbnMuY29udGV4dCk7XG4gICAgICAgICAgICBjdXJSYW5nZS5wdXNoKC4uLiBjb250ZXh0TGluZXMobGluZXMuc2xpY2UoMCwgY29udGV4dFNpemUpKSk7XG5cbiAgICAgICAgICAgIGxldCBodW5rID0ge1xuICAgICAgICAgICAgICBvbGRTdGFydDogb2xkUmFuZ2VTdGFydCxcbiAgICAgICAgICAgICAgb2xkTGluZXM6IChvbGRMaW5lIC0gb2xkUmFuZ2VTdGFydCArIGNvbnRleHRTaXplKSxcbiAgICAgICAgICAgICAgbmV3U3RhcnQ6IG5ld1JhbmdlU3RhcnQsXG4gICAgICAgICAgICAgIG5ld0xpbmVzOiAobmV3TGluZSAtIG5ld1JhbmdlU3RhcnQgKyBjb250ZXh0U2l6ZSksXG4gICAgICAgICAgICAgIGxpbmVzOiBjdXJSYW5nZVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGh1bmtzLnB1c2goaHVuayk7XG5cbiAgICAgICAgICAgIG9sZFJhbmdlU3RhcnQgPSAwO1xuICAgICAgICAgICAgbmV3UmFuZ2VTdGFydCA9IDA7XG4gICAgICAgICAgICBjdXJSYW5nZSA9IFtdO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBvbGRMaW5lICs9IGxpbmVzLmxlbmd0aDtcbiAgICAgICAgbmV3TGluZSArPSBsaW5lcy5sZW5ndGg7XG4gICAgICB9XG4gICAgfVxuXG4gICAgLy8gU3RlcCAyOiBlbGltaW5hdGUgdGhlIHRyYWlsaW5nIGBcXG5gIGZyb20gZWFjaCBsaW5lIG9mIGVhY2ggaHVuayw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DLG1CQUFtQixDQUFDSyxRQUFRLEVBQUVBLFFBQVEsRUFBRXJELE1BQU0sRUFBRUMsTUFBTSxFQUFFQyxTQUFTLEVBQUVDLFNBQVMsRUFBRUMsT0FBTyxDQUFDO0FBQy9GOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFNBQVNzQixVQUFVQSxDQUFDNEIsSUFBSSxFQUFFO0VBQ3hCLElBQU1DLGFBQWEsR0FBR0QsSUFBSSxDQUFDWCxRQUFRLENBQUMsSUFBSSxDQUFDO0VBQ3pDLElBQU1hLE1BQU0sR0FBR0YsSUFBSSxDQUFDRyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUN6QyxHQUFHLENBQUMsVUFBQTBDLElBQUk7RUFBQTtFQUFBO0lBQUE7TUFBQTtNQUFJQSxJQUFJLEdBQUc7SUFBSTtFQUFBLEVBQUM7RUFDeEQsSUFBSUgsYUFBYSxFQUFFO0lBQ2pCQyxNQUFNLENBQUNHLEdBQUcsQ0FBQyxDQUFDO0VBQ2QsQ0FBQyxNQUFNO0lBQ0xILE1BQU0sQ0FBQzlFLElBQUksQ0FBQzhFLE1BQU0sQ0FBQ0csR0FBRyxDQUFDLENBQUMsQ0FBQ3JHLEtBQUssQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQztFQUN4QztFQUNBLE9BQU9rRyxNQUFNO0FBQ2YiLCJpZ25vcmVMaXN0IjpbXX0= diff --git a/deps/npm/node_modules/diff/lib/patch/line-endings.js b/deps/npm/node_modules/diff/lib/patch/line-endings.js new file mode 100644 index 00000000000000..8d00bd22030ab4 --- /dev/null +++ b/deps/npm/node_modules/diff/lib/patch/line-endings.js @@ -0,0 +1,176 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isUnix = isUnix; +exports.isWin = isWin; +exports.unixToWin = unixToWin; +exports.winToUnix = winToUnix; +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } +function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } +/*istanbul ignore end*/ +function unixToWin(patch) { + if (Array.isArray(patch)) { + return patch.map(unixToWin); + } + return ( + /*istanbul ignore start*/ + _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + patch), {}, { + hunks: patch.hunks.map(function (hunk) + /*istanbul ignore start*/ + { + return _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + hunk), {}, { + lines: hunk.lines.map(function (line, i) + /*istanbul ignore start*/ + { + var _hunk$lines; + return ( + /*istanbul ignore end*/ + line.startsWith('\\') || line.endsWith('\r') || + /*istanbul ignore start*/ + (_hunk$lines = + /*istanbul ignore end*/ + hunk.lines[i + 1]) !== null && _hunk$lines !== void 0 && + /*istanbul ignore start*/ + _hunk$lines + /*istanbul ignore end*/ + .startsWith('\\') ? line : line + '\r' + ); + }) + }); + }) + }) + ); +} +function winToUnix(patch) { + if (Array.isArray(patch)) { + return patch.map(winToUnix); + } + return ( + /*istanbul ignore start*/ + _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + patch), {}, { + hunks: patch.hunks.map(function (hunk) + /*istanbul ignore start*/ + { + return _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + hunk), {}, { + lines: hunk.lines.map(function (line) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + line.endsWith('\r') ? line.substring(0, line.length - 1) : line + ); + }) + }); + }) + }) + ); +} + +/** + * Returns true if the patch consistently uses Unix line endings (or only involves one line and has + * no line endings). + */ +function isUnix(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return !patch.some(function (index) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + index.hunks.some(function (hunk) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + hunk.lines.some(function (line) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + !line.startsWith('\\') && line.endsWith('\r') + ); + }) + ); + }) + ); + }); +} + +/** + * Returns true if the patch uses Windows line endings and only Windows line endings. + */ +function isWin(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return patch.some(function (index) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + index.hunks.some(function (hunk) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + hunk.lines.some(function (line) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + line.endsWith('\r') + ); + }) + ); + }) + ); + }) && patch.every(function (index) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + index.hunks.every(function (hunk) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + hunk.lines.every(function (line, i) + /*istanbul ignore start*/ + { + var _hunk$lines2; + return ( + /*istanbul ignore end*/ + line.startsWith('\\') || line.endsWith('\r') || + /*istanbul ignore start*/ + ((_hunk$lines2 = + /*istanbul ignore end*/ + hunk.lines[i + 1]) === null || _hunk$lines2 === void 0 ? void 0 : + /*istanbul ignore start*/ + _hunk$lines2 + /*istanbul ignore end*/ + .startsWith('\\')) + ); + }) + ); + }) + ); + }); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJ1bml4VG9XaW4iLCJwYXRjaCIsIkFycmF5IiwiaXNBcnJheSIsIm1hcCIsIl9vYmplY3RTcHJlYWQiLCJodW5rcyIsImh1bmsiLCJsaW5lcyIsImxpbmUiLCJpIiwiX2h1bmskbGluZXMiLCJzdGFydHNXaXRoIiwiZW5kc1dpdGgiLCJ3aW5Ub1VuaXgiLCJzdWJzdHJpbmciLCJsZW5ndGgiLCJpc1VuaXgiLCJzb21lIiwiaW5kZXgiLCJpc1dpbiIsImV2ZXJ5IiwiX2h1bmskbGluZXMyIl0sInNvdXJjZXMiOlsiLi4vLi4vc3JjL3BhdGNoL2xpbmUtZW5kaW5ncy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gdW5peFRvV2luKHBhdGNoKSB7XG4gIGlmIChBcnJheS5pc0FycmF5KHBhdGNoKSkge1xuICAgIHJldHVybiBwYXRjaC5tYXAodW5peFRvV2luKTtcbiAgfVxuXG4gIHJldHVybiB7XG4gICAgLi4ucGF0Y2gsXG4gICAgaHVua3M6IHBhdGNoLmh1bmtzLm1hcChodW5rID0+ICh7XG4gICAgICAuLi5odW5rLFxuICAgICAgbGluZXM6IGh1bmsubGluZXMubWFwKFxuICAgICAgICAobGluZSwgaSkgPT5cbiAgICAgICAgICAobGluZS5zdGFydHNXaXRoKCdcXFxcJykgfHwgbGluZS5lbmRzV2l0aCgnXFxyJykgfHwgaHVuay5saW5lc1tpICsgMV0/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yZUxpc3QiOltdfQ== diff --git a/deps/npm/node_modules/diff/lib/patch/merge.js b/deps/npm/node_modules/diff/lib/patch/merge.js index b46faaaba8e8b1..fead4e011df0df 100644 --- a/deps/npm/node_modules/diff/lib/patch/merge.js +++ b/deps/npm/node_modules/diff/lib/patch/merge.js @@ -6,71 +6,63 @@ Object.defineProperty(exports, "__esModule", { }); exports.calcLineCount = calcLineCount; exports.merge = merge; - /*istanbul ignore end*/ var /*istanbul ignore start*/ _create = require("./create") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _parse = require("./parse") /*istanbul ignore end*/ ; - var /*istanbul ignore start*/ _array = require("../util/array") /*istanbul ignore end*/ ; - /*istanbul ignore start*/ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } - +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /*istanbul ignore end*/ function calcLineCount(hunk) { - /*istanbul ignore start*/ - var _calcOldNewLineCount = - /*istanbul ignore end*/ - calcOldNewLineCount(hunk.lines), - oldLines = _calcOldNewLineCount.oldLines, - newLines = _calcOldNewLineCount.newLines; - + var + /*istanbul ignore start*/ + _calcOldNewLineCount = + /*istanbul ignore end*/ + calcOldNewLineCount(hunk.lines), + /*istanbul ignore start*/ + /*istanbul ignore end*/ + oldLines = _calcOldNewLineCount.oldLines, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + newLines = _calcOldNewLineCount.newLines; if (oldLines !== undefined) { hunk.oldLines = oldLines; } else { delete hunk.oldLines; } - if (newLines !== undefined) { hunk.newLines = newLines; } else { delete hunk.newLines; } } - function merge(mine, theirs, base) { mine = loadPatch(mine, base); theirs = loadPatch(theirs, base); - var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning. + var ret = {}; + + // For index we just let it pass through as it doesn't have any necessary meaning. // Leaving sanity checks on this to the API consumer that may know more about the // meaning in their own context. - if (mine.index || theirs.index) { ret.index = mine.index || theirs.index; } - if (mine.newFileName || theirs.newFileName) { if (!fileNameChanged(mine)) { // No header or no change in ours, use theirs (and ours if theirs does not exist) @@ -92,21 +84,18 @@ function merge(mine, theirs, base) { ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); } } - ret.hunks = []; var mineIndex = 0, - theirsIndex = 0, - mineOffset = 0, - theirsOffset = 0; - + theirsIndex = 0, + mineOffset = 0, + theirsOffset = 0; while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { var mineCurrent = mine.hunks[mineIndex] || { - oldStart: Infinity - }, - theirsCurrent = theirs.hunks[theirsIndex] || { - oldStart: Infinity - }; - + oldStart: Infinity + }, + theirsCurrent = theirs.hunks[theirsIndex] || { + oldStart: Infinity + }; if (hunkBefore(mineCurrent, theirsCurrent)) { // This patch does not overlap with any of the others, yay. ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); @@ -132,10 +121,8 @@ function merge(mine, theirs, base) { ret.hunks.push(mergedHunk); } } - return ret; } - function loadPatch(param, base) { if (typeof param === 'string') { if (/^@@/m.test(param) || /^Index:/m.test(param)) { @@ -143,7 +130,6 @@ function loadPatch(param, base) { /*istanbul ignore start*/ (0, /*istanbul ignore end*/ - /*istanbul ignore start*/ _parse /*istanbul ignore end*/ @@ -154,16 +140,13 @@ function loadPatch(param, base) { (param)[0] ); } - if (!base) { throw new Error('Must provide a base reference or pass in a patch'); } - return ( /*istanbul ignore start*/ (0, /*istanbul ignore end*/ - /*istanbul ignore start*/ _create /*istanbul ignore end*/ @@ -174,14 +157,11 @@ function loadPatch(param, base) { (undefined, undefined, base, param) ); } - return param; } - function fileNameChanged(patch) { return patch.newFileName && patch.newFileName !== patch.oldFileName; } - function selectField(index, mine, theirs) { if (mine === theirs) { return mine; @@ -193,11 +173,9 @@ function selectField(index, mine, theirs) { }; } } - function hunkBefore(test, check) { return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; } - function cloneHunk(hunk, offset) { return { oldStart: hunk.oldStart, @@ -207,42 +185,38 @@ function cloneHunk(hunk, offset) { lines: hunk.lines }; } - function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { // This will generally result in a conflicted hunk, but there are cases where the context // is the only overlap where we can successfully merge the content here. var mine = { - offset: mineOffset, - lines: mineLines, - index: 0 - }, - their = { - offset: theirOffset, - lines: theirLines, - index: 0 - }; // Handle any leading content + offset: mineOffset, + lines: mineLines, + index: 0 + }, + their = { + offset: theirOffset, + lines: theirLines, + index: 0 + }; + // Handle any leading content insertLeading(hunk, mine, their); - insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each. + insertLeading(hunk, their, mine); + // Now in the overlap content. Scan through and select the best changes from each. while (mine.index < mine.lines.length && their.index < their.lines.length) { var mineCurrent = mine.lines[mine.index], - theirCurrent = their.lines[their.index]; - + theirCurrent = their.lines[their.index]; if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { // Both modified ... mutualChange(hunk, mine, their); } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { /*istanbul ignore start*/ var _hunk$lines; - /*istanbul ignore end*/ // Mine inserted - /*istanbul ignore start*/ - /*istanbul ignore end*/ - /*istanbul ignore start*/ (_hunk$lines = /*istanbul ignore end*/ @@ -258,14 +232,10 @@ function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { /*istanbul ignore start*/ var _hunk$lines2; - /*istanbul ignore end*/ // Theirs inserted - /*istanbul ignore start*/ - /*istanbul ignore end*/ - /*istanbul ignore start*/ (_hunk$lines2 = /*istanbul ignore end*/ @@ -293,25 +263,22 @@ function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { // Context mismatch conflict(hunk, collectChange(mine), collectChange(their)); } - } // Now push anything that may be remaining - + } + // Now push anything that may be remaining insertTrailing(hunk, mine); insertTrailing(hunk, their); calcLineCount(hunk); } - function mutualChange(hunk, mine, their) { var myChanges = collectChange(mine), - theirChanges = collectChange(their); - + theirChanges = collectChange(their); if (allRemoves(myChanges) && allRemoves(theirChanges)) { // Special case for remove changes that are supersets of one another if ( /*istanbul ignore start*/ (0, /*istanbul ignore end*/ - /*istanbul ignore start*/ _array /*istanbul ignore end*/ @@ -322,13 +289,9 @@ function mutualChange(hunk, mine, their) { (myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { /*istanbul ignore start*/ var _hunk$lines3; - /*istanbul ignore end*/ - /*istanbul ignore start*/ - /*istanbul ignore end*/ - /*istanbul ignore start*/ (_hunk$lines3 = /*istanbul ignore end*/ @@ -341,13 +304,11 @@ function mutualChange(hunk, mine, their) { _toConsumableArray( /*istanbul ignore end*/ myChanges)); - return; } else if ( /*istanbul ignore start*/ (0, /*istanbul ignore end*/ - /*istanbul ignore start*/ _array /*istanbul ignore end*/ @@ -358,13 +319,9 @@ function mutualChange(hunk, mine, their) { (theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { /*istanbul ignore start*/ var _hunk$lines4; - /*istanbul ignore end*/ - /*istanbul ignore start*/ - /*istanbul ignore end*/ - /*istanbul ignore start*/ (_hunk$lines4 = /*istanbul ignore end*/ @@ -377,14 +334,12 @@ function mutualChange(hunk, mine, their) { _toConsumableArray( /*istanbul ignore end*/ theirChanges)); - return; } } else if ( /*istanbul ignore start*/ (0, /*istanbul ignore end*/ - /*istanbul ignore start*/ _array /*istanbul ignore end*/ @@ -395,13 +350,9 @@ function mutualChange(hunk, mine, their) { (myChanges, theirChanges)) { /*istanbul ignore start*/ var _hunk$lines5; - /*istanbul ignore end*/ - /*istanbul ignore start*/ - /*istanbul ignore end*/ - /*istanbul ignore start*/ (_hunk$lines5 = /*istanbul ignore end*/ @@ -414,27 +365,19 @@ function mutualChange(hunk, mine, their) { _toConsumableArray( /*istanbul ignore end*/ myChanges)); - return; } - conflict(hunk, myChanges, theirChanges); } - function removal(hunk, mine, their, swap) { var myChanges = collectChange(mine), - theirChanges = collectContext(their, myChanges); - + theirChanges = collectContext(their, myChanges); if (theirChanges.merged) { /*istanbul ignore start*/ var _hunk$lines6; - /*istanbul ignore end*/ - /*istanbul ignore start*/ - /*istanbul ignore end*/ - /*istanbul ignore start*/ (_hunk$lines6 = /*istanbul ignore end*/ @@ -451,7 +394,6 @@ function removal(hunk, mine, their, swap) { conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); } } - function conflict(hunk, mine, their) { hunk.conflict = true; hunk.lines.push({ @@ -460,7 +402,6 @@ function conflict(hunk, mine, their) { theirs: their }); } - function insertLeading(hunk, insert, their) { while (insert.offset < their.offset && insert.index < insert.lines.length) { var line = insert.lines[insert.index++]; @@ -468,25 +409,22 @@ function insertLeading(hunk, insert, their) { insert.offset++; } } - function insertTrailing(hunk, insert) { while (insert.index < insert.lines.length) { var line = insert.lines[insert.index++]; hunk.lines.push(line); } } - function collectChange(state) { var ret = [], - operation = state.lines[state.index][0]; - + operation = state.lines[state.index][0]; while (state.index < state.lines.length) { - var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. + var line = state.lines[state.index]; + // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. if (operation === '-' && line[0] === '+') { operation = '+'; } - if (operation === line[0]) { ret.push(line); state.index++; @@ -494,39 +432,35 @@ function collectChange(state) { break; } } - return ret; } - function collectContext(state, matchChanges) { var changes = [], - merged = [], - matchIndex = 0, - contextChanges = false, - conflicted = false; - + merged = [], + matchIndex = 0, + contextChanges = false, + conflicted = false; while (matchIndex < matchChanges.length && state.index < state.lines.length) { var change = state.lines[state.index], - match = matchChanges[matchIndex]; // Once we've hit our add, then we are done + match = matchChanges[matchIndex]; + // Once we've hit our add, then we are done if (match[0] === '+') { break; } - contextChanges = contextChanges || change[0] !== ' '; merged.push(match); - matchIndex++; // Consume any additions in the other block as a conflict to attempt - // to pull in the remaining context after this + matchIndex++; + // Consume any additions in the other block as a conflict to attempt + // to pull in the remaining context after this if (change[0] === '+') { conflicted = true; - while (change[0] === '+') { changes.push(change); change = state.lines[++state.index]; } } - if (match.substr(1) === change.substr(1)) { changes.push(change); state.index++; @@ -534,44 +468,35 @@ function collectContext(state, matchChanges) { conflicted = true; } } - if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { conflicted = true; } - if (conflicted) { return changes; } - while (matchIndex < matchChanges.length) { merged.push(matchChanges[matchIndex++]); } - return { merged: merged, changes: changes }; } - function allRemoves(changes) { return changes.reduce(function (prev, change) { return prev && change[0] === '-'; }, true); } - function skipRemoveSuperset(state, removeChanges, delta) { for (var i = 0; i < delta; i++) { var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); - if (state.lines[state.index + i] !== ' ' + changeContent) { return false; } } - state.index += delta; return true; } - function calcOldNewLineCount(lines) { var oldLines = 0; var newLines = 0; @@ -579,7 +504,6 @@ function calcOldNewLineCount(lines) { if (typeof line !== 'string') { var myCount = calcOldNewLineCount(line.mine); var theirCount = calcOldNewLineCount(line.theirs); - if (oldLines !== undefined) { if (myCount.oldLines === theirCount.oldLines) { oldLines += myCount.oldLines; @@ -587,7 +511,6 @@ function calcOldNewLineCount(lines) { oldLines = undefined; } } - if (newLines !== undefined) { if (myCount.newLines === theirCount.newLines) { newLines += myCount.newLines; @@ -599,7 +522,6 @@ function calcOldNewLineCount(lines) { if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { newLines++; } - if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { oldLines++; } @@ -610,4 +532,4 @@ function calcOldNewLineCount(lines) { newLines: newLines }; } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9tZXJnZS5qcyJdLCJuYW1lcyI6WyJjYWxjTGluZUNvdW50IiwiaHVuayIsImNhbGNPbGROZXdMaW5lQ291bnQiLCJsaW5lcyIsIm9sZExpbmVzIiwibmV3TGluZXMiLCJ1bmRlZmluZWQiLCJtZXJnZSIsIm1pbmUiLCJ0aGVpcnMiLCJiYXNlIiwibG9hZFBhdGNoIiwicmV0IiwiaW5kZXgiLCJuZXdGaWxlTmFtZSIsImZpbGVOYW1lQ2hhbmdlZCIsIm9sZEZpbGVOYW1lIiwib2xkSGVhZGVyIiwibmV3SGVhZGVyIiwic2VsZWN0RmllbGQiLCJodW5rcyIsIm1pbmVJbmRleCIsInRoZWlyc0luZGV4IiwibWluZU9mZnNldCIsInRoZWlyc09mZnNldCIsImxlbmd0aCIsIm1pbmVDdXJyZW50Iiwib2xkU3RhcnQiLCJJbmZpbml0eSIsInRoZWlyc0N1cnJlbnQiLCJodW5rQmVmb3JlIiwicHVzaCIsImNsb25lSHVuayIsIm1lcmdlZEh1bmsiLCJNYXRoIiwibWluIiwibmV3U3RhcnQiLCJtZXJnZU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ZCkge1xuICAgICAgICBpZiAobXlDb3VudC5vbGRMaW5lcyA9PT0gdGhlaXJDb3VudC5vbGRMaW5lcykge1xuICAgICAgICAgIG9sZExpbmVzICs9IG15Q291bnQub2xkTGluZXM7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgb2xkTGluZXMgPSB1bmRlZmluZWQ7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgaWYgKG5ld0xpbmVzICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgaWYgKG15Q291bnQubmV3TGluZXMgPT09IHRoZWlyQ291bnQubmV3TGluZXMpIHtcbiAgICAgICAgICBuZXdMaW5lcyArPSBteUNvdW50Lm5ld0xpbmVzO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIG5ld0xpbmVzID0gdW5kZWZpbmVkO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgIGlmIChuZXdMaW5lcyAhPT0gdW5kZWZpbmVkICYmIChsaW5lWzBdID09PSAnKycgfHwgbGluZVswXSA9PT0gJyAnKSkge1xuICAgICAgICBuZXdMaW5lcysrO1xuICAgICAgfVxuICAgICAgaWYgKG9sZExpbmVzICE9PSB1bmRlZmluZWQgJiYgKGxpbmVbMF0gPT09ICctJyB8fCBsaW5lWzBdID09PSAnICcpKSB7XG4gICAgICAgIG9sZExpbmVzKys7XG4gICAgICB9XG4gICAgfVxuICB9KTtcblxuICByZXR1cm4ge29sZExpbmVzLCBuZXdMaW5lc307XG59XG4iXX0= +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfY3JlYXRlIiwicmVxdWlyZSIsIl9wYXJzZSIsIl9hcnJheSIsIl90b0NvbnN1bWFibGVBcnJheSIsImFyciIsIl9hcnJheVdpdGhvdXRIb2xlcyIsIl9pdGVyYWJsZVRvQXJyYXkiLCJfdW5zdXBwb3J0ZWRJdGVyYWJsZVRvQXJyYXkiLCJfbm9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FDQSxJQUFJRCxRQUFRLEtBQUtFLFNBQVMsS0FBS2tFLElBQUksQ0FBQyxDQUFDLENBQUMsS0FBSyxHQUFHLElBQUlBLElBQUksQ0FBQyxDQUFDLENBQUMsS0FBSyxHQUFHLENBQUMsRUFBRTtRQUNsRXBFLFFBQVEsRUFBRTtNQUNaO0lBQ0Y7RUFDRixDQUFDLENBQUM7RUFFRixPQUFPO0lBQUNBLFFBQVEsRUFBUkEsUUFBUTtJQUFFQyxRQUFRLEVBQVJBO0VBQVEsQ0FBQztBQUM3QiIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/deps/npm/node_modules/diff/lib/patch/parse.js b/deps/npm/node_modules/diff/lib/patch/parse.js index f1501048014f1f..15acdd9a0e1c2c 100644 --- a/deps/npm/node_modules/diff/lib/patch/parse.js +++ b/deps/npm/node_modules/diff/lib/patch/parse.js @@ -5,123 +5,110 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.parsePatch = parsePatch; - /*istanbul ignore end*/ function parsePatch(uniDiff) { - /*istanbul ignore start*/ - var - /*istanbul ignore end*/ - options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/), - delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [], - list = [], - i = 0; - + var diffstr = uniDiff.split(/\n/), + list = [], + i = 0; function parseIndex() { var index = {}; - list.push(index); // Parse diff metadata + list.push(index); + // Parse diff metadata while (i < diffstr.length) { - var line = diffstr[i]; // File header found, end parsing diff metadata + var line = diffstr[i]; + // File header found, end parsing diff metadata if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { break; - } // Diff index - + } + // Diff index var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); - if (header) { index.index = header[1]; } - i++; - } // Parse file headers if they are defined. Unified diff requires them, but - // there's no technical issues to have an isolated hunk without file header - + } + // Parse file headers if they are defined. Unified diff requires them, but + // there's no technical issues to have an isolated hunk without file header + parseFileHeader(index); parseFileHeader(index); - parseFileHeader(index); // Parse hunks + // Parse hunks index.hunks = []; - while (i < diffstr.length) { var _line = diffstr[i]; - - if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) { + if (/^(Index:\s|diff\s|\-\-\-\s|\+\+\+\s|===================================================================)/.test(_line)) { break; } else if (/^@@/.test(_line)) { index.hunks.push(parseHunk()); - } else if (_line && options.strict) { - // Ignore unexpected content unless in strict mode + } else if (_line) { throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); } else { i++; } } - } // Parses the --- and +++ headers, if none are found, no lines - // are consumed. - + } + // Parses the --- and +++ headers, if none are found, no lines + // are consumed. function parseFileHeader(index) { - var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]); - + var fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]); if (fileHeader) { var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; var data = fileHeader[2].split('\t', 2); var fileName = data[0].replace(/\\\\/g, '\\'); - if (/^".*"$/.test(fileName)) { fileName = fileName.substr(1, fileName.length - 2); } - index[keyPrefix + 'FileName'] = fileName; index[keyPrefix + 'Header'] = (data[1] || '').trim(); i++; } - } // Parses a hunk - // This assumes that we are at the start of a hunk. - + } + // Parses a hunk + // This assumes that we are at the start of a hunk. function parseHunk() { var chunkHeaderIndex = i, - chunkHeaderLine = diffstr[i++], - chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); + chunkHeaderLine = diffstr[i++], + chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); var hunk = { oldStart: +chunkHeader[1], oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2], newStart: +chunkHeader[3], newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4], - lines: [], - linedelimiters: [] - }; // Unified Diff Format quirk: If the chunk size is 0, + lines: [] + }; + + // Unified Diff Format quirk: If the chunk size is 0, // the first number is one lower than one would expect. // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 - if (hunk.oldLines === 0) { hunk.oldStart += 1; } - if (hunk.newLines === 0) { hunk.newStart += 1; } - var addCount = 0, - removeCount = 0; - - for (; i < diffstr.length; i++) { - // Lines starting with '---' could be mistaken for the "remove line" operation - // But they could be the header for the next file. Therefore prune such cases out. - if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) { - break; - } - + removeCount = 0; + for (; i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || + /*istanbul ignore start*/ + (_diffstr$i = + /*istanbul ignore end*/ + diffstr[i]) !== null && _diffstr$i !== void 0 && + /*istanbul ignore start*/ + _diffstr$i + /*istanbul ignore end*/ + .startsWith('\\')); i++) { + /*istanbul ignore start*/ + var _diffstr$i; + /*istanbul ignore end*/ var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; - if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { hunk.lines.push(diffstr[i]); - hunk.linedelimiters.push(delimiters[i] || '\n'); - if (operation === '+') { addCount++; } else if (operation === '-') { @@ -131,37 +118,34 @@ function parsePatch(uniDiff) { removeCount++; } } else { - break; + throw new Error( + /*istanbul ignore start*/ + "Hunk at line ".concat( + /*istanbul ignore end*/ + chunkHeaderIndex + 1, " contained invalid line ").concat(diffstr[i])); } - } // Handle the empty block count case - + } + // Handle the empty block count case if (!addCount && hunk.newLines === 1) { hunk.newLines = 0; } - if (!removeCount && hunk.oldLines === 1) { hunk.oldLines = 0; - } // Perform optional sanity checking - - - if (options.strict) { - if (addCount !== hunk.newLines) { - throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } - - if (removeCount !== hunk.oldLines) { - throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); - } } + // Perform sanity checking + if (addCount !== hunk.newLines) { + throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + if (removeCount !== hunk.oldLines) { + throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } return hunk; } - while (i < diffstr.length) { parseIndex(); } - return list; } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9wYXJzZS5qcyJdLCJuYW1lcyI6WyJwYXJzZVBhdGNoIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJkaWZmc3RyIiwic3BsaXQiLCJkZWxpbWl0ZXJzIiwibWF0Y2giLCJsaXN0IiwiaSIsInBhcnNlSW5kZXgiLCJpbmRleCIsInB1c2giLCJsZW5ndGgiLCJsaW5lIiwidGVzdCIsImhlYWRlciIsImV4ZWMiLCJwYXJzZUZpbGVIZWFkZXIiLCJodW5rcyIsInBhcnNlSHVuayIsInN0cmljdCIsIkVycm9yIiwiSlNPTiIsInN0cmluZ2lmeSIsImZpbGVIZWFkZXIiLCJrZXlQcmVmaXgiLCJkYXRhIiwiZmlsZU5hbWUiLCJyZXBsYWNlIiwic3Vic3RyIiwidHJpbSIsImNodW5rSGVhZGVySW5kZXgiLCJjaHVua0hlYWRlckxpbmUiLCJjaHVua0hlYWRlciIsImh1bmsiLCJvbGRTdGFydCIsIm9sZExpbmVzIiwibmV3U3RhcnQiLCJuZXdMaW5lcyIsImxpbmVzIiwibGluZWRlbGltaXRlcnMiLCJhZGRDb3VudCIsInJlbW92ZUNvdW50IiwiaW5kZXhPZiIsIm9wZXJhdGlvbiJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQU8sU0FBU0EsVUFBVCxDQUFvQkMsT0FBcEIsRUFBMkM7QUFBQTtBQUFBO0FBQUE7QUFBZEMsRUFBQUEsT0FBYyx1RUFBSixFQUFJO0FBQ2hELE1BQUlDLE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NodW5rSGVhZGVySW5kZXggKyAxKSk7XG4gICAgICB9XG4gICAgICBpZiAocmVtb3ZlQ291bnQgIT09IGh1bmsub2xkTGluZXMpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdSZW1vdmVkIGxpbmUgY291bnQgZGlkIG5vdCBtYXRjaCBmb3IgaHVuayBhdCBsaW5lICcgKyAoY2h1bmtIZWFkZXJJbmRleCArIDEpKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gaHVuaztcbiAgfVxuXG4gIHdoaWxlIChpIDwgZGlmZnN0ci5sZW5ndGgpIHtcbiAgICBwYXJzZUluZGV4KCk7XG4gIH1cblxuICByZXR1cm4gbGlzdDtcbn1cbiJdfQ== +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJwYXJzZVBhdGNoIiwidW5pRGlmZiIsImRpZmZzdHIiLCJzcGxpdCIsImxpc3QiLCJpIiwicGFyc2VJbmRleCIsImluZGV4IiwicHVzaCIsImxlbmd0aCIsImxpbmUiLCJ0ZXN0IiwiaGVhZGVyIiwiZXhlYyIsInBhcnNlRmlsZUhlYWRlciIsImh1bmtzIiwicGFyc2VIdW5rIiwiRXJyb3IiLCJKU09OIiwic3RyaW5naWZ5IiwiZmlsZUhlYWRlciIsImtleVByZWZpeCIsImRhdGEiLCJmaWxlTmFtZSIsInJlcGxhY2UiLCJzdWJzdHIiLCJ0cmltIiwiY2h1bmtIZWFkZXJJbmRleCIsImNodW5rSGVhZGVyTGluZSIsImNodW5rSGVhZGVyIiwiaHVuayIsIm9sZFN0YXJ0Iiwib2xkTGluZXMiLCJuZXdTdGFydCIsIm5ld0xpbmVzIiwibGluZXMiLCJhZGRDb3VudCIsInJlbW92ZUNvdW50IiwiX2RpZmZzdHIkaSIsInN0YXJ0c1dpdGgiLCJvcGVyYXRpb24iLCJjb25jYXQiXSwic291cmNlcyI6WyIuLi8uLi9zcmMvcGF0Y2gvcGFy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XG5cbiAgICAgICAgaWYgKG9wZXJhdGlvbiA9PT0gJysnKSB7XG4gICAgICAgICAgYWRkQ291bnQrKztcbiAgICAgICAgfSBlbHNlIGlmIChvcGVyYXRpb24gPT09ICctJykge1xuICAgICAgICAgIHJlbW92ZUNvdW50Kys7XG4gICAgICAgIH0gZWxzZSBpZiAob3BlcmF0aW9uID09PSAnICcpIHtcbiAgICAgICAgICBhZGRDb3VudCsrO1xuICAgICAgICAgIHJlbW92ZUNvdW50Kys7XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHRocm93IG5ldyBFcnJvcihgSHVuayBhdCBsaW5lICR7Y2h1bmtIZWFkZXJJbmRleCArIDF9IGNvbnRhaW5lZCBpbnZhbGlkIGxpbmUgJHtkaWZmc3RyW2ldfWApO1xuICAgICAgfVxuICAgIH1cblxuICAgIC8vIEhhbmRsZSB0aGUgZW1wdHkgYmxvY2sgY291bnQgY2FzZVxuICAgIGlmICghYWRkQ291bnQgJiYgaHVuay5uZXdMaW5lcyA9PT0gMSkge1xuICAgICAgaHVuay5uZXdMaW5lcyA9IDA7XG4gICAgfVxuICAgIGlmICghcmVtb3ZlQ291bnQgJiYgaHVuay5vbGRMaW5lcyA9PT0gMSkge1xuICAgICAgaHVuay5vbGRMaW5lcyA9IDA7XG4gICAgfVxuXG4gICAgLy8gUGVyZm9ybSBzYW5pdHkgY2hlY2tpbmdcbiAgICBpZiAoYWRkQ291bnQgIT09IGh1bmsubmV3TGluZXMpIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcignQWRkZWQgbGluZSBjb3VudCBkaWQgbm90IG1hdGNoIGZvciBodW5rIGF0IGxpbmUgJyArIChjaHVua0hlYWRlckluZGV4ICsgMSkpO1xuICAgIH1cbiAgICBpZiAocmVtb3ZlQ291bnQgIT09IGh1bmsub2xkTGluZXMpIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcignUmVtb3ZlZCBsaW5lIGNvdW50IGRpZCBub3QgbWF0Y2gg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Q0FBQyxDQUFDO0lBQzlGO0lBQ0EsSUFBSVUsV0FBVyxLQUFLUCxJQUFJLENBQUNFLFFBQVEsRUFBRTtNQUNqQyxNQUFNLElBQUlmLEtBQUssQ0FBQyxvREFBb0QsSUFBSVUsZ0JBQWdCLEdBQUcsQ0FBQyxDQUFDLENBQUM7SUFDaEc7SUFFQSxPQUFPRyxJQUFJO0VBQ2I7RUFFQSxPQUFPekIsQ0FBQyxHQUFHSCxPQUFPLENBQUNPLE1BQU0sRUFBRTtJQUN6QkgsVUFBVSxDQUFDLENBQUM7RUFDZDtFQUVBLE9BQU9GLElBQUk7QUFDYiIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/deps/npm/node_modules/diff/lib/patch/reverse.js b/deps/npm/node_modules/diff/lib/patch/reverse.js index 6e4be99af8ac32..3c8723e4d5fe66 100644 --- a/deps/npm/node_modules/diff/lib/patch/reverse.js +++ b/deps/npm/node_modules/diff/lib/patch/reverse.js @@ -5,19 +5,17 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.reversePatch = reversePatch; - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } +function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*istanbul ignore end*/ function reversePatch(structuredPatch) { if (Array.isArray(structuredPatch)) { return structuredPatch.map(reversePatch).reverse(); } - return ( /*istanbul ignore start*/ _objectSpread(_objectSpread({}, @@ -33,7 +31,6 @@ function reversePatch(structuredPatch) { oldStart: hunk.newStart, newLines: hunk.oldLines, newStart: hunk.oldStart, - linedelimiters: hunk.linedelimiters, lines: hunk.lines.map(function (l) { if (l.startsWith('-')) { return ( @@ -43,7 +40,6 @@ function reversePatch(structuredPatch) { l.slice(1)) ); } - if (l.startsWith('+')) { return ( /*istanbul ignore start*/ @@ -52,7 +48,6 @@ function reversePatch(structuredPatch) { l.slice(1)) ); } - return l; }) }; @@ -60,4 +55,4 @@ function reversePatch(structuredPatch) { }) ); } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9yZXZlcnNlLmpzIl0sIm5hbWVzIjpbInJldmVyc2VQYXRjaCIsInN0cnVjdHVyZWRQYXRjaCIsIkFycmF5IiwiaXNBcnJheSIsIm1hcCIsInJldmVyc2UiLCJvbGRGaWxlTmFtZSIsIm5ld0ZpbGVOYW1lIiwib2xkSGVhZGVyIiwibmV3SGVhZGVyIiwiaHVua3MiLCJodW5rIiwib2xkTGluZXMiLCJuZXdMaW5lcyIsIm9sZFN0YXJ0IiwibmV3U3RhcnQiLCJsaW5lZGVsaW1pdGVycyIsImxpbmVzIiwibCIsInN0YXJ0c1dpdGgiLCJzbGljZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7O0FBQU8sU0FBU0EsWUFBVCxDQUFzQkMsZUFBdEIsRUFBdUM7QUFDNUMsTUFBSUMsS0FBSyxDQUFDQyxPQUFOLENBQWNGLGVBQWQsQ0FBSixFQUFvQztBQUNsQyxXQUFPQSxlQUFlLENBQUNHLEdBQWhCLENBQW9CSixZQUFwQixFQUFrQ0ssT0FBbEMsRUFBUDtBQUNEOztBQUVEO0FBQUE7QUFBQTtBQUFBO0FBQ0tKLElBQUFBLGVBREw7QUFFRUssTUFBQUEsV0FBVyxFQUFFTCxlQUFlLENBQUNNLFdBRi9CO0FBR0VDLE1BQUFBLFNBQVMsRUFBRVAsZUFBZSxDQUFDUSxTQUg3QjtBQUlFRixNQUFBQSxXQUFXLEVBQUVOLGVBQWUsQ0FBQ0ssV0FKL0I7QUFLRUcsTUFBQUEsU0FBUyxFQUFFUixlQUFlLENBQUNPLFNBTDdCO0FBTUVFLE1BQUFBLEtBQUssR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BQUVGLElBQUksQ0FBQ0MsUUFBUTtVQUN2QkcsUUFBUSxFQUFFSixJQUFJLENBQUNHLFFBQVE7VUFDdkJFLEtBQUssRUFBRUwsSUFBSSxDQUFDSyxLQUFLLENBQUNiLEdBQUcsQ0FBQyxVQUFBYyxDQUFDLEVBQUk7WUFDekIsSUFBSUEsQ0FBQyxDQUFDQyxVQUFVLENBQUMsR0FBRyxDQUFDLEVBQUU7Y0FBRTtnQkFBQTtnQkFBQSxJQUFBQyxNQUFBO2dCQUFBO2dCQUFXRixDQUFDLENBQUNHLEtBQUssQ0FBQyxDQUFDLENBQUM7Y0FBQTtZQUFJO1lBQ2xELElBQUlILENBQUMsQ0FBQ0MsVUFBVSxDQUFDLEdBQUcsQ0FBQyxFQUFFO2NBQUU7Z0JBQUE7Z0JBQUEsSUFBQUMsTUFBQTtnQkFBQTtnQkFBV0YsQ0FBQyxDQUFDRyxLQUFLLENBQUMsQ0FBQyxDQUFDO2NBQUE7WUFBSTtZQUNsRCxPQUFPSCxDQUFDO1VBQ1YsQ0FBQztRQUNILENBQUM7TUFDSCxDQUFDO0lBQUM7RUFBQTtBQUVOIiwiaWdub3JlTGlzdCI6W119 diff --git a/deps/npm/node_modules/diff/lib/util/array.js b/deps/npm/node_modules/diff/lib/util/array.js index aecf67ac817c16..af10977a70ac66 100644 --- a/deps/npm/node_modules/diff/lib/util/array.js +++ b/deps/npm/node_modules/diff/lib/util/array.js @@ -6,27 +6,22 @@ Object.defineProperty(exports, "__esModule", { }); exports.arrayEqual = arrayEqual; exports.arrayStartsWith = arrayStartsWith; - /*istanbul ignore end*/ function arrayEqual(a, b) { if (a.length !== b.length) { return false; } - return arrayStartsWith(a, b); } - function arrayStartsWith(array, start) { if (start.length > array.length) { return false; } - for (var i = 0; i < start.length; i++) { if (start[i] !== array[i]) { return false; } } - return true; } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGl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TyxTQUFTQSxVQUFVQSxDQUFDQyxDQUFDLEVBQUVDLENBQUMsRUFBRTtFQUMvQixJQUFJRCxDQUFDLENBQUNFLE1BQU0sS0FBS0QsQ0FBQyxDQUFDQyxNQUFNLEVBQUU7SUFDekIsT0FBTyxLQUFLO0VBQ2Q7RUFFQSxPQUFPQyxlQUFlLENBQUNILENBQUMsRUFBRUMsQ0FBQyxDQUFDO0FBQzlCO0FBRU8sU0FBU0UsZUFBZUEsQ0FBQ0MsS0FBSyxFQUFFQyxLQUFLLEVBQUU7RUFDNUMsSUFBSUEsS0FBSyxDQUFDSCxNQUFNLEdBQUdFLEtBQUssQ0FBQ0YsTUFBTSxFQUFFO0lBQy9CLE9BQU8sS0FBSztFQUNkO0VBRUEsS0FBSyxJQUFJSSxDQUFDLEdBQUcsQ0FBQyxFQUFFQSxDQUFDLEdBQUdELEtBQUssQ0FBQ0gsTUFBTSxFQUFFSSxDQUFDLEVBQUUsRUFBRTtJQUNyQyxJQUFJRCxLQUFLLENBQUNDLENBQUMsQ0FBQyxLQUFLRixLQUFLLENBQUNFLENBQUMsQ0FBQyxFQUFFO01BQ3pCLE9BQU8sS0FBSztJQUNkO0VBQ0Y7RUFFQSxPQUFPLElBQUk7QUFDYiIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/deps/npm/node_modules/diff/lib/util/distance-iterator.js b/deps/npm/node_modules/diff/lib/util/distance-iterator.js index 57c06a3f9cf1ce..63893731fb1509 100644 --- a/deps/npm/node_modules/diff/lib/util/distance-iterator.js +++ b/deps/npm/node_modules/diff/lib/util/distance-iterator.js @@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = _default; - /*istanbul ignore end*/ // Iterator that traverses in the range of [min, max], stepping // by distance from a given start position. I.e. for [0, 4], with @@ -16,42 +15,40 @@ _default /*istanbul ignore end*/ (start, minLine, maxLine) { var wantForward = true, - backwardExhausted = false, - forwardExhausted = false, - localOffset = 1; + backwardExhausted = false, + forwardExhausted = false, + localOffset = 1; return function iterator() { if (wantForward && !forwardExhausted) { if (backwardExhausted) { localOffset++; } else { wantForward = false; - } // Check if trying to fit beyond text length, and if not, check it fits - // after offset location (or desired location on first iteration) - + } + // Check if trying to fit beyond text length, and if not, check it fits + // after offset location (or desired location on first iteration) if (start + localOffset <= maxLine) { - return localOffset; + return start + localOffset; } - forwardExhausted = true; } - if (!backwardExhausted) { if (!forwardExhausted) { wantForward = true; - } // Check if trying to fit before text beginning, and if not, check it fits - // before offset location - + } + // Check if trying to fit before text beginning, and if not, check it fits + // before offset location if (minLine <= start - localOffset) { - return -localOffset++; + return start - localOffset++; } - backwardExhausted = true; return iterator(); - } // We tried to fit hunk before text beginning and beyond text length, then - // hunk can't fit on the text. Return undefined + } + // We tried to fit hunk before text beginning and beyond text length, then + // hunk can't fit on the text. Return undefined }; } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2Rpc3RhbmNlLWl0ZXJhdG9yLmpzIl0sIm5hbWVzIjpbInN0YXJ0IiwibWluTGluZSIsIm1heExpbmUiLCJ3YW50Rm9yd2FyZCIsImJhY2t3YXJkRXhoYXVzdGVkIiwiZm9yd2FyZEV4aGF1c3RlZCIsImxvY2FsT2Zmc2V0IiwiaXRlcmF0b3IiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQUFBO0FBQ0E7QUFDQTtBQUNlO0FBQUE7QUFBQTtBQUFBO0FBQUEsQ0FBU0EsS0FBVCxFQUFnQkMsT0FBaEIsRUFBeUJDLE9BQXpCLEVBQWtDO0FBQy9DLE1BQUlDLFdBQVcsR0FBRyxJQUFsQjtBQUFBLE1BQ0lDLGlCQUFpQixHQUFHLEtBRHhCO0FBQUEsTUFFSUMsZ0JBQWdCLEdBQUcsS0FGdkI7QUFBQSxNQUdJQyxXQUFXLEdBQUcsQ0FIbEI7QUFLQSxTQUFPLFNBQVNDLFFBQVQsR0FBb0I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U7UUFDckJGLFdBQVcsR0FBRyxJQUFJO01BQ3BCOztNQUVBO01BQ0E7TUFDQSxJQUFJRixPQUFPLElBQUlELEtBQUssR0FBR00sV0FBVyxFQUFFO1FBQ2xDLE9BQU9OLEtBQUssR0FBR00sV0FBVyxFQUFFO01BQzlCO01BRUFGLGlCQUFpQixHQUFHLElBQUk7TUFDeEIsT0FBT0csUUFBUSxDQUFDLENBQUM7SUFDbkI7O0lBRUE7SUFDQTtFQUNGLENBQUM7QUFDSCIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/deps/npm/node_modules/diff/lib/util/params.js b/deps/npm/node_modules/diff/lib/util/params.js index e838eb2f42d157..283c2472bc601e 100644 --- a/deps/npm/node_modules/diff/lib/util/params.js +++ b/deps/npm/node_modules/diff/lib/util/params.js @@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.generateOptions = generateOptions; - /*istanbul ignore end*/ function generateOptions(options, defaults) { if (typeof options === 'function') { @@ -18,7 +17,6 @@ function generateOptions(options, defaults) { } } } - return defaults; } -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3BhcmFtcy5qcyJdLCJuYW1lcyI6WyJnZW5lcmF0ZU9wdGlvbnMiLCJvcHRpb25zIiwiZGVmYXVsdHMiLCJjYWxsYmFjayIsIm5hbWUiLCJoYXNPd25Qcm9wZXJ0eSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQU8sU0FBU0EsZUFBVCxDQUF5QkMsT0FBekIsRUFBa0NDLFFBQWxDLEVBQTRDO0FBQ2pELE1BQUksT0FBT0QsT0FBUCxLQUFtQixVQUF2QixFQUFtQztBQUNqQ0MsSUFBQUEsUUFBUSxDQUFDQyxRQUFULEdBQW9CRixPQUFwQjtBQUNELEdBRkQsTUFFTyxJQUFJQSxPQUFKLEVBQWE7QUFDbEIsU0FBSyxJQUFJRyxJQUFULElBQ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B0aW9ucyA9PT0gJ2Z1bmN0aW9uJykge1xuICAgIGRlZmF1bHRzLmNhbGxiYWNrID0gb3B0aW9ucztcbiAgfSBlbHNlIGlmIChvcHRpb25zKSB7XG4gICAgZm9yIChsZXQgbmFtZSBpbiBvcHRpb25zKSB7XG4gICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgZWxzZSAqL1xuICAgICAgaWYgKG9wdGlvbnMuaGFzT3duUHJvcGVydHkobmFtZSkpIHtcbiAgICAgICAgZGVmYXVsdHNbbmFtZV0gPSBvcHRpb25zW25hbWVdO1xuICAgICAgfVxuICAgIH1cbiAgfVxuICByZXR1cm4gZGVmYXVsdHM7XG59XG4iXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBQU8sU0FBU0EsZUFBZUEsQ0FBQ0MsT0FBTyxFQUFFQyxRQUFRLEVBQUU7RUFDakQsSUFBSSxPQUFPRCxPQUFPLEtBQUssVUFBVSxFQUFFO0lBQ2pDQyxRQUFRLENBQUNDLFFBQVEsR0FBR0YsT0FBTztFQUM3QixDQUFDLE1BQU0sSUFBSUEsT0FBTyxFQUFFO0lBQ2xCLEtBQUssSUFBSUcsSUFBSSxJQUFJSCxPQUFPLEVBQUU7TUFDeEI7TUFDQSxJQUFJQSxPQUFPLENBQUNJLGNBQWMsQ0FBQ0QsSUFBSSxDQUFDLEVBQUU7UUFDaENGLFFBQVEsQ0FBQ0UsSUFBSSxDQUFDLEdBQUdILE9BQU8sQ0FBQ0csSUFBSSxDQUFDO01BQ2hDO0lBQ0Y7RUFDRjtFQUNBLE9BQU9GLFFBQVE7QUFDakIiLCJpZ25vcmVMaXN0IjpbXX0= diff --git a/deps/npm/node_modules/diff/lib/util/string.js b/deps/npm/node_modules/diff/lib/util/string.js new file mode 100644 index 00000000000000..f81c6827be731b --- /dev/null +++ b/deps/npm/node_modules/diff/lib/util/string.js @@ -0,0 +1,131 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.hasOnlyUnixLineEndings = hasOnlyUnixLineEndings; +exports.hasOnlyWinLineEndings = hasOnlyWinLineEndings; +exports.longestCommonPrefix = longestCommonPrefix; +exports.longestCommonSuffix = longestCommonSuffix; +exports.maximumOverlap = maximumOverlap; +exports.removePrefix = removePrefix; +exports.removeSuffix = removeSuffix; +exports.replacePrefix = replacePrefix; +exports.replaceSuffix = replaceSuffix; +/*istanbul ignore end*/ +function longestCommonPrefix(str1, str2) { + var i; + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[i] != str2[i]) { + return str1.slice(0, i); + } + } + return str1.slice(0, i); +} +function longestCommonSuffix(str1, str2) { + var i; + + // Unlike longestCommonPrefix, we need a special case to handle all scenarios + // where we return the empty string since str1.slice(-0) will return the + // entire string. + if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) { + return ''; + } + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) { + return str1.slice(-i); + } + } + return str1.slice(-i); +} +function replacePrefix(string, oldPrefix, newPrefix) { + if (string.slice(0, oldPrefix.length) != oldPrefix) { + throw Error( + /*istanbul ignore start*/ + "string ".concat( + /*istanbul ignore end*/ + JSON.stringify(string), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug")); + } + return newPrefix + string.slice(oldPrefix.length); +} +function replaceSuffix(string, oldSuffix, newSuffix) { + if (!oldSuffix) { + return string + newSuffix; + } + if (string.slice(-oldSuffix.length) != oldSuffix) { + throw Error( + /*istanbul ignore start*/ + "string ".concat( + /*istanbul ignore end*/ + JSON.stringify(string), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug")); + } + return string.slice(0, -oldSuffix.length) + newSuffix; +} +function removePrefix(string, oldPrefix) { + return replacePrefix(string, oldPrefix, ''); +} +function removeSuffix(string, oldSuffix) { + return replaceSuffix(string, oldSuffix, ''); +} +function maximumOverlap(string1, string2) { + return string2.slice(0, overlapCount(string1, string2)); +} + +// Nicked from https://stackoverflow.com/a/60422853/1709587 +function overlapCount(a, b) { + // Deal with cases where the strings differ in length + var startA = 0; + if (a.length > b.length) { + startA = a.length - b.length; + } + var endB = b.length; + if (a.length < b.length) { + endB = a.length; + } + // Create a back-reference for each index + // that should be followed in case of a mismatch. + // We only need B to make these references: + var map = Array(endB); + var k = 0; // Index that lags behind j + map[0] = 0; + for (var j = 1; j < endB; j++) { + if (b[j] == b[k]) { + map[j] = map[k]; // skip over the same character (optional optimisation) + } else { + map[j] = k; + } + while (k > 0 && b[j] != b[k]) { + k = map[k]; + } + if (b[j] == b[k]) { + k++; + } + } + // Phase 2: use these references while iterating over A + k = 0; + for (var i = startA; i < a.length; i++) { + while (k > 0 && a[i] != b[k]) { + k = map[k]; + } + if (a[i] == b[k]) { + k++; + } + } + return k; +} + +/** + * Returns true if the string consistently uses Windows line endings. + */ +function hasOnlyWinLineEndings(string) { + return string.includes('\r\n') && !string.startsWith('\n') && !string.match(/[^\r]\n/); +} + +/** + * Returns true if the string consistently uses Unix line endings. + */ +function hasOnlyUnixLineEndings(string) { + return !string.includes('\r\n') && string.includes('\n'); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJsb25nZXN0Q29tbW9uUHJlZml4Iiwic3RyMSIsInN0cjIiLCJpIiwibGVuZ3RoIiwic2xpY2UiLCJsb25nZXN0Q29tbW9uU3VmZml4IiwicmVwbGFjZVByZWZpeCIsInN0cmluZyIsIm9sZFByZWZpeCIsIm5ld1ByZWZpeCIsIkVycm9yIiwiY29uY2F0IiwiSlNPTiIsInN0cmluZ2lmeSIsInJlcGxhY2VTdWZmaXgiLCJvbGRTdWZmaXgiLCJuZXdTdWZmaXgiLCJyZW1vdmVQcmVmaXgiLCJyZW1vdmVTdWZmaXgiLCJtYXhpbXVtT3ZlcmxhcCIsInN0cmluZzEiLCJzdHJpbmcyIiwib3ZlcmxhcENvdW50IiwiYSIsImIiLCJzdGFyd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yxDQUFDQSxNQUFNLENBQUN5QixRQUFRLENBQUMsTUFBTSxDQUFDLElBQUl6QixNQUFNLENBQUN5QixRQUFRLENBQUMsSUFBSSxDQUFDO0FBQzFEIiwiaWdub3JlTGlzdCI6W119 diff --git a/deps/npm/node_modules/diff/package.json b/deps/npm/node_modules/diff/package.json index dcffb9474baefc..400c8dd8fe9b3e 100644 --- a/deps/npm/node_modules/diff/package.json +++ b/deps/npm/node_modules/diff/package.json @@ -1,6 +1,6 @@ { "name": "diff", - "version": "5.2.0", + "version": "7.0.0", "description": "A JavaScript text diff implementation.", "keywords": [ "diff", @@ -47,43 +47,42 @@ "test": "grunt" }, "devDependencies": { - "@babel/cli": "^7.2.3", - "@babel/core": "^7.2.2", - "@babel/plugin-transform-modules-commonjs": "^7.2.0", - "@babel/preset-env": "^7.2.3", - "@babel/register": "^7.0.0", - "@colors/colors": "^1.3.3", + "@babel/cli": "^7.24.1", + "@babel/core": "^7.24.1", + "@babel/plugin-transform-modules-commonjs": "^7.24.1", + "@babel/preset-env": "^7.24.1", + "@babel/register": "^7.23.7", + "@colors/colors": "^1.6.0", "babel-eslint": "^10.0.1", - "babel-loader": "^8.0.5", + "babel-loader": "^9.1.3", "chai": "^4.2.0", "eslint": "^5.12.0", - "grunt": "^1.0.3", + "grunt": "^1.6.1", "grunt-babel": "^8.0.0", - "grunt-cli": "^1.3.2", - "grunt-contrib-clean": "^2.0.0", + "grunt-cli": "^1.4.3", + "grunt-contrib-clean": "^2.0.1", "grunt-contrib-copy": "^1.0.0", - "grunt-contrib-uglify": "^5.0.0", + "grunt-contrib-uglify": "^5.2.2", "grunt-contrib-watch": "^1.1.0", - "grunt-eslint": "^23.0.0", + "grunt-eslint": "^24.3.0", "grunt-exec": "^3.0.0", - "grunt-karma": "^4.0.0", + "grunt-karma": "^4.0.2", "grunt-mocha-istanbul": "^5.0.2", "grunt-mocha-test": "^0.13.3", - "grunt-webpack": "^3.1.3", + "grunt-webpack": "^6.0.0", "istanbul": "github:kpdecker/istanbul", - "karma": "^6.3.16", - "karma-chrome-launcher": "^3.1.0", + "karma": "^6.4.3", + "karma-chrome-launcher": "^3.2.0", "karma-mocha": "^2.0.1", - "karma-mocha-reporter": "^2.0.0", - "karma-sauce-launcher": "^4.1.5", - "karma-sourcemap-loader": "^0.3.6", - "karma-webpack": "^4.0.2", - "mocha": "^6.0.0", - "rollup": "^1.0.2", + "karma-mocha-reporter": "^2.2.5", + "karma-sourcemap-loader": "^0.4.0", + "karma-webpack": "^5.0.1", + "mocha": "^7.0.0", + "rollup": "^4.13.0", "rollup-plugin-babel": "^4.2.0", - "semver": "^7.3.2", - "webpack": "^4.28.3", - "webpack-dev-server": "^3.1.14" + "semver": "^7.6.0", + "webpack": "^5.90.3", + "webpack-dev-server": "^5.0.3" }, "optionalDependencies": {} } diff --git a/deps/npm/node_modules/diff/release-notes.md b/deps/npm/node_modules/diff/release-notes.md index fe98f22d239e7e..21b5d41d6188b1 100644 --- a/deps/npm/node_modules/diff/release-notes.md +++ b/deps/npm/node_modules/diff/release-notes.md @@ -1,8 +1,52 @@ # Release Notes +## 7.0.0 + +Just a single (breaking) bugfix, undoing a behaviour change introduced accidentally in 6.0.0: + +- [#554](https://github.com/kpdecker/jsdiff/pull/554) **`diffWords` treats numbers and underscores as word characters again.** This behaviour was broken in v6.0.0. + +## 6.0.0 + +This is a release containing many, *many* breaking changes. The objective of this release was to carry out a mass fix, in one go, of all the open bugs and design problems that required breaking changes to fix. A substantial, but exhaustive, changelog is below. + +[Commits](https://github.com/kpdecker/jsdiff/compare/v5.2.0...v6.0.0) + +- [#497](https://github.com/kpdecker/jsdiff/pull/497) **`diffWords` behavior has been radically changed.** Previously, even with `ignoreWhitespace: true`, runs of whitespace were tokens, which led to unhelpful and unintuitive diffing behavior in typical texts. Specifically, even when two texts contained overlapping passages, `diffWords` would sometimes choose to delete all the words from the old text and insert them anew in their new positions in order to avoid having to delete or insert whitespace tokens. Whitespace sequences are no longer tokens as of this release, which affects both the generated diffs and the `count`s. + + Runs of whitespace are still tokens in `diffWordsWithSpace`. + + As part of the changes to `diffWords`, **a new `.postProcess` method has been added on the base `Diff` type**, which can be overridden in custom `Diff` implementations. + + **`diffLines` with `ignoreWhitespace: true` will no longer ignore the insertion or deletion of entire extra lines of whitespace at the end of the text**. Previously, these would not show up as insertions or deletions, as a side effect of a hack in the base diffing algorithm meant to help ignore whitespace in `diffWords`. More generally, **the undocumented special handling in the core algorithm for ignored terminals has been removed entirely.** (This special case behavior used to rewrite the final two change objects in a scenario where the final change object was an addition or deletion and its `value` was treated as equal to the empty string when compared using the diff object's `.equals` method.) + +- [#500](https://github.com/kpdecker/jsdiff/pull/500) **`diffChars` now diffs Unicode code points** instead of UTF-16 code units. +- [#508](https://github.com/kpdecker/jsdiff/pull/508) **`parsePatch` now always runs in what was previously "strict" mode; the undocumented `strict` option has been removed.** Previously, by default, `parsePatch` (and other patch functions that use it under the hood to parse patches) would accept a patch where the line counts in the headers were inconsistent with the actual patch content - e.g. where a hunk started with the header `@@ -1,3 +1,6 @@`, indicating that the content below spanned 3 lines in the old file and 6 lines in the new file, but then the actual content below the header consisted of some different number of lines, say 10 lines of context, 5 deletions, and 1 insertion. Actually trying to work with these patches using `applyPatch` or `merge`, however, would produce incorrect results instead of just ignoring the incorrect headers, making this "feature" more of a trap than something actually useful. It's been ripped out, and now we are always "strict" and will reject patches where the line counts in the headers aren't consistent with the actual patch content. +- [#435](https://github.com/kpdecker/jsdiff/pull/435) **Fix `parsePatch` handling of control characters.** `parsePatch` used to interpret various unusual control characters - namely vertical tabs, form feeds, lone carriage returns without a line feed, and EBCDIC NELs - as line breaks when parsing a patch file. This was inconsistent with the behavior of both JsDiff's own `diffLines` method and also the Unix `diff` and `patch` utils, which all simply treat those control characters as ordinary characters. The result of this discrepancy was that some well-formed patches - produced either by `diff` or by JsDiff itself and handled properly by the `patch` util - would be wrongly parsed by `parsePatch`, with the effect that it would disregard the remainder of a hunk after encountering one of these control characters. +- [#439](https://github.com/kpdecker/jsdiff/pull/439) **Prefer diffs that order deletions before insertions.** When faced with a choice between two diffs with an equal total edit distance, the Myers diff algorithm generally prefers one that does deletions before insertions rather than insertions before deletions. For instance, when diffing `abcd` against `acbd`, it will prefer a diff that says to delete the `b` and then insert a new `b` after the `c`, over a diff that says to insert a `c` before the `b` and then delete the existing `c`. JsDiff deviated from the published Myers algorithm in a way that led to it having the opposite preference in many cases, including that example. This is now fixed, meaning diffs output by JsDiff will more accurately reflect what the published Myers diff algorithm would output. +- [#455](https://github.com/kpdecker/jsdiff/pull/455) **The `added` and `removed` properties of change objects are now guaranteed to be set to a boolean value.** (Previously, they would be set to `undefined` or omitted entirely instead of setting them to false.) +- [#464](https://github.com/kpdecker/jsdiff/pull/464) Specifying `{maxEditLength: 0}` now sets a max edit length of 0 instead of no maximum. +- [#460](https://github.com/kpdecker/jsdiff/pull/460) **Added `oneChangePerToken` option.** +- [#467](https://github.com/kpdecker/jsdiff/pull/467) **Consistent ordering of arguments to `comparator(left, right)`.** Values from the old array will now consistently be passed as the first argument (`left`) and values from the new array as the second argument (`right`). Previously this was almost (but not quite) always the other way round. +- [#480](https://github.com/kpdecker/jsdiff/pull/480) **Passing `maxEditLength` to `createPatch` & `createTwoFilesPatch` now works properly** (i.e. returns undefined if the max edit distance is exceeded; previous behavior was to crash with a `TypeError` if the edit distance was exceeded). +- [#486](https://github.com/kpdecker/jsdiff/pull/486) **The `ignoreWhitespace` option of `diffLines` behaves more sensibly now.** `value`s in returned change objects now include leading/trailing whitespace even when `ignoreWhitespace` is used, just like how with `ignoreCase` the `value`s still reflect the case of one of the original texts instead of being all-lowercase. `ignoreWhitespace` is also now compatible with `newlineIsToken`. Finally, **`diffTrimmedLines` is deprecated** (and removed from the docs) in favour of using `diffLines` with `ignoreWhitespace: true`; the two are, and always have been, equivalent. +- [#490](https://github.com/kpdecker/jsdiff/pull/490) **When calling diffing functions in async mode by passing a `callback` option, the diff result will now be passed as the *first* argument to the callback instead of the second.** (Previously, the first argument was never used at all and would always have value `undefined`.) +- [#489](github.com/kpdecker/jsdiff/pull/489) **`this.options` no longer exists on `Diff` objects.** Instead, `options` is now passed as an argument to methods that rely on options, like `equals(left, right, options)`. This fixes a race condition in async mode, where diffing behaviour could be changed mid-execution if a concurrent usage of the same `Diff` instances overwrote its `options`. +- [#518](https://github.com/kpdecker/jsdiff/pull/518) **`linedelimiters` no longer exists** on patch objects; instead, when a patch with Windows-style CRLF line endings is parsed, **the lines in `lines` will end with `\r`**. There is now a **new `autoConvertLineEndings` option, on by default**, which makes it so that when a patch with Windows-style line endings is applied to a source file with Unix style line endings, the patch gets autoconverted to use Unix-style line endings, and when a patch with Unix-style line endings is applied to a source file with Windows-style line endings, it gets autoconverted to use Windows-style line endings. +- [#521](https://github.com/kpdecker/jsdiff/pull/521) **the `callback` option is now supported by `structuredPatch`, `createPatch +- [#529](https://github.com/kpdecker/jsdiff/pull/529) **`parsePatch` can now parse patches where lines starting with `--` or `++` are deleted/inserted**; previously, there were edge cases where the parser would choke on valid patches or give wrong results. +- [#530](https://github.com/kpdecker/jsdiff/pull/530) **Added `ignoreNewlineAtEof` option` to `diffLines`** +- [#533](https://github.com/kpdecker/jsdiff/pull/533) **`applyPatch` uses an entirely new algorithm for fuzzy matching.** Differences between the old and new algorithm are as follows: + * The `fuzzFactor` now indicates the maximum [*Levenshtein* distance](https://en.wikipedia.org/wiki/Levenshtein_distance) that there can be between the context shown in a hunk and the actual file content at a location where we try to apply the hunk. (Previously, it represented a maximum [*Hamming* distance](https://en.wikipedia.org/wiki/Hamming_distance), meaning that a single insertion or deletion in the source file could stop a hunk from applying even with a high `fuzzFactor`.) + * A hunk containing a deletion can now only be applied in a context where the line to be deleted actually appears verbatim. (Previously, as long as enough context lines in the hunk matched, `applyPatch` would apply the hunk anyway and delete a completely different line.) + * The context line immediately before and immediately after an insertion must match exactly between the hunk and the file for a hunk to apply. (Previously this was not required.) +- [#535](https://github.com/kpdecker/jsdiff/pull/535) **A bug in patch generation functions is now fixed** that would sometimes previously cause `\ No newline at end of file` to appear in the wrong place in the generated patch, resulting in the patch being invalid. +- [#535](https://github.com/kpdecker/jsdiff/pull/535) **Passing `newlineIsToken: true` to *patch*-generation functions is no longer allowed.** (Passing it to `diffLines` is still supported - it's only functions like `createPatch` where passing `newlineIsToken` is now an error.) Allowing it to be passed never really made sense, since in cases where the option had any effect on the output at all, the effect tended to be causing a garbled patch to be created that couldn't actually be applied to the source file. +- [#539](https://github.com/kpdecker/jsdiff/pull/539) **`diffWords` now takes an optional `intlSegmenter` option** which should be an `Intl.Segmenter` with word-level granularity. This provides better tokenization of text into words than the default behaviour, even for English but especially for some other languages for which the default behaviour is poor. + ## v5.2.0 -[Commits](https://github.com/kpdecker/jsdiff/compare/v5.1.0...master) +[Commits](https://github.com/kpdecker/jsdiff/compare/v5.1.0...v5.2.0) - [#411](https://github.com/kpdecker/jsdiff/pull/411) Big performance improvement. Previously an O(n) array-copying operation inside the innermost loop of jsdiff's base diffing code increased the overall worst-case time complexity of computing a diff from O(n²) to O(n³). This is now fixed, bringing the worst-case time complexity down to what it theoretically should be for a Myers diff implementation. - [#448](https://github.com/kpdecker/jsdiff/pull/411) Performance improvement. Diagonals whose furthest-reaching D-path would go off the edge of the edit graph are now skipped, rather than being pointlessly considered as called for by the original Myers diff algorithm. This dramatically speeds up computing diffs where the new text just appends or truncates content at the end of the old text. diff --git a/deps/npm/node_modules/https-proxy-agent/dist/index.js b/deps/npm/node_modules/https-proxy-agent/dist/index.js index 0c91722035f07e..1857f464724e20 100644 --- a/deps/npm/node_modules/https-proxy-agent/dist/index.js +++ b/deps/npm/node_modules/https-proxy-agent/dist/index.js @@ -35,6 +35,17 @@ const agent_base_1 = require("agent-base"); const url_1 = require("url"); const parse_proxy_response_1 = require("./parse-proxy-response"); const debug = (0, debug_1.default)('https-proxy-agent'); +const setServernameFromNonIpHost = (options) => { + if (options.servername === undefined && + options.host && + !net.isIP(options.host)) { + return { + ...options, + servername: options.host, + }; + } + return options; +}; /** * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests. @@ -82,11 +93,7 @@ class HttpsProxyAgent extends agent_base_1.Agent { let socket; if (proxy.protocol === 'https:') { debug('Creating `tls.Socket`: %o', this.connectOpts); - const servername = this.connectOpts.servername || this.connectOpts.host; - socket = tls.connect({ - ...this.connectOpts, - servername, - }); + socket = tls.connect(setServernameFromNonIpHost(this.connectOpts)); } else { debug('Creating `net.Socket`: %o', this.connectOpts); @@ -122,11 +129,9 @@ class HttpsProxyAgent extends agent_base_1.Agent { // The proxy is connecting to a TLS server, so upgrade // this socket connection to a TLS connection. debug('Upgrading socket connection to TLS'); - const servername = opts.servername || opts.host; return tls.connect({ - ...omit(opts, 'host', 'path', 'port'), + ...omit(setServernameFromNonIpHost(opts), 'host', 'path', 'port'), socket, - servername, }); } return socket; diff --git a/deps/npm/node_modules/https-proxy-agent/package.json b/deps/npm/node_modules/https-proxy-agent/package.json index 3c793b769dc5d9..51b7e1175ff51b 100644 --- a/deps/npm/node_modules/https-proxy-agent/package.json +++ b/deps/npm/node_modules/https-proxy-agent/package.json @@ -1,6 +1,6 @@ { "name": "https-proxy-agent", - "version": "7.0.5", + "version": "7.0.6", "description": "An HTTP(s) proxy `http.Agent` implementation for HTTPS", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -21,7 +21,7 @@ "author": "Nathan Rajlich (http://n8.io/)", "license": "MIT", "dependencies": { - "agent-base": "^7.0.2", + "agent-base": "^7.1.2", "debug": "4" }, "devDependencies": { diff --git a/deps/npm/node_modules/indent-string/index.js b/deps/npm/node_modules/indent-string/index.js deleted file mode 100644 index e1ab804f2fd8a1..00000000000000 --- a/deps/npm/node_modules/indent-string/index.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -module.exports = (string, count = 1, options) => { - options = { - indent: ' ', - includeEmptyLines: false, - ...options - }; - - if (typeof string !== 'string') { - throw new TypeError( - `Expected \`input\` to be a \`string\`, got \`${typeof string}\`` - ); - } - - if (typeof count !== 'number') { - throw new TypeError( - `Expected \`count\` to be a \`number\`, got \`${typeof count}\`` - ); - } - - if (typeof options.indent !== 'string') { - throw new TypeError( - `Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\`` - ); - } - - if (count === 0) { - return string; - } - - const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm; - - return string.replace(regex, options.indent.repeat(count)); -}; diff --git a/deps/npm/node_modules/indent-string/license b/deps/npm/node_modules/indent-string/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/deps/npm/node_modules/indent-string/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/indent-string/package.json b/deps/npm/node_modules/indent-string/package.json deleted file mode 100644 index 497bb83bbd9b7f..00000000000000 --- a/deps/npm/node_modules/indent-string/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "indent-string", - "version": "4.0.0", - "description": "Indent each line in a string", - "license": "MIT", - "repository": "sindresorhus/indent-string", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "indent", - "string", - "pad", - "align", - "line", - "text", - "each", - "every" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/deps/npm/node_modules/init-package-json/lib/default-input.js b/deps/npm/node_modules/init-package-json/lib/default-input.js index 0a01bfa05fa45c..3b38c77606e328 100644 --- a/deps/npm/node_modules/init-package-json/lib/default-input.js +++ b/deps/npm/node_modules/init-package-json/lib/default-input.js @@ -261,3 +261,8 @@ exports.license = yes ? license : prompt('license', license, (data) => { const errors = (its.errors || []).concat(its.warnings || []) return invalid(`Sorry, ${errors.join(' and ')}.`) }) + +const type = package.type || getConfig('type') || 'commonjs' +exports.type = yes ? type : prompt('type', type, (data) => { + return data +}) diff --git a/deps/npm/node_modules/init-package-json/lib/init-package-json.js b/deps/npm/node_modules/init-package-json/lib/init-package-json.js index 51cbd21a1ebe6a..b67ae418f7abd7 100644 --- a/deps/npm/node_modules/init-package-json/lib/init-package-json.js +++ b/deps/npm/node_modules/init-package-json/lib/init-package-json.js @@ -139,7 +139,7 @@ async function init (dir, return } - await pkg.save() + await pkg.save({ sort: true }) return pkg.content } diff --git a/deps/npm/node_modules/init-package-json/package.json b/deps/npm/node_modules/init-package-json/package.json index d1de96476a9f14..c264eb44f97495 100644 --- a/deps/npm/node_modules/init-package-json/package.json +++ b/deps/npm/node_modules/init-package-json/package.json @@ -1,6 +1,6 @@ { "name": "init-package-json", - "version": "7.0.2", + "version": "8.0.0", "main": "lib/init-package-json.js", "scripts": { "test": "tap", @@ -20,7 +20,7 @@ "license": "ISC", "description": "A node module to get your node module started", "dependencies": { - "@npmcli/package-json": "^6.0.0", + "@npmcli/package-json": "^6.1.0", "npm-package-arg": "^12.0.0", "promzard": "^2.0.0", "read": "^4.0.0", @@ -29,13 +29,13 @@ "validate-npm-package-name": "^6.0.0" }, "devDependencies": { - "@npmcli/config": "^8.2.0", + "@npmcli/config": "^9.0.0", "@npmcli/eslint-config": "^5.0.0", - "@npmcli/template-oss": "4.23.3", + "@npmcli/template-oss": "4.23.4", "tap": "^16.0.1" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "tap": { "test-ignore": "fixtures/", @@ -61,7 +61,7 @@ ], "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.4", "publish": true } } diff --git a/deps/npm/node_modules/libnpmaccess/package.json b/deps/npm/node_modules/libnpmaccess/package.json index 0022437adadc60..ff63233c488716 100644 --- a/deps/npm/node_modules/libnpmaccess/package.json +++ b/deps/npm/node_modules/libnpmaccess/package.json @@ -1,6 +1,6 @@ { "name": "libnpmaccess", - "version": "9.0.0", + "version": "10.0.0", "description": "programmatic library for `npm access` commands", "author": "GitHub Inc.", "license": "ISC", @@ -18,8 +18,7 @@ "devDependencies": { "@npmcli/eslint-config": "^5.0.1", "@npmcli/mock-registry": "^1.0.0", - "@npmcli/template-oss": "4.23.3", - "nock": "^13.3.3", + "@npmcli/template-oss": "4.23.6", "tap": "^16.3.8" }, "repository": { @@ -34,7 +33,7 @@ "npm-registry-fetch": "^18.0.1" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "files": [ "bin/", @@ -42,7 +41,7 @@ ], "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.6", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmdiff/lib/format-diff.js b/deps/npm/node_modules/libnpmdiff/lib/format-diff.js index a6606d94b8b302..f50738207c854a 100644 --- a/deps/npm/node_modules/libnpmdiff/lib/format-diff.js +++ b/deps/npm/node_modules/libnpmdiff/lib/format-diff.js @@ -19,7 +19,7 @@ const color = (colorStr, colorId) => { return colorStr.replace(/[^\n\r]+/g, open + '$&' + close) } -const formatDiff = ({ files, opts = {}, refs, versions }) => { +const formatDiff = async ({ files, opts = {}, refs, versions }) => { let res = '' const srcPrefix = opts.diffNoPrefix ? '' : opts.diffSrcPrefix || 'a/' const dstPrefix = opts.diffNoPrefix ? '' : opts.diffDstPrefix || 'b/' @@ -77,7 +77,7 @@ const formatDiff = ({ files, opts = {}, refs, versions }) => { /* eslint-disable-next-line max-len */ header(`index ${opts.tagVersionPrefix || 'v'}${versions.a}..${opts.tagVersionPrefix || 'v'}${versions.b} ${fileMode}`) - if (shouldPrintPatch(filename)) { + if (await shouldPrintPatch(filename)) { patch += jsDiff.createTwoFilesPatch( names.a, names.b, 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 8000fc5e6afc16..c63cdee87c1fab 100644 --- a/deps/npm/node_modules/libnpmdiff/lib/should-print-patch.js +++ b/deps/npm/node_modules/libnpmdiff/lib/should-print-patch.js @@ -1,14 +1,14 @@ const { basename, extname } = require('node:path') -const binaryExtensions = require('binary-extensions') - // we should try to print patches as long as the // extension is not identified as binary files -const shouldPrintPatch = (path, opts = {}) => { +const shouldPrintPatch = async (path, opts = {}) => { if (opts.diffText) { return true } + const { default: binaryExtensions } = await import('binary-extensions') + const filename = basename(path) const extension = ( filename.startsWith('.') diff --git a/deps/npm/node_modules/libnpmdiff/package.json b/deps/npm/node_modules/libnpmdiff/package.json index ccb499e78ff66d..48673c03ff4c73 100644 --- a/deps/npm/node_modules/libnpmdiff/package.json +++ b/deps/npm/node_modules/libnpmdiff/package.json @@ -1,6 +1,6 @@ { "name": "libnpmdiff", - "version": "7.0.0", + "version": "8.0.0", "description": "The registry diff", "repository": { "type": "git", @@ -13,7 +13,7 @@ "lib/" ], "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "keywords": [ "npm", @@ -43,22 +43,22 @@ }, "devDependencies": { "@npmcli/eslint-config": "^5.0.1", - "@npmcli/template-oss": "4.23.3", + "@npmcli/template-oss": "4.23.6", "tap": "^16.3.8" }, "dependencies": { - "@npmcli/arborist": "^8.0.0", + "@npmcli/arborist": "^9.0.0", "@npmcli/installed-package-contents": "^3.0.0", - "binary-extensions": "^2.3.0", - "diff": "^5.1.0", + "binary-extensions": "^3.0.0", + "diff": "^7.0.0", "minimatch": "^9.0.4", "npm-package-arg": "^12.0.0", - "pacote": "^19.0.0", + "pacote": "^21.0.0", "tar": "^6.2.1" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.6", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmexec/lib/index.js b/deps/npm/node_modules/libnpmexec/lib/index.js index 8344471696e25d..78633a8cadb3cf 100644 --- a/deps/npm/node_modules/libnpmexec/lib/index.js +++ b/deps/npm/node_modules/libnpmexec/lib/index.js @@ -24,7 +24,7 @@ const manifests = new Map() const getManifest = async (spec, flatOptions) => { if (!manifests.has(spec.raw)) { - const manifest = await pacote.manifest(spec, { ...flatOptions, preferOnline: true }) + const manifest = await pacote.manifest(spec, { ...flatOptions, preferOnline: true, Arborist }) manifests.set(spec.raw, manifest) } return manifests.get(spec.raw) diff --git a/deps/npm/node_modules/libnpmexec/package.json b/deps/npm/node_modules/libnpmexec/package.json index 497b971a0841bc..5009d76d12fe54 100644 --- a/deps/npm/node_modules/libnpmexec/package.json +++ b/deps/npm/node_modules/libnpmexec/package.json @@ -1,13 +1,13 @@ { "name": "libnpmexec", - "version": "9.0.0", + "version": "10.0.0", "files": [ "bin/", "lib/" ], "main": "lib/index.js", "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "description": "npm exec (npx) programmatic API", "repository": { @@ -52,7 +52,7 @@ "devDependencies": { "@npmcli/eslint-config": "^5.0.1", "@npmcli/mock-registry": "^1.0.0", - "@npmcli/template-oss": "4.23.3", + "@npmcli/template-oss": "4.23.6", "bin-links": "^5.0.0", "chalk": "^5.2.0", "just-extend": "^6.2.0", @@ -60,20 +60,20 @@ "tap": "^16.3.8" }, "dependencies": { - "@npmcli/arborist": "^8.0.0", + "@npmcli/arborist": "^9.0.0", "@npmcli/run-script": "^9.0.1", "ci-info": "^4.0.0", "npm-package-arg": "^12.0.0", - "pacote": "^19.0.0", + "pacote": "^21.0.0", "proc-log": "^5.0.0", "read": "^4.0.0", "read-package-json-fast": "^4.0.0", "semver": "^7.3.7", - "walk-up-path": "^3.0.1" + "walk-up-path": "^4.0.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.6", "content": "../../scripts/template-oss/index.js" } } diff --git a/deps/npm/node_modules/libnpmfund/package.json b/deps/npm/node_modules/libnpmfund/package.json index 07c1e33f2a7c38..8d458259abd6b3 100644 --- a/deps/npm/node_modules/libnpmfund/package.json +++ b/deps/npm/node_modules/libnpmfund/package.json @@ -1,6 +1,6 @@ { "name": "libnpmfund", - "version": "6.0.0", + "version": "7.0.0", "main": "lib/index.js", "files": [ "bin/", @@ -42,18 +42,18 @@ }, "devDependencies": { "@npmcli/eslint-config": "^5.0.1", - "@npmcli/template-oss": "4.23.3", + "@npmcli/template-oss": "4.23.6", "tap": "^16.3.8" }, "dependencies": { - "@npmcli/arborist": "^8.0.0" + "@npmcli/arborist": "^9.0.0" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.6", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmhook/LICENSE.md b/deps/npm/node_modules/libnpmhook/LICENSE.md deleted file mode 100644 index 8d28acf866d932..00000000000000 --- a/deps/npm/node_modules/libnpmhook/LICENSE.md +++ /dev/null @@ -1,16 +0,0 @@ -ISC License - -Copyright (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 -above copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE COPYRIGHT HOLDER DISCLAIMS -ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE -COPYRIGHT HOLDER 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/libnpmhook/README.md b/deps/npm/node_modules/libnpmhook/README.md deleted file mode 100644 index 309f8041da08b2..00000000000000 --- a/deps/npm/node_modules/libnpmhook/README.md +++ /dev/null @@ -1,271 +0,0 @@ -# libnpmhook - -[![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) -[![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. - -For a more general introduction to managing hooks, see [the introductory blog -post](https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm). - -## Table of Contents - -* [Example](#example) -* [Install](#install) -* [Contributing](#contributing) -* [API](#api) - * [hook opts](#opts) - * [`add()`](#add) - * [`rm()`](#rm) - * [`ls()`](#ls) - * [`ls.stream()`](#ls-stream) - * [`update()`](#update) - -## Example - -```js -const hooks = require('libnpmhook') - -console.log(await hooks.ls('mypkg', {token: 'deadbeef'})) -// array of hook objects on `mypkg`. -``` - -## Install - -`$ npm install libnpmhook` - -### API - -#### `opts` for `libnpmhook` commands - -`libnpmhook` uses [`npm-registry-fetch`](https://npm.im/npm-registry-fetch). -All options are passed through directly to that library, so please refer to [its -own `opts` -documentation](https://www.npmjs.com/package/npm-registry-fetch#fetch-options) -for options that can be passed in. - -A couple of options of note for those in a hurry: - -* `opts.token` - can be passed in and will be used as the authentication token for the registry. For other ways to pass in auth details, see the n-r-f docs. -* `opts.otp` - certain operations will require an OTP token to be passed in. If a `libnpmhook` command fails with `err.code === EOTP`, please retry the request with `{otp: <2fa token>}` - -#### `> hooks.add(name, endpoint, secret, [opts]) -> Promise` - -`name` is the name of the package, org, or user/org scope to watch. The type is -determined by the name syntax: `'@foo/bar'` and `'foo'` are treated as packages, -`@foo` is treated as a scope, and `~user` is treated as an org name or scope. -Each type will attach to different events. - -The `endpoint` should be a fully-qualified http URL for the endpoint the hook -will send its payload to when it fires. `secret` is a shared secret that the -hook will send to that endpoint to verify that it's actually coming from the -registry hook. - -The returned Promise resolves to the full hook object that was created, -including its generated `id`. - -See also: [`POST -/v1/hooks/hook`](https://github.com/npm/registry/blob/master/docs/hooks/endpoints.md#post-v1hookshook) - -##### Example - -```javascript -await hooks.add('~zkat', 'https://example.com/api/added', 'supersekrit', { - token: 'myregistrytoken', - otp: '694207' -}) - -=> - -{ id: '16f7xoal', - username: 'zkat', - name: 'zkat', - endpoint: 'https://example.com/api/added', - secret: 'supersekrit', - type: 'owner', - created: '2018-08-21T20:05:25.125Z', - updated: '2018-08-21T20:05:25.125Z', - deleted: false, - delivered: false, - last_delivery: null, - response_code: 0, - status: 'active' } -``` - -#### `> hooks.find(id, [opts]) -> Promise` - -Returns the hook identified by `id`. - -The returned Promise resolves to the full hook object that was found, or error -with `err.code` of `'E404'` if it didn't exist. - -See also: [`GET -/v1/hooks/hook/:id`](https://github.com/npm/registry/blob/master/docs/hooks/endpoints.md#get-v1hookshookid) - -##### Example - -```javascript -await hooks.find('16f7xoal', {token: 'myregistrytoken'}) - -=> - -{ id: '16f7xoal', - username: 'zkat', - name: 'zkat', - endpoint: 'https://example.com/api/added', - secret: 'supersekrit', - type: 'owner', - created: '2018-08-21T20:05:25.125Z', - updated: '2018-08-21T20:05:25.125Z', - deleted: false, - delivered: false, - last_delivery: null, - response_code: 0, - status: 'active' } -``` - -#### `> hooks.rm(id, [opts]) -> Promise` - -Removes the hook identified by `id`. - -The returned Promise resolves to the full hook object that was removed, if it -existed, or `null` if no such hook was there (instead of erroring). - -See also: [`DELETE -/v1/hooks/hook/:id`](https://github.com/npm/registry/blob/master/docs/hooks/endpoints.md#delete-v1hookshookid) - -##### Example - -```javascript -await hooks.rm('16f7xoal', { - token: 'myregistrytoken', - otp: '694207' -}) - -=> - -{ id: '16f7xoal', - username: 'zkat', - name: 'zkat', - endpoint: 'https://example.com/api/added', - secret: 'supersekrit', - type: 'owner', - created: '2018-08-21T20:05:25.125Z', - updated: '2018-08-21T20:05:25.125Z', - deleted: true, - delivered: false, - last_delivery: null, - response_code: 0, - status: 'active' } - -// Repeat it... -await hooks.rm('16f7xoal', { - token: 'myregistrytoken', - otp: '694207' -}) - -=> null -``` - -#### `> hooks.update(id, endpoint, secret, [opts]) -> Promise` - -The `id` should be a hook ID from a previously-created hook. - -The `endpoint` should be a fully-qualified http URL for the endpoint the hook -will send its payload to when it fires. `secret` is a shared secret that the -hook will send to that endpoint to verify that it's actually coming from the -registry hook. - -The returned Promise resolves to the full hook object that was updated, if it -existed. Otherwise, it will error with an `'E404'` error code. - -See also: [`PUT -/v1/hooks/hook/:id`](https://github.com/npm/registry/blob/master/docs/hooks/endpoints.md#put-v1hookshookid) - -##### Example - -```javascript -await hooks.update('16fxoal', 'https://example.com/api/other', 'newsekrit', { - token: 'myregistrytoken', - otp: '694207' -}) - -=> - -{ id: '16f7xoal', - username: 'zkat', - name: 'zkat', - endpoint: 'https://example.com/api/other', - secret: 'newsekrit', - type: 'owner', - created: '2018-08-21T20:05:25.125Z', - updated: '2018-08-21T20:14:41.964Z', - deleted: false, - delivered: false, - last_delivery: null, - response_code: 0, - status: 'active' } -``` - -#### `> hooks.ls([opts]) -> Promise` - -Resolves to an array of hook objects associated with the account you're -authenticated as. - -Results can be further filtered with three values that can be passed in through -`opts`: - -* `opts.package` - filter results by package name -* `opts.limit` - maximum number of hooks to return -* `opts.offset` - pagination offset for results (use with `opts.limit`) - -See also: - * [`hooks.ls.stream()`](#ls-stream) - * [`GET -/v1/hooks`](https://github.com/npm/registry/blob/master/docs/hooks/endpoints.md#get-v1hooks) - -##### Example - -```javascript -await hooks.ls({token: 'myregistrytoken'}) - -=> -[ - { id: '16f7xoal', ... }, - { id: 'wnyf98a1', ... }, - ... -] -``` - -#### `> hooks.ls.stream([opts]) -> Stream` - -Returns a stream of hook objects associated with the account you're -authenticated as. The returned stream is a valid `Symbol.asyncIterator` on -`node@>=10`. - -Results can be further filtered with three values that can be passed in through -`opts`: - -* `opts.package` - filter results by package name -* `opts.limit` - maximum number of hooks to return -* `opts.offset` - pagination offset for results (use with `opts.limit`) - -See also: - * [`hooks.ls()`](#ls) - * [`GET -/v1/hooks`](https://github.com/npm/registry/blob/master/docs/hooks/endpoints.md#get-v1hooks) - -##### Example - -```javascript -for await (let hook of hooks.ls.stream({token: 'myregistrytoken'})) { - console.log('found hook:', hook.id) -} - -=> -// outputs: -// found hook: 16f7xoal -// found hook: wnyf98a1 -``` diff --git a/deps/npm/node_modules/libnpmhook/lib/index.js b/deps/npm/node_modules/libnpmhook/lib/index.js deleted file mode 100644 index 091cdc49a80d1a..00000000000000 --- a/deps/npm/node_modules/libnpmhook/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -'use strict' - -const fetch = require('npm-registry-fetch') -const validate = require('aproba') - -const eu = encodeURIComponent -const cmd = module.exports = {} -cmd.add = (name, endpoint, secret, opts = {}) => { - validate('SSSO', [name, endpoint, secret, opts]) - let type = 'package' - if (name.match(/^@[^/]+$/)) { - type = 'scope' - } - if (name[0] === '~') { - type = 'owner' - name = name.slice(1) - } - return fetch.json('/-/npm/v1/hooks/hook', { - ...opts, - method: 'POST', - body: { type, name, endpoint, secret }, - }) -} - -cmd.rm = (id, opts = {}) => { - validate('SO', [id, opts]) - return fetch.json(`/-/npm/v1/hooks/hook/${eu(id)}`, { - ...opts, - method: 'DELETE', - }).catch(err => { - if (err.code === 'E404') { - return null - } else { - throw err - } - }) -} - -cmd.update = (id, endpoint, secret, opts = {}) => { - validate('SSSO', [id, endpoint, secret, opts]) - return fetch.json(`/-/npm/v1/hooks/hook/${eu(id)}`, { - ...opts, - method: 'PUT', - body: { endpoint, secret }, - }) -} - -cmd.find = (id, opts = {}) => { - validate('SO', [id, opts]) - return fetch.json(`/-/npm/v1/hooks/hook/${eu(id)}`, opts) -} - -cmd.ls = (opts = {}) => { - return cmd.ls.stream(opts).collect() -} - -cmd.ls.stream = (opts = {}) => { - const { package: pkg, limit, offset } = opts - validate('S|Z', [pkg]) - validate('N|Z', [limit]) - validate('N|Z', [offset]) - return fetch.json.stream('/-/npm/v1/hooks', 'objects.*', { - ...opts, - query: { - package: pkg, - limit, - offset, - }, - }) -} diff --git a/deps/npm/node_modules/libnpmhook/package.json b/deps/npm/node_modules/libnpmhook/package.json deleted file mode 100644 index 09157ab08cb209..00000000000000 --- a/deps/npm/node_modules/libnpmhook/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "libnpmhook", - "version": "11.0.0", - "description": "programmatic API for managing npm registry hooks", - "main": "lib/index.js", - "files": [ - "bin/", - "lib/" - ], - "scripts": { - "test": "tap", - "lint": "npm run eslint", - "postlint": "template-oss-check", - "lintfix": "npm run eslint -- --fix", - "snap": "tap", - "posttest": "npm run lint", - "template-oss-apply": "template-oss-apply --force", - "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/npm/cli.git", - "directory": "workspaces/libnpmhook" - }, - "keywords": [ - "npm", - "hooks", - "registry", - "npm api" - ], - "author": "GitHub Inc.", - "license": "ISC", - "dependencies": { - "aproba": "^2.0.0", - "npm-registry-fetch": "^18.0.1" - }, - "devDependencies": { - "@npmcli/eslint-config": "^5.0.1", - "@npmcli/template-oss": "4.23.3", - "nock": "^13.3.3", - "tap": "^16.3.8" - }, - "engines": { - "node": "^18.17.0 || >=20.5.0" - }, - "templateOSS": { - "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", - "content": "../../scripts/template-oss/index.js" - }, - "tap": { - "nyc-arg": [ - "--exclude", - "tap-snapshots/**" - ] - } -} diff --git a/deps/npm/node_modules/libnpmorg/lib/index.js b/deps/npm/node_modules/libnpmorg/lib/index.js index 4684b516d2b4ad..f3d361b8be6d75 100644 --- a/deps/npm/node_modules/libnpmorg/lib/index.js +++ b/deps/npm/node_modules/libnpmorg/lib/index.js @@ -1,7 +1,7 @@ 'use strict' const eu = encodeURIComponent -const fetch = require('npm-registry-fetch') +const npmFetch = require('npm-registry-fetch') const validate = require('aproba') // From https://github.com/npm/registry/blob/master/docs/orgs/memberships.md @@ -19,7 +19,7 @@ cmd.set = (org, user, role, opts = {}) => { validate('SSSO|SSZO', [org, user, role, opts]) user = user.replace(/^@?/, '') org = org.replace(/^@?/, '') - return fetch.json(`/-/org/${eu(org)}/user`, { + return npmFetch.json(`/-/org/${eu(org)}/user`, { ...opts, method: 'PUT', body: { user, role }, @@ -30,7 +30,7 @@ cmd.rm = (org, user, opts = {}) => { validate('SSO', [org, user, opts]) user = user.replace(/^@?/, '') org = org.replace(/^@?/, '') - return fetch(`/-/org/${eu(org)}/user`, { + return npmFetch(`/-/org/${eu(org)}/user`, { ...opts, method: 'DELETE', body: { user }, @@ -55,7 +55,7 @@ cmd.ls = (org, opts = {}) => { cmd.ls.stream = (org, opts = {}) => { validate('SO', [org, opts]) org = org.replace(/^@?/, '') - return fetch.json.stream(`/-/org/${eu(org)}/user`, '*', { + return npmFetch.json.stream(`/-/org/${eu(org)}/user`, '*', { ...opts, mapJSON: (value, [key]) => { return [key, value] diff --git a/deps/npm/node_modules/libnpmorg/package.json b/deps/npm/node_modules/libnpmorg/package.json index 38800308a31a4e..aec1ef79791c80 100644 --- a/deps/npm/node_modules/libnpmorg/package.json +++ b/deps/npm/node_modules/libnpmorg/package.json @@ -1,6 +1,6 @@ { "name": "libnpmorg", - "version": "7.0.0", + "version": "8.0.0", "description": "Programmatic api for `npm org` commands", "author": "GitHub Inc.", "main": "lib/index.js", @@ -29,7 +29,7 @@ ], "devDependencies": { "@npmcli/eslint-config": "^5.0.1", - "@npmcli/template-oss": "4.23.3", + "@npmcli/template-oss": "4.23.6", "minipass": "^7.1.1", "nock": "^13.3.3", "tap": "^16.3.8" @@ -46,11 +46,11 @@ "npm-registry-fetch": "^18.0.1" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.6", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmpack/lib/index.js b/deps/npm/node_modules/libnpmpack/lib/index.js index b026ad1a935c79..bd3e0c7bd7232a 100644 --- a/deps/npm/node_modules/libnpmpack/lib/index.js +++ b/deps/npm/node_modules/libnpmpack/lib/index.js @@ -12,7 +12,7 @@ async function pack (spec = 'file:.', opts = {}) { // gets spec spec = npa(spec) - const manifest = await pacote.manifest(spec, opts) + const manifest = await pacote.manifest(spec, { ...opts, Arborist }) const stdio = opts.foregroundScripts ? 'inherit' : 'pipe' diff --git a/deps/npm/node_modules/libnpmpack/package.json b/deps/npm/node_modules/libnpmpack/package.json index 35d12425b02ff7..eba99bd38a9bc5 100644 --- a/deps/npm/node_modules/libnpmpack/package.json +++ b/deps/npm/node_modules/libnpmpack/package.json @@ -1,6 +1,6 @@ { "name": "libnpmpack", - "version": "8.0.0", + "version": "9.0.0", "description": "Programmatic API for the bits behind npm pack", "author": "GitHub Inc.", "main": "lib/index.js", @@ -24,7 +24,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^5.0.1", - "@npmcli/template-oss": "4.23.3", + "@npmcli/template-oss": "4.23.6", "nock": "^13.3.3", "spawk": "^1.7.1", "tap": "^16.3.8" @@ -37,17 +37,17 @@ "bugs": "https://github.com/npm/libnpmpack/issues", "homepage": "https://npmjs.com/package/libnpmpack", "dependencies": { - "@npmcli/arborist": "^8.0.0", + "@npmcli/arborist": "^9.0.0", "@npmcli/run-script": "^9.0.1", "npm-package-arg": "^12.0.0", - "pacote": "^19.0.0" + "pacote": "^21.0.0" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.6", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmpublish/lib/publish.js b/deps/npm/node_modules/libnpmpublish/lib/publish.js index 2bcab4f3ba304e..93d546efb5f0e1 100644 --- a/deps/npm/node_modules/libnpmpublish/lib/publish.js +++ b/deps/npm/node_modules/libnpmpublish/lib/publish.js @@ -137,7 +137,7 @@ const buildMetadata = async (registry, manifest, tarballData, spec, opts) => { if (provenance === true) { await ensureProvenanceGeneration(registry, spec, opts) - provenanceBundle = await generateProvenance([subject], { legacyCompatibility: true, ...opts }) + provenanceBundle = await generateProvenance([subject], opts) /* eslint-disable-next-line max-len */ log.notice('publish', `Signed provenance statement with source and build information from ${ciInfo.name}`) diff --git a/deps/npm/node_modules/libnpmpublish/package.json b/deps/npm/node_modules/libnpmpublish/package.json index 594f5041480b4a..87526bdd88ca0d 100644 --- a/deps/npm/node_modules/libnpmpublish/package.json +++ b/deps/npm/node_modules/libnpmpublish/package.json @@ -1,6 +1,6 @@ { "name": "libnpmpublish", - "version": "10.0.1", + "version": "11.0.0", "description": "Programmatic API for the bits behind npm publish and unpublish", "author": "GitHub Inc.", "main": "lib/index.js", @@ -27,8 +27,7 @@ "@npmcli/eslint-config": "^5.0.1", "@npmcli/mock-globals": "^1.0.0", "@npmcli/mock-registry": "^1.0.0", - "@npmcli/template-oss": "4.23.3", - "nock": "^13.3.3", + "@npmcli/template-oss": "4.23.6", "tap": "^16.3.8" }, "repository": { @@ -49,11 +48,11 @@ "ssri": "^12.0.0" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.6", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmsearch/package.json b/deps/npm/node_modules/libnpmsearch/package.json index a5d2ae424913ef..ca021f24144401 100644 --- a/deps/npm/node_modules/libnpmsearch/package.json +++ b/deps/npm/node_modules/libnpmsearch/package.json @@ -1,6 +1,6 @@ { "name": "libnpmsearch", - "version": "8.0.0", + "version": "9.0.0", "description": "Programmatic API for searching in npm and compatible registries.", "author": "GitHub Inc.", "main": "lib/index.js", @@ -27,7 +27,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^5.0.1", - "@npmcli/template-oss": "4.23.3", + "@npmcli/template-oss": "4.23.6", "nock": "^13.3.3", "tap": "^16.3.8" }, @@ -42,11 +42,11 @@ "npm-registry-fetch": "^18.0.1" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.6", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmteam/package.json b/deps/npm/node_modules/libnpmteam/package.json index fd8f69669f15cf..72858f25c2f164 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": "7.0.0", + "version": "8.0.0", "author": "GitHub Inc.", "license": "ISC", "main": "lib/index.js", @@ -17,7 +17,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^5.0.1", - "@npmcli/template-oss": "4.23.3", + "@npmcli/template-oss": "4.23.6", "nock": "^13.3.3", "tap": "^16.3.8" }, @@ -36,11 +36,11 @@ "npm-registry-fetch": "^18.0.1" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.6", "content": "../../scripts/template-oss/index.js" }, "tap": { diff --git a/deps/npm/node_modules/libnpmversion/package.json b/deps/npm/node_modules/libnpmversion/package.json index cdc9e7bbdf718a..b319156a18fc98 100644 --- a/deps/npm/node_modules/libnpmversion/package.json +++ b/deps/npm/node_modules/libnpmversion/package.json @@ -1,6 +1,6 @@ { "name": "libnpmversion", - "version": "7.0.0", + "version": "8.0.0", "main": "lib/index.js", "files": [ "bin/", @@ -33,7 +33,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^5.0.1", - "@npmcli/template-oss": "4.23.3", + "@npmcli/template-oss": "4.23.6", "require-inject": "^1.4.4", "tap": "^16.3.8" }, @@ -45,11 +45,11 @@ "semver": "^7.3.7" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.6", "content": "../../scripts/template-oss/index.js" } } diff --git a/deps/npm/node_modules/npm-package-arg/lib/npa.js b/deps/npm/node_modules/npm-package-arg/lib/npa.js index 8094b3e732cd98..e92605811ae3e6 100644 --- a/deps/npm/node_modules/npm-package-arg/lib/npa.js +++ b/deps/npm/node_modules/npm-package-arg/lib/npa.js @@ -17,6 +17,7 @@ const hasSlashes = isWindows ? /\\|[/]/ : /[/]/ const isURL = /^(?:git[+])?[a-z]+:/i const isGit = /^[^@]+@[^:.]+\.[^:]+:.+$/i const isFilename = /[.](?:tgz|tar.gz|tar)$/i +const isPortNumber = /:[0-9]+(\/|$)/i function npa (arg, where) { let name @@ -324,7 +325,9 @@ function fromURL (res) { // git+ssh://git@my.custom.git.com:username/project.git#deadbeef // ...and various combinations. The username in the beginning is *required*. const matched = rawSpec.match(/^git\+ssh:\/\/([^:#]+:[^#]+(?:\.git)?)(?:#(.*))?$/i) - if (matched && !matched[1].match(/:[0-9]+\/?.*$/i)) { + // Filter out all-number "usernames" which are really port numbers + // They can either be :1234 :1234/ or :1234/path but not :12abc + if (matched && !matched[1].match(isPortNumber)) { res.type = 'git' setGitAttrs(res, matched[2]) res.fetchSpec = matched[1] diff --git a/deps/npm/node_modules/npm-package-arg/package.json b/deps/npm/node_modules/npm-package-arg/package.json index 80baa3d32a52fe..ab285eb6c610c6 100644 --- a/deps/npm/node_modules/npm-package-arg/package.json +++ b/deps/npm/node_modules/npm-package-arg/package.json @@ -1,6 +1,6 @@ { "name": "npm-package-arg", - "version": "12.0.0", + "version": "12.0.1", "description": "Parse the things that can be arguments to `npm install`", "main": "./lib/npa.js", "directories": { @@ -18,7 +18,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^5.0.0", - "@npmcli/template-oss": "4.23.3", + "@npmcli/template-oss": "4.23.4", "tap": "^16.0.1" }, "scripts": { @@ -55,7 +55,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.4", "publish": true } } diff --git a/deps/npm/node_modules/npm-packlist/lib/index.js b/deps/npm/node_modules/npm-packlist/lib/index.js index 985f11ee3f7384..9e4e7db07c01cb 100644 --- a/deps/npm/node_modules/npm-packlist/lib/index.js +++ b/deps/npm/node_modules/npm-packlist/lib/index.js @@ -290,6 +290,7 @@ class PackWalker extends IgnoreWalker { '/package-lock.json', '/yarn.lock', '/pnpm-lock.yaml', + '/bun.lockb', ] // if we have a files array in our package, we need to pull rules from it diff --git a/deps/npm/node_modules/npm-packlist/package.json b/deps/npm/node_modules/npm-packlist/package.json index d7e0a4fd5a8452..b25864612030f9 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": "9.0.0", + "version": "10.0.0", "description": "Get a list of the files to add from a folder into an npm package", "directories": { "test": "test" @@ -16,9 +16,9 @@ "lib/" ], "devDependencies": { - "@npmcli/arborist": "^7.5.4", - "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.23.3", + "@npmcli/arborist": "^8.0.0", + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/template-oss": "4.23.4", "mutate-fs": "^2.1.1", "tap": "^16.0.1" }, @@ -51,11 +51,11 @@ ] }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.4", "publish": true } } diff --git a/deps/npm/node_modules/p-map/index.js b/deps/npm/node_modules/p-map/index.js index c11a28512a4733..10558008a77283 100644 --- a/deps/npm/node_modules/p-map/index.js +++ b/deps/npm/node_modules/p-map/index.js @@ -1,49 +1,107 @@ -'use strict'; -const AggregateError = require('aggregate-error'); - -module.exports = async ( +export default async function pMap( iterable, mapper, { - concurrency = Infinity, - stopOnError = true - } = {} -) => { - return new Promise((resolve, reject) => { + concurrency = Number.POSITIVE_INFINITY, + stopOnError = true, + signal, + } = {}, +) { + return new Promise((resolve_, reject_) => { + if (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) { + throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`); + } + if (typeof mapper !== 'function') { throw new TypeError('Mapper function is required'); } - if (!((Number.isSafeInteger(concurrency) || concurrency === Infinity) && concurrency >= 1)) { + if (!((Number.isSafeInteger(concurrency) && concurrency >= 1) || concurrency === Number.POSITIVE_INFINITY)) { throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`); } const result = []; const errors = []; - const iterator = iterable[Symbol.iterator](); + const skippedIndexesMap = new Map(); let isRejected = false; + let isResolved = false; let isIterableDone = false; let resolvingCount = 0; let currentIndex = 0; + const iterator = iterable[Symbol.iterator] === undefined ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator](); + + const signalListener = () => { + reject(signal.reason); + }; - const next = () => { - if (isRejected) { + const cleanup = () => { + signal?.removeEventListener('abort', signalListener); + }; + + const resolve = value => { + resolve_(value); + cleanup(); + }; + + const reject = reason => { + isRejected = true; + isResolved = true; + reject_(reason); + cleanup(); + }; + + if (signal) { + if (signal.aborted) { + reject(signal.reason); + } + + signal.addEventListener('abort', signalListener, {once: true}); + } + + const next = async () => { + if (isResolved) { return; } - const nextItem = iterator.next(); + const nextItem = await iterator.next(); + const index = currentIndex; currentIndex++; + // Note: `iterator.next()` can be called many times in parallel. + // This can cause multiple calls to this `next()` function to + // receive a `nextItem` with `done === true`. + // The shutdown logic that rejects/resolves must be protected + // so it runs only one time as the `skippedIndex` logic is + // non-idempotent. if (nextItem.done) { isIterableDone = true; - if (resolvingCount === 0) { - if (!stopOnError && errors.length !== 0) { - reject(new AggregateError(errors)); - } else { + if (resolvingCount === 0 && !isResolved) { + if (!stopOnError && errors.length > 0) { + reject(new AggregateError(errors)); // eslint-disable-line unicorn/error-message + return; + } + + isResolved = true; + + if (skippedIndexesMap.size === 0) { resolve(result); + return; + } + + const pureResult = []; + + // Support multiple `pMapSkip`'s. + for (const [index, value] of result.entries()) { + if (skippedIndexesMap.get(index) === pMapSkip) { + continue; + } + + pureResult.push(value); } + + resolve(pureResult); } return; @@ -51,31 +109,173 @@ module.exports = async ( resolvingCount++; + // Intentionally detached (async () => { try { const element = await nextItem.value; - result[index] = await mapper(element, index); + + if (isResolved) { + return; + } + + const value = await mapper(element, index); + + // Use Map to stage the index of the element. + if (value === pMapSkip) { + skippedIndexesMap.set(index, value); + } + + result[index] = value; + resolvingCount--; - next(); + await next(); } catch (error) { if (stopOnError) { - isRejected = true; reject(error); } else { errors.push(error); resolvingCount--; - next(); + + // In that case we can't really continue regardless of `stopOnError` state + // since an iterable is likely to continue throwing after it throws once. + // If we continue calling `next()` indefinitely we will likely end up + // in an infinite loop of failed iteration. + try { + await next(); + } catch (error) { + reject(error); + } } } })(); }; - for (let i = 0; i < concurrency; i++) { - next(); + // Create the concurrent runners in a detached (non-awaited) + // promise. We need this so we can await the `next()` calls + // to stop creating runners before hitting the concurrency limit + // if the iterable has already been marked as done. + // NOTE: We *must* do this for async iterators otherwise we'll spin up + // infinite `next()` calls by default and never start the event loop. + (async () => { + for (let index = 0; index < concurrency; index++) { + try { + // eslint-disable-next-line no-await-in-loop + await next(); + } catch (error) { + reject(error); + break; + } - if (isIterableDone) { - break; + if (isIterableDone || isRejected) { + break; + } } - } + })(); }); -}; +} + +export function pMapIterable( + iterable, + mapper, + { + concurrency = Number.POSITIVE_INFINITY, + backpressure = concurrency, + } = {}, +) { + if (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) { + throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`); + } + + if (typeof mapper !== 'function') { + throw new TypeError('Mapper function is required'); + } + + if (!((Number.isSafeInteger(concurrency) && concurrency >= 1) || concurrency === Number.POSITIVE_INFINITY)) { + throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`); + } + + if (!((Number.isSafeInteger(backpressure) && backpressure >= concurrency) || backpressure === Number.POSITIVE_INFINITY)) { + throw new TypeError(`Expected \`backpressure\` to be an integer from \`concurrency\` (${concurrency}) and up or \`Infinity\`, got \`${backpressure}\` (${typeof backpressure})`); + } + + return { + async * [Symbol.asyncIterator]() { + const iterator = iterable[Symbol.asyncIterator] === undefined ? iterable[Symbol.iterator]() : iterable[Symbol.asyncIterator](); + + const promises = []; + let runningMappersCount = 0; + let isDone = false; + let index = 0; + + function trySpawn() { + if (isDone || !(runningMappersCount < concurrency && promises.length < backpressure)) { + return; + } + + const promise = (async () => { + const {done, value} = await iterator.next(); + + if (done) { + return {done: true}; + } + + runningMappersCount++; + + // Spawn if still below concurrency and backpressure limit + trySpawn(); + + try { + const returnValue = await mapper(await value, index++); + + runningMappersCount--; + + if (returnValue === pMapSkip) { + const index = promises.indexOf(promise); + + if (index > 0) { + promises.splice(index, 1); + } + } + + // Spawn if still below backpressure limit and just dropped below concurrency limit + trySpawn(); + + return {done: false, value: returnValue}; + } catch (error) { + isDone = true; + return {error}; + } + })(); + + promises.push(promise); + } + + trySpawn(); + + while (promises.length > 0) { + const {error, done, value} = await promises[0]; // eslint-disable-line no-await-in-loop + + promises.shift(); + + if (error) { + throw error; + } + + if (done) { + return; + } + + // Spawn if just dropped below backpressure limit and below the concurrency limit + trySpawn(); + + if (value === pMapSkip) { + continue; + } + + yield value; + } + }, + }; +} + +export const pMapSkip = Symbol('skip'); diff --git a/deps/npm/node_modules/p-map/package.json b/deps/npm/node_modules/p-map/package.json index 042b1af553f2de..b7b6594c855d8c 100644 --- a/deps/npm/node_modules/p-map/package.json +++ b/deps/npm/node_modules/p-map/package.json @@ -1,6 +1,6 @@ { "name": "p-map", - "version": "4.0.0", + "version": "7.0.3", "description": "Map over promises concurrently", "license": "MIT", "repository": "sindresorhus/p-map", @@ -10,8 +10,14 @@ "email": "sindresorhus@gmail.com", "url": "https://sindresorhus.com" }, + "type": "module", + "exports": { + "types": "./index.d.ts", + "default": "./index.js" + }, + "sideEffects": false, "engines": { - "node": ">=10" + "node": ">=18" }, "scripts": { "test": "xo && ava && tsd" @@ -38,16 +44,14 @@ "parallel", "bluebird" ], - "dependencies": { - "aggregate-error": "^3.0.0" - }, "devDependencies": { - "ava": "^2.2.0", - "delay": "^4.1.0", - "in-range": "^2.0.0", - "random-int": "^2.0.0", - "time-span": "^3.1.0", - "tsd": "^0.7.4", - "xo": "^0.27.2" + "ava": "^5.2.0", + "chalk": "^5.3.0", + "delay": "^6.0.0", + "in-range": "^3.0.0", + "random-int": "^3.0.0", + "time-span": "^5.1.0", + "tsd": "^0.29.0", + "xo": "^0.56.0" } } diff --git a/deps/npm/node_modules/pacote/lib/dir.js b/deps/npm/node_modules/pacote/lib/dir.js index 4ae97c216fe64f..04846eb8a6e221 100644 --- a/deps/npm/node_modules/pacote/lib/dir.js +++ b/deps/npm/node_modules/pacote/lib/dir.js @@ -32,6 +32,9 @@ class DirFetcher extends Fetcher { if (!mani.scripts || !mani.scripts.prepare) { return } + if (this.opts.ignoreScripts) { + return + } // we *only* run prepare. // pre/post-pack is run by the npm CLI for publish and pack, diff --git a/deps/npm/node_modules/pacote/package.json b/deps/npm/node_modules/pacote/package.json index 71c9aa1ce32572..422be5f5452dc8 100644 --- a/deps/npm/node_modules/pacote/package.json +++ b/deps/npm/node_modules/pacote/package.json @@ -1,6 +1,6 @@ { "name": "pacote", - "version": "19.0.1", + "version": "21.0.0", "description": "JavaScript package downloader", "author": "GitHub Inc.", "bin": { @@ -26,13 +26,14 @@ ] }, "devDependencies": { - "@npmcli/arborist": "^7.1.0", + "@npmcli/arborist": "^8.0.0", "@npmcli/eslint-config": "^5.0.0", - "@npmcli/template-oss": "4.23.3", + "@npmcli/template-oss": "4.23.4", "hosted-git-info": "^8.0.0", "mutate-fs": "^2.1.1", "nock": "^13.2.4", "npm-registry-mock": "^1.3.2", + "rimraf": "^6.0.1", "tap": "^16.0.1" }, "files": [ @@ -54,7 +55,7 @@ "fs-minipass": "^3.0.0", "minipass": "^7.0.2", "npm-package-arg": "^12.0.0", - "npm-packlist": "^9.0.0", + "npm-packlist": "^10.0.0", "npm-pick-manifest": "^10.0.0", "npm-registry-fetch": "^18.0.0", "proc-log": "^5.0.0", @@ -64,7 +65,7 @@ "tar": "^6.1.11" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "repository": { "type": "git", @@ -72,7 +73,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.4", "windowsCI": false, "publish": "true" } diff --git a/deps/npm/node_modules/socks-proxy-agent/dist/index.js b/deps/npm/node_modules/socks-proxy-agent/dist/index.js index a9b5db2d61f573..15e06e8f431765 100644 --- a/deps/npm/node_modules/socks-proxy-agent/dist/index.js +++ b/deps/npm/node_modules/socks-proxy-agent/dist/index.js @@ -31,9 +31,21 @@ const socks_1 = require("socks"); const agent_base_1 = require("agent-base"); const debug_1 = __importDefault(require("debug")); const dns = __importStar(require("dns")); +const net = __importStar(require("net")); const tls = __importStar(require("tls")); const url_1 = require("url"); const debug = (0, debug_1.default)('socks-proxy-agent'); +const setServernameFromNonIpHost = (options) => { + if (options.servername === undefined && + options.host && + !net.isIP(options.host)) { + return { + ...options, + servername: options.host, + }; + } + return options; +}; function parseSocksURL(url) { let lookup = false; let type = 5; @@ -149,11 +161,9 @@ class SocksProxyAgent extends agent_base_1.Agent { // The proxy is connecting to a TLS server, so upgrade // this socket connection to a TLS connection. debug('Upgrading socket connection to TLS'); - const servername = opts.servername || opts.host; const tlsSocket = tls.connect({ - ...omit(opts, 'host', 'path', 'port'), + ...omit(setServernameFromNonIpHost(opts), 'host', 'path', 'port'), socket, - servername, }); tlsSocket.once('error', (error) => { debug('Socket TLS error', error.message); diff --git a/deps/npm/node_modules/socks-proxy-agent/package.json b/deps/npm/node_modules/socks-proxy-agent/package.json index ae0e373fa77381..0f330a73106778 100644 --- a/deps/npm/node_modules/socks-proxy-agent/package.json +++ b/deps/npm/node_modules/socks-proxy-agent/package.json @@ -1,6 +1,6 @@ { "name": "socks-proxy-agent", - "version": "8.0.4", + "version": "8.0.5", "description": "A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -107,7 +107,7 @@ "socks5h" ], "dependencies": { - "agent-base": "^7.1.1", + "agent-base": "^7.1.2", "debug": "^4.3.4", "socks": "^2.8.3" }, diff --git a/deps/npm/node_modules/sprintf-js/bower.json b/deps/npm/node_modules/sprintf-js/bower.json deleted file mode 100644 index d90a75989f7b05..00000000000000 --- a/deps/npm/node_modules/sprintf-js/bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "sprintf", - "description": "JavaScript sprintf implementation", - "version": "1.0.3", - "main": "src/sprintf.js", - "license": "BSD-3-Clause-Clear", - "keywords": ["sprintf", "string", "formatting"], - "authors": ["Alexandru Marasteanu (http://alexei.ro/)"], - "homepage": "https://github.com/alexei/sprintf.js", - "repository": { - "type": "git", - "url": "git://github.com/alexei/sprintf.js.git" - } -} diff --git a/deps/npm/node_modules/sprintf-js/demo/angular.html b/deps/npm/node_modules/sprintf-js/demo/angular.html deleted file mode 100644 index 3559efd7635634..00000000000000 --- a/deps/npm/node_modules/sprintf-js/demo/angular.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - -
      {{ "%+010d"|sprintf:-123 }}
      -
      {{ "%+010d"|vsprintf:[-123] }}
      -
      {{ "%+010d"|fmt:-123 }}
      -
      {{ "%+010d"|vfmt:[-123] }}
      -
      {{ "I've got %2$d apples and %1$d oranges."|fmt:4:2 }}
      -
      {{ "I've got %(apples)d apples and %(oranges)d oranges."|fmt:{apples: 2, oranges: 4} }}
      - - - - diff --git a/deps/npm/node_modules/sprintf-js/gruntfile.js b/deps/npm/node_modules/sprintf-js/gruntfile.js deleted file mode 100644 index 246e1c3b9801fc..00000000000000 --- a/deps/npm/node_modules/sprintf-js/gruntfile.js +++ /dev/null @@ -1,36 +0,0 @@ -module.exports = function(grunt) { - grunt.initConfig({ - pkg: grunt.file.readJSON("package.json"), - - uglify: { - options: { - banner: "/*! <%= pkg.name %> | <%= pkg.author %> | <%= pkg.license %> */\n", - sourceMap: true - }, - build: { - files: [ - { - src: "src/sprintf.js", - dest: "dist/sprintf.min.js" - }, - { - src: "src/angular-sprintf.js", - dest: "dist/angular-sprintf.min.js" - } - ] - } - }, - - watch: { - js: { - files: "src/*.js", - tasks: ["uglify"] - } - } - }) - - grunt.loadNpmTasks("grunt-contrib-uglify") - grunt.loadNpmTasks("grunt-contrib-watch") - - grunt.registerTask("default", ["uglify", "watch"]) -} diff --git a/deps/npm/node_modules/sprintf-js/test/test.js b/deps/npm/node_modules/sprintf-js/test/test.js deleted file mode 100644 index 6f57b2538c8522..00000000000000 --- a/deps/npm/node_modules/sprintf-js/test/test.js +++ /dev/null @@ -1,82 +0,0 @@ -var assert = require("assert"), - sprintfjs = require("../src/sprintf.js"), - sprintf = sprintfjs.sprintf, - vsprintf = sprintfjs.vsprintf - -describe("sprintfjs", function() { - var pi = 3.141592653589793 - - it("should return formated strings for simple placeholders", function() { - assert.equal("%", sprintf("%%")) - assert.equal("10", sprintf("%b", 2)) - assert.equal("A", sprintf("%c", 65)) - assert.equal("2", sprintf("%d", 2)) - assert.equal("2", sprintf("%i", 2)) - assert.equal("2", sprintf("%d", "2")) - assert.equal("2", sprintf("%i", "2")) - assert.equal('{"foo":"bar"}', sprintf("%j", {foo: "bar"})) - assert.equal('["foo","bar"]', sprintf("%j", ["foo", "bar"])) - assert.equal("2e+0", sprintf("%e", 2)) - assert.equal("2", sprintf("%u", 2)) - assert.equal("4294967294", sprintf("%u", -2)) - assert.equal("2.2", sprintf("%f", 2.2)) - assert.equal("3.141592653589793", sprintf("%g", pi)) - assert.equal("10", sprintf("%o", 8)) - assert.equal("%s", sprintf("%s", "%s")) - assert.equal("ff", sprintf("%x", 255)) - assert.equal("FF", sprintf("%X", 255)) - assert.equal("Polly wants a cracker", sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants")) - assert.equal("Hello world!", sprintf("Hello %(who)s!", {"who": "world"})) - }) - - it("should return formated strings for complex placeholders", function() { - // sign - assert.equal("2", sprintf("%d", 2)) - assert.equal("-2", sprintf("%d", -2)) - assert.equal("+2", sprintf("%+d", 2)) - assert.equal("-2", sprintf("%+d", -2)) - assert.equal("2", sprintf("%i", 2)) - assert.equal("-2", sprintf("%i", -2)) - assert.equal("+2", sprintf("%+i", 2)) - assert.equal("-2", sprintf("%+i", -2)) - assert.equal("2.2", sprintf("%f", 2.2)) - assert.equal("-2.2", sprintf("%f", -2.2)) - assert.equal("+2.2", sprintf("%+f", 2.2)) - assert.equal("-2.2", sprintf("%+f", -2.2)) - assert.equal("-2.3", sprintf("%+.1f", -2.34)) - assert.equal("-0.0", sprintf("%+.1f", -0.01)) - assert.equal("3.14159", sprintf("%.6g", pi)) - assert.equal("3.14", sprintf("%.3g", pi)) - assert.equal("3", sprintf("%.1g", pi)) - assert.equal("-000000123", sprintf("%+010d", -123)) - assert.equal("______-123", sprintf("%+'_10d", -123)) - assert.equal("-234.34 123.2", sprintf("%f %f", -234.34, 123.2)) - - // padding - assert.equal("-0002", sprintf("%05d", -2)) - assert.equal("-0002", sprintf("%05i", -2)) - assert.equal(" <", sprintf("%5s", "<")) - assert.equal("0000<", sprintf("%05s", "<")) - assert.equal("____<", sprintf("%'_5s", "<")) - assert.equal("> ", sprintf("%-5s", ">")) - assert.equal(">0000", sprintf("%0-5s", ">")) - assert.equal(">____", sprintf("%'_-5s", ">")) - assert.equal("xxxxxx", sprintf("%5s", "xxxxxx")) - assert.equal("1234", sprintf("%02u", 1234)) - assert.equal(" -10.235", sprintf("%8.3f", -10.23456)) - assert.equal("-12.34 xxx", sprintf("%f %s", -12.34, "xxx")) - assert.equal('{\n "foo": "bar"\n}', sprintf("%2j", {foo: "bar"})) - assert.equal('[\n "foo",\n "bar"\n]', sprintf("%2j", ["foo", "bar"])) - - // precision - assert.equal("2.3", sprintf("%.1f", 2.345)) - assert.equal("xxxxx", sprintf("%5.5s", "xxxxxx")) - assert.equal(" x", sprintf("%5.1s", "xxxxxx")) - - }) - - it("should return formated strings for callbacks", function() { - assert.equal("foobar", sprintf("%s", function() { return "foobar" })) - assert.equal(Date.now(), sprintf("%s", Date.now)) // should pass... - }) -}) diff --git a/deps/npm/node_modules/walk-up-path/LICENSE b/deps/npm/node_modules/walk-up-path/LICENSE index 05eeeb88c2ef4c..d710582667b8bc 100644 --- a/deps/npm/node_modules/walk-up-path/LICENSE +++ b/deps/npm/node_modules/walk-up-path/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) Isaac Z. Schlueter +Copyright (c) 2020-2023 Isaac Z. Schlueter 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/walk-up-path/dist/cjs/index.js b/deps/npm/node_modules/walk-up-path/dist/commonjs/index.js similarity index 100% rename from deps/npm/node_modules/walk-up-path/dist/cjs/index.js rename to deps/npm/node_modules/walk-up-path/dist/commonjs/index.js diff --git a/deps/npm/node_modules/walk-up-path/dist/cjs/package.json b/deps/npm/node_modules/walk-up-path/dist/commonjs/package.json similarity index 100% rename from deps/npm/node_modules/walk-up-path/dist/cjs/package.json rename to deps/npm/node_modules/walk-up-path/dist/commonjs/package.json diff --git a/deps/npm/node_modules/walk-up-path/dist/mjs/index.js b/deps/npm/node_modules/walk-up-path/dist/esm/index.js similarity index 100% rename from deps/npm/node_modules/walk-up-path/dist/mjs/index.js rename to deps/npm/node_modules/walk-up-path/dist/esm/index.js diff --git a/deps/npm/node_modules/walk-up-path/dist/mjs/package.json b/deps/npm/node_modules/walk-up-path/dist/esm/package.json similarity index 100% rename from deps/npm/node_modules/walk-up-path/dist/mjs/package.json rename to deps/npm/node_modules/walk-up-path/dist/esm/package.json diff --git a/deps/npm/node_modules/walk-up-path/package.json b/deps/npm/node_modules/walk-up-path/package.json index 0931c670a8d044..4f6d95363297e7 100644 --- a/deps/npm/node_modules/walk-up-path/package.json +++ b/deps/npm/node_modules/walk-up-path/package.json @@ -1,24 +1,9 @@ { "name": "walk-up-path", - "version": "3.0.1", + "version": "4.0.0", "files": [ "dist" ], - "main": "./dist/cjs/index.js", - "module": "./dist/mjs/index.js", - "types": "./dist/mjs/index.d.ts", - "exports": { - ".": { - "require": { - "types": "./dist/cjs/index.d.ts", - "default": "./dist/cjs/index.js" - }, - "import": { - "types": "./dist/mjs/index.d.ts", - "default": "./dist/mjs/index.js" - } - } - }, "description": "Given a path string, return a generator that walks up the path, emitting each dirname.", "repository": { "type": "git", @@ -30,15 +15,16 @@ "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json && bash ./scripts/fixup.sh", + "prepare": "tshy", "pretest": "npm run prepare", "presnap": "npm run prepare", - "test": "c8 tap", - "snap": "c8 tap", - "format": "prettier --write . --loglevel warn", + "test": "tap", + "snap": "tap", + "format": "prettier --write . --log-level warn", "typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts" }, "prettier": { + "experimentalTernaries": true, "semi": false, "printWidth": 75, "tabWidth": 2, @@ -49,24 +35,37 @@ "arrowParens": "avoid", "endOfLine": "lf" }, - "tap": { - "coverage": false, - "node-arg": [ - "--no-warnings", - "--loader", - "ts-node/esm" - ], - "ts": false - }, "devDependencies": { - "@types/node": "^18.15.5", - "@types/tap": "^15.0.8", - "c8": "^7.13.0", - "eslint-config-prettier": "^8.8.0", - "prettier": "^2.8.6", - "tap": "^16.3.4", - "ts-node": "^10.9.1", - "typedoc": "^0.23.28", - "typescript": "^5.0.2" + "@types/node": "^20.14.10", + "prettier": "^3.3.2", + "tap": "^20.0.3", + "tshy": "^3.0.0", + "typedoc": "^0.26.3" + }, + "type": "module", + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js", + "engines": { + "node": "20 || >=22" } } diff --git a/deps/npm/package.json b/deps/npm/package.json index 8d01af4a7ce8d0..82c5a193b88c02 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "10.9.2", + "version": "11.0.0", "name": "npm", "description": "a package manager for JavaScript", "workspaces": [ @@ -52,8 +52,8 @@ }, "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/arborist": "^8.0.0", - "@npmcli/config": "^9.0.0", + "@npmcli/arborist": "^9.0.0", + "@npmcli/config": "^10.0.0", "@npmcli/fs": "^4.0.0", "@npmcli/map-workspaces": "^4.0.2", "@npmcli/package-json": "^6.1.0", @@ -73,20 +73,19 @@ "graceful-fs": "^4.2.11", "hosted-git-info": "^8.0.2", "ini": "^5.0.0", - "init-package-json": "^7.0.2", + "init-package-json": "^8.0.0", "is-cidr": "^5.1.0", "json-parse-even-better-errors": "^4.0.0", - "libnpmaccess": "^9.0.0", - "libnpmdiff": "^7.0.0", - "libnpmexec": "^9.0.0", - "libnpmfund": "^6.0.0", - "libnpmhook": "^11.0.0", - "libnpmorg": "^7.0.0", - "libnpmpack": "^8.0.0", - "libnpmpublish": "^10.0.1", - "libnpmsearch": "^8.0.0", - "libnpmteam": "^7.0.0", - "libnpmversion": "^7.0.0", + "libnpmaccess": "^10.0.0", + "libnpmdiff": "^8.0.0", + "libnpmexec": "^10.0.0", + "libnpmfund": "^7.0.0", + "libnpmorg": "^8.0.0", + "libnpmpack": "^9.0.0", + "libnpmpublish": "^11.0.0", + "libnpmsearch": "^9.0.0", + "libnpmteam": "^8.0.0", + "libnpmversion": "^8.0.0", "make-fetch-happen": "^14.0.3", "minimatch": "^9.0.5", "minipass": "^7.1.1", @@ -97,13 +96,13 @@ "normalize-package-data": "^7.0.0", "npm-audit-report": "^6.0.0", "npm-install-checks": "^7.1.1", - "npm-package-arg": "^12.0.0", + "npm-package-arg": "^12.0.1", "npm-pick-manifest": "^10.0.0", "npm-profile": "^11.0.1", "npm-registry-fetch": "^18.0.2", "npm-user-validate": "^3.0.0", - "p-map": "^4.0.0", - "pacote": "^19.0.1", + "p-map": "^7.0.3", + "pacote": "^21.0.0", "parse-conflict-json": "^4.0.0", "proc-log": "^5.0.0", "qrcode-terminal": "^0.12.0", @@ -117,8 +116,7 @@ "tiny-relative-date": "^1.3.0", "treeverse": "^3.0.0", "validate-npm-package-name": "^6.0.0", - "which": "^5.0.0", - "write-file-atomic": "^6.0.0" + "which": "^5.0.0" }, "bundleDependencies": [ "@isaacs/string-locale-compare", @@ -150,7 +148,6 @@ "libnpmdiff", "libnpmexec", "libnpmfund", - "libnpmhook", "libnpmorg", "libnpmpack", "libnpmpublish", @@ -187,8 +184,7 @@ "tiny-relative-date", "treeverse", "validate-npm-package-name", - "which", - "write-file-atomic" + "which" ], "devDependencies": { "@npmcli/docs": "^1.0.0", @@ -196,15 +192,15 @@ "@npmcli/git": "^6.0.1", "@npmcli/mock-globals": "^1.0.0", "@npmcli/mock-registry": "^1.0.0", - "@npmcli/template-oss": "4.23.3", - "@tufjs/repo-mock": "^2.0.0", + "@npmcli/template-oss": "4.23.6", + "@tufjs/repo-mock": "^3.0.1", "ajv": "^8.12.0", "ajv-formats": "^2.1.1", "ajv-formats-draft2019": "^1.6.1", "cli-table3": "^0.6.4", - "diff": "^5.2.0", + "diff": "^7.0.0", "nock": "^13.4.0", - "npm-packlist": "^9.0.0", + "npm-packlist": "^10.0.0", "remark": "^14.0.2", "remark-gfm": "^3.0.1", "remark-github": "^11.2.4", @@ -254,11 +250,11 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.23.6", "content": "./scripts/template-oss/root.js" }, "license": "Artistic-2.0", "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" } } 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 index 21c22b26c12e6b..843cf7c8dd3708 100644 --- a/deps/npm/tap-snapshots/test/lib/commands/audit.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/commands/audit.js.test.cjs @@ -331,21 +331,6 @@ audited 2 packages in xxx 2 packages have verified registry signatures ` -exports[`test/lib/commands/audit.js TAP fallback audit > must match snapshot 1`] = ` -# npm audit report - -test-dep-a 1.0.0 -Severity: high -Test advisory 100 - https://github.com/advisories/GHSA-100 -fix available via \`npm audit fix\` -node_modules/test-dep-a - -1 high severity vulnerability - -To address all issues, run: - npm audit fix -` - exports[`test/lib/commands/audit.js TAP json audit > must match snapshot 1`] = ` { "auditReportVersion": 2, diff --git a/deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs index a538e3c0688633..9b6f1ba51c7871 100644 --- a/deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs @@ -64,7 +64,6 @@ Array [ get help help-search - hook init install install-ci-test diff --git a/deps/npm/tap-snapshots/test/lib/commands/publish.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/publish.js.test.cjs index 78395c5cbca637..c0dc06b568180a 100644 --- a/deps/npm/tap-snapshots/test/lib/commands/publish.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/commands/publish.js.test.cjs @@ -174,7 +174,6 @@ Object { "man/man1/npm-fund.1", "man/man1/npm-help-search.1", "man/man1/npm-help.1", - "man/man1/npm-hook.1", "man/man1/npm-init.1", "man/man1/npm-install-ci-test.1", "man/man1/npm-install-test.1", diff --git a/deps/npm/tap-snapshots/test/lib/commands/search.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/search.js.test.cjs index d5485853545882..eb2bf419dd2186 100644 --- a/deps/npm/tap-snapshots/test/lib/commands/search.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/commands/search.js.test.cjs @@ -45,12 +45,6 @@ npm Team management APIs Version 2.0.2 published 2020-11-03 by nlf Maintainers: nlf ruyadorno darcyclarke isaacs https://npm.im/libnpmteam -libnpmhook -programmatic API for managing npm registry hooks -Version 6.0.1 published 2020-11-03 by nlf -Maintainers: nlf ruyadorno darcyclarke isaacs -Keywords: npm hooks registry npm api -https://npm.im/libnpmhook libnpmpublish Programmatic API for the bits behind npm publish and unpublish Version 4.0.0 published 2020-11-03 by nlf @@ -124,12 +118,6 @@ npm Team management APIs Version 2.0.2 published 2020-11-03 by nlf Maintainers: nlf ruyadorno darcyclarke isaacs https://npm.im/libnpmteam -libnpmhook -programmatic API for managing npm registry hooks -Version 6.0.1 published 2020-11-03 by nlf -Maintainers: nlf ruyadorno darcyclarke isaacs -Keywords: npm hooks registry npm api -https://npm.im/libnpmhook libnpmpublish Programmatic API for the bits behind npm publish and unpublish Version 4.0.0 published 2020-11-03 by nlf @@ -171,7 +159,6 @@ libnpmaccess programmatic library for \`npm access\` commands 2020-11-03 4.0.1 l libnpmorg Programmatic api for \`npm org\` commands 2020-11-03 2.0.1 libnpm,npm,package manager,api,orgs,teams libnpmsearch Programmatic API for searching in npm and compatible registries. 2020-12-08 3.1.0 npm,search,api,libnpm libnpmteam npm Team management APIs 2020-11-03 2.0.2 -libnpmhook programmatic API for managing npm registry hooks 2020-11-03 6.0.1 npm,hooks,registry,npm api libnpmpublish Programmatic API for the bits behind npm publish and unpublish 2020-11-03 4.0.0 libnpmfund Programmatic API for npm fund 2020-12-08 1.0.2 npm,npmcli,libnpm,cli,git,fund,gitfund @npmcli/map-workspaces Retrieves a name:pathname Map for a given workspaces config 2020-09-30 1.0.1 npm,,bad map,npmcli,libnpm,cli,workspaces,map-workspaces @@ -235,12 +222,6 @@ npm Team management APIs Version 2.0.2 published 2020-11-03 by nlf Maintainers: nlf ruyadorno darcyclarke isaacs https://npm.im/libnpmteam -libnpmhook -programmatic API for managing npm registry hooks -Version 6.0.1 published 2020-11-03 by nlf -Maintainers: nlf ruyadorno darcyclarke isaacs -Keywords: npm hooks registry npm api -https://npm.im/libnpmhook libnpmpublish Programmatic API for the bits behind npm publish and unpublish Version 4.0.0 published 2020-11-03 by nlf @@ -318,12 +299,6 @@ npm Team management APIs Version 2.0.2 published 2020-11-03 by nlf Maintainers: nlf ruyadorno darcyclarke isaacs https://npm.im/libnpmteam -libnpmhook -programmatic API for managing npm registry hooks -Version 6.0.1 published 2020-11-03 by nlf -Maintainers: nlf ruyadorno darcyclarke isaacs -Keywords: npm hooks registry npm api -https://npm.im/libnpmhook libnpmpublish Programmatic API for the bits behind npm publish and unpublish Version 4.0.0 published 2020-11-03 by nlf @@ -392,12 +367,6 @@ npm Team management APIs Version 2.0.2 published 2020-11-03 by nlf Maintainers: nlf ruyadorno darcyclarke isaacs https://npm.im/libnpmteam -libnpmhook -programmatic API for managing npm registry hooks -Version 6.0.1 published 2020-11-03 by nlf -Maintainers: nlf ruyadorno darcyclarke isaacs -Keywords: npm hooks registry npm api -https://npm.im/libnpmhook libnpmpublish Programmatic API for the bits behind npm publish and unpublish Version 4.0.0 published 2020-11-03 by nlf @@ -466,12 +435,6 @@ npm Team management APIs Version 2.0.2 published 2020-11-03 by nlf Maintainers: nlf ruyadorno darcyclarke isaacs https://npm.im/libnpmteam -libnpmhook -programmatic API for managing npm registry hooks -Version 6.0.1 published 2020-11-03 by nlf -Maintainers: nlf ruyadorno darcyclarke isaacs -Keywords: npm hooks registry npm api -https://npm.im/libnpmhook libnpmpublish Programmatic API for the bits behind npm publish and unpublish Version 4.0.0 published 2020-11-03 by nlf @@ -772,51 +735,6 @@ Array [ "scope": "unscoped", "version": "2.0.2", }, - Object { - "author": Object { - "email": "kzm@sykosomatic.org", - "name": "Kat Marchán", - }, - "date": "2020-11-03T19:20:45.818Z", - "description": "programmatic API for managing npm registry hooks", - "keywords": Array [ - "npm", - "hooks", - "registry", - "npm api", - ], - "links": Object { - "bugs": "https://github.com/npm/libnpmhook/issues", - "homepage": "https://github.com/npm/libnpmhook#readme", - "npm": "https://www.npmjs.com/package/libnpmhook", - "repository": "https://github.com/npm/libnpmhook", - }, - "maintainers": Array [ - Object { - "email": "quitlahok@gmail.com", - "username": "nlf", - }, - Object { - "email": "ruyadorno@hotmail.com", - "username": "ruyadorno", - }, - Object { - "email": "darcy@darcyclarke.me", - "username": "darcyclarke", - }, - Object { - "email": "i@izs.me", - "username": "isaacs", - }, - ], - "name": "libnpmhook", - "publisher": Object { - "email": "quitlahok@gmail.com", - "username": "nlf", - }, - "scope": "unscoped", - "version": "6.0.1", - }, Object { "author": Object { "email": "support@npmjs.com", 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 e6cd42d0d32a50..051313c59ef9a4 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 @@ -102,6 +102,18 @@ dist dist-tags: latest: 1.0.0 +z: 1.0.0 +y: 1.0.0 +v1: 1.0.0 +prev: 1.0.0 +d: 1.0.0 +c: 1.0.0 +b: 1.0.0 +a: 1.0.0 +x: 1.0.1 +next: 1.0.1 +h: 1.0.1 +(...and 3 more.) published {TIME} ago ` @@ -116,6 +128,18 @@ dist dist-tags: latest: 1.0.0 +z: 1.0.0 +y: 1.0.0 +v1: 1.0.0 +prev: 1.0.0 +d: 1.0.0 +c: 1.0.0 +b: 1.0.0 +a: 1.0.0 +x: 1.0.1 +next: 1.0.1 +h: 1.0.1 +(...and 3 more.) published {TIME} ago ` @@ -130,6 +154,18 @@ dist dist-tags: latest: 1.0.0 +z: 1.0.0 +y: 1.0.0 +v1: 1.0.0 +prev: 1.0.0 +d: 1.0.0 +c: 1.0.0 +b: 1.0.0 +a: 1.0.0 +x: 1.0.1 +next: 1.0.1 +h: 1.0.1 +(...and 3 more.) published {TIME} ago ` @@ -269,6 +305,18 @@ dist dist-tags: latest: 1.0.0 +z: 1.0.0 +y: 1.0.0 +v1: 1.0.0 +prev: 1.0.0 +d: 1.0.0 +c: 1.0.0 +b: 1.0.0 +a: 1.0.0 +x: 1.0.1 +next: 1.0.1 +h: 1.0.1 +(...and 3 more.) published {TIME} ago ` @@ -283,6 +331,18 @@ dist dist-tags: latest: 1.0.0 +z: 1.0.0 +y: 1.0.0 +v1: 1.0.0 +prev: 1.0.0 +d: 1.0.0 +c: 1.0.0 +b: 1.0.0 +a: 1.0.0 +x: 1.0.1 +next: 1.0.1 +h: 1.0.1 +(...and 3 more.) published {TIME} ago @@ -296,8 +356,20 @@ dist dist-tags: latest: 1.0.0 +z: 1.0.0 +y: 1.0.0 +v1: 1.0.0 +prev: 1.0.0 +d: 1.0.0 +c: 1.0.0 +b: 1.0.0 +a: 1.0.0 +x: 1.0.1 +next: 1.0.1 +h: 1.0.1 +(...and 3 more.) -published over a year from now +published {TIME} ago ` exports[`test/lib/commands/view.js TAP package with single version full json > must match snapshot 1`] = ` diff --git a/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs b/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs index 68eee1542d9352..8e8d9a9ba4b815 100644 --- a/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs @@ -119,7 +119,6 @@ Array [ "get", "help", "help-search", - "hook", "init", "install", "install-ci-test", @@ -1878,9 +1877,9 @@ When set to \`dev\` or \`development\`, this is an alias for \`--include=dev\`. * Default: null * Type: null or String * DEPRECATED: \`key\` and \`cert\` are no longer used for most registry - operations. Use registry scoped \`keyfile\` and \`certfile\` instead. Example: + operations. Use registry scoped \`keyfile\` and \`cafile\` instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem - //other-registry.tld/:certfile=/path/to/cert.crt + //other-registry.tld/:cafile=/path/to/cert.crt A client certificate to pass when accessing the registry. Values should be in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with @@ -1891,8 +1890,8 @@ cert="-----BEGIN CERTIFICATE-----\\nXXXX\\nXXXX\\n-----END CERTIFICATE-----" \`\`\` It is _not_ the path to a certificate file, though you can set a -registry-scoped "certfile" path like -"//other-registry.tld/:certfile=/path/to/cert.pem". +registry-scoped "cafile" path like +"//other-registry.tld/:cafile=/path/to/cert.pem". @@ -1983,9 +1982,9 @@ Alias for \`--init-version\` * Default: null * Type: null or String * DEPRECATED: \`key\` and \`cert\` are no longer used for most registry - operations. Use registry scoped \`keyfile\` and \`certfile\` instead. Example: + operations. Use registry scoped \`keyfile\` and \`cafile\` instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem - //other-registry.tld/:certfile=/path/to/cert.crt + //other-registry.tld/:cafile=/path/to/cert.crt A client key to pass when accessing the registry. Values should be in PEM format with newlines replaced by the string "\\n". For example: @@ -3200,33 +3199,6 @@ Note: This command is unaware of workspaces. #### \`long\` ` -exports[`test/lib/docs.js TAP usage hook > must match snapshot 1`] = ` -Manage registry hooks - -Usage: -npm hook add [--type=] -npm hook ls [pkg] -npm hook rm -npm hook update - -Options: -[--registry ] [--otp ] - -Run "npm help hook" for more info - -\`\`\`bash -npm hook add [--type=] -npm hook ls [pkg] -npm hook rm -npm hook update -\`\`\` - -Note: This command is unaware of workspaces. - -#### \`registry\` -#### \`otp\` -` - exports[`test/lib/docs.js TAP usage init > must match snapshot 1`] = ` Create a package.json file @@ -3708,7 +3680,7 @@ npm pack Options: [--dry-run] [--json] [--pack-destination ] [-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] [--include-workspace-root] [--ignore-scripts] Run "npm help pack" for more info @@ -3722,6 +3694,7 @@ npm pack #### \`workspace\` #### \`workspaces\` #### \`include-workspace-root\` +#### \`ignore-scripts\` ` exports[`test/lib/docs.js TAP usage ping > must match snapshot 1`] = ` @@ -3781,7 +3754,7 @@ exports[`test/lib/docs.js TAP usage prefix > must match snapshot 1`] = ` Display prefix Usage: -npm prefix [-g] +npm prefix Options: [-g|--global] @@ -3789,7 +3762,7 @@ Options: Run "npm help prefix" for more info \`\`\`bash -npm prefix [-g] +npm prefix \`\`\` Note: This command is unaware of workspaces. diff --git a/deps/npm/tap-snapshots/test/lib/npm.js.test.cjs b/deps/npm/tap-snapshots/test/lib/npm.js.test.cjs index 32ab47ef06b18e..0864ffe37d297c 100644 --- a/deps/npm/tap-snapshots/test/lib/npm.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/npm.js.test.cjs @@ -34,13 +34,12 @@ All commands: access, adduser, audit, bugs, cache, ci, completion, config, dedupe, deprecate, diff, dist-tag, docs, doctor, edit, exec, explain, explore, find-dupes, fund, get, help, - help-search, hook, init, install, install-ci-test, - install-test, link, ll, login, logout, ls, org, outdated, - owner, pack, ping, pkg, prefix, profile, prune, publish, - query, rebuild, repo, restart, root, run-script, sbom, - search, set, shrinkwrap, star, stars, start, stop, team, - test, token, uninstall, unpublish, unstar, update, version, - view, whoami + help-search, init, install, install-ci-test, install-test, + link, ll, login, logout, ls, org, outdated, owner, pack, + ping, pkg, prefix, profile, prune, publish, query, rebuild, + repo, restart, root, run-script, sbom, search, set, + shrinkwrap, star, stars, start, stop, team, test, token, + uninstall, unpublish, unstar, update, version, view, whoami Specify configs in the ini-formatted file: {USERCONFIG} @@ -76,7 +75,7 @@ All commands: edit, exec, explain, explore, find-dupes, fund, get, help, - help-search, hook, init, + help-search, init, install, install-ci-test, install-test, link, ll, @@ -128,7 +127,7 @@ All commands: edit, exec, explain, explore, find-dupes, fund, get, help, - help-search, hook, init, + help-search, init, install, install-ci-test, install-test, link, ll, @@ -175,13 +174,12 @@ All commands: access, adduser, audit, bugs, cache, ci, completion, config, dedupe, deprecate, diff, dist-tag, docs, doctor, edit, exec, explain, explore, find-dupes, fund, get, help, - help-search, hook, init, install, install-ci-test, - install-test, link, ll, login, logout, ls, org, outdated, - owner, pack, ping, pkg, prefix, profile, prune, publish, - query, rebuild, repo, restart, root, run-script, sbom, - search, set, shrinkwrap, star, stars, start, stop, team, - test, token, uninstall, unpublish, unstar, update, version, - view, whoami + help-search, init, install, install-ci-test, install-test, + link, ll, login, logout, ls, org, outdated, owner, pack, + ping, pkg, prefix, profile, prune, publish, query, rebuild, + repo, restart, root, run-script, sbom, search, set, + shrinkwrap, star, stars, start, stop, team, test, token, + uninstall, unpublish, unstar, update, version, view, whoami Specify configs in the ini-formatted file: {USERCONFIG} @@ -217,7 +215,7 @@ All commands: edit, exec, explain, explore, find-dupes, fund, get, help, - help-search, hook, init, + help-search, init, install, install-ci-test, install-test, link, ll, @@ -269,7 +267,7 @@ All commands: edit, exec, explain, explore, find-dupes, fund, get, help, - help-search, hook, init, + help-search, init, install, install-ci-test, install-test, link, ll, @@ -321,7 +319,7 @@ All commands: edit, exec, explain, explore, find-dupes, fund, get, help, - help-search, hook, init, + help-search, init, install, install-ci-test, install-test, link, ll, login, logout, ls, org, @@ -367,13 +365,13 @@ All commands: access, adduser, audit, bugs, cache, ci, completion, config, dedupe, deprecate, diff, dist-tag, docs, doctor, edit, exec, explain, explore, find-dupes, fund, get, help, - help-search, hook, init, install, install-ci-test, - install-test, link, ll, login, logout, ls, org, outdated, - owner, pack, ping, pkg, prefix, profile, prune, publish, - query, rebuild, repo, restart, root, run-script, sbom, - search, set, shrinkwrap, star, stars, start, stop, team, - test, token, uninstall, unpublish, unstar, update, version, - view, whoami + help-search, init, install, install-ci-test, install-test, + link, ll, login, logout, ls, org, outdated, owner, pack, + ping, pkg, prefix, profile, prune, publish, query, rebuild, + repo, restart, root, run-script, sbom, search, set, + shrinkwrap, star, stars, start, stop, team, test, token, + uninstall, unpublish, unstar, update, version, view, + whoami Specify configs in the ini-formatted file: {USERCONFIG} @@ -404,13 +402,12 @@ All commands: access, adduser, audit, bugs, cache, ci, completion, config, dedupe, deprecate, diff, dist-tag, docs, doctor, edit, exec, explain, explore, find-dupes, fund, get, help, - help-search, hook, init, install, install-ci-test, - install-test, link, ll, login, logout, ls, org, outdated, - owner, pack, ping, pkg, prefix, profile, prune, publish, - query, rebuild, repo, restart, root, run-script, sbom, - search, set, shrinkwrap, star, stars, start, stop, team, - test, token, uninstall, unpublish, unstar, update, version, - view, whoami + help-search, init, install, install-ci-test, install-test, + link, ll, login, logout, ls, org, outdated, owner, pack, + ping, pkg, prefix, profile, prune, publish, query, rebuild, + repo, restart, root, run-script, sbom, search, set, + shrinkwrap, star, stars, start, stop, team, test, token, + uninstall, unpublish, unstar, update, version, view, whoami Specify configs in the ini-formatted file: {USERCONFIG} @@ -441,13 +438,12 @@ All commands: access, adduser, audit, bugs, cache, ci, completion, config, dedupe, deprecate, diff, dist-tag, docs, doctor, edit, exec, explain, explore, find-dupes, fund, get, help, - help-search, hook, init, install, install-ci-test, - install-test, link, ll, login, logout, ls, org, outdated, - owner, pack, ping, pkg, prefix, profile, prune, publish, - query, rebuild, repo, restart, root, run-script, sbom, - search, set, shrinkwrap, star, stars, start, stop, team, - test, token, uninstall, unpublish, unstar, update, version, - view, whoami + help-search, init, install, install-ci-test, install-test, + link, ll, login, logout, ls, org, outdated, owner, pack, + ping, pkg, prefix, profile, prune, publish, query, rebuild, + repo, restart, root, run-script, sbom, search, set, + shrinkwrap, star, stars, start, stop, team, test, token, + uninstall, unpublish, unstar, update, version, view, whoami Specify configs in the ini-formatted file: {USERCONFIG} diff --git a/deps/npm/test/fixtures/git-test.tgz b/deps/npm/test/fixtures/git-test.tgz new file mode 100644 index 0000000000000000000000000000000000000000..c06592708c2a0995543a3716238ea7b803e7a22e GIT binary patch literal 268 zcmV+n0rUPJiwFP!00002|Lv8}O2a@9hxfcsF~-BT&?K{(KcIKPgC~7~bUVt{W)pXk zS`pt}TALn<-i%V%?=tY4VPFm)(^lrWdZN_21#OZgixEJ?GSA_=e2dm4h|9b{t&0LP z5U8=dC_$k31A6W%FA#s>NJNA~JrT~&(w==fw=N~O2G=Y|N>4An^)ykBtftAUw;kQs z72Ur%Gf}RsW7?33JK`?p-WXz5Go_~2Qi{N7(eC}<*JR0!8^Qk~%YOF1#AE+;zMT*L zkI%aV0Ek>wQ*;H { const mock = await setupMockNpm(t, opts) + return { + ...mock, + ...loadRegistry(t, mock, opts), + ...loadFsAssertions(t, mock), + } +} + +const loadRegistry = (t, mock, opts) => { const registry = new MockRegistry({ tap: t, - registry: mock.npm.config.get('registry'), - strict: true, + registry: opts.registry ?? mock.npm.config.get('registry'), + authorization: opts.authorization, + basic: opts.basic, + debug: opts.debugRegistry ?? false, + strict: opts.strictRegistryNock ?? true, }) + return { registry } +} +const loadFsAssertions = (t, mock) => { const fileShouldExist = (filePath) => { t.equal( fsSync.existsSync(path.join(mock.npm.prefix, filePath)), true, `${filePath} should exist` @@ -352,7 +366,7 @@ const loadNpmWithRegistry = async (t, opts) => { packageDirty, } - return { registry, assert, ...mock } + return { assert } } /** breaks down a spec "abbrev@1.1.1" into different parts for mocking */ diff --git a/deps/npm/test/lib/cli/entry.js b/deps/npm/test/lib/cli/entry.js index 900e3ab7943177..369927dace0f24 100644 --- a/deps/npm/test/lib/cli/entry.js +++ b/deps/npm/test/lib/cli/entry.js @@ -35,16 +35,16 @@ const cliMock = async (t, opts) => { } } -t.test('print the version, and treat npm_g as npm -g', async t => { +t.test('print the version ', async t => { const { logs, cli, Npm, outputs, exitHandlerCalled } = await cliMock(t, { - globals: { 'process.argv': ['node', 'npm_g', 'root'] }, + globals: { 'process.argv': ['node', 'npm', 'root'] }, }) await cli(process) - t.strictSame(process.argv, ['node', 'npm', '-g', 'root'], 'system process.argv was rewritten') + t.strictSame(process.argv, ['node', 'npm', 'root'], 'system process.argv was rewritten') t.strictSame(logs.verbose.byTitle('cli'), ['cli node npm']) t.strictSame(logs.verbose.byTitle('title'), ['title npm root']) - t.match(logs.verbose.byTitle('argv'), ['argv "--global" "root"']) + t.match(logs.verbose.byTitle('argv'), ['argv "root"']) t.strictSame(logs.info, [`using npm@${Npm.version}`, `using node@${process.version}`]) t.equal(outputs.length, 1) t.match(outputs[0], dirname(process.cwd())) diff --git a/deps/npm/test/lib/commands/audit.js b/deps/npm/test/lib/commands/audit.js index 4b239116188cae..e3bf40ee613732 100644 --- a/deps/npm/test/lib/commands/audit.js +++ b/deps/npm/test/lib/commands/audit.js @@ -90,54 +90,6 @@ t.test('normal audit', async t => { t.matchSnapshot(joinedOutput()) }) -t.test('fallback audit ', async t => { - const { npm, joinedOutput } = await loadMockNpm(t, { - prefixDir: tree, - }) - 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, - module_name: 'test-dep-a', - vulnerable_versions: '<1.0.1', - findings: [{ version: '1.0.0', paths: ['test-dep-a'] }], - }) - registry.nock - .post('/-/npm/v1/security/advisories/bulk').reply(404) - .post('/-/npm/v1/security/audits/quick', body => { - const unzipped = JSON.parse(gunzip(Buffer.from(body, 'hex'))) - return t.match(unzipped, { - name: 'test-dep', - version: '1.0.0', - requires: { 'test-dep-a': '*' }, - dependencies: { 'test-dep-a': { version: '1.0.0' } }, - }) - }).reply(200, { - actions: [], - muted: [], - advisories: { - 100: advisory, - }, - metadata: { - vulnerabilities: { info: 0, low: 0, moderate: 0, high: 1, critical: 0 }, - dependencies: 1, - devDependencies: 0, - optionalDependencies: 0, - totalDependencies: 1, - }, - }) - await npm.exec('audit', []) - t.ok(process.exitCode, 'would have exited uncleanly') - t.matchSnapshot(joinedOutput()) -}) - t.test('json audit', async t => { const { npm, joinedOutput } = await loadMockNpm(t, { prefixDir: tree, diff --git a/deps/npm/test/lib/commands/exec.js b/deps/npm/test/lib/commands/exec.js index c2977a2f577cb3..db2a8641708d31 100644 --- a/deps/npm/test/lib/commands/exec.js +++ b/deps/npm/test/lib/commands/exec.js @@ -254,3 +254,27 @@ t.test('npx --no-install @npmcli/npx-test', async t => { ) } }) + +t.test('packs from git spec', async t => { + const spec = 'test/test#111111aaaaaaaabbbbbbbbccccccdddddddeeeee' + const pkgPath = path.resolve(__dirname, '../../fixtures/git-test.tgz') + + const srv = MockRegistry.tnock(t, 'https://codeload.github.com') + srv.get('/test/test/tar.gz/111111aaaaaaaabbbbbbbbccccccdddddddeeeee') + .times(2) + .reply(200, await fs.readFile(pkgPath)) + + const { npm } = await loadMockNpm(t, { + config: { + audit: false, + yes: true, + }, + }) + try { + await npm.exec('exec', [spec]) + const exists = await fs.stat(path.join(npm.prefix, 'npm-exec-test-success')) + t.ok(exists.isFile(), 'bin ran, creating file') + } catch (err) { + t.fail(err, "shouldn't throw") + } +}) diff --git a/deps/npm/test/lib/commands/hook.js b/deps/npm/test/lib/commands/hook.js deleted file mode 100644 index 003dae647a35a2..00000000000000 --- a/deps/npm/test/lib/commands/hook.js +++ /dev/null @@ -1,640 +0,0 @@ -const t = require('tap') -const mockNpm = require('../../fixtures/mock-npm') - -const mockHook = async (t, { hookResponse, ...npmOpts } = {}) => { - const now = Date.now() - - let hookArgs = null - - const pkgTypes = { - semver: 'package', - '@npmcli': 'scope', - npm: 'owner', - } - - const libnpmhook = { - add: async (pkg, uri, secret, opts) => { - hookArgs = { pkg, uri, secret, opts } - return { id: 1, name: pkg, type: pkgTypes[pkg], endpoint: uri } - }, - ls: async opts => { - hookArgs = opts - let id = 0 - if (hookResponse) { - return hookResponse - } - - return Object.keys(pkgTypes).map(name => ({ - id: ++id, - name, - type: pkgTypes[name], - endpoint: 'https://google.com', - last_delivery: id % 2 === 0 ? now : undefined, - response_code: 200, - })) - }, - rm: async (id, opts) => { - hookArgs = { id, opts } - const pkg = Object.keys(pkgTypes)[0] - return { - id: 1, - name: pkg, - type: pkgTypes[pkg], - endpoint: 'https://google.com', - } - }, - update: async (id, uri, secret, opts) => { - hookArgs = { id, uri, secret, opts } - const pkg = Object.keys(pkgTypes)[0] - return { id, name: pkg, type: pkgTypes[pkg], endpoint: uri } - }, - } - - const mock = await mockNpm(t, { - ...npmOpts, - command: 'hook', - mocks: { - libnpmhook, - ...npmOpts.mocks, - }, - }) - - return { - ...mock, - now, - hookArgs: () => hookArgs, - } -} - -t.test('npm hook no args', async t => { - const { hook } = await mockHook(t) - await t.rejects(hook.exec([]), hook.usage, 'throws usage with no arguments') -}) - -t.test('npm hook add', async t => { - const { npm, hook, outputs, hookArgs } = await mockHook(t) - await hook.exec(['add', 'semver', 'https://google.com', 'some-secret']) - - t.match( - hookArgs(), - { - pkg: 'semver', - uri: 'https://google.com', - secret: 'some-secret', - opts: npm.flatOptions, - }, - 'provided the correct arguments to libnpmhook' - ) - t.strictSame(outputs[0], '+ semver -> https://google.com', 'prints the correct output') -}) - -t.test('npm hook add - correct owner hook output', async t => { - const { npm, hook, outputs, hookArgs } = await mockHook(t) - await hook.exec(['add', '~npm', 'https://google.com', 'some-secret']) - - t.match( - hookArgs(), - { - pkg: '~npm', - uri: 'https://google.com', - secret: 'some-secret', - opts: npm.flatOptions, - }, - 'provided the correct arguments to libnpmhook' - ) - t.strictSame(outputs[0], '+ ~npm -> https://google.com', 'prints the correct output') -}) - -t.test('npm hook add - correct scope hook output', async t => { - const { npm, hook, outputs, hookArgs } = await mockHook(t) - await hook.exec(['add', '@npmcli', 'https://google.com', 'some-secret']) - - t.match( - hookArgs(), - { - pkg: '@npmcli', - uri: 'https://google.com', - secret: 'some-secret', - opts: npm.flatOptions, - }, - 'provided the correct arguments to libnpmhook' - ) - t.strictSame(outputs[0], '+ @npmcli -> https://google.com', 'prints the correct output') -}) - -t.test('npm hook add - unicode output', async t => { - const config = { - unicode: true, - } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['add', 'semver', 'https://google.com', 'some-secret']) - - t.match( - hookArgs(), - { - pkg: 'semver', - uri: 'https://google.com', - secret: 'some-secret', - opts: npm.flatOptions, - }, - 'provided the correct arguments to libnpmhook' - ) - t.strictSame(outputs[0], '+ semver ➜ https://google.com', 'prints the correct output') -}) - -t.test('npm hook add - json output', async t => { - const config = { - json: true, - } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['add', '@npmcli', 'https://google.com', 'some-secret']) - - t.match( - hookArgs(), - { - pkg: '@npmcli', - uri: 'https://google.com', - secret: 'some-secret', - opts: npm.flatOptions, - }, - 'provided the correct arguments to libnpmhook' - ) - t.strictSame( - JSON.parse(outputs[0]), - { - id: 1, - name: '@npmcli', - endpoint: 'https://google.com', - type: 'scope', - }, - 'prints the correct json output' - ) -}) - -t.test('npm hook add - parseable output', async t => { - const config = { - parseable: true, - } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['add', '@npmcli', 'https://google.com', 'some-secret']) - - t.match( - hookArgs(), - { - pkg: '@npmcli', - uri: 'https://google.com', - secret: 'some-secret', - opts: npm.flatOptions, - }, - 'provided the correct arguments to libnpmhook' - ) - - t.strictSame( - outputs[0].split(/\t/), - ['id', 'name', 'type', 'endpoint'], - 'prints the correct parseable output headers' - ) - t.strictSame( - outputs[1].split(/\t/), - ['1', '@npmcli', 'scope', 'https://google.com'], - 'prints the correct parseable values' - ) -}) - -t.test('npm hook add - silent output', async t => { - const config = { loglevel: 'silent' } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['add', '@npmcli', 'https://google.com', 'some-secret']) - - t.match( - hookArgs(), - { - pkg: '@npmcli', - uri: 'https://google.com', - secret: 'some-secret', - opts: npm.flatOptions, - }, - 'provided the correct arguments to libnpmhook' - ) - t.strictSame(outputs, [], 'printed no output') -}) - -t.test('npm hook ls', async t => { - const { npm, hook, outputs, hookArgs } = await mockHook(t) - await hook.exec(['ls']) - - t.match( - hookArgs(), - { - ...npm.flatOptions, - package: undefined, - }, - 'received the correct arguments' - ) - t.strictSame(outputs, [ - 'You have 3 hooks configured.', - 'Hook 1: semver', - 'Endpoint: https://google.com', - 'Never triggered\n', - 'Hook 2: @npmcli', - 'Endpoint: https://google.com', - 'Triggered just now, response code was "200"\n', - 'Hook 3: ~npm', - 'Endpoint: https://google.com', - 'Never triggered\n', - ]) -}) - -t.test('npm hook ls, no results', async t => { - const hookResponse = [] - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - hookResponse, - }) - - await hook.exec(['ls']) - - t.match( - hookArgs(), - { - ...npm.flatOptions, - package: undefined, - }, - 'received the correct arguments' - ) - t.strictSame(outputs, [`You don't have any hooks configured yet.`]) -}) - -t.test('npm hook ls, single result', async t => { - const hookResponse = [ - { - id: 1, - name: 'semver', - type: 'package', - endpoint: 'https://google.com', - }, - ] - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - hookResponse, - }) - - await hook.exec(['ls']) - - t.match( - hookArgs(), - { - ...npm.flatOptions, - package: undefined, - }, - 'received the correct arguments' - ) - t.strictSame(outputs, [ - 'You have 1 hook configured.', - 'Hook 1: semver', - 'Endpoint: https://google.com', - 'Never triggered\n', - ]) -}) - -t.test('npm hook ls - json output', async t => { - const config = { - json: true, - } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['ls']) - - t.match( - hookArgs(), - { - ...npm.flatOptions, - package: undefined, - }, - 'received the correct arguments' - ) - const out = JSON.parse(outputs[0]) - t.match( - out, - [ - { - id: 1, - name: 'semver', - type: 'package', - endpoint: 'https://google.com', - }, - { - id: 2, - name: 'npmcli', - type: 'scope', - endpoint: 'https://google.com', - }, - { - id: 3, - name: 'npm', - type: 'owner', - endpoint: 'https://google.com', - }, - ], - 'prints the correct output' - ) -}) - -t.test('npm hook ls - parseable output', async t => { - const config = { - parseable: true, - } - const { npm, hook, outputs, hookArgs, now } = await mockHook(t, { - config, - }) - - await hook.exec(['ls']) - - t.match( - hookArgs(), - { - ...npm.flatOptions, - package: undefined, - }, - 'received the correct arguments' - ) - t.strictSame( - outputs.map(line => line.split(/\t/)), - [ - ['id', 'name', 'type', 'endpoint', 'last_delivery', 'response_code'], - ['1', 'semver', 'package', 'https://google.com', '', '200'], - ['2', '@npmcli', 'scope', 'https://google.com', `${now}`, '200'], - ['3', 'npm', 'owner', 'https://google.com', '', '200'], - ], - 'prints the correct result' - ) -}) - -t.test('npm hook ls - silent output', async t => { - const config = { loglevel: 'silent' } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['ls']) - - t.match( - hookArgs(), - { - ...npm.flatOptions, - package: undefined, - }, - 'received the correct arguments' - ) - t.strictSame(outputs, [], 'printed no output') -}) - -t.test('npm hook rm', async t => { - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - }) - await hook.exec(['rm', '1']) - - t.match( - hookArgs(), - { - id: '1', - opts: npm.flatOptions, - }, - 'received the correct arguments' - ) - t.strictSame(outputs[0], '- semver X https://google.com', 'printed the correct output') -}) - -t.test('npm hook rm - unicode output', async t => { - const config = { - unicode: true, - } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['rm', '1']) - - t.match( - hookArgs(), - { - id: '1', - opts: npm.flatOptions, - }, - 'received the correct arguments' - ) - t.strictSame(outputs[0], '- semver ✘ https://google.com', 'printed the correct output') -}) - -t.test('npm hook rm - silent output', async t => { - const config = { loglevel: 'silent' } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['rm', '1']) - - t.match( - hookArgs(), - { - id: '1', - opts: npm.flatOptions, - }, - 'received the correct arguments' - ) - t.strictSame(outputs, [], 'printed no output') -}) - -t.test('npm hook rm - json output', async t => { - const config = { - json: true, - } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['rm', '1']) - - t.match( - hookArgs(), - { - id: '1', - opts: npm.flatOptions, - }, - 'received the correct arguments' - ) - t.strictSame( - JSON.parse(outputs[0]), - { - id: 1, - name: 'semver', - type: 'package', - endpoint: 'https://google.com', - }, - 'printed correct output' - ) -}) - -t.test('npm hook rm - parseable output', async t => { - const config = { - parseable: true, - } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['rm', '1']) - - t.match( - hookArgs(), - { - id: '1', - opts: npm.flatOptions, - }, - 'received the correct arguments' - ) - t.strictSame( - outputs.map(line => line.split(/\t/)), - [ - ['id', 'name', 'type', 'endpoint'], - ['1', 'semver', 'package', 'https://google.com'], - ], - 'printed correct output' - ) -}) - -t.test('npm hook update', async t => { - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - }) - await hook.exec(['update', '1', 'https://google.com', 'some-secret']) - - t.match( - hookArgs(), - { - id: '1', - uri: 'https://google.com', - secret: 'some-secret', - opts: npm.flatOptions, - }, - 'received the correct arguments' - ) - t.strictSame(outputs[0], '+ semver -> https://google.com', 'printed the correct output') -}) - -t.test('npm hook update - unicode', async t => { - const config = { - unicode: true, - } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['update', '1', 'https://google.com', 'some-secret']) - - t.match( - hookArgs(), - { - id: '1', - uri: 'https://google.com', - secret: 'some-secret', - opts: npm.flatOptions, - }, - 'received the correct arguments' - ) - t.strictSame(outputs[0], '+ semver ➜ https://google.com', 'printed the correct output') -}) - -t.test('npm hook update - json output', async t => { - const config = { - json: true, - } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['update', '1', 'https://google.com', 'some-secret']) - - t.match( - hookArgs(), - { - id: '1', - uri: 'https://google.com', - secret: 'some-secret', - opts: npm.flatOptions, - }, - 'received the correct arguments' - ) - t.strictSame( - JSON.parse(outputs[0]), - { - id: '1', - name: 'semver', - type: 'package', - endpoint: 'https://google.com', - }, - 'printed the correct output' - ) -}) - -t.test('npm hook update - parseable output', async t => { - const config = { - parseable: true, - } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['update', '1', 'https://google.com', 'some-secret']) - - t.match( - hookArgs(), - { - id: '1', - uri: 'https://google.com', - secret: 'some-secret', - opts: npm.flatOptions, - }, - 'received the correct arguments' - ) - t.strictSame( - outputs.map(line => line.split(/\t/)), - [ - ['id', 'name', 'type', 'endpoint'], - ['1', 'semver', 'package', 'https://google.com'], - ], - 'printed the correct output' - ) -}) - -t.test('npm hook update - silent output', async t => { - const config = { loglevel: 'silent' } - const { npm, hook, outputs, hookArgs } = await mockHook(t, { - config, - }) - - await hook.exec(['update', '1', 'https://google.com', 'some-secret']) - - t.match( - hookArgs(), - { - id: '1', - uri: 'https://google.com', - secret: 'some-secret', - opts: npm.flatOptions, - }, - 'received the correct arguments' - ) - t.strictSame(outputs, [], 'printed no output') -}) diff --git a/deps/npm/test/lib/commands/pkg.js b/deps/npm/test/lib/commands/pkg.js index 2306fe10db0251..f4d0278b04d9b5 100644 --- a/deps/npm/test/lib/commands/pkg.js +++ b/deps/npm/test/lib/commands/pkg.js @@ -108,6 +108,26 @@ t.test('get multiple arg', async t => { ) }) +t.test('get multiple arg with only one arg existing', async t => { + const { pkg, OUTPUT } = await mockNpm(t, { + prefixDir: { + 'package.json': JSON.stringify({ + name: 'foo', + }), + }, + }) + + await pkg('get', 'name', 'version', 'dependencies') + + t.strictSame( + JSON.parse(OUTPUT()), + { + name: 'foo', + }, + 'should print retrieved package.json field' + ) +}) + t.test('get multiple arg with empty value', async t => { const { pkg, OUTPUT } = await mockNpm(t, { prefixDir: { diff --git a/deps/npm/test/lib/commands/publish.js b/deps/npm/test/lib/commands/publish.js index 4dea3e2fa06a09..10dc9b33deda45 100644 --- a/deps/npm/test/lib/commands/publish.js +++ b/deps/npm/test/lib/commands/publish.js @@ -1,12 +1,10 @@ const t = require('tap') -const { load: loadMockNpm } = require('../../fixtures/mock-npm') +const { loadNpmWithRegistry } = require('../../fixtures/mock-npm') const { cleanZlib } = require('../../fixtures/clean-snapshot') -const MockRegistry = require('@npmcli/mock-registry') const pacote = require('pacote') const Arborist = require('@npmcli/arborist') const path = require('node:path') const fs = require('node:fs') -const npa = require('npm-package-arg') const pkg = 'test-package' const token = 'test-auth-token' @@ -23,54 +21,28 @@ const pkgJson = { t.cleanSnapshot = data => cleanZlib(data) t.test('respects publishConfig.registry, runs appropriate scripts', async t => { - const { npm, joinedOutput, prefix } = await loadMockNpm(t, { + const packageJson = { + ...pkgJson, + scripts: { + prepublishOnly: 'touch scripts-prepublishonly', + prepublish: 'touch scripts-prepublish', // should NOT run this one + publish: 'touch scripts-publish', + postpublish: 'touch scripts-postpublish', + }, + publishConfig: { registry: alternateRegistry }, + } + const { npm, joinedOutput, prefix, registry } = await loadNpmWithRegistry(t, { config: { loglevel: 'silent', [`${alternateRegistry.slice(6)}/:_authToken`]: 'test-other-token', }, prefixDir: { - 'package.json': JSON.stringify({ - ...pkgJson, - scripts: { - prepublishOnly: 'touch scripts-prepublishonly', - prepublish: 'touch scripts-prepublish', // should NOT run this one - publish: 'touch scripts-publish', - postpublish: 'touch scripts-postpublish', - }, - publishConfig: { registry: alternateRegistry }, - }, null, 2), + 'package.json': JSON.stringify(packageJson, null, 2), }, - }) - const registry = new MockRegistry({ - tap: t, registry: alternateRegistry, authorization: 'test-other-token', }) - registry.nock.put(`/${pkg}`, body => { - return t.match(body, { - _id: pkg, - name: pkg, - 'dist-tags': { latest: '1.0.0' }, - access: null, - versions: { - '1.0.0': { - name: pkg, - version: '1.0.0', - _id: `${pkg}@1.0.0`, - dist: { - shasum: /\.*/, - tarball: `http:${alternateRegistry.slice(6)}/test-package/-/test-package-1.0.0.tgz`, - }, - publishConfig: { - registry: alternateRegistry, - }, - }, - }, - _attachments: { - [`${pkg}-1.0.0.tgz`]: {}, - }, - }) - }).reply(200, {}) + registry.publish(pkg, { packageJson }) await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'new package version') t.equal(fs.existsSync(path.join(prefix, 'scripts-prepublishonly')), true, 'ran prepublishOnly') @@ -80,115 +52,66 @@ t.test('respects publishConfig.registry, runs appropriate scripts', async t => { }) t.test('re-loads publishConfig.registry if added during script process', async t => { - const { joinedOutput, npm } = await loadMockNpm(t, { + const initPackageJson = { + ...pkgJson, + scripts: { + prepare: 'cp new.json package.json', + }, + } + const packageJson = { + ...initPackageJson, + publishConfig: { registry: alternateRegistry }, + } + const { joinedOutput, npm, registry } = await loadNpmWithRegistry(t, { config: { [`${alternateRegistry.slice(6)}/:_authToken`]: 'test-other-token', // Keep output from leaking into tap logs for readability 'foreground-scripts': false, }, prefixDir: { - 'package.json': JSON.stringify({ - ...pkgJson, - scripts: { - prepare: 'cp new.json package.json', - }, - }, null, 2), - 'new.json': JSON.stringify({ - ...pkgJson, - publishConfig: { registry: alternateRegistry }, - }), + 'package.json': JSON.stringify(initPackageJson, null, 2), + 'new.json': JSON.stringify(packageJson, null, 2), }, - }) - const registry = new MockRegistry({ - tap: t, registry: alternateRegistry, authorization: 'test-other-token', }) - registry.nock.put(`/${pkg}`, body => { - return t.match(body, { - _id: pkg, - name: pkg, - 'dist-tags': { latest: '1.0.0' }, - access: null, - versions: { - '1.0.0': { - name: pkg, - version: '1.0.0', - _id: `${pkg}@1.0.0`, - dist: { - shasum: /\.*/, - tarball: `http:${alternateRegistry.slice(6)}/test-package/-/test-package-1.0.0.tgz`, - }, - publishConfig: { - registry: alternateRegistry, - }, - }, - }, - _attachments: { - [`${pkg}-1.0.0.tgz`]: {}, - }, - }) - }).reply(200, {}) + registry.publish(pkg, { packageJson }) await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'new package version') }) t.test('prioritize CLI flags over publishConfig', async t => { - const publishConfig = { registry: 'http://publishconfig' } - const { joinedOutput, npm } = await loadMockNpm(t, { + const initPackageJson = { + ...pkgJson, + scripts: { + prepare: 'cp new.json package.json', + }, + } + const packageJson = { + ...initPackageJson, + publishConfig: { registry: alternateRegistry }, + } + const { joinedOutput, npm, registry } = await loadNpmWithRegistry(t, { config: { [`${alternateRegistry.slice(6)}/:_authToken`]: 'test-other-token', // Keep output from leaking into tap logs for readability 'foreground-scripts': false, }, prefixDir: { - 'package.json': JSON.stringify({ - ...pkgJson, - scripts: { - prepare: 'cp new.json package.json', - }, - }, null, 2), - 'new.json': JSON.stringify({ - ...pkgJson, - publishConfig, - }), + 'package.json': JSON.stringify(initPackageJson, null, 2), + 'new.json': JSON.stringify(packageJson, null, 2), }, argv: ['--registry', alternateRegistry], - }) - const registry = new MockRegistry({ - tap: t, - registry: alternateRegistry, + registryUrl: alternateRegistry, authorization: 'test-other-token', }) - registry.nock.put(`/${pkg}`, body => { - return t.match(body, { - _id: pkg, - name: pkg, - 'dist-tags': { latest: '1.0.0' }, - access: null, - versions: { - '1.0.0': { - name: pkg, - version: '1.0.0', - _id: `${pkg}@1.0.0`, - dist: { - shasum: /\.*/, - tarball: `http:${alternateRegistry.slice(6)}/test-package/-/test-package-1.0.0.tgz`, - }, - publishConfig, - }, - }, - _attachments: { - [`${pkg}-1.0.0.tgz`]: {}, - }, - }) - }).reply(200, {}) + registry.publish(pkg, { packageJson }) await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'new package version') }) t.test('json', async t => { - const { joinedOutput, npm, logs } = await loadMockNpm(t, { + const { joinedOutput, npm, logs, registry } = await loadNpmWithRegistry(t, { config: { json: true, ...auth, @@ -196,20 +119,16 @@ t.test('json', async t => { prefixDir: { 'package.json': JSON.stringify(pkgJson, null, 2), }, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), authorization: token, }) - registry.nock.put(`/${pkg}`).reply(200, {}) + registry.publish(pkg) await npm.exec('publish', []) t.matchSnapshot(logs.notice) t.matchSnapshot(joinedOutput(), 'new package json') }) t.test('dry-run', async t => { - const { joinedOutput, npm, logs } = await loadMockNpm(t, { + const { joinedOutput, npm, logs, registry } = await loadNpmWithRegistry(t, { config: { 'dry-run': true, ...auth, @@ -217,14 +136,16 @@ t.test('dry-run', async t => { prefixDir: { 'package.json': JSON.stringify(pkgJson, null, 2), }, + authorization: token, }) + registry.publish(pkg, { noPut: true }) await npm.exec('publish', []) t.equal(joinedOutput(), `+ ${pkg}@1.0.0`) t.matchSnapshot(logs.notice) }) t.test('foreground-scripts defaults to true', async t => { - const { outputs, npm, logs } = await loadMockNpm(t, { + const { outputs, npm, logs, registry } = await loadNpmWithRegistry(t, { config: { 'dry-run': true, ...auth, @@ -241,11 +162,9 @@ t.test('foreground-scripts defaults to true', async t => { ), }, }) - + registry.publish('test-fg-scripts', { noPut: true }) await npm.exec('publish', []) - t.matchSnapshot(logs.notice) - t.strictSame( outputs, [ @@ -257,7 +176,7 @@ t.test('foreground-scripts defaults to true', async t => { }) t.test('foreground-scripts can still be set to false', async t => { - const { outputs, npm, logs } = await loadMockNpm(t, { + const { outputs, npm, logs, registry } = await loadNpmWithRegistry(t, { config: { 'dry-run': true, 'foreground-scripts': false, @@ -276,6 +195,7 @@ t.test('foreground-scripts can still be set to false', async t => { }, }) + registry.publish('test-fg-scripts', { noPut: true }) await npm.exec('publish', []) t.matchSnapshot(logs.notice) @@ -287,12 +207,12 @@ t.test('foreground-scripts can still be set to false', async t => { }) t.test('shows usage with wrong set of arguments', async t => { - const { publish } = await loadMockNpm(t, { command: 'publish' }) + const { publish } = await loadNpmWithRegistry(t, { command: 'publish' }) await t.rejects(publish.exec(['a', 'b', 'c']), publish.usage) }) t.test('throws when invalid tag is semver', async t => { - const { npm } = await loadMockNpm(t, { + const { npm } = await loadNpmWithRegistry(t, { config: { tag: '0.0.13', }, @@ -307,7 +227,7 @@ t.test('throws when invalid tag is semver', async t => { }) t.test('throws when invalid tag when not url encodable', async t => { - const { npm } = await loadMockNpm(t, { + const { npm } = await loadNpmWithRegistry(t, { config: { tag: '@test', }, @@ -325,7 +245,7 @@ t.test('throws when invalid tag when not url encodable', async t => { }) t.test('tarball', async t => { - const { npm, joinedOutput, logs, home } = await loadMockNpm(t, { + const { npm, joinedOutput, logs, home, registry } = await loadNpmWithRegistry(t, { config: { 'fetch-retries': 0, ...auth, @@ -338,27 +258,19 @@ t.test('tarball', async t => { }, null, 2), 'index.js': 'console.log("hello world"}', }, + authorization: token, }) const tarball = await pacote.tarball(home, { Arborist }) const tarFilename = path.join(home, 'tarball.tgz') fs.writeFileSync(tarFilename, tarball) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), - authorization: token, - }) - registry.nock.put('/test-tar-package', body => { - return t.match(body, { - name: 'test-tar-package', - }) - }).reply(200, {}) + registry.publish('test-tar-package') await npm.exec('publish', [tarFilename]) t.matchSnapshot(logs.notice) t.matchSnapshot(joinedOutput(), 'new package json') }) t.test('no auth default registry', async t => { - const { npm } = await loadMockNpm(t, { + const { npm } = await loadNpmWithRegistry(t, { prefixDir: { 'package.json': JSON.stringify(pkgJson, null, 2), }, @@ -373,7 +285,7 @@ t.test('no auth default registry', async t => { }) t.test('no auth dry-run', async t => { - const { npm, joinedOutput, logs } = await loadMockNpm(t, { + const { npm, joinedOutput, logs, registry } = await loadNpmWithRegistry(t, { config: { 'dry-run': true, }, @@ -381,13 +293,14 @@ t.test('no auth dry-run', async t => { 'package.json': JSON.stringify(pkgJson, null, 2), }, }) + registry.publish(pkg, { noPut: true }) await npm.exec('publish', []) t.matchSnapshot(joinedOutput()) t.matchSnapshot(logs.warn, 'warns about auth being needed') }) t.test('no auth for configured registry', async t => { - const { npm } = await loadMockNpm(t, { + const { npm } = await loadNpmWithRegistry(t, { config: { registry: alternateRegistry, ...auth, @@ -406,7 +319,7 @@ t.test('no auth for configured registry', async t => { }) t.test('no auth for scope configured registry', async t => { - const { npm } = await loadMockNpm(t, { + const { npm } = await loadNpmWithRegistry(t, { config: { scope: '@npm', registry: alternateRegistry, @@ -429,8 +342,7 @@ t.test('no auth for scope configured registry', async t => { }) t.test('has token auth for scope configured registry', async t => { - const spec = npa('@npm/test-package') - const { npm, joinedOutput } = await loadMockNpm(t, { + const { npm, joinedOutput, registry } = await loadNpmWithRegistry(t, { config: { scope: '@npm', registry: alternateRegistry, @@ -442,22 +354,16 @@ t.test('has token auth for scope configured registry', async t => { version: '1.0.0', }, null, 2), }, - }) - const registry = new MockRegistry({ - tap: t, registry: alternateRegistry, authorization: 'test-scope-token', }) - registry.nock.put(`/${spec.escapedName}`, body => { - return t.match(body, { name: '@npm/test-package' }) - }).reply(200, {}) + registry.publish('@npm/test-package') await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'new package version') }) t.test('has mTLS auth for scope configured registry', async t => { - const spec = npa('@npm/test-package') - const { npm, joinedOutput } = await loadMockNpm(t, { + const { npm, joinedOutput, registry } = await loadNpmWithRegistry(t, { config: { scope: '@npm', registry: alternateRegistry, @@ -470,14 +376,9 @@ t.test('has mTLS auth for scope configured registry', async t => { version: '1.0.0', }, null, 2), }, - }) - const registry = new MockRegistry({ - tap: t, registry: alternateRegistry, }) - registry.nock.put(`/${spec.escapedName}`, body => { - return t.match(body, { name: '@npm/test-package' }) - }).reply(200, {}) + registry.publish('@npm/test-package') await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'new package version') }) @@ -519,101 +420,71 @@ t.test('workspaces', t => { } t.test('all workspaces - no color', async t => { - const { npm, joinedOutput, logs } = await loadMockNpm(t, { + const { npm, joinedOutput, logs, registry } = await loadNpmWithRegistry(t, { config: { + tag: 'latest', color: false, ...auth, workspaces: true, }, prefixDir: dir, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), authorization: token, }) - registry.nock - .put('/workspace-a', body => { - return t.match(body, { name: 'workspace-a' }) - }).reply(200, {}) - .put('/workspace-b', body => { - return t.match(body, { name: 'workspace-b' }) - }).reply(200, {}) - .put('/workspace-n', body => { - return t.match(body, { name: 'workspace-n' }) - }).reply(200, {}) + ;['workspace-a', 'workspace-b', 'workspace-n'].forEach(name => { + registry.publish(name) + }) await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'all public workspaces') t.matchSnapshot(logs.warn, 'warns about skipped private workspace') }) t.test('all workspaces - color', async t => { - const { npm, joinedOutput, logs } = await loadMockNpm(t, { + const { npm, joinedOutput, logs, registry } = await loadNpmWithRegistry(t, { config: { ...auth, + tag: 'latest', color: 'always', workspaces: true, }, prefixDir: dir, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), authorization: token, }) - registry.nock - .put('/workspace-a', body => { - return t.match(body, { name: 'workspace-a' }) - }).reply(200, {}) - .put('/workspace-b', body => { - return t.match(body, { name: 'workspace-b' }) - }).reply(200, {}) - .put('/workspace-n', body => { - return t.match(body, { name: 'workspace-n' }) - }).reply(200, {}) + ;['workspace-a', 'workspace-b', 'workspace-n'].forEach(name => { + registry.publish(name) + }) await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'all public workspaces') t.matchSnapshot(logs.warn, 'warns about skipped private workspace in color') }) t.test('one workspace - success', async t => { - const { npm, joinedOutput } = await loadMockNpm(t, { + const { npm, joinedOutput, registry } = await loadNpmWithRegistry(t, { config: { ...auth, + tag: 'latest', workspace: ['workspace-a'], }, prefixDir: dir, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), authorization: token, }) - registry.nock - .put('/workspace-a', body => { - return t.match(body, { name: 'workspace-a' }) - }).reply(200, {}) + ;['workspace-a'].forEach(name => { + registry.publish(name) + }) await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'single workspace') }) t.test('one workspace - failure', async t => { - const { npm } = await loadMockNpm(t, { + const { npm, registry } = await loadNpmWithRegistry(t, { config: { ...auth, + tag: 'latest', workspace: ['workspace-a'], }, prefixDir: dir, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), authorization: token, }) - registry.nock - .put('/workspace-a', body => { - return t.match(body, { name: 'workspace-a' }) - }).reply(404, {}) + registry.publish('workspace-a', { putCode: 404 }) await t.rejects(npm.exec('publish', []), { code: 'E404' }) }) @@ -639,30 +510,25 @@ t.test('workspaces', t => { }, } - const { npm, joinedOutput } = await loadMockNpm(t, { + const { npm, joinedOutput, registry } = await loadNpmWithRegistry(t, { config: { ...auth, + tag: 'latest', workspaces: true, }, prefixDir: testDir, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), authorization: token, }) - registry.nock - .put('/workspace-a', body => { - return t.match(body, { name: 'workspace-a' }) - }).reply(200, {}) + registry.publish('workspace-a') await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'one marked private') }) t.test('invalid workspace', async t => { - const { npm } = await loadMockNpm(t, { + const { npm } = await loadNpmWithRegistry(t, { config: { ...auth, + tag: 'latest', workspace: ['workspace-x'], }, prefixDir: dir, @@ -674,29 +540,19 @@ t.test('workspaces', t => { }) t.test('json', async t => { - const { npm, joinedOutput } = await loadMockNpm(t, { + const { npm, joinedOutput, registry } = await loadNpmWithRegistry(t, { config: { ...auth, + tag: 'latest', workspaces: true, json: true, }, prefixDir: dir, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), authorization: token, }) - registry.nock - .put('/workspace-a', body => { - return t.match(body, { name: 'workspace-a' }) - }).reply(200, {}) - .put('/workspace-b', body => { - return t.match(body, { name: 'workspace-b' }) - }).reply(200, {}) - .put('/workspace-n', body => { - return t.match(body, { name: 'workspace-n' }) - }).reply(200, {}) + ;['workspace-a', 'workspace-b', 'workspace-n'].forEach(name => { + registry.publish(name) + }) await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'all workspaces in json') }) @@ -722,22 +578,16 @@ t.test('workspaces', t => { }, } - const { npm, joinedOutput } = await loadMockNpm(t, { + const { npm, joinedOutput, registry } = await loadNpmWithRegistry(t, { config: { ...auth, + tag: 'latest', }, prefixDir: testDir, chdir: ({ prefix }) => path.resolve(prefix, './workspace-a'), - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), authorization: token, }) - registry.nock - .put('/pkg', body => { - return t.match(body, { name: 'pkg' }) - }).reply(200, {}) + registry.publish('pkg') await npm.exec('publish', ['../dir/pkg']) t.matchSnapshot(joinedOutput(), 'publish different package spec') }) @@ -746,7 +596,7 @@ t.test('workspaces', t => { }) t.test('ignore-scripts', async t => { - const { npm, joinedOutput, prefix } = await loadMockNpm(t, { + const { npm, joinedOutput, prefix, registry } = await loadNpmWithRegistry(t, { config: { ...auth, 'ignore-scripts': true, @@ -762,13 +612,9 @@ t.test('ignore-scripts', async t => { }, }, null, 2), }, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), authorization: token, }) - registry.nock.put(`/${pkg}`).reply(200, {}) + registry.publish(pkg) await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'new package version') t.equal( @@ -794,27 +640,22 @@ t.test('ignore-scripts', async t => { }) t.test('_auth config default registry', async t => { - const { npm, joinedOutput } = await loadMockNpm(t, { + const { npm, joinedOutput, registry } = await loadNpmWithRegistry(t, { config: { '//registry.npmjs.org/:_auth': basic, }, prefixDir: { 'package.json': JSON.stringify(pkgJson), }, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), basic, }) - registry.nock.put(`/${pkg}`).reply(200, {}) + registry.publish(pkg) await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'new package version') }) t.test('bare _auth and registry config', async t => { - const spec = npa('@npm/test-package') - const { npm, joinedOutput } = await loadMockNpm(t, { + const { npm, joinedOutput, registry } = await loadNpmWithRegistry(t, { config: { registry: alternateRegistry, '//other.registry.npmjs.org/:_auth': basic, @@ -825,19 +666,16 @@ t.test('bare _auth and registry config', async t => { version: '1.0.0', }, null, 2), }, - }) - const registry = new MockRegistry({ - tap: t, registry: alternateRegistry, basic, }) - registry.nock.put(`/${spec.escapedName}`).reply(200, {}) + registry.publish('@npm/test-package') await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'new package version') }) t.test('bare _auth config scoped registry', async t => { - const { npm } = await loadMockNpm(t, { + const { npm } = await loadNpmWithRegistry(t, { config: { scope: '@npm', registry: alternateRegistry, @@ -857,8 +695,7 @@ t.test('bare _auth config scoped registry', async t => { }) t.test('scoped _auth config scoped registry', async t => { - const spec = npa('@npm/test-package') - const { npm, joinedOutput } = await loadMockNpm(t, { + const { npm, joinedOutput, registry } = await loadNpmWithRegistry(t, { config: { scope: '@npm', registry: alternateRegistry, @@ -870,48 +707,37 @@ t.test('scoped _auth config scoped registry', async t => { version: '1.0.0', }, null, 2), }, - }) - const registry = new MockRegistry({ - tap: t, registry: alternateRegistry, basic, }) - registry.nock.put(`/${spec.escapedName}`).reply(200, {}) + registry.publish('@npm/test-package') await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'new package version') }) t.test('restricted access', async t => { - const spec = npa('@npm/test-package') - const { npm, joinedOutput, logs } = await loadMockNpm(t, { + const packageJson = { + name: '@npm/test-package', + version: '1.0.0', + } + const { npm, joinedOutput, logs, registry } = await loadNpmWithRegistry(t, { config: { ...auth, access: 'restricted', }, prefixDir: { - 'package.json': JSON.stringify({ - name: '@npm/test-package', - version: '1.0.0', - }, null, 2), + 'package.json': JSON.stringify(packageJson, null, 2), }, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), authorization: token, }) - registry.nock.put(`/${spec.escapedName}`, body => { - t.equal(body.access, 'restricted', 'access is explicitly set to restricted') - return true - }).reply(200, {}) + registry.publish('@npm/test-package', { packageJson, access: 'restricted' }) await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'new package version') t.matchSnapshot(logs.notice) }) t.test('public access', async t => { - const spec = npa('@npm/test-package') - const { npm, joinedOutput, logs } = await loadMockNpm(t, { + const { npm, joinedOutput, logs, registry } = await loadNpmWithRegistry(t, { config: { ...auth, access: 'public', @@ -922,16 +748,9 @@ t.test('public access', async t => { version: '1.0.0', }, null, 2), }, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), authorization: token, }) - registry.nock.put(`/${spec.escapedName}`, body => { - t.equal(body.access, 'public', 'access is explicitly set to public') - return true - }).reply(200, {}) + registry.publish('@npm/test-package', { access: 'public' }) await npm.exec('publish', []) t.matchSnapshot(joinedOutput(), 'new package version') t.matchSnapshot(logs.notice) @@ -951,9 +770,10 @@ t.test('manifest', async t => { t.cleanSnapshot = (s) => s.replace(new RegExp(npmPkg.version, 'g'), '{VERSION}') let manifest = null - const { npm } = await loadMockNpm(t, { + const { npm, registry } = await loadNpmWithRegistry(t, { config: { ...auth, + tag: 'latest', 'foreground-scripts': false, }, chdir: () => root, @@ -963,6 +783,9 @@ t.test('manifest', async t => { }, }, }) + + registry.publish('npm', { noPut: true }) + await npm.exec('publish', []) const okKeys = [ @@ -988,3 +811,114 @@ t.test('manifest', async t => { t.matchSnapshot(manifest, 'manifest') }) + +t.test('prerelease dist tag', (t) => { + t.test('aborts when prerelease and no tag', async t => { + const { npm } = await loadNpmWithRegistry(t, { + config: { + loglevel: 'silent', + [`${alternateRegistry.slice(6)}/:_authToken`]: 'test-other-token', + }, + prefixDir: { + 'package.json': JSON.stringify({ + ...pkgJson, + version: '1.0.0-0', + publishConfig: { registry: alternateRegistry }, + }, null, 2), + }, + }) + await t.rejects(async () => { + await npm.exec('publish', []) + }, new Error('You must specify a tag using --tag when publishing a prerelease version')) + }) + + t.test('does not abort when prerelease and authored tag latest', async t => { + const packageJson = { + ...pkgJson, + version: '1.0.0-0', + publishConfig: { registry: alternateRegistry }, + } + const { npm, registry } = await loadNpmWithRegistry(t, { + config: { + loglevel: 'silent', + tag: 'latest', + [`${alternateRegistry.slice(6)}/:_authToken`]: 'test-other-token', + }, + prefixDir: { + 'package.json': JSON.stringify(packageJson, null, 2), + }, + registry: alternateRegistry, + authorization: 'test-other-token', + }) + registry.publish(pkg, { packageJson }) + await npm.exec('publish', []) + }) + + t.end() +}) + +t.test('latest dist tag', (t) => { + const init = (version) => ({ + config: { + loglevel: 'silent', + ...auth, + }, + prefixDir: { + 'package.json': JSON.stringify({ + ...pkgJson, + version, + }, null, 2), + }, + authorization: token, + }) + + const packuments = [ + // this needs more than one item in it to cover the sort logic + { version: '50.0.0' }, + { version: '100.0.0' }, + { version: '105.0.0-pre' }, + ] + + t.test('PREVENTS publish when latest version is HIGHER than publishing version', async t => { + const version = '99.0.0' + const { npm, registry } = await loadNpmWithRegistry(t, init(version)) + registry.publish(pkg, { noPut: true, packuments }) + await t.rejects(async () => { + await npm.exec('publish', []) + /* eslint-disable-next-line max-len */ + }, new Error('Cannot implicitly apply the "latest" tag because published version 100.0.0 is higher than the new version 99.0.0. You must specify a tag using --tag.')) + }) + + t.test('ALLOWS publish when latest is HIGHER than publishing version and flag', async t => { + const version = '99.0.0' + const { npm, registry } = await loadNpmWithRegistry(t, { + ...init(version), + argv: ['--tag', 'latest'], + }) + registry.publish(pkg, { packuments }) + await npm.exec('publish', []) + }) + + t.test('ALLOWS publish when latest versions are LOWER than publishing version', async t => { + const version = '101.0.0' + const { npm, registry } = await loadNpmWithRegistry(t, init(version)) + registry.publish(pkg, { packuments }) + await npm.exec('publish', []) + }) + + t.test('ALLOWS publish when packument has empty versions (for coverage)', async t => { + const version = '1.0.0' + const { npm, registry } = await loadNpmWithRegistry(t, init(version)) + registry.publish(pkg, { manifest: { versions: { } } }) + await npm.exec('publish', []) + }) + + t.test('ALLOWS publish when packument has empty manifest (for coverage)', async t => { + const version = '1.0.0' + const { npm, registry } = await loadNpmWithRegistry(t, init(version)) + registry.publish(pkg, { manifest: {} }) + await npm.exec('publish', []) + }) + + t.end() +}) diff --git a/deps/npm/test/lib/commands/view.js b/deps/npm/test/lib/commands/view.js index 5da9182ddd55ef..f25b3da005b969 100644 --- a/deps/npm/test/lib/commands/view.js +++ b/deps/npm/test/lib/commands/view.js @@ -36,10 +36,25 @@ const packument = (nv, opts) => { _id: 'blue', name: 'blue', 'dist-tags': { + v1: '1.0.0', + next: '1.0.1', + prev: '1.0.0', latest: '1.0.0', + a: '1.0.0', + c: '1.0.0', + b: '1.0.0', + d: '1.0.0', + f: '1.0.1', + g: '1.0.1', + h: '1.0.1', + e: '1.0.1', + z: '1.0.0', + x: '1.0.1', + y: '1.0.0', }, time: { '1.0.0': yesterday, + '1.0.1': '2012-12-20T00:00:00.000Z', }, versions: { '1.0.0': {