deps: upgrade npm to 7.4.3

PR-URL: https://github.com/nodejs/node/pull/37018
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
This commit is contained in:
Ruy Adorno 2021-01-21 12:20:52 -05:00
parent e279304954
commit a35b32ec1e
No known key found for this signature in database
GPG Key ID: 97B01419BD92F80A
14 changed files with 89 additions and 88 deletions

1
deps/npm/.npmignore vendored
View File

@ -12,6 +12,7 @@ node_modules/.bin
node_modules/npm-registry-mock node_modules/npm-registry-mock
/npmrc /npmrc
/release/ /release/
/coverage/
# don't need these in the npm package. # don't need these in the npm package.
html/*.png html/*.png

20
deps/npm/CHANGELOG.md vendored
View File

@ -1,3 +1,23 @@
## v7.4.3 (2021-01-21)
### DOCUMENTATION
* [`ec1f06d06`](https://github.com/npm/cli/commit/ec1f06d06447a29c74bee063cff103ede7a2111b)
[#2498](https://github.com/npm/cli/issues/2498)
docs(npm): update `npm` docs
([@darcyclarke](https://github.com/darcyclarke))
### DEPENDENCIES
* [`bc23284cd`](https://github.com/npm/cli/commit/bc23284cd5c4cc4532875aff14df94213727a509)
[#2511](https://github.com/npm/cli/issues/2511)
remove coverage files
([@ruyadorno](https://github.com/ruyadorno))
* [`fcbc676b8`](https://github.com/npm/cli/commit/fcbc676b88e1b7c8d01a3799683cd388a82c44d6)
`pacote@11.2.3`
* [`ebd3a24ff`](https://github.com/npm/cli/commit/ebd3a24ff8381f2def306136b745d1615fd6139f)
`@npmcli/arborist@2.0.6`
* Preserve git+https auth when provided
## v7.4.2 (2021-01-15) ## v7.4.2 (2021-01-15)
### DEPENDENCIES ### DEPENDENCIES

View File

@ -133,19 +133,12 @@ See [`config`](/using-npm/config) for much much more information.
Patches welcome! Patches welcome!
If you would like to contribute, but don't know what to work on, read If you would like to contribute, but don't know what to work on, read
the contributing guidelines and check the issues list. the [contributing guidelines](https://github.com/npm/cli/blob/latest/CONTRIBUTING.md)
and check the issues list.
* [CONTRIBUTING.md](https://github.com/npm/cli/blob/latest/CONTRIBUTING.md)
* [Bug tracker](https://github.com/npm/cli/issues)
### Bugs ### Bugs
When you find issues, please report them: When you find issues, please report them: <https://github.com/npm/cli/issues>
* web:
<https://github.com/npm/npm/issues>
* archived web:
<https://npm.community/c/bugs>
Be sure to follow the template and bug reporting guidelines. Be sure to follow the template and bug reporting guidelines.
@ -159,13 +152,6 @@ Or suggest formal RFC proposals:
* <https://github.com/npm/rfcs> * <https://github.com/npm/rfcs>
### Author
[Isaac Z. Schlueter](http://blog.izs.me/) ::
[isaacs](https://github.com/isaacs/) ::
[@izs](https://twitter.com/izs) ::
<i@izs.me>
### See Also ### See Also
* [npm help](/commands/npm-help) * [npm help](/commands/npm-help)
* [package.json](/configuring-npm/package-json) * [package.json](/configuring-npm/package-json)

View File

@ -159,7 +159,7 @@ tree at all, use <a href="../commands/npm-explain.html"><code>npm explain</code>
the results to only the paths to the packages named. Note that nested the results to only the paths to the packages named. Note that nested
packages will <em>also</em> show the paths to the specified packages. For packages will <em>also</em> show the paths to the specified packages. For
example, running <code>npm ls promzard</code> in npms source tree will show:</p> example, running <code>npm ls promzard</code> in npms source tree will show:</p>
<pre lang="bash"><code>npm@7.4.2 /path/to/npm <pre lang="bash"><code>npm@7.4.3 /path/to/npm
└─┬ init-package-json@0.0.4 └─┬ init-package-json@0.0.4
└── promzard@0.1.5 └── promzard@0.1.5
</code></pre> </code></pre>

View File

@ -141,14 +141,14 @@ npm command-line interface
<section id="table_of_contents"> <section id="table_of_contents">
<h2 id="table-of-contents">Table of contents</h2> <h2 id="table-of-contents">Table of contents</h2>
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#version">Version</a></li><li><a href="#description">Description</a></li><li><a href="#important">Important</a></li><li><a href="#introduction">Introduction</a></li><li><a href="#dependencies">Dependencies</a></li><li><a href="#directories">Directories</a></li><li><a href="#developer-usage">Developer Usage</a></li><ul><li><a href="#configuration">Configuration</a></li></ul><li><a href="#contributions">Contributions</a></li><li><a href="#bugs">Bugs</a></li><li><a href="#feature-requests">Feature Requests</a></li><li><a href="#author">Author</a></li><li><a href="#see-also">See Also</a></li></ul></div> <div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#version">Version</a></li><li><a href="#description">Description</a></li><li><a href="#important">Important</a></li><li><a href="#introduction">Introduction</a></li><li><a href="#dependencies">Dependencies</a></li><li><a href="#directories">Directories</a></li><li><a href="#developer-usage">Developer Usage</a></li><ul><li><a href="#configuration">Configuration</a></li></ul><li><a href="#contributions">Contributions</a></li><li><a href="#bugs">Bugs</a></li><li><a href="#feature-requests">Feature Requests</a></li><li><a href="#see-also">See Also</a></li></ul></div>
</section> </section>
<div id="_content"><h3 id="synopsis">Synopsis</h3> <div id="_content"><h3 id="synopsis">Synopsis</h3>
<pre lang="bash"><code>npm &lt;command&gt; [args] <pre lang="bash"><code>npm &lt;command&gt; [args]
</code></pre> </code></pre>
<h3 id="version">Version</h3> <h3 id="version">Version</h3>
<p>7.4.2</p> <p>7.4.3</p>
<h3 id="description">Description</h3> <h3 id="description">Description</h3>
<p>npm is the package manager for the Node JavaScript platform. It puts <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 modules in place so that node can find them, and manages dependency
@ -246,19 +246,10 @@ lib/utils/config-defs.js. These must not be changed.</li>
<h3 id="contributions">Contributions</h3> <h3 id="contributions">Contributions</h3>
<p>Patches welcome!</p> <p>Patches welcome!</p>
<p>If you would like to contribute, but dont know what to work on, read <p>If you would like to contribute, but dont know what to work on, read
the contributing guidelines and check the issues list.</p> the <a href="https://github.com/npm/cli/blob/latest/CONTRIBUTING.md">contributing guidelines</a>
<ul> and check the issues list.</p>
<li><a href="https://github.com/npm/cli/blob/latest/CONTRIBUTING.md">CONTRIBUTING.md</a></li>
<li><a href="https://github.com/npm/cli/issues">Bug tracker</a></li>
</ul>
<h3 id="bugs">Bugs</h3> <h3 id="bugs">Bugs</h3>
<p>When you find issues, please report them:</p> <p>When you find issues, please report them: <a href="https://github.com/npm/cli/issues">https://github.com/npm/cli/issues</a></p>
<ul>
<li>web:
<a href="https://github.com/npm/npm/issues">https://github.com/npm/npm/issues</a></li>
<li>archived web:
<a href="https://npm.community/c/bugs">https://npm.community/c/bugs</a></li>
</ul>
<p>Be sure to follow the template and bug reporting guidelines.</p> <p>Be sure to follow the template and bug reporting guidelines.</p>
<h3 id="feature-requests">Feature Requests</h3> <h3 id="feature-requests">Feature Requests</h3>
<p>Discuss new feature ideas on our discussion forum:</p> <p>Discuss new feature ideas on our discussion forum:</p>
@ -269,11 +260,6 @@ the contributing guidelines and check the issues list.</p>
<ul> <ul>
<li><a href="https://github.com/npm/rfcs">https://github.com/npm/rfcs</a></li> <li><a href="https://github.com/npm/rfcs">https://github.com/npm/rfcs</a></li>
</ul> </ul>
<h3 id="author">Author</h3>
<p><a href="http://blog.izs.me/">Isaac Z. Schlueter</a> ::
<a href="https://github.com/isaacs/">isaacs</a> ::
<a href="https://twitter.com/izs">@izs</a> ::
<a href="mailto:i@izs.me">i@izs.me</a></p>
<h3 id="see-also">See Also</h3> <h3 id="see-also">See Also</h3>
<ul> <ul>
<li><a href="../commands/npm-help.html">npm help</a></li> <li><a href="../commands/npm-help.html">npm help</a></li>

View File

@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show:
.P .P
.RS 2 .RS 2
.nf .nf
npm@7\.4\.2 /path/to/npm npm@7\.4\.3 /path/to/npm
└─┬ init\-package\-json@0\.0\.4 └─┬ init\-package\-json@0\.0\.4
└── promzard@0\.1\.5 └── promzard@0\.1\.5
.fi .fi

View File

@ -10,7 +10,7 @@ npm <command> [args]
.RE .RE
.SS Version .SS Version
.P .P
7\.4\.2 7\.4\.3
.SS Description .SS Description
.P .P
npm is the package manager for the Node JavaScript platform\. It puts npm is the package manager for the Node JavaScript platform\. It puts
@ -141,26 +141,11 @@ See npm help \fBconfig\fP for much much more information\.
Patches welcome! Patches welcome!
.P .P
If you would like to contribute, but don't know what to work on, read If you would like to contribute, but don't know what to work on, read
the contributing guidelines and check the issues list\. the contributing guidelines \fIhttps://github\.com/npm/cli/blob/latest/CONTRIBUTING\.md\fR
.RS 0 and check the issues list\.
.IP \(bu 2
CONTRIBUTING\.md \fIhttps://github\.com/npm/cli/blob/latest/CONTRIBUTING\.md\fR
.IP \(bu 2
Bug tracker \fIhttps://github\.com/npm/cli/issues\fR
.RE
.SS Bugs .SS Bugs
.P .P
When you find issues, please report them: When you find issues, please report them: https://github\.com/npm/cli/issues
.RS 0
.IP \(bu 2
web:
https://github\.com/npm/npm/issues
.IP \(bu 2
archived web:
https://npm\.community/c/bugs
.RE
.P .P
Be sure to follow the template and bug reporting guidelines\. Be sure to follow the template and bug reporting guidelines\.
.SS Feature Requests .SS Feature Requests
@ -178,12 +163,6 @@ Or suggest formal RFC proposals:
https://github\.com/npm/rfcs https://github\.com/npm/rfcs
.RE .RE
.SS Author
.P
Isaac Z\. Schlueter \fIhttp://blog\.izs\.me/\fR ::
isaacs \fIhttps://github\.com/isaacs/\fR ::
@izs \fIhttps://twitter\.com/izs\fR ::
i@izs\.me
.SS See Also .SS See Also
.RS 0 .RS 0
.IP \(bu 2 .IP \(bu 2

View File

@ -830,9 +830,14 @@ module.exports = cls => class Reifier extends cls {
const pname = child.package.name const pname = child.package.name
const alias = name !== pname const alias = name !== pname
updateDepSpec(pkg, name, (alias ? `npm:${pname}@` : '') + range) updateDepSpec(pkg, name, (alias ? `npm:${pname}@` : '') + range)
} else if (req.hosted) } else if (req.hosted) {
updateDepSpec(pkg, name, req.hosted.shortcut({ noCommittish: false })) // save the git+https url if it has auth, otherwise shortcut
else const h = req.hosted
const opt = { noCommittish: false }
const save = h.https && h.auth ? `git+${h.https(opt)}`
: h.shortcut(opt)
updateDepSpec(pkg, name, save)
} else
updateDepSpec(pkg, name, req.saveSpec) updateDepSpec(pkg, name, req.saveSpec)
} }

View File

@ -9,6 +9,7 @@ const consistentResolve = (resolved, fromPath, toPath, relPaths = false) => {
return null return null
try { try {
const hostedOpt = { noCommittish: false }
const { const {
fetchSpec, fetchSpec,
saveSpec, saveSpec,
@ -20,7 +21,9 @@ const consistentResolve = (resolved, fromPath, toPath, relPaths = false) => {
const isPath = type === 'file' || type === 'directory' const isPath = type === 'file' || type === 'directory'
return isPath && !relPaths ? `file:${fetchSpec}` return isPath && !relPaths ? `file:${fetchSpec}`
: isPath ? 'file:' + (toPath ? relpath(toPath, fetchSpec) : fetchSpec) : isPath ? 'file:' + (toPath ? relpath(toPath, fetchSpec) : fetchSpec)
: hosted ? 'git+' + hosted.sshurl({ noCommittish: false }) : hosted ? `git+${
hosted.auth ? hosted.https(hostedOpt) : hosted.sshurl(hostedOpt)
}`
: type === 'git' ? saveSpec : type === 'git' ? saveSpec
// always return something. 'foo' is interpreted as 'foo@' otherwise. // always return something. 'foo' is interpreted as 'foo@' otherwise.
: rawSpec === '' && raw.slice(-1) !== '@' ? raw : rawSpec === '' && raw.slice(-1) !== '@' ? raw

View File

@ -1,6 +1,6 @@
{ {
"name": "@npmcli/arborist", "name": "@npmcli/arborist",
"version": "2.0.5", "version": "2.0.6",
"description": "Manage node_modules trees", "description": "Manage node_modules trees",
"dependencies": { "dependencies": {
"@npmcli/installed-package-contents": "^1.0.5", "@npmcli/installed-package-contents": "^1.0.5",
@ -20,7 +20,7 @@
"npm-package-arg": "^8.1.0", "npm-package-arg": "^8.1.0",
"npm-pick-manifest": "^6.1.0", "npm-pick-manifest": "^6.1.0",
"npm-registry-fetch": "^9.0.0", "npm-registry-fetch": "^9.0.0",
"pacote": "^11.2.1", "pacote": "^11.2.3",
"parse-conflict-json": "^1.1.1", "parse-conflict-json": "^1.1.1",
"promise-all-reject-late": "^1.0.0", "promise-all-reject-late": "^1.0.0",
"promise-call-limit": "^1.0.1", "promise-call-limit": "^1.0.1",

View File

@ -47,6 +47,8 @@ class FetcherBase {
throw new TypeError('options object is required') throw new TypeError('options object is required')
this.spec = npa(spec, opts.where) this.spec = npa(spec, opts.where)
this.allowGitIgnore = !!opts.allowGitIgnore
// a bit redundant because presumably the caller already knows this, // a bit redundant because presumably the caller already knows this,
// but it makes it easier to not have to keep track of the requested // 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 // spec when we're dispatching thousands of these at once, and normalizing
@ -414,7 +416,7 @@ class FetcherBase {
const base = basename(entry.path) const base = basename(entry.path)
if (base === '.npmignore') if (base === '.npmignore')
sawIgnores.add(entry.path) sawIgnores.add(entry.path)
else if (base === '.gitignore') { else if (base === '.gitignore' && !this.allowGitIgnore) {
// rename, but only if there's not already a .npmignore // rename, but only if there's not already a .npmignore
const ni = entry.path.replace(/\.gitignore$/, '.npmignore') const ni = entry.path.replace(/\.gitignore$/, '.npmignore')
if (sawIgnores.has(ni)) if (sawIgnores.has(ni))

View File

@ -24,13 +24,16 @@ const _cloneRepo = Symbol('_cloneRepo')
const _setResolvedWithSha = Symbol('_setResolvedWithSha') const _setResolvedWithSha = Symbol('_setResolvedWithSha')
const _prepareDir = Symbol('_prepareDir') const _prepareDir = Symbol('_prepareDir')
// get the repository url. prefer ssh, fall back to git:// // 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. // We have to add the git+ back because npa suppresses it.
const repoUrl = (hosted, opts) => const repoUrl = (h, opts) =>
hosted.sshurl && addGitPlus(hosted.sshurl(opts)) || h.sshurl && !(h.https && h.auth) && addGitPlus(h.sshurl(opts)) ||
hosted.https && addGitPlus(hosted.https(opts)) h.https && addGitPlus(h.https(opts))
const addGitPlus = url => url && `git+${url}` // add git+ to the url, but only one time.
const addGitPlus = url => url && `git+${url}`.replace(/^(git\+)+/, 'git+')
class GitFetcher extends Fetcher { class GitFetcher extends Fetcher {
constructor (spec, opts) { constructor (spec, opts) {
@ -51,6 +54,11 @@ class GitFetcher extends Fetcher {
this.resolvedSha = '' this.resolvedSha = ''
} }
// just exposed to make it easier to test all the combinations
static repoUrl (hosted, opts) {
return repoUrl(hosted, opts)
}
get types () { get types () {
return ['git'] return ['git']
} }
@ -69,13 +77,16 @@ class GitFetcher extends Fetcher {
} }
// first try https, since that's faster and passphrase-less for // first try https, since that's faster and passphrase-less for
// public repos. Fall back to SSH to support private repos. // public repos, and supports private repos when auth is provided.
// NB: we always store the SSH url in the 'resolved' field. // 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) { [_resolvedFromHosted] (hosted) {
return this[_resolvedFromRepo](hosted.https && hosted.https()) return this[_resolvedFromRepo](hosted.https && hosted.https())
.catch(er => { .catch(er => {
const ssh = hosted.sshurl && hosted.sshurl() const ssh = hosted.sshurl && hosted.sshurl()
if (!ssh) // no fallthrough if we can't fall through or have https auth
if (!ssh || hosted.auth)
throw er throw er
return this[_resolvedFromRepo](ssh) return this[_resolvedFromRepo](ssh)
}) })
@ -121,9 +132,11 @@ class GitFetcher extends Fetcher {
// either a git url with a hash, or a tarball download URL // either a git url with a hash, or a tarball download URL
[_addGitSha] (sha) { [_addGitSha] (sha) {
if (this.spec.hosted) { if (this.spec.hosted) {
this[_setResolvedWithSha]( const h = this.spec.hosted
this.spec.hosted.shortcut({ noCommittish: true }) + '#' + sha const opt = { noCommittish: true }
) const base = h.https && h.auth ? h.https(opt) : h.shortcut(opt)
this[_setResolvedWithSha](`${base}#${sha}`)
} else { } else {
const u = url.format(new url.URL(`#${sha}`, this.spec.rawSpec)) const u = url.format(new url.URL(`#${sha}`, this.spec.rawSpec))
this[_setResolvedWithSha](url.format(u)) this[_setResolvedWithSha](url.format(u))
@ -207,6 +220,7 @@ class GitFetcher extends Fetcher {
const nameat = this.spec.name ? `${this.spec.name}@` : '' const nameat = this.spec.name ? `${this.spec.name}@` : ''
return new RemoteFetcher(h.tarball({ noCommittish: false }), { return new RemoteFetcher(h.tarball({ noCommittish: false }), {
...this.opts, ...this.opts,
allowGitIgnore: true,
pkgid: `git:${nameat}${this.resolved}`, pkgid: `git:${nameat}${this.resolved}`,
resolved: this.resolved, resolved: this.resolved,
integrity: null, // it'll always be different, if we have one integrity: null, // it'll always be different, if we have one
@ -231,14 +245,19 @@ class GitFetcher extends Fetcher {
}) })
} }
// 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) { [_cloneHosted] (ref, tmp) {
const hosted = this.spec.hosted const hosted = this.spec.hosted
const https = hosted.https() const https = hosted.https()
return this[_cloneRepo](hosted.https({ noCommittish: true }), ref, tmp) return this[_cloneRepo](hosted.https({ noCommittish: true }), ref, tmp)
.catch(er => { .catch(er => {
const ssh = hosted.sshurl && hosted.sshurl({ noCommittish: true }) const ssh = hosted.sshurl && hosted.sshurl({ noCommittish: true })
/* istanbul ignore if - should be covered by the resolve() call */ // no fallthrough if we can't fall through or have https auth
if (!ssh) if (!ssh || hosted.auth)
throw er throw er
return this[_cloneRepo](ssh, ref, tmp) return this[_cloneRepo](ssh, ref, tmp)
}) })

