Skip to content

Commit 0baa610

Browse files
ruyadornotargos
authored andcommitted
deps: upgrade npm to 7.1.1
PR-URL: #36459 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Myles Borins <[email protected]>
1 parent c6e65d0 commit 0baa610

File tree

127 files changed

+4159
-764
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+4159
-764
lines changed

β€Ždeps/npm/CHANGELOG.md

+47
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
1+
## 7.1.1 (2020-12-08)
2+
3+
### DEPENDENCIES
4+
5+
* [`bf09e719c`](https://github.com/npm/cli/commit/bf09e719c7f563a255b1e9af6b1237ebc5598db6)
6+
7+
* Much stricter tree integrity guarantees
8+
* Fix issues where the root project is a symlink, or linked as a
9+
workspace
10+
* [`7ceb5b728`](https://github.com/npm/cli/commit/7ceb5b728b9f326c567f5ffe5831c9eccf013aa0)
11+
12+
* [`77c6ced2a`](https://github.com/npm/cli/commit/77c6ced2a6daaadbff715c8f05b2e61ba76e9bab)
13+
14+
* Avoid caching headers that are hazardous or unnecessary to leave
15+
lying around (authorization, npm-session, etc.)
16+
* [#38](https://github.com/npm/make-fetch-happen/pull/38) Include query
17+
string in cache key ([@jpb](https://github.com/jpb))
18+
* [`0ef25b6cd`](https://github.com/npm/cli/commit/0ef25b6cd2921794d36f066e2b11c406342cf167)
19+
20+
* Update to accept query params as options, so we can paginate.
21+
([@nlf](https://github.com/nlf))
22+
* [`518a66450`](https://github.com/npm/cli/commit/518a664500bcde30475788e8c1c3e651f23e881b)
23+
`@npmcli/[email protected]`:
24+
* Do not allow path options to be set to a boolean `false` value
25+
* [`3d7aff9d8`](https://github.com/npm/cli/commit/3d7aff9d8dd1cf29956aa306464cd44fbc2af426)
26+
update all dependencies using latest npm to install them
27+
28+
### TESTS
29+
30+
* [`2848f5940`](https://github.com/npm/cli/commit/2848f594034b87939bfc5546e3e603f123d98a01)
31+
[npm/statusboard#173](https://github.com/npm/statusboard/issues/173)
32+
[#2293](https://github.com/npm/cli/issues/2293) npm shrinkwrap
33+
([@ruyadorno](https://github.com/ruyadorno))
34+
* [`f6824459a`](https://github.com/npm/cli/commit/f6824459ae0c86e2fa9c84b3dcec85f572ae8e1b)
35+
[#2302](https://github.com/npm/cli/issues/2302) npm deprecate
36+
([@nlf](https://github.com/nlf))
37+
* [`b7d74b627`](https://github.com/npm/cli/commit/b7d74b627859f08fca23209d6e0d3ec6657a4489)
38+
[npm/statusboard#180](https://github.com/npm/statusboard/issues/180)
39+
[#2304](https://github.com/npm/cli/issues/2304) npm unpublish
40+
([@ruyadorno](https://github.com/ruyadorno))
41+
42+
### FEATURES
43+
44+
* [`3db90d944`](https://github.com/npm/cli/commit/3db90d94474f673591811fdab5eb6a5bfdeba261)
45+
[#2303](https://github.com/npm/cli/issues/2303) allow for passing object
46+
keys to searchopts to allow pagination ([@nlf](https://github.com/nlf))
47+
148
## 7.1.0 (2020-12-04)
249

350
### FEATURES

β€Ždeps/npm/docs/output/commands/npm-ls.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ <h3 id="description">Description</h3>
156156
limit the results to only the paths to the packages named. Note that
157157
nested packages will <em>also</em> show the paths to the specified packages.
158158
For example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
159-
<pre lang="bash"><code> [email protected].0 /path/to/npm
159+
<pre lang="bash"><code> [email protected].1 /path/to/npm
160160
└─┬ [email protected]
161161
└── [email protected]
162162
</code></pre>

β€Ždeps/npm/docs/output/commands/npm.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ <h2 id="table-of-contents">Table of contents</h2>
148148
<pre lang="bash"><code>npm &lt;command&gt; [args]
149149
</code></pre>
150150
<h3 id="version">Version</h3>
151-
<p>7.1.0</p>
151+
<p>7.1.1</p>
152152
<h3 id="description">Description</h3>
153153
<p>npm is the package manager for the Node JavaScript platform. It puts
154154
modules in place so that node can find them, and manages dependency

β€Ždeps/npm/lib/deprecate.js

+58-54
Original file line numberDiff line numberDiff line change
@@ -5,68 +5,72 @@ const fetch = require('npm-registry-fetch')
55
const otplease = require('./utils/otplease.js')
66
const npa = require('npm-package-arg')
77
const semver = require('semver')
8-
const getItentity = require('./utils/get-identity')
8+
const getIdentity = require('./utils/get-identity.js')
9+
const libaccess = require('libnpmaccess')
10+
const usageUtil = require('./utils/usage.js')
911

10-
module.exports = deprecate
12+
const UsageError = () =>
13+
Object.assign(new Error(`\nUsage: ${usage}`), {
14+
code: 'EUSAGE',
15+
})
1116

12-
deprecate.usage = 'npm deprecate <pkg>[@<version>] <message>'
17+
const usage = usageUtil(
18+
'deprecate',
19+
'npm deprecate <pkg>[@<version>] <message>'
20+
)
1321

14-
deprecate.completion = function (opts, cb) {
15-
return Promise.resolve().then(() => {
16-
if (opts.conf.argv.remain.length > 2)
17-
return
18-
return getItentity(npm.flatOptions).then(username => {
19-
if (username) {
20-
// first, get a list of remote packages this user owns.
21-
// once we have a user account, then don't complete anything.
22-
// get the list of packages by user
23-
return fetch(
24-
`/-/by-user/${encodeURIComponent(username)}`,
25-
npm.flatOptions
26-
).then(list => list[username])
27-
}
22+
const completion = (opts, cb) => {
23+
if (opts.conf.argv.remain.length > 1)
24+
return cb(null, [])
25+
26+
return getIdentity(npm.flatOptions).then((username) => {
27+
return libaccess.lsPackages(username, npm.flatOptions).then((packages) => {
28+
return Object.keys(packages)
29+
.filter((name) => packages[name] === 'write' &&
30+
(opts.conf.argv.remain.length === 0 || name.startsWith(opts.conf.argv.remain[0]))
31+
)
2832
})
29-
}).then(() => cb(), er => cb(er))
33+
}).then((list) => cb(null, list), (err) => cb(err))
3034
}
3135

32-
function deprecate ([pkg, msg], opts, cb) {
33-
if (typeof cb !== 'function') {
34-
cb = opts
35-
opts = null
36-
}
37-
opts = opts || npm.flatOptions
38-
return Promise.resolve().then(() => {
39-
if (msg == null)
40-
throw new Error(`Usage: ${deprecate.usage}`)
41-
// fetch the data and make sure it exists.
42-
const p = npa(pkg)
36+
const cmd = (args, cb) =>
37+
deprecate(args)
38+
.then(() => cb())
39+
.catch(err => cb(err.code === 'EUSAGE' ? err.message : err))
40+
41+
const deprecate = async ([pkg, msg]) => {
42+
if (!pkg || !msg)
43+
throw UsageError()
44+
45+
// fetch the data and make sure it exists.
46+
const p = npa(pkg)
47+
// npa makes the default spec "latest", but for deprecation
48+
// "*" is the appropriate default.
49+
const spec = p.rawSpec === '' ? '*' : p.fetchSpec
4350

44-
// npa makes the default spec "latest", but for deprecation
45-
// "*" is the appropriate default.
46-
const spec = p.rawSpec === '' ? '*' : p.fetchSpec
51+
if (semver.validRange(spec, true) === null)
52+
throw new Error(`invalid version range: ${spec}`)
4753

48-
if (semver.validRange(spec, true) === null)
49-
throw new Error('invalid version range: ' + spec)
54+
const uri = '/' + p.escapedName
55+
const packument = await fetch.json(uri, {
56+
...npm.flatOptions,
57+
spec: p,
58+
query: { write: true },
59+
})
5060

51-
const uri = '/' + p.escapedName
52-
return fetch.json(uri, {
53-
...opts,
54-
spec: p,
55-
query: { write: true },
56-
}).then(packument => {
57-
// filter all the versions that match
58-
Object.keys(packument.versions)
59-
.filter(v => semver.satisfies(v, spec))
60-
.forEach(v => {
61-
packument.versions[v].deprecated = msg
62-
})
63-
return otplease(opts, opts => fetch(uri, {
64-
...opts,
65-
spec: p,
66-
method: 'PUT',
67-
body: packument,
68-
ignoreBody: true,
69-
}))
61+
Object.keys(packument.versions)
62+
.filter(v => semver.satisfies(v, spec))
63+
.forEach(v => {
64+
packument.versions[v].deprecated = msg
7065
})
71-
}).then(() => cb(), cb)
66+
67+
return otplease(npm.flatOptions, opts => fetch(uri, {
68+
...opts,
69+
spec: p,
70+
method: 'PUT',
71+
body: packument,
72+
ignoreBody: true,
73+
}))
7274
}
75+
76+
module.exports = Object.assign(cmd, { completion, usage })

β€Ždeps/npm/lib/shrinkwrap.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1+
'use strict'
2+
3+
const { resolve, basename } = require('path')
4+
const { promises: { unlink } } = require('fs')
15
const Arborist = require('@npmcli/arborist')
6+
const log = require('npmlog')
7+
28
const npm = require('./npm.js')
9+
const completion = require('./utils/completion/none.js')
310
const usageUtil = require('./utils/usage.js')
411
const usage = usageUtil('shrinkwrap', 'npm shrinkwrap')
5-
const { resolve, basename } = require('path')
6-
const log = require('npmlog')
712

813
const cmd = (args, cb) => shrinkwrap().then(() => cb()).catch(cb)
914

10-
const completion = require('./utils/completion/none.js')
11-
1215
const shrinkwrap = async () => {
1316
// if has a npm-shrinkwrap.json, nothing to do
1417
// if has a package-lock.json, rename to npm-shrinkwrap.json
@@ -31,7 +34,6 @@ const shrinkwrap = async () => {
3134
const newFile = meta.hiddenLockfile || !meta.loadedFromDisk
3235
const oldFilename = meta.filename
3336
const notSW = !newFile && basename(oldFilename) !== 'npm-shrinkwrap.json'
34-
const { promises: { unlink } } = require('fs')
3537

3638
meta.hiddenLockfile = false
3739
meta.filename = sw

β€Ždeps/npm/lib/unpublish.js

+31-24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
const path = require('path')
24
const util = require('util')
35
const log = require('npmlog')
@@ -11,7 +13,7 @@ const npm = require('./npm.js')
1113
const usageUtil = require('./utils/usage.js')
1214
const output = require('./utils/output.js')
1315
const otplease = require('./utils/otplease.js')
14-
const whoami = util.promisify(require('./whoami.js'))
16+
const getIdentity = require('./utils/get-identity.js')
1517

1618
const usage = usageUtil('unpublish', 'npm unpublish [<@scope>/]<pkg>[@<version>]')
1719

@@ -25,18 +27,18 @@ const completionFn = async (args) => {
2527
const { partialWord, conf } = args
2628

2729
if (conf.argv.remain.length >= 3)
28-
return
30+
return []
2931

30-
const username = await whoami([], true)
32+
const opts = npm.flatOptions
33+
const username = await getIdentity({ ...opts }).catch(() => null)
3134
if (!username)
3235
return []
33-
const opts = npm.flatOptions
3436

3537
const access = await libaccess.lsPackages(username, opts)
3638
// do a bit of filtering at this point, so that we don't need
3739
// to fetch versions for more than one thing, but also don't
3840
// accidentally a whole project
39-
let pkgs = Object.keys(access)
41+
let pkgs = Object.keys(access || {})
4042
if (!partialWord || !pkgs.length)
4143
return pkgs
4244

@@ -55,18 +57,20 @@ const completionFn = async (args) => {
5557

5658
async function unpublish (args) {
5759
if (args.length > 1)
58-
throw usage
60+
throw new Error(usage)
5961

6062
const spec = args.length && npa(args[0])
6163
const opts = npm.flatOptions
6264
const { force, silent, loglevel } = opts
63-
let ret
65+
let res
66+
let pkgName
67+
let pkgVersion
6468

6569
log.silly('unpublish', 'args[0]', args[0])
6670
log.silly('unpublish', 'spec', spec)
6771

6872
if (!spec.rawSpec && !force) {
69-
throw (
73+
throw new Error(
7074
'Refusing to delete entire project.\n' +
7175
'Run with --force to do this.\n' +
7276
usage
@@ -77,31 +81,34 @@ async function unpublish (args) {
7781
// if there's a package.json in the current folder, then
7882
// read the package name and version out of that.
7983
const pkgJson = path.join(npm.localPrefix, 'package.json')
80-
const manifest = await readJson(pkgJson)
81-
82-
log.verbose('unpublish', manifest)
83-
84-
const { name, version, publishConfig } = manifest
85-
const pkgJsonSpec = npa.resolve(name, version)
86-
84+
let manifest
8785
try {
88-
ret = await otplease(opts, opts => libunpub(pkgJsonSpec, { ...opts, publishConfig }))
86+
manifest = await readJson(pkgJson)
8987
} catch (err) {
9088
if (err && err.code !== 'ENOENT' && err.code !== 'ENOTDIR')
9189
throw err
9290
else
93-
throw `Usage: ${usage}`
91+
throw new Error(`Usage: ${usage}`)
9492
}
95-
} else
96-
ret = await otplease(opts, opts => libunpub(spec, opts))
9793

98-
if (!silent && loglevel !== 'silent') {
99-
output(`- ${spec.name}${
100-
spec.type === 'version' ? `@${spec.rawSpec}` : ''
101-
}`)
94+
log.verbose('unpublish', manifest)
95+
96+
const { name, version, publishConfig } = manifest
97+
const pkgJsonSpec = npa.resolve(name, version)
98+
99+
res = await otplease(opts, opts => libunpub(pkgJsonSpec, { ...opts, publishConfig }))
100+
pkgName = name
101+
pkgVersion = version ? `@${version}` : ''
102+
} else {
103+
res = await otplease(opts, opts => libunpub(spec, opts))
104+
pkgName = spec.name
105+
pkgVersion = spec.type === 'version' ? `@${spec.rawSpec}` : ''
102106
}
103107

104-
return ret
108+
if (!silent && loglevel !== 'silent')
109+
output(`- ${pkgName}${pkgVersion}`)
110+
111+
return res
105112
}
106113

107114
module.exports = Object.assign(cmd, { completion, usage })

β€Ždeps/npm/lib/utils/completion/installed-deep.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const readNames = async () => {
1313

1414
const getValues = (tree) =>
1515
[...tree.inventory.values()]
16+
.filter(i => i.location !== '' && !i.isRoot)
1617
.map(i => {
1718
return i
1819
})

β€Ždeps/npm/lib/utils/flat-options.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
const log = require('npmlog')
55
const crypto = require('crypto')
6+
const querystring = require('querystring')
67
const npmSession = crypto.randomBytes(8).toString('hex')
78
log.verbose('npm-session', npmSession)
89
const { join } = require('path')
@@ -92,7 +93,7 @@ const flatten = obj => ({
9293
description: obj.description,
9394
exclude: obj.searchexclude,
9495
limit: obj.searchlimit || 20,
95-
opts: obj.searchopts,
96+
opts: querystring.parse(obj.searchopts),
9697
staleness: obj.searchstaleness,
9798
},
9899

β€Ždeps/npm/man/man1/npm-ls.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ For example, running \fBnpm ls promzard\fP in npm's source tree will show:
2222
.P
2323
.RS 2
2424
.nf
25-
npm@7\.1\.0 /path/to/npm
25+
npm@7\.1\.1 /path/to/npm
2626
└─┬ init\-package\-json@0\.0\.4
2727
└── promzard@0\.1\.5
2828
.fi

β€Ždeps/npm/man/man1/npm.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ npm <command> [args]
1010
.RE
1111
.SS Version
1212
.P
13-
7\.1\.0
13+
7\.1\.1
1414
.SS Description
1515
.P
1616
npm is the package manager for the Node JavaScript platform\. It puts

0 commit comments

Comments
Β (0)