Skip to content

Commit b89c7ae

Browse files
npm-robotdanielleadams
authored andcommitted
deps: upgrade npm to 8.0.0
PR-URL: #40369 Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Danielle Adams <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 8d1c471 commit b89c7ae

File tree

748 files changed

+4610
-97661
lines changed

Some content is hidden

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

748 files changed

+4610
-97661
lines changed

deps/npm/docs/content/configuring-npm/package-lock-json.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ Package descriptors have the following fields:
138138
the case of packages fetched from the registry, this will be a url to a
139139
tarball. In the case of git dependencies, this will be the full git url
140140
with commit sha. In the case of link dependencies, this will be the
141-
location of the link target.
141+
location of the link target. `registry.npmjs.org` is a magic value meaning
142+
"the currently configured registry".
142143

143144
* integrity: A `sha512` or `sha1` [Standard Subresource
144145
Integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/)
@@ -201,7 +202,8 @@ Dependency objects have the following fields:
201202

202203
* resolved: For registry sources this is path of the tarball relative to
203204
the registry URL. If the tarball URL isn't on the same server as the
204-
registry URL then this is a complete URL.
205+
registry URL then this is a complete URL. `registry.npmjs.org` is a magic
206+
value meaning "the currently configured registry".
205207

206208
* bundled: If true, this is the bundled dependency and will be installed
207209
by the parent module. When installing, this module will be extracted

deps/npm/docs/content/using-npm/registry.md