View File

@ -1,6 +1,6 @@
{ {
"name": "pacote", "name": "pacote",
"version": "11.2.1", "version": "11.2.3",
"description": "JavaScript package downloader", "description": "JavaScript package downloader",
"author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)",
"bin": { "bin": {

View File

@ -1,5 +1,5 @@
{ {
"version": "7.4.2", "version": "7.4.3",
"name": "npm", "name": "npm",
"description": "a package manager for JavaScript", "description": "a package manager for JavaScript",
"keywords": [ "keywords": [
@ -42,7 +42,7 @@
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"dependencies": { "dependencies": {
"@npmcli/arborist": "^2.0.5", "@npmcli/arborist": "^2.0.6",
"@npmcli/ci-detect": "^1.2.0", "@npmcli/ci-detect": "^1.2.0",
"@npmcli/config": "^1.2.8", "@npmcli/config": "^1.2.8",
"@npmcli/run-script": "^1.8.1", "@npmcli/run-script": "^1.8.1",
@ -90,7 +90,7 @@
"npm-user-validate": "^1.0.1", "npm-user-validate": "^1.0.1",
"npmlog": "~4.1.2", "npmlog": "~4.1.2",
"opener": "^1.5.2", "opener": "^1.5.2",
"pacote": "^11.2.1", "pacote": "^11.2.3",
"parse-conflict-json": "^1.1.1", "parse-conflict-json": "^1.1.1",
"qrcode-terminal": "^0.12.0", "qrcode-terminal": "^0.12.0",
"read": "~1.0.7", "read": "~1.0.7",
@ -180,7 +180,7 @@
], ],
"devDependencies": { "devDependencies": {
"cmark-gfm": "^0.8.5", "cmark-gfm": "^0.8.5",
"eslint": "^7.14.0", "eslint": "^7.18.0",
"eslint-plugin-import": "^2.22.1", "eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1", "eslint-plugin-promise": "^4.2.1",