Skip to content

Commit

Permalink
Merge branch 'nodejs:master' into fix-events-require
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwzbwcom committed Sep 3, 2021
2 parents 10918f4 + f26c2ce commit e36aa6a
Show file tree
Hide file tree
Showing 3,636 changed files with 84,998 additions and 47,822 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .eslintrc.js
Expand Up @@ -18,6 +18,7 @@ const hacks = [
'eslint-plugin-markdown',
'@babel/eslint-parser',
'@babel/plugin-syntax-class-properties',
'@babel/plugin-syntax-import-assertions',
'@babel/plugin-syntax-top-level-await',
];
Module._findPath = (request, paths, isMain) => {
Expand All @@ -41,6 +42,7 @@ module.exports = {
babelOptions: {
plugins: [
Module._findPath('@babel/plugin-syntax-class-properties'),
Module._findPath('@babel/plugin-syntax-import-assertions'),
Module._findPath('@babel/plugin-syntax-top-level-await'),
],
},
Expand Down Expand Up @@ -362,5 +364,6 @@ module.exports = {
btoa: 'readable',
atob: 'readable',
performance: 'readable',
structuredClone: 'readable',
},
};
6 changes: 3 additions & 3 deletions .github/workflows/authors.yml
Expand Up @@ -12,11 +12,11 @@ jobs:
- run: "tools/update-authors.js" # run the AUTHORS tool
- uses: gr2m/create-or-update-pull-request-action@v1 # create a PR or update the Action's existing PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
with:
title: "meta: update AUTHORS"
author: Node.js GitHub Bot <github-bot@iojs.org>
body: "If this PR exists, there's presumably new additions to the AUTHORS file. This is an automatically generated PR by the `authors.yml` GitHub Action, which runs `tools/update-authors.js` and submits a new PR or updates an existing PR.\n\nPlease note that there might be duplicate entries. If there are, please remove them and add the duplicate emails to .mailmap directly to this PR."
branch: "actions/authors-update" # custom branch *just* for this Action.
commit-message: "meta: update AUTHORS"
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
labels: meta
title: "meta: update AUTHORS"
4 changes: 2 additions & 2 deletions .github/workflows/find-inactive-collaborators.yml
Expand Up @@ -32,9 +32,9 @@ jobs:
- name: Open pull request
uses: gr2m/create-or-update-pull-request-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
with:
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
author: Node.js GitHub Bot <github-bot@iojs.org>
body: This PR was generated by tools/find-inactive-collaborators.yml.
commit-message: "meta: move one or more collaborators to emeritus"
labels: meta
Expand Down
3 changes: 3 additions & 0 deletions .mailmap
Expand Up @@ -123,6 +123,7 @@ Elliott Cable <me@ell.io>
Eric Phetteplace <phette23@gmail.com>
Ernesto Salazar <ernestoalbertosalazar@gmail.com>
Erwin W. Ramadhan <erwinwahyuramadhan@gmail.com>
Ethan Arrowood <ethan@arrowood.dev> <ethan.arrowood@gmail.com>
Eugene Obrezkov <ghaiklor@gmail.com>
Eugene Ostroukhov <eostroukhov@google.com> <eostroukhov@chromium.org>
Eugene Ostroukhov <eostroukhov@google.com> <eostroukhov@gmail.com>
Expand Down Expand Up @@ -300,6 +301,8 @@ Nebu Pookins <nebu@nebupookins.net>
Netto Farah <nettofarah@gmail.com>
Nicholas Kinsey <pyrotechnick@feistystudios.com>
Nick Soggin <nicksoggin@gmail.com> <iSkore@users.noreply.github.com>
Nigel Kibodeaux <nigelmail@gmail.com> <nigel@team.about.me>
Nikola Glavina <glavina.nikola5@gmail.com> <nikola.glavina@student.um.si>
Nikolai Vavilov <vvnicholas@gmail.com>
Nils Kuhnhenn <lain@volafile.io>
Nitzan Uziely <linkgoron@gmail.com> <nitzan@testim.io>
Expand Down
8 changes: 3 additions & 5 deletions AUTHORS
Expand Up @@ -1237,12 +1237,12 @@ Josh Mays <josh.mays@creditcards.com>
Matt Crummey <mcrummey@validusa.com>
michael6 <michaelf614@gmail.com>
Raja Panidepu <rpanidepu@lmdv-rpani.jomax.paholdings.com>
Ethan Arrowood <ethan.arrowood@gmail.com>
Ethan Arrowood <ethan@arrowood.dev>
Dan Villa <danielavilla02@gmail.com>
CodeTheInternet <edlerner+github@protonmail.com>
Eric Gonzalez <ericxgonzalez@gmail.com>
rgoodwin <rjngoodwin@gmial.com>
Nigel Kibodeaux <nigel@team.about.me>
Nigel Kibodeaux <nigelmail@gmail.com>
fmizzell <fmizzell@1312210.no-reply.drupal.org>
cdnadmin <cdnadmin@collaborare.net>
Paul Lucas <pjl.paul@gmail.com>
Expand Down Expand Up @@ -1772,7 +1772,6 @@ Guilherme Akio Sakae <akio.xd@gmail.com>
Martin Michaelis <code@mgjm.de>
Christopher Sidebottom <chris@damouse.co.uk>
Edward Andrew Robinson <earobinson@gmail.com>
Nigel Kibodeaux <nigelmail@gmail.com>
Shakeel Mohamed <contact@shakeel.xyz>
Tobias Kieslich <tobias.kieslich@gmail.com>
Ruy Adorno <ruyadorno@hotmail.com>
Expand Down Expand Up @@ -3088,7 +3087,7 @@ Anentropic <ego@anentropic.com>
Saleem <hamids2@asme.org>
Julien Poissonnier <julien@caffeine.lu>
zombieleet <zombieleetnca@gmail.com>
Nikola Glavina <nikola.glavina@student.um.si>
Nikola Glavina <glavina.nikola5@gmail.com>
Johannes SchΓΆpp <schoepp@rz.uni-frankfurt.de>
Francisco Ryan Tolmasky I <tolmasky@gmail.com>
Ye-hyoung Kang <keepyourhonor@gmail.com>
Expand Down Expand Up @@ -3167,7 +3166,6 @@ FeelyChau <feely@outlook.com>
Darcy Clarke <darcy@darcyclarke.me>
mayank agarwal <mayankagarwal44442@gmail.com>
woodfairy <d.schmit@m3connect.de>
Nikola Glavina <glavina.nikola5@gmail.com>
Rishabh Mehan <darkrishabh@gmail.com>
Andrew Casey <andrew.casey@microsoft.com>
Anders Kaseorg <andersk@mit.edu>
Expand Down
6 changes: 4 additions & 2 deletions CHANGELOG.md
Expand Up @@ -47,7 +47,8 @@ release.
<a href="doc/changelogs/CHANGELOG_V16.md#16.0.0">16.0.0</a><br/>
</td>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V14.md#14.17.5">14.17.5</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V14.md#14.17.6">14.17.6</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.17.5">14.17.5</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.17.4">14.17.4</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.17.3">14.17.3</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.17.2">14.17.2</a><br/>
Expand Down Expand Up @@ -80,7 +81,8 @@ release.
<a href="doc/changelogs/CHANGELOG_V14.md#14.0.0">14.0.0</a><br/>
</td>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V12.md#12.22.5">12.22.5</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V12.md#12.22.6">12.22.6</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V12.md#12.22.5">12.22.5</a><br/>
<a href="doc/changelogs/CHANGELOG_V12.md#12.22.4">12.22.4</a><br/>
<a href="doc/changelogs/CHANGELOG_V12.md#12.22.3">12.22.3</a><br/>
<a href="doc/changelogs/CHANGELOG_V12.md#12.22.2">12.22.2</a><br/>
Expand Down
10 changes: 8 additions & 2 deletions README.md
Expand Up @@ -171,8 +171,6 @@ For information about the governance of the Node.js project, see
**Colin Ihrig** &lt;cjihrig@gmail.com&gt; (he/him)
* [codebytere](https://github.com/codebytere) -
**Shelley Vohr** &lt;shelley.vohr@gmail.com&gt; (she/her)
* [danbev](https://github.com/danbev) -
**Daniel Bevenius** &lt;daniel.bevenius@gmail.com&gt; (he/him)
* [danielleadams](https://github.com/danielleadams) -
**Danielle Adams** &lt;adamzdanielle@gmail.com&gt; (she/her)
* [fhinkel](https://github.com/fhinkel) -
Expand Down Expand Up @@ -214,6 +212,8 @@ For information about the governance of the Node.js project, see
**Ben Noordhuis** &lt;info@bnoordhuis.nl&gt;
* [chrisdickinson](https://github.com/chrisdickinson) -
**Chris Dickinson** &lt;christopher.s.dickinson@gmail.com&gt;
* [danbev](https://github.com/danbev) -
**Daniel Bevenius** &lt;daniel.bevenius@gmail.com&gt; (he/him)
* [evanlucas](https://github.com/evanlucas) -
**Evan Lucas** &lt;evanlucas@me.com&gt; (he/him)
* [Fishrock123](https://github.com/Fishrock123) -
Expand Down Expand Up @@ -622,12 +622,18 @@ maintaining the Node.js project.
**Qingyu Deng** &lt;i@ayase-lab.com&gt;
* [himadriganguly](https://github.com/himadriganguly) -
**Himadri Ganguly** &lt;himadri.tech@gmail.com&gt; (he/him)
* [iam-frankqiu](https://github.com/iam-frankqiu) -
**Frank Qiu** &lt;iam.frankqiu@gmail.com&gt; (he/him)
* [marsonya](https://github.com/marsonya) -
**Akhil Marsonya** &lt;akhil.marsonya27@gmail.com&gt; (he/him)
* [Mesteery](https://github.com/Mesteery) -
**Mestery** &lt;mestery@pm.me&gt;
* [PoojaDurgad](https://github.com/PoojaDurgad) -
**Pooja Durgad** &lt;Pooja.D.P@ibm.com&gt;
* [RaisinTen](https://github.com/RaisinTen) -
**Darshan Sen** &lt;raisinten@gmail.com&gt;
* [VoltrexMaster](https://github.com/VoltrexMaster) -
**Voltrex** &lt;mohammadkeyvanzade94@gmail.com&gt; (he/him)

### Release keys

Expand Down
21 changes: 21 additions & 0 deletions benchmark/async_hooks/async-local-storage-run.js
@@ -0,0 +1,21 @@
'use strict';
const common = require('../common.js');
const { AsyncLocalStorage } = require('async_hooks');

const bench = common.createBenchmark(main, {
n: [1e7]
});

async function run(store, n) {
for (let i = 0; i < n; i++) {
await new Promise((resolve) => store.run(i, resolve));
}
}

function main({ n }) {
const store = new AsyncLocalStorage();
bench.start();
run(store, n).then(() => {
bench.end(n);
});
}
2 changes: 1 addition & 1 deletion common.gypi
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.21',
'v8_embedder_string': '-node.9',

##### V8 defaults for Node.js #####

Expand Down
13 changes: 13 additions & 0 deletions deps/npm/docs/content/using-npm/scripts.md
Expand Up @@ -203,6 +203,19 @@ will default the `start` command to `node server.js`. `prestart` and
* `test`
* `posttest`

#### A Note on a lack of [`npm uninstall`](/commands/npm-uninstall) scripts

While npm v6 had `uninstall` lifecycle scripts, npm v7 does not. Removal of a package can happen for a wide variety of reasons, and there's no clear way to currently give the script enough context to be useful.

Reasons for a package removal include:

* a user directly uninstalled this package
* a user uninstalled a dependant package and so this dependency is being uninstalled
* a user uninstalled a dependant package but another package also depends on this version
* this version has been merged as a duplicate with another version
* etc.

Due to the lack of necessary context, `uninstall` lifecycle scripts are not implemented and will not function.

### User

Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-ls.html
Expand Up @@ -159,7 +159,7 @@ <h3 id="description">Description</h3>
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
example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
<pre lang="bash"><code>npm@7.21.0 /path/to/npm
<pre lang="bash"><code>npm@7.21.1 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm.html
Expand Up @@ -148,7 +148,7 @@ <h2 id="table-of-contents">Table of contents</h2>
<pre lang="bash"><code>npm &lt;command&gt; [args]
</code></pre>
<h3 id="version">Version</h3>
<p>7.21.0</p>
<p>7.21.1</p>
<h3 id="description">Description</h3>
<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
Expand Down
13 changes: 12 additions & 1 deletion deps/npm/docs/output/using-npm/scripts.html
Expand Up @@ -141,7 +141,7 @@ <h1 id="scripts">scripts</h1>

<section id="table_of_contents">
<h2 id="table-of-contents">Table of contents</h2>
<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#pre--post-scripts">Pre &amp; Post Scripts</a></li><li><a href="#life-cycle-scripts">Life Cycle Scripts</a></li><ul><li><a href="#prepare-and-prepublish">Prepare and Prepublish</a></li></ul><li><a href="#life-cycle-operation-order">Life Cycle Operation Order</a></li><ul><li><a href="#npm-cache-add"><a href="../commands/npm-cache.html"><code>npm cache add</code></a></a></li><li><a href="#npm-ci"><a href="../commands/npm-ci.html"><code>npm ci</code></a></a></li><li><a href="#npm-diff"><a href="../commands/npm-diff.html"><code>npm diff</code></a></a></li><li><a href="#npm-install"><a href="../commands/npm-install.html"><code>npm install</code></a></a></li><li><a href="#npm-pack"><a href="../commands/npm-pack.html"><code>npm pack</code></a></a></li><li><a href="#npm-publish"><a href="../commands/npm-publish.html"><code>npm publish</code></a></a></li><li><a href="#npm-rebuild"><a href="../commands/npm-rebuild.html"><code>npm rebuild</code></a></a></li><li><a href="#npm-restart"><a href="../commands/npm-restart.html"><code>npm restart</code></a></a></li><li><a href="#npm-run-user-defined"><a href="../commands/npm-run-script.html"><code>npm run &lt;user defined&gt;</code></a></a></li><li><a href="#npm-start"><a href="../commands/npm-start.html"><code>npm start</code></a></a></li><li><a href="#npm-stop"><a href="../commands/npm-stop.html"><code>npm stop</code></a></a></li><li><a href="#npm-test"><a href="../commands/npm-test.html"><code>npm test</code></a></a></li></ul><li><a href="#user">User</a></li><li><a href="#environment">Environment</a></li><ul><li><a href="#path">path</a></li><li><a href="#packagejson-vars">package.json vars</a></li><li><a href="#current-lifecycle-event">current lifecycle event</a></li></ul><li><a href="#examples">Examples</a></li><li><a href="#exiting">Exiting</a></li><li><a href="#best-practices">Best Practices</a></li><li><a href="#see-also">See Also</a></li></ul></div>
<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#pre--post-scripts">Pre &amp; Post Scripts</a></li><li><a href="#life-cycle-scripts">Life Cycle Scripts</a></li><ul><li><a href="#prepare-and-prepublish">Prepare and Prepublish</a></li></ul><li><a href="#life-cycle-operation-order">Life Cycle Operation Order</a></li><ul><li><a href="#npm-cache-add"><a href="../commands/npm-cache.html"><code>npm cache add</code></a></a></li><li><a href="#npm-ci"><a href="../commands/npm-ci.html"><code>npm ci</code></a></a></li><li><a href="#npm-diff"><a href="../commands/npm-diff.html"><code>npm diff</code></a></a></li><li><a href="#npm-install"><a href="../commands/npm-install.html"><code>npm install</code></a></a></li><li><a href="#npm-pack"><a href="../commands/npm-pack.html"><code>npm pack</code></a></a></li><li><a href="#npm-publish"><a href="../commands/npm-publish.html"><code>npm publish</code></a></a></li><li><a href="#npm-rebuild"><a href="../commands/npm-rebuild.html"><code>npm rebuild</code></a></a></li><li><a href="#npm-restart"><a href="../commands/npm-restart.html"><code>npm restart</code></a></a></li><li><a href="#npm-run-user-defined"><a href="../commands/npm-run-script.html"><code>npm run &lt;user defined&gt;</code></a></a></li><li><a href="#npm-start"><a href="../commands/npm-start.html"><code>npm start</code></a></a></li><li><a href="#npm-stop"><a href="../commands/npm-stop.html"><code>npm stop</code></a></a></li><li><a href="#npm-test"><a href="../commands/npm-test.html"><code>npm test</code></a></a></li><li><a href="#a-note-on-a-lack-of-npm-uninstall-scripts">A Note on a lack of <a href="../commands/npm-uninstall.html"><code>npm uninstall</code></a> scripts</a></li></ul><li><a href="#user">User</a></li><li><a href="#environment">Environment</a></li><ul><li><a href="#path">path</a></li><li><a href="#packagejson-vars">package.json vars</a></li><li><a href="#current-lifecycle-event">current lifecycle event</a></li></ul><li><a href="#examples">Examples</a></li><li><a href="#exiting">Exiting</a></li><li><a href="#best-practices">Best Practices</a></li><li><a href="#see-also">See Also</a></li></ul></div>
</section>

<div id="_content"><h3 id="description">Description</h3>
Expand Down Expand Up @@ -337,6 +337,17 @@ <h4 id="npm-test"><a href="../commands/npm-test.html"><code>npm test</code></a><
<li><code>test</code></li>
<li><code>posttest</code></li>
</ul>
<h4 id="a-note-on-a-lack-of-npm-uninstall-scripts">A Note on a lack of <a href="../commands/npm-uninstall.html"><code>npm uninstall</code></a> scripts</h4>
<p>While npm v6 had <code>uninstall</code> lifecycle scripts, npm v7 does not. Removal of a package can happen for a wide variety of reasons, and there’s no clear way to currently give the script enough context to be useful.</p>
<p>Reasons for a package removal include:</p>
<ul>
<li>a user directly uninstalled this package</li>
<li>a user uninstalled a dependant package and so this dependency is being uninstalled</li>
<li>a user uninstalled a dependant package but another package also depends on this version</li>
<li>this version has been merged as a duplicate with another version</li>
<li>etc.</li>
</ul>
<p>Due to the lack of necessary context, <code>uninstall</code> lifecycle scripts are not implemented and will not function.</p>
<h3 id="user">User</h3>
<p>When npm is run as root, scripts are always run with the effective uid
and gid of the working directory owner.</p>
Expand Down
11 changes: 6 additions & 5 deletions deps/npm/lib/config.js
Expand Up @@ -121,7 +121,7 @@ class Config extends BaseCommand {
break
case 'list':
case 'ls':
await (this.npm.config.get('json') ? this.listJson() : this.list())
await (this.npm.flatOptions.json ? this.listJson() : this.list())
break
case 'edit':
await this.edit()
Expand All @@ -138,7 +138,7 @@ class Config extends BaseCommand {
if (!args.length)
throw this.usageError()

const where = this.npm.config.get('location')
const where = this.npm.flatOptions.location
for (const [key, val] of Object.entries(keyValues(args))) {
this.npm.log.info('config', 'set %j %j', key, val)
this.npm.config.set(key, val || '', where)
Expand Down Expand Up @@ -168,15 +168,15 @@ class Config extends BaseCommand {
if (!keys.length)
throw this.usageError()

const where = this.npm.config.get('location')
const where = this.npm.flatOptions.location
for (const key of keys)
this.npm.config.delete(key, where)
await this.npm.config.save(where)
}

async edit () {
const e = this.npm.config.get('editor')
const where = this.npm.config.get('location')
const e = this.npm.flatOptions.editor
const where = this.npm.flatOptions.location
const file = this.npm.config.data.get(where).source

// save first, just to make sure it's synced up
Expand Down Expand Up @@ -232,6 +232,7 @@ ${defData}

async list () {
const msg = []
// long does not have a flattener
const long = this.npm.config.get('long')
for (const [where, { data, source }] of this.npm.config.data.entries()) {
if (where === 'default' && !long)
Expand Down
30 changes: 19 additions & 11 deletions deps/npm/lib/utils/config/definitions.js
Expand Up @@ -804,7 +804,11 @@ define('global', {
* bin files are linked to \`{prefix}/bin\`
* man pages are linked to \`{prefix}/share/man\`
`,
flatten,
flatten: (key, obj, flatOptions) => {
flatten(key, obj, flatOptions)
if (flatOptions.global)
flatOptions.location = 'global'
},
})

define('global-style', {
Expand Down Expand Up @@ -1131,14 +1135,10 @@ define('location', {
description: `
When passed to \`npm config\` this refers to which config file to use.
`,
// NOTE: the flattener here deliberately does not alter the value of global
// for now, this is to avoid inadvertently causing any breakage. the value of
// global, however, does modify this flag.
flatten (key, obj, flatOptions) {
// if global is set, we override ourselves
if (obj.global)
obj.location = 'global'
flatOptions.location = obj.location
flatten: (key, obj, flatOptions) => {
flatten(key, obj, flatOptions)
if (flatOptions.global)
flatOptions.location = 'global'
},
})

Expand Down Expand Up @@ -1359,7 +1359,11 @@ define('package-lock', {
modules will also be disabled. To remove extraneous modules with
package-locks disabled use \`npm prune\`.
`,
flatten,
flatten: (key, obj, flatOptions) => {
flatten(key, obj, flatOptions)
if (flatOptions.packageLockOnly)
flatOptions.packageLock = true
},
})

define('package-lock-only', {
Expand All @@ -1375,7 +1379,11 @@ define('package-lock-only', {
For \`list\` this means the output will be based on the tree described by the
\`package-lock.json\`, rather than the contents of \`node_modules\`.
`,
flatten,
flatten: (key, obj, flatOptions) => {
flatten(key, obj, flatOptions)
if (flatOptions.packageLockOnly)
flatOptions.packageLock = true
},
})

define('pack-destination', {
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-ls.1
Expand Up @@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show:
.P
.RS 2
.nf
npm@7\.21\.0 /path/to/npm
npm@7\.21\.1 /path/to/npm
└─┬ init\-package\-json@0\.0\.4
└── promzard@0\.1\.5
.fi
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm.1
Expand Up @@ -10,7 +10,7 @@ npm <command> [args]
.RE
.SS Version
.P
7\.21\.0
7\.21\.1
.SS Description
.P
npm is the package manager for the Node JavaScript platform\. It puts
Expand Down

0 comments on commit e36aa6a

Please sign in to comment.