+7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ The registry URL used is determined by the scope of the package (see
3030
supplied by the `registry` config parameter. See [`npm config`](/commands/npm-config),
3131
[`npmrc`](/configuring-npm/npmrc), and [`config`](/using-npm/config) for more on managing npm's configuration.
3232

33+
When the default registry is used in a package-lock or shrinkwrap is has the
34+
special meaning of "the currently configured registry". If you create a lock
35+
file while using the default registry you can switch to another registry and
36+
npm will install packages from the new registry, but if you create a lock
37+
file while using a custom registry packages will be installed from that
38+
registry even after you change to another registry.
39+
3340
### Does npm send any information about me back to the registry?
3441

3542
Yes.

deps/npm/docs/content/using-npm/scope.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ desired, with `npm access` or on the npmjs.com website.
9898

9999
Scopes can be associated with a separate registry. This allows you to
100100
seamlessly use a mix of packages from the primary npm registry and one or more
101-
private registries, such as npm Enterprise.
101+
private registries, such as [GitHub Packages](https://github.com/features/packages) or the open source [Verdaccio](https://verdaccio.org)
102+
project.
102103

103104
You can associate a scope with a registry at login, e.g.
104105

deps/npm/docs/content/using-npm/workspaces.md

+16
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,22 @@ npm run test --workspaces
176176

177177
Will run the `test` script in both `./packages/a` and `./packages/b`.
178178

179+
Commands will be run in each workspace in the order they appear in your `package.json`
180+
181+
```
182+
{
183+
"workspaces": [ "packages/a", "packages/b" ]
184+
}
185+
```
186+
187+
Order of run is different with:
188+
189+
```
190+
{
191+
"workspaces": [ "packages/b", "packages/a" ]
192+
}
193+
```
194+
179195
### Ignoring missing scripts
180196

181197
It is not required for all of the workspaces to implement scripts run with the `npm run` command.

deps/npm/docs/output/commands/npm-ls.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ <h3 id="description">Description</h3>
159159
the results to only the paths to the packages named. Note that nested
160160
packages will <em>also</em> show the paths to the specified packages. For
161161
example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
162-
<pre lang="bash"><code>npm@7.24.0 /path/to/npm
162+
<pre lang="bash"><code>npm@8.0.0 /path/to/npm
163163
164164
165165
</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.24.0</p>
151+
<p>8.0.0</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/docs/output/configuring-npm/package-lock-json.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ <h4 id="packages"><code>packages</code></h4>
262262
the case of packages fetched from the registry, this will be a url to a
263263
tarball. In the case of git dependencies, this will be the full git url
264264
with commit sha. In the case of link dependencies, this will be the
265-
location of the link target.</p>
265+
location of the link target. <code>registry.npmjs.org</code> is a magic value meaning
266+
“the currently configured registry”.</p>
266267
</li>
267268
<li>
268269
<p>integrity: A <code>sha512</code> or <code>sha1</code> <a href="https://w3c.github.io/webappsec/specs/subresourceintegrity/">Standard Subresource
@@ -334,7 +335,8 @@ <h4 id="dependencies">dependencies</h4>
334335
<li>
335336
<p>resolved: For registry sources this is path of the tarball relative to
336337
the registry URL. If the tarball URL isn’t on the same server as the
337-
registry URL then this is a complete URL.</p>
338+
registry URL then this is a complete URL. <code>registry.npmjs.org</code> is a magic
339+
value meaning “the currently configured registry”.</p>
338340
</li>
339341
<li>
340342
<p>bundled: If true, this is the bundled dependency and will be installed

deps/npm/docs/output/using-npm/registry.html

+6
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ <h2 id="table-of-contents">Table of contents</h2>
163163
<a href="../using-npm/scope.html"><code>scope</code></a>. If no scope is specified, the default registry is used, which is
164164
supplied by the <code>registry</code> config parameter. See <a href="../commands/npm-config.html"><code>npm config</code></a>,
165165
<a href="../configuring-npm/npmrc.html"><code>npmrc</code></a>, and <a href="../using-npm/config.html"><code>config</code></a> for more on managing npm’s configuration.</p>
166+
<p>When the default registry is used in a package-lock or shrinkwrap is has the
167+
special meaning of “the currently configured registry”. If you create a lock
168+
file while using the default registry you can switch to another registry and
169+
npm will install packages from the new registry, but if you create a lock
170+
file while using a custom registry packages will be installed from that
171+
registry even after you change to another registry.</p>
166172
<h3 id="does-npm-send-any-information-about-me-back-to-the-registry">Does npm send any information about me back to the registry?</h3>
167173
<p>Yes.</p>
168174
<p>When making requests of the registry npm adds two headers with information

deps/npm/docs/output/using-npm/scope.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ <h4 id="publishing-private-scoped-packages-to-the-npm-registry">Publishing priva
206206
<h3 id="associating-a-scope-with-a-registry">Associating a scope with a registry</h3>
207207
<p>Scopes can be associated with a separate registry. This allows you to
208208
seamlessly use a mix of packages from the primary npm registry and one or more
209-
private registries, such as npm Enterprise.</p>
209+
private registries, such as <a href="https://github.com/features/packages">GitHub Packages</a> or the open source <a href="https://verdaccio.org">Verdaccio</a>
210+
project.</p>
210211
<p>You can associate a scope with a registry at login, e.g.</p>
211212
<pre lang="bash"><code>npm login --registry=http://reg.example.com --scope=@myco
212213
</code></pre>

deps/npm/docs/output/using-npm/workspaces.html

+10
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,16 @@ <h3 id="running-commands-in-the-context-of-workspaces">Running commands in the c
264264
<pre><code>npm run test --workspaces
265265
</code></pre>
266266
<p>Will run the <code>test</code> script in both <code>./packages/a</code> and <code>./packages/b</code>.</p>
267+
<p>Commands will be run in each workspace in the order they appear in your <code>package.json</code></p>
268+
<pre><code>{
269+
"workspaces": [ "packages/a", "packages/b" ]
270+
}
271+
</code></pre>
272+
<p>Order of run is different with:</p>
273+
<pre><code>{
274+
"workspaces": [ "packages/b", "packages/a" ]
275+
}
276+
</code></pre>
267277
<h3 id="ignoring-missing-scripts">Ignoring missing scripts</h3>
268278
<p>It is not required for all of the workspaces to implement scripts run with the <code>npm run</code> command.</p>
269279
<p>By running the command with the <code>--if-present</code> flag, npm will ignore workspaces missing target script.</p>

deps/npm/lib/cache.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const semver = require('semver')
88
const BaseCommand = require('./base-command.js')
99
const npa = require('npm-package-arg')
1010
const jsonParse = require('json-parse-even-better-errors')
11+
const localeCompare = require('@isaacs/string-locale-compare')('en')
1112

1213
const searchCachePackage = async (path, spec, cacheKeys) => {
1314
const parsed = npa(spec)
@@ -212,10 +213,10 @@ class Cache extends BaseCommand {
212213
for (const key of keySet)
213214
results.add(key)
214215
}
215-
[...results].sort((a, b) => a.localeCompare(b, 'en')).forEach(key => this.npm.output(key))
216+
[...results].sort(localeCompare).forEach(key => this.npm.output(key))
216217
return
217218
}
218-
cacheKeys.sort((a, b) => a.localeCompare(b, 'en')).forEach(key => this.npm.output(key))
219+
cacheKeys.sort(localeCompare).forEach(key => this.npm.output(key))
219220
}
220221
}
221222

