Skip to content

Commit 54c958c

Browse files
committed
Merge branch 'master' of https://github.com/nodejs/node into psj-dev
I added a testcase about executionAsyncResource with Http Agent. Refs: https://github.com/nodejs/node/blob/master/test/async-hooks/test-async-exec-resource-http.js Signed-off-by: psj-tar-gz <[email protected]>
2 parents 4de4483 + 6e8701b commit 54c958c

File tree

144 files changed

+6789
-605
lines changed

Some content is hidden

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

144 files changed

+6789
-605
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@
8686

8787
/doc/api/modules.md @nodejs/modules
8888
/doc/api/esm.md @nodejs/modules
89+
/doc/api/module.md @nodejs/modules
90+
/doc/api/packages.md @nodejs/modules
8991
/lib/module.js @nodejs/modules
9092
/lib/internal/modules/* @nodejs/modules
9193
/lib/internal/bootstrap/loaders.js @nodejs/modules
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Close stalled issues and PRs
2+
on:
3+
schedule:
4+
- cron: "0 0 * * *"
5+
6+
jobs:
7+
stale:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/stale@v3
11+
with:
12+
repo-token: ${{ secrets.GITHUB_TOKEN }}
13+
days-before-close: 30
14+
stale-pr-label: stalled
15+
stale-issue-label: stalled
16+
close-issue-message: Closing this because it has stalled. Feel free to reopen if this issue is still relevant, or to ping the collaborator who labelled it stalled if you have any questions.
17+
close-pr-message: Closing this because it has stalled. Feel free to reopen if this PR is still relevant, or to ping the collaborator who labelled it stalled if you have any questions.
18+
# deactivates automatic removal of stalled label if issue gets any activity
19+
remove-stale-when-updated: false
20+
# deactivates automatic stale labelling as we prefer to do that manually
21+
days-before-stale: -1
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Comment on issues and PRs when labelled stalled
2+
on:
3+
issues:
4+
types: [labeled]
5+
pull_request_target:
6+
types: [labeled]
7+
8+
jobs:
9+
staleComment:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Post comment
13+
if: github.event.label.name == 'stalled'
14+
env:
15+
COMMENTS_URL: ${{ github.event.issue.comments_url || github.event.pull_request.comments_url }}
16+
run: |
17+
curl -X POST $COMMENTS_URL \
18+
-H "Content-Type: application/json" \
19+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
20+
--data '{ "body": "This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open." }'

.github/workflows/commit-queue.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ jobs:
3535
- name: Install dependencies
3636
run: |
3737
sudo apt-get install jq -y
38-
# TODO(mmarchini): install from npm after next ncu release is out
39-
npm install -g 'https://github.com/mmarchini/node-core-utils#commit-queue-branch'
40-
# npm install -g node-core-utils
38+
npm install -g node-core-utils@latest
4139
4240
- name: Set variables
4341
run: |
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Require “Allow Edits”
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
_:
7+
name: "Require “Allow Edits”"
8+
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: ljharb/require-allow-edits@main
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

benchmark/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ directory, see [the guide on benchmarks](../doc/guides/writing-and-running-bench
3232
| module | Benchmarks for the `module` subsystem. |
3333
| net | Benchmarks for the `net` subsystem. |
3434
| path | Benchmarks for the `path` subsystem. |
35+
| perf_hooks | Benchmarks for the `perf_hooks` subsystem. |
3536
| process | Benchmarks for the `process` subsystem. |
3637
| querystring | Benchmarks for the `querystring` subsystem. |
3738
| streams | Benchmarks for the `streams` subsystem. |
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
'use strict';
2+
3+
const common = require('../common.js');
4+
const assert = require('assert').ok;
5+
const { performance } = require('perf_hooks');
6+
const { nodeTiming, eventLoopUtilization } = performance;
7+
8+
const bench = common.createBenchmark(main, {
9+
n: [1e6],
10+
method: [
11+
'idleTime',
12+
'ELU_simple',
13+
'ELU_passed',
14+
],
15+
});
16+
17+
function main({ method, n }) {
18+
switch (method) {
19+
case 'idleTime':
20+
benchIdleTime(n);
21+
break;
22+
case 'ELU_simple':
23+
benchELUSimple(n);
24+
break;
25+
case 'ELU_passed':
26+
benchELUPassed(n);
27+
break;
28+
default:
29+
throw new Error(`Unsupported method ${method}`);
30+
}
31+
}
32+
33+
function benchIdleTime(n) {
34+
bench.start();
35+
for (let i = 0; i < n; i++)
36+
nodeTiming.idleTime;
37+
bench.end(n);
38+
}
39+
40+
function benchELUSimple(n) {
41+
// Need to put this in setImmediate or will always return 0.
42+
setImmediate(() => {
43+
const elu = eventLoopUtilization();
44+
assert(elu.active + elu.idle > 0);
45+
46+
bench.start();
47+
for (let i = 0; i < n; i++)
48+
eventLoopUtilization();
49+
bench.end(n);
50+
});
51+
}
52+
53+
function benchELUPassed(n) {
54+
// Need to put this in setImmediate or will always return 0.
55+
setImmediate(() => {
56+
let elu = eventLoopUtilization();
57+
assert(elu.active + elu.idle > 0);
58+
59+
bench.start();
60+
for (let i = 0; i < n; i++)
61+
elu = eventLoopUtilization(elu);
62+
bench.end(n);
63+
});
64+
}

doc/api/buffer.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ string into a `Buffer` as decoding.
107107
tabs, and new lines contained within the base64-encoded string are ignored.
108108

109109
* `'hex'`: Encode each byte as two hexadecimal characters. Data truncation
110-
may occur when decoding string that do exclusively contain valid hexadecimal
110+
may occur when decoding strings that do exclusively contain valid hexadecimal
111111
characters. See below for an example.
112112

113113
The following legacy character encodings are also supported:
114114

115115
* `'ascii'`: For 7-bit [ASCII][] data only. When encoding a string into a
116116
`Buffer`, this is equivalent to using `'latin1'`. When decoding a `Buffer`
117-
into a string, using encoding this will additionally unset the highest bit of
117+
into a string, using this encoding will additionally unset the highest bit of
118118
each byte before decoding as `'latin1'`.
119119
Generally, there should be no reason to use this encoding, as `'utf8'`
120120
(or, if the data is known to always be ASCII-only, `'latin1'`) will be a
@@ -176,7 +176,7 @@ In particular:
176176
There are two ways to create new [`TypedArray`][] instances from a `Buffer`:
177177

178178
* Passing a `Buffer` to a [`TypedArray`][] constructor will copy the `Buffer`s
179-
contents, interpreted an array array of integers, and not as a byte sequence
179+
contents, interpreted as an array of integers, and not as a byte sequence
180180
of the target type.
181181

182182
```js
@@ -1379,6 +1379,10 @@ values.
13791379
added:
13801380
- v12.0.0
13811381
- v10.20.0
1382+
changes:
1383+
- version: REPLACEME
1384+
pr-url: https://github.com/nodejs/node/pull/34960
1385+
description: This function is also available as `buf.readBigUint64BE()`.
13821386
-->
13831387

13841388
* `offset` {integer} Number of bytes to skip before starting to read. Must
@@ -1400,6 +1404,10 @@ console.log(buf.readBigUInt64BE(0));
14001404
added:
14011405
- v12.0.0
14021406
- v10.20.0
1407+
changes:
1408+
- version: REPLACEME
1409+
pr-url: https://github.com/nodejs/node/pull/34960
1410+
description: This function is also available as `buf.readBigUint64LE()`.
14031411
-->
14041412

14051413
* `offset` {integer} Number of bytes to skip before starting to read. Must
@@ -2304,6 +2312,10 @@ console.log(buf);
23042312
added:
23052313
- v12.0.0
23062314
- v10.20.0
2315+
changes:
2316+
- version: REPLACEME
2317+
pr-url: https://github.com/nodejs/node/pull/34960
2318+
description: This function is also available as `buf.writeBigUint64BE()`.
23072319
-->
23082320

23092321
* `value` {bigint} Number to be written to `buf`.
@@ -2327,6 +2339,10 @@ console.log(buf);
23272339
added:
23282340
- v12.0.0
23292341
- v10.20.0
2342+
changes:
2343+
- version: REPLACEME
2344+
pr-url: https://github.com/nodejs/node/pull/34960
2345+
description: This function is also available as `buf.writeBigUint64LE()`.
23302346
-->
23312347

23322348
* `value` {bigint} Number to be written to `buf`.

doc/api/crypto.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2801,6 +2801,44 @@ threadpool request. To minimize threadpool task length variation, partition
28012801
large `randomFill` requests when doing so as part of fulfilling a client
28022802
request.
28032803

2804+
### `crypto.randomInt([min, ]max[, callback])`
2805+
<!-- YAML
2806+
added: REPLACEME
2807+
-->
2808+
2809+
* `min` {integer} Start of random range (inclusive). **Default**: `0`.
2810+
* `max` {integer} End of random range (exclusive).
2811+
* `callback` {Function} `function(err, n) {}`.
2812+
2813+
Return a random integer `n` such that `min <= n < max`. This
2814+
implementation avoids [modulo bias][].
2815+
2816+
The range (`max - min`) must be less than `2^48`. `min` and `max` must
2817+
be safe integers.
2818+
2819+
If the `callback` function is not provided, the random integer is
2820+
generated synchronously.
2821+
2822+
```js
2823+
// Asynchronous
2824+
crypto.randomInt(3, (err, n) => {
2825+
if (err) throw err;
2826+
console.log(`Random number chosen from (0, 1, 2): ${n}`);
2827+
});
2828+
```
2829+
2830+
```js
2831+
// Synchronous
2832+
const n = crypto.randomInt(3);
2833+
console.log(`Random number chosen from (0, 1, 2): ${n}`);
2834+
```
2835+
2836+
```js
2837+
// With `min` argument
2838+
const n = crypto.randomInt(1, 7);
2839+
console.log(`The dice rolled: ${n}`);
2840+
```
2841+
28042842
### `crypto.scrypt(password, salt, keylen[, options], callback)`
28052843
<!-- YAML
28062844
added: v10.5.0
@@ -3573,6 +3611,7 @@ See the [list of SSL OP Flags][] for details.
35733611
[NIST SP 800-131A]: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf
35743612
[NIST SP 800-132]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf
35753613
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
3614+
[modulo bias]: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias
35763615
[Nonce-Disrespecting Adversaries]: https://github.com/nonce-disrespect/nonce-disrespect
35773616
[OpenSSL's SPKAC implementation]: https://www.openssl.org/docs/man1.1.0/apps/openssl-spkac.html
35783617
[RFC 1421]: https://www.rfc-editor.org/rfc/rfc1421.txt

doc/api/deprecations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2858,7 +2858,7 @@ The [`crypto.Certificate()` constructor][] is deprecated. Use
28582858
[`response.socket`]: http.html#http_response_socket
28592859
[`response.connection`]: http.html#http_response_connection
28602860
[`response.end()`]: http.html#http_response_end_data_encoding_callback
2861-
[`response.finished`]: #http_response_finished
2861+
[`response.finished`]: http.html#http_response_finished
28622862
[`response.writableFinished`]: #http_response_writablefinished
28632863
[`response.writableEnded`]: #http_response_writableended
28642864
[`script.createCachedData()`]: vm.html#vm_script_createcacheddata

0 commit comments

Comments
 (0)