diff --git a/.eslintrc.js b/.eslintrc.js index 9a4ffea210a828..dc83c0e8c11e90 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -147,32 +147,32 @@ module.exports = { message: '__defineSetter__ is deprecated.', } ], - /* eslint-disable max-len, quotes */ + /* eslint-disable max-len */ // If this list is modified, please copy the change to lib/.eslintrc.yaml 'no-restricted-syntax': [ 'error', { selector: "CallExpression[callee.object.name='assert'][callee.property.name='doesNotThrow']", - message: "Please replace `assert.doesNotThrow()` and add a comment next to the code instead." + message: 'Please replace `assert.doesNotThrow()` and add a comment next to the code instead.' }, { - selector: `CallExpression[callee.object.name='assert'][callee.property.name='rejects'][arguments.length<2]`, + selector: "CallExpression[callee.object.name='assert'][callee.property.name='rejects'][arguments.length<2]", message: 'assert.rejects() must be invoked with at least two arguments.', }, { - selector: `CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.1.type='Literal']:not([arguments.1.regex])`, + selector: "CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.1.type='Literal']:not([arguments.1.regex])", message: 'Use an object as second argument of assert.throws()', }, { - selector: `CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.length<2]`, + selector: "CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.length<2]", message: 'assert.throws() must be invoked with at least two arguments.', }, { - selector: `CallExpression[callee.name='setTimeout'][arguments.length<2]`, + selector: "CallExpression[callee.name='setTimeout'][arguments.length<2]", message: 'setTimeout() must be invoked with at least two arguments.', }, { - selector: `CallExpression[callee.name='setInterval'][arguments.length<2]`, + selector: "CallExpression[callee.name='setInterval'][arguments.length<2]", message: 'setInterval() must be invoked with at least 2 arguments.', }, { diff --git a/BUILDING.md b/BUILDING.md index 3e053050743c10..48c287a319273e 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -311,7 +311,7 @@ $ make ### `Intl` (ECMA-402) support: -[Intl](https://github.com/nodejs/node/wiki/Intl) support is +[Intl](https://github.com/nodejs/node/blob/master/doc/api/intl.md) support is enabled by default, with English data only. #### Default: `small-icu` (English only) support @@ -321,9 +321,6 @@ the full `Intl` (ECMA-402) APIs. It does not need to download any dependencies to function. You can add full data at runtime. -*Note:* more docs are on -[the node wiki](https://github.com/nodejs/node/wiki/Intl). - #### Build with full ICU support (all locales supported by ICU): With the `--download=all`, this may download ICU if you don't have an diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 99e8b701c69c76..238a72547247b6 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -453,21 +453,21 @@ the documentation for the assigned deprecation identifier must remain in the Node.js API documentation. -A _Deprecation cycle_ is one full Node.js major release during which an API -has been in one of the three Deprecation levels. (Note that Documentation-Only -Deprecations may land in a Node.js minor release but must not be upgraded to -a Runtime Deprecation until the next major release.) +A _Deprecation cycle_ is a major release during which an API has been in one of +the three Deprecation levels. Documentation-Only Deprecations may land in a +minor release but must not be upgraded to a Runtime Deprecation until the next +major release. No API can be moved to End-of-life without first having gone through a Runtime Deprecation cycle. However, there is no requirement that deprecated code must progress ultimately to *End-of-Life*. Documentation-only and runtime deprecations may remain indefinitely. -A best effort will be made to communicate pending deprecations and associated -mitigations with the ecosystem as soon as possible (preferably before the pull -request adding the deprecation lands on the master branch). All deprecations -included in a Node.js release should be listed prominently in the "Notable -Changes" section of the release notes. +Communicate pending deprecations and associated mitigations with the ecosystem +as soon as possible (preferably before the pull request adding the deprecation +lands on the master branch). Use the `notable-change` label on all pull requests +that add a new deprecation or move an existing deprecation to a new deprecation +level. ### Involving the TSC diff --git a/Makefile b/Makefile index 8bfd4e674a452b..c2edfe59a4595a 100644 --- a/Makefile +++ b/Makefile @@ -1044,7 +1044,7 @@ lint-md-build: tools/remark-cli/node_modules \ .PHONY: lint-md ifneq ("","$(wildcard tools/remark-cli/node_modules/)") -LINT_MD_DOC_FILES = $(shell ls doc/**/*.md) +LINT_MD_DOC_FILES = $(shell ls doc/*.md doc/**/*.md) run-lint-doc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_DOC_FILES) # Lint all changed markdown files under doc/ tools/.docmdlintstamp: $(LINT_MD_DOC_FILES) diff --git a/README.md b/README.md index 8db496c22f6c78..6167a3599f1c28 100644 --- a/README.md +++ b/README.md @@ -347,6 +347,8 @@ For more information about the governance of the Node.js project, see **Daniel Bevenius** <daniel.bevenius@gmail.com> * [DavidCai1993](https://github.com/DavidCai1993) - **David Cai** <davidcai1993@yahoo.com> (he/him) +* [davisjam](https://github.com/davisjam) - +**Jamie Davis** <davisjam@vt.edu> (he/him) * [devsnek](https://github.com/devsnek) - **Gus Caplan** <me@gus.host> (he/him) * [edsadr](https://github.com/edsadr) - diff --git a/deps/openssl/openssl/crypto/dh/dh_key.c b/deps/openssl/openssl/crypto/dh/dh_key.c index fce9ff47f3670f..58003d708781f3 100644 --- a/deps/openssl/openssl/crypto/dh/dh_key.c +++ b/deps/openssl/openssl/crypto/dh/dh_key.c @@ -78,10 +78,15 @@ static int generate_key(DH *dh) int ok = 0; int generate_new_key = 0; unsigned l; - BN_CTX *ctx; + BN_CTX *ctx = NULL; BN_MONT_CTX *mont = NULL; BIGNUM *pub_key = NULL, *priv_key = NULL; + if (BN_num_bits(dh->p) > OPENSSL_DH_MAX_MODULUS_BITS) { + DHerr(DH_F_GENERATE_KEY, DH_R_MODULUS_TOO_LARGE); + return 0; + } + ctx = BN_CTX_new(); if (ctx == NULL) goto err; diff --git a/doc/STYLE_GUIDE.md b/doc/STYLE_GUIDE.md index 610b012dda5570..5d0f4f14eb2a22 100644 --- a/doc/STYLE_GUIDE.md +++ b/doc/STYLE_GUIDE.md @@ -58,15 +58,19 @@ * Use a capital letter after the "Note:" label. * Preferably, make the note a new paragraph for better visual distinction. * Function arguments or object properties should use the following format: - * * \`name\` {type|type2} Optional description. \*\*Default:\*\* \`defaultValue\`. - * E.g. * `byteOffset` {integer} Index of first byte to expose. **Default:** `0`. + * ``` * `name` {type|type2} Optional description. **Default:** `value`. ``` + + * For example: * `byteOffset` {integer} Index of first byte to expose. **Default:** `0`. + * The `type` should refer to a Node.js type or a [JavaScript type][]. * Function returns should use the following format: * * Returns: {type|type2} Optional description. * E.g. * Returns: {AsyncHook} A reference to `asyncHook`. * Use official styling for capitalization in products and projects. * OK: JavaScript, Google's V8 + * NOT OK: Javascript, Google's v8 + See also API documentation structure overview in [doctools README][]. diff --git a/doc/api/console.md b/doc/api/console.md index 5ef55e63da27c6..6c63a4ffb56656 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -94,7 +94,7 @@ changes: * `stdout` {stream.Writable} * `stderr` {stream.Writable} * `ignoreErrors` {boolean} Ignore errors when writing to the underlying - streams. **Default:** `true`. + streams. **Default:** `true`. * `colorMode` {boolean|string} Set color support for this `Console` instance. Setting to `true` enables coloring while inspecting values, setting to `'auto'` will make color support depend on the value of the `isTTY` property @@ -164,7 +164,7 @@ operates similarly to the `clear` shell command. On Windows, `console.clear()` will clear only the output in the current terminal viewport for the Node.js binary. -### console.count([label='default']) +### console.count([label]) @@ -197,7 +197,7 @@ undefined > ``` -### console.countReset([label='default']) +### console.countReset([label]) @@ -381,7 +381,7 @@ console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']); // └─────────┴─────┘ ``` -### console.time(label) +### console.time([label]) @@ -392,7 +392,7 @@ are identified by a unique `label`. Use the same `label` when calling [`console.timeEnd()`][] to stop the timer and output the elapsed time in milliseconds to `stdout`. Timer durations are accurate to the sub-millisecond. -### console.timeEnd(label) +### console.timeEnd([label]) @@ -476,11 +476,11 @@ the **Profile** panel of the inspector. ```js console.profile('MyLabel'); // Some code -console.profileEnd(); +console.profileEnd('MyLabel'); // Adds the profile 'MyLabel' to the Profiles panel of the inspector. ``` -### console.profileEnd() +### console.profileEnd([label]) @@ -490,6 +490,9 @@ current JavaScript CPU profiling session if one has been started and prints the report to the **Profiles** panel of the inspector. See [`console.profile()`][] for an example. +If this method is called without a label, the most recently started profile is +stopped. + ### console.timeStamp([label]) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index ef2396409b45a3..5a9c81e3698ba3 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -536,7 +536,7 @@ napi_status napi_fatal_exception(napi_env env, napi_value err); ``` - `[in] env`: The environment that the API is invoked under. -- `[in] err`: The error you want to pass to `'uncaughtException'`. +- `[in] err`: The error that is passed to `'uncaughtException'`. Trigger an `'uncaughtException'` in JavaScript. Useful if an async callback throws an exception with no way to recover. @@ -1019,9 +1019,8 @@ napi_value Init(napi_env env, napi_value exports) { } ``` -If you expect that your module will be loaded multiple times during the lifetime -of the Node.js process, you can use the `NAPI_MODULE_INIT` macro to initialize -your module: +If the module will be loaded multiple times during the lifetime of the Node.js +process, use the `NAPI_MODULE_INIT` macro to initialize the module: ```C NAPI_MODULE_INIT() { diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md index a8c6bcf7378837..f16a217bbea6ef 100644 --- a/doc/api/perf_hooks.md +++ b/doc/api/perf_hooks.md @@ -219,26 +219,6 @@ The high resolution millisecond timestamp at which the Node.js process completed bootstrapping. If bootstrapping has not yet finished, the property has the value of -1. -### performanceNodeTiming.clusterSetupEnd - - -* {number} - -The high resolution millisecond timestamp at which cluster processing ended. If -cluster processing has not yet ended, the property has the value of -1. - -### performanceNodeTiming.clusterSetupStart - - -* {number} - -The high resolution millisecond timestamp at which cluster processing started. -If cluster processing has not yet started, the property has the value of -1. - ### performanceNodeTiming.loopExit - -* {number} - -The high resolution millisecond timestamp at which main module load ended. - -### performanceNodeTiming.moduleLoadStart - - -* {number} - -The high resolution millisecond timestamp at which main module load started. - ### performanceNodeTiming.nodeStart - -* {number} - -The high resolution millisecond timestamp at which preload module load ended. - -### performanceNodeTiming.preloadModuleLoadStart - - -* {number} - -The high resolution millisecond timestamp at which preload module load started. - -### performanceNodeTiming.thirdPartyMainEnd - - -* {number} - -The high resolution millisecond timestamp at which third\_party\_main -processing ended. If third\_party\_main processing has not yet ended, the -property has the value of -1. - -### performanceNodeTiming.thirdPartyMainStart - - -* {number} - -The high resolution millisecond timestamp at which third\_party\_main -processing started. If third\_party\_main processing has not yet started, the -property has the value of -1. - ### performanceNodeTiming.v8Start + +* Returns: {bigint} + +The `bigint` version of the [`process.hrtime()`][] method returning the +current high-resolution real time in a `bigint`. + +Unlike [`process.hrtime()`][], it does not support an additional `time` +argument since the difference can just be computed directly +by subtraction of the two `bigint`s. + +```js +const start = process.hrtime.bigint(); +// 191051479007711n + +setTimeout(() => { + const end = process.hrtime.bigint(); + // 191052633396993n + + console.log(`Benchmark took ${end - start} nanoseconds`); + // Benchmark took 1154389282 nanoseconds +}, 1000); +``` + ## process.initgroups(user, extraGroup)