deps/npm/lib/config.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const writeFile = promisify(fs.writeFile)
1010
const { spawn } = require('child_process')
1111
const { EOL } = require('os')
1212
const ini = require('ini')
13+
const localeCompare = require('@isaacs/string-locale-compare')('en')
1314

1415
// take an array of `[key, value, k2=v2, k3, v3, ...]` and turn into
1516
// { key: value, k2: v2, k3: v3 }
@@ -209,7 +210,7 @@ class Config extends BaseCommand {
209210
; Configs like \`//<hostname>/:_authToken\` are auth that is restricted
210211
; to the registry host specified.
211212
212-
${data.split('\n').sort((a, b) => a.localeCompare(b, 'en')).join('\n').trim()}
213+
${data.split('\n').sort(localeCompare).join('\n').trim()}
213214
214215
;;;;
215216
; all available options shown below with default values
@@ -238,7 +239,7 @@ ${defData}
238239
if (where === 'default' && !long)
239240
continue
240241

241-
const keys = Object.keys(data).sort((a, b) => a.localeCompare(b, 'en'))
242+
const keys = Object.keys(data).sort(localeCompare)
242243
if (!keys.length)
243244
continue
244245

deps/npm/lib/deprecate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Deprecate extends BaseCommand {
4949
}
5050

5151
async deprecate ([pkg, msg]) {
52-
// msg == null becase '' is a valid value, it indicates undeprecate
52+
// msg == null because '' is a valid value, it indicates undeprecate
5353
if (!pkg || msg == null)
5454
throw this.usageError()
5555

deps/npm/lib/help.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const path = require('path')
33
const openUrl = require('./utils/open-url.js')
44
const { promisify } = require('util')
55
const glob = promisify(require('glob'))
6+
const localeCompare = require('@isaacs/string-locale-compare')('en')
67

78
const BaseCommand = require('./base-command.js')
89

@@ -82,7 +83,7 @@ class Help extends BaseCommand {
8283
if (aManNumber !== bManNumber)
8384
return aManNumber - bManNumber
8485

85-
return a.localeCompare(b, 'en')
86+
return localeCompare(a, b)
8687
})
8788
const man = mans[0]
8889

deps/npm/lib/ls.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const _problems = Symbol('problems')
2222
const _required = Symbol('required')
2323
const _type = Symbol('type')
2424
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
25+
const localeCompare = require('@isaacs/string-locale-compare')('en')
2526

2627
class LS extends ArboristWorkspaceCmd {
2728
/* istanbul ignore next - see test/lib/load-all-commands.js */
@@ -503,8 +504,7 @@ const augmentNodesWithMetadata = ({
503504
return node
504505
}
505506

506-
const sortAlphabetically = (a, b) =>
507-
a.pkgid.localeCompare(b.pkgid, 'en')
507+
const sortAlphabetically = ({ pkgid: a }, { pkgid: b }) => localeCompare(a, b)
508508

509509
const humanOutput = ({ color, result, seenItems, unicode }) => {
510510
// we need to traverse the entire tree in order to determine which items

deps/npm/lib/npm.js

-3
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,3 @@ const npm = module.exports = new class extends EventEmitter {
355355
this.log.showProgress()
356356
}
357357
}()
358-
359-
if (require.main === module)
360-
require('./cli.js')(process)

deps/npm/lib/outdated.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const color = require('chalk')
66
const styles = require('ansistyles')
77
const npa = require('npm-package-arg')
88
const pickManifest = require('npm-pick-manifest')
9+
const localeCompare = require('@isaacs/string-locale-compare')('en')
910

1011
const Arborist = require('@npmcli/arborist')
1112

@@ -85,7 +86,10 @@ class Outdated extends ArboristWorkspaceCmd {
8586
}))
8687

8788
// sorts list alphabetically
88-
const outdated = this.list.sort((a, b) => a.name.localeCompare(b.name, 'en'))
89+
const outdated = this.list.sort((a, b) => localeCompare(a.name, b.name))
90+
91+
if (outdated.length > 0)
92+
process.exitCode = 1
8993

9094
// return if no outdated packages
9195
if (outdated.length === 0 && !this.npm.config.get('json'))

deps/npm/lib/utils/completion/installed-deep.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const { resolve } = require('path')
22
const Arborist = require('@npmcli/arborist')
3+
const localeCompare = require('@isaacs/string-locale-compare')('en')
34

45
const installedDeep = async (npm) => {
56
const {
@@ -15,8 +16,7 @@ const installedDeep = async (npm) => {
1516
return i
1617
})
1718
.filter(i => (i.depth - 1) <= depth)
18-
.sort((a, b) => a.depth - b.depth)
19-
.sort((a, b) => a.depth === b.depth ? a.name.localeCompare(b.name, 'en') : 0)
19+
.sort((a, b) => (a.depth - b.depth) || localeCompare(a.name, b.name))
2020

2121
const res = new Set()
2222
const gArb = new Arborist({ global: true, path: resolve(npm.globalDir, '..') })

deps/npm/lib/utils/config/describe-all.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const definitions = require('./definitions.js')
2+
const localeCompare = require('@isaacs/string-locale-compare')('en')
23
const describeAll = () => {
34
// sort not-deprecated ones to the top
45
/* istanbul ignore next - typically already sorted in the definitions file,
@@ -7,7 +8,7 @@ const describeAll = () => {
78
const sort = ([keya, {deprecated: depa}], [keyb, {deprecated: depb}]) => {
89
return depa && !depb ? 1
910
: !depa && depb ? -1
10-
: keya.localeCompare(keyb, 'en')
11+
: localeCompare(keya, keyb)
1112
}
1213
return Object.entries(definitions).sort(sort)
1314
.map(([key, def]) => def.describe())

deps/npm/lib/utils/npm-usage.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const { dirname } = require('path')
22
const { cmdList } = require('./cmd-list')
3+
const localeCompare = require('@isaacs/string-locale-compare')('en')
34

45
module.exports = (npm) => {
56
const usesBrowser = npm.config.get('viewer') === 'browser'
@@ -62,7 +63,7 @@ const usages = (npm) => {
6263
maxLen = Math.max(maxLen, c.length)
6364
return set
6465
}, [])
65-
.sort((a, b) => a[0].localeCompare(b[0], 'en'))
66+
.sort(([a], [b]) => localeCompare(a, b))
6667
.map(([c, usage]) => `\n ${c}${' '.repeat(maxLen - c.length + 1)}${
6768
(usage.split('\n').join('\n' + ' '.repeat(maxLen + 5)))}`)
6869
.join('\n')

deps/npm/lib/utils/open-url.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const { URL } = require('url')
44

55
// attempt to open URL in web-browser, print address otherwise:
66
const open = async (npm, url, errMsg) => {
7+
url = encodeURI(url)
78
const browser = npm.config.get('browser')
89

910
function printAlternateMsg () {

deps/npm/lib/utils/tar.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ const ssri = require('ssri')
33
const npmlog = require('npmlog')
44
const formatBytes = require('./format-bytes.js')
55
const columnify = require('columnify')
6+
const localeCompare = require('@isaacs/string-locale-compare')('en', {
7+
sensitivity: 'case',
8+
numeric: true,
9+
})
610

711
const logTar = (tarball, opts = {}) => {
812
const { unicode = false, log = npmlog } = opts
@@ -75,12 +79,7 @@ const getContents = async (manifest, tarball) => {
7579
algorithms: ['sha1', 'sha512'],
7680
})
7781

78-
const comparator = (a, b) => {
79-
return a.path.localeCompare(b.path, 'en', {
80-
sensitivity: 'case',
81-
numeric: true,
82-
})
83-
}
82+
const comparator = ({ path: a }, { path: b }) => localeCompare(a, b)
8483

8584
const isUpper = (str) => {
8685
const ch = str.charAt(0)

deps/npm/man/man1/npm-access.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "NPM\-ACCESS" "1" "September 2021" "" ""
1+
.TH "NPM\-ACCESS" "1" "October 2021" "" ""
22
.SH "NAME"
33
\fBnpm-access\fR \- Set access level on published packages
44
.SS Synopsis

deps/npm/man/man1/npm-adduser.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "NPM\-ADDUSER" "1" "September 2021" "" ""
1+
.TH "NPM\-ADDUSER" "1" "October 2021" "" ""
22
.SH "NAME"
33
\fBnpm-adduser\fR \- Add a registry user account
44
.SS Synopsis

deps/npm/man/man1/npm-audit.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "NPM\-AUDIT" "1" "September 2021" "" ""
1+
.TH "NPM\-AUDIT" "1" "October 2021" "" ""
22
.SH "NAME"
33
\fBnpm-audit\fR \- Run a security audit
44
.SS Synopsis

deps/npm/man/man1/npm-bin.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "NPM\-BIN" "1" "September 2021" "" ""
1+
.TH "NPM\-BIN" "1" "October 2021" "" ""
22
.SH "NAME"
33
\fBnpm-bin\fR \- Display npm bin folder
44
.SS Synopsis

deps/npm/man/man1/npm-bugs.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "NPM\-BUGS" "1" "September 2021" "" ""
1+
.TH "NPM\-BUGS" "1" "October 2021" "" ""
22
.SH "NAME"
33
\fBnpm-bugs\fR \- Report bugs for a package in a web browser
44
.SS Synopsis

deps/npm/man/man1/npm-cache.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "NPM\-CACHE" "1" "September 2021" "" ""
1+
.TH "NPM\-CACHE" "1" "October 2021" "" ""
22
.SH "NAME"
33
\fBnpm-cache\fR \- Manipulates packages cache
44
.SS Synopsis

deps/npm/man/man1/npm-ci.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "NPM\-CI" "1" "September 2021" "" ""
1+
.TH "NPM\-CI" "1" "October 2021" "" ""
22
.SH "NAME"
33
\fBnpm-ci\fR \- Install a project with a clean slate
44
.SS Synopsis

deps/npm/man/man1/npm-completion.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "NPM\-COMPLETION" "1" "September 2021" "" ""
1+
.TH "NPM\-COMPLETION" "1" "October 2021" "" ""
22
.SH "NAME"
33
\fBnpm-completion\fR \- Tab Completion for npm
44
.SS Synopsis

deps/npm/man/man1/npm-config.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "NPM\-CONFIG" "1" "September 2021" "" ""
1+
.TH "NPM\-CONFIG" "1" "October 2021" "" ""
22
.SH "NAME"
33
\fBnpm-config\fR \- Manage the npm configuration files
44
.SS Synopsis

0 commit comments

Comments
 (0)