mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
doc: remove unnecessary <!-- eslint- magic comments
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: https://github.com/nodejs/node/pull/63200 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
This commit is contained in:
20 files changed
+170
-250
No files matched your search
+2
-2
@@ -2036,7 +2036,7 @@ If no arguments are passed in at all `message` will be set to the string:
|
||||
Be aware that in the `repl` the error message will be different to the one
|
||||
thrown in a file! See below for further details.
|
||||
|
||||
<!-- eslint-skip -->
|
||||
<!-- eslint-disable no-restricted-syntax -->
|
||||
|
||||
```mjs
|
||||
import assert from 'node:assert/strict';
|
||||
@@ -2073,7 +2073,7 @@ assert.ok(0);
|
||||
// assert.ok(0)
|
||||
```
|
||||
|
||||
<!-- eslint-skip -->
|
||||
<!-- eslint-disable no-restricted-syntax -->
|
||||
|
||||
```cjs
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
+2
-6
@@ -240,9 +240,7 @@ added: v8.3.0
|
||||
Maintains an internal counter specific to `label` and outputs to `stdout` the
|
||||
number of times `console.count()` has been called with the given `label`.
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
```console
|
||||
> console.count()
|
||||
default: 1
|
||||
undefined
|
||||
@@ -274,9 +272,7 @@ added: v8.3.0
|
||||
|
||||
Resets the internal counter specific to `label`.
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
```console
|
||||
> console.count('abc');
|
||||
abc: 1
|
||||
undefined
|
||||
|
||||
@@ -53,8 +53,6 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
<!-- eslint-enable no-global-assign -->
|
||||
|
||||
When using the lexical ESM `import` keyword, the error can only be
|
||||
caught if a handler for `process.on('uncaughtException')` is registered
|
||||
_before_ any attempt to load the module is made (using, for instance,
|
||||
|
||||
+36
-60
@@ -205,14 +205,12 @@ Returns an array of IP address strings, formatted according to [RFC 5952][],
|
||||
that are currently configured for DNS resolution. A string will include a port
|
||||
section if a custom port is used.
|
||||
|
||||
<!-- eslint-disable @stylistic/js/semi-->
|
||||
|
||||
```js
|
||||
```json
|
||||
[
|
||||
'8.8.8.8',
|
||||
'2001:4860:4860::8888',
|
||||
'8.8.8.8:1053',
|
||||
'[2001:4860:4860::8888]:1053',
|
||||
"8.8.8.8",
|
||||
"2001:4860:4860::8888",
|
||||
"8.8.8.8:1053",
|
||||
"[2001:4860:4860::8888]:1053",
|
||||
]
|
||||
```
|
||||
|
||||
@@ -559,8 +557,6 @@ will be present on the object:
|
||||
|
||||
Here is an example of the `ret` object passed to the callback:
|
||||
|
||||
<!-- eslint-disable @stylistic/js/semi -->
|
||||
|
||||
```js
|
||||
[ { type: 'A', address: '127.0.0.1', ttl: 299 },
|
||||
{ type: 'CNAME', value: 'example.com' },
|
||||
@@ -574,7 +570,7 @@ Here is an example of the `ret` object passed to the callback:
|
||||
refresh: 900,
|
||||
retry: 900,
|
||||
expire: 1800,
|
||||
minttl: 60 } ]
|
||||
minttl: 60 } ];
|
||||
```
|
||||
|
||||
DNS server operators may choose not to respond to `ANY`
|
||||
@@ -678,17 +674,15 @@ function will contain an array of objects with the following properties:
|
||||
* `order`
|
||||
* `preference`
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
{
|
||||
({
|
||||
flags: 's',
|
||||
service: 'SIP+D2U',
|
||||
regexp: '',
|
||||
replacement: '_sip._udp.example.com',
|
||||
order: 30,
|
||||
preference: 100
|
||||
}
|
||||
preference: 100,
|
||||
});
|
||||
```
|
||||
|
||||
## `dns.resolveNs(hostname, callback)`
|
||||
@@ -763,18 +757,16 @@ be an object with the following properties:
|
||||
* `expire`
|
||||
* `minttl`
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
{
|
||||
({
|
||||
nsname: 'ns.example.com',
|
||||
hostmaster: 'root.example.com',
|
||||
serial: 2013101809,
|
||||
refresh: 10000,
|
||||
retry: 2400,
|
||||
expire: 604800,
|
||||
minttl: 3600
|
||||
}
|
||||
minttl: 3600,
|
||||
});
|
||||
```
|
||||
|
||||
## `dns.resolveSrv(hostname, callback)`
|
||||
@@ -803,15 +795,13 @@ be an array of objects with the following properties:
|
||||
* `port`
|
||||
* `name`
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
{
|
||||
({
|
||||
priority: 10,
|
||||
weight: 5,
|
||||
port: 21223,
|
||||
name: 'service.example.com'
|
||||
}
|
||||
name: 'service.example.com',
|
||||
});
|
||||
```
|
||||
|
||||
## `dns.resolveTlsa(hostname, callback)`
|
||||
@@ -840,15 +830,13 @@ array of objects with these properties:
|
||||
* `match`
|
||||
* `data`
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
{
|
||||
({
|
||||
certUsage: 3,
|
||||
selector: 1,
|
||||
match: 1,
|
||||
data: [ArrayBuffer]
|
||||
}
|
||||
data: [ArrayBuffer],
|
||||
});
|
||||
```
|
||||
|
||||
## `dns.resolveTxt(hostname, callback)`
|
||||
@@ -1081,14 +1069,12 @@ Returns an array of IP address strings, formatted according to [RFC 5952][],
|
||||
that are currently configured for DNS resolution. A string will include a port
|
||||
section if a custom port is used.
|
||||
|
||||
<!-- eslint-disable @stylistic/js/semi-->
|
||||
|
||||
```js
|
||||
```json
|
||||
[
|
||||
'8.8.8.8',
|
||||
'2001:4860:4860::8888',
|
||||
'8.8.8.8:1053',
|
||||
'[2001:4860:4860::8888]:1053',
|
||||
"8.8.8.8",
|
||||
"2001:4860:4860::8888",
|
||||
"8.8.8.8:1053",
|
||||
"[2001:4860:4860::8888]:1053"
|
||||
]
|
||||
```
|
||||
|
||||
@@ -1329,8 +1315,6 @@ present on the object:
|
||||
|
||||
Here is an example of the result object:
|
||||
|
||||
<!-- eslint-disable @stylistic/js/semi -->
|
||||
|
||||
```js
|
||||
[ { type: 'A', address: '127.0.0.1', ttl: 299 },
|
||||
{ type: 'CNAME', value: 'example.com' },
|
||||
@@ -1344,7 +1328,7 @@ Here is an example of the result object:
|
||||
refresh: 900,
|
||||
retry: 900,
|
||||
expire: 1800,
|
||||
minttl: 60 } ]
|
||||
minttl: 60 } ];
|
||||
```
|
||||
|
||||
### `dnsPromises.resolveCaa(hostname)`
|
||||
@@ -1407,17 +1391,15 @@ of objects with the following properties:
|
||||
* `order`
|
||||
* `preference`
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
{
|
||||
({
|
||||
flags: 's',
|
||||
service: 'SIP+D2U',
|
||||
regexp: '',
|
||||
replacement: '_sip._udp.example.com',
|
||||
order: 30,
|
||||
preference: 100
|
||||
}
|
||||
preference: 100,
|
||||
});
|
||||
```
|
||||
|
||||
### `dnsPromises.resolveNs(hostname)`
|
||||
@@ -1465,18 +1447,16 @@ following properties:
|
||||
* `expire`
|
||||
* `minttl`
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
{
|
||||
({
|
||||
nsname: 'ns.example.com',
|
||||
hostmaster: 'root.example.com',
|
||||
serial: 2013101809,
|
||||
refresh: 10000,
|
||||
retry: 2400,
|
||||
expire: 604800,
|
||||
minttl: 3600
|
||||
}
|
||||
minttl: 3600,
|
||||
});
|
||||
```
|
||||
|
||||
### `dnsPromises.resolveSrv(hostname)`
|
||||
@@ -1496,15 +1476,13 @@ the following properties:
|
||||
* `port`
|
||||
* `name`
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
{
|
||||
({
|
||||
priority: 10,
|
||||
weight: 5,
|
||||
port: 21223,
|
||||
name: 'service.example.com'
|
||||
}
|
||||
name: 'service.example.com',
|
||||
});
|
||||
```
|
||||
|
||||
### `dnsPromises.resolveTlsa(hostname)`
|
||||
@@ -1526,15 +1504,13 @@ with these properties:
|
||||
* `match`
|
||||
* `data`
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
{
|
||||
({
|
||||
certUsage: 3,
|
||||
selector: 1,
|
||||
match: 1,
|
||||
data: [ArrayBuffer]
|
||||
}
|
||||
data: [ArrayBuffer],
|
||||
});
|
||||
```
|
||||
|
||||
### `dnsPromises.resolveTxt(hostname)`
|
||||
|
||||
@@ -564,8 +564,6 @@ console.log(cjs === cjsSugar);
|
||||
This Module Namespace Exotic Object can be directly observed either when using
|
||||
`import * as m from 'cjs'` or a dynamic import:
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
import * as m from 'cjs';
|
||||
console.log(m);
|
||||
|
||||
+7
-9
@@ -39,15 +39,13 @@ property, which is an array of `[key, value, key2, value2, ...]`. For
|
||||
example, the previous message header object might have a `rawHeaders`
|
||||
list like the following:
|
||||
|
||||
<!-- eslint-disable @stylistic/js/semi -->
|
||||
|
||||
```js
|
||||
[ 'ConTent-Length', '123456',
|
||||
'content-LENGTH', '123',
|
||||
'content-type', 'text/plain',
|
||||
'CONNECTION', 'keep-alive',
|
||||
'Host', 'example.com',
|
||||
'accepT', '*/*' ]
|
||||
```json
|
||||
[ "ConTent-Length", "123456",
|
||||
"content-LENGTH", "123",
|
||||
"content-type", "text/plain",
|
||||
"CONNECTION", "keep-alive",
|
||||
"Host", "example.com",
|
||||
"accepT", "*/*" ]
|
||||
```
|
||||
|
||||
## Class: `http.Agent`
|
||||
|
||||
+2
-4
@@ -4281,10 +4281,8 @@ Accept: text/plain
|
||||
|
||||
Then `request.url` will be:
|
||||
|
||||
<!-- eslint-disable @stylistic/js/semi -->
|
||||
|
||||
```js
|
||||
'/status?name=ryan'
|
||||
```json
|
||||
"/status?name=ryan"
|
||||
```
|
||||
|
||||
To parse the url into its parts, `new URL()` can be used:
|
||||
|
||||
+1
-5
@@ -1149,8 +1149,6 @@ export async function load(url, context, nextLoad) {
|
||||
Unlike synchronous hooks, the asynchronous hooks would not run for these modules loaded in the file
|
||||
that calls `register()`:
|
||||
|
||||
<!-- eslint-disable no-restricted-globals -->
|
||||
|
||||
```mjs
|
||||
// register-hooks.js
|
||||
import { register, createRequire } from 'node:module';
|
||||
@@ -1158,12 +1156,10 @@ register('./hooks.mjs', import.meta.url);
|
||||
|
||||
// Asynchronous hooks does not affect modules loaded via custom require()
|
||||
// functions created by module.createRequire().
|
||||
const userRequire = createRequire(__filename);
|
||||
const userRequire = createRequire(import.meta.filename);
|
||||
userRequire('./my-app-2.cjs'); // Hooks won't affect this
|
||||
```
|
||||
|
||||
<!-- eslint-enable no-restricted-globals -->
|
||||
|
||||
```cjs
|
||||
// register-hooks.js
|
||||
const { register, createRequire } = require('node:module');
|
||||
|
||||
+2
-6
@@ -262,8 +262,6 @@ the default export in the `.default` property, similar to the results returned b
|
||||
To customize what should be returned by `require(esm)` directly, the ES Module can export the
|
||||
desired value using the string name `"module.exports"`.
|
||||
|
||||
<!-- eslint-disable @stylistic/js/semi -->
|
||||
|
||||
```mjs
|
||||
// point.mjs
|
||||
export default class Point {
|
||||
@@ -273,7 +271,7 @@ export default class Point {
|
||||
// `distance` is lost to CommonJS consumers of this module, unless it's
|
||||
// added to `Point` as a static property.
|
||||
export function distance(a, b) { return Math.sqrt((b.x - a.x) ** 2 + (b.y - a.y) ** 2); }
|
||||
export { Point as 'module.exports' }
|
||||
export { Point as 'module.exports' };
|
||||
```
|
||||
|
||||
<!-- eslint-disable node-core/no-duplicate-requires -->
|
||||
@@ -293,8 +291,6 @@ named exports, the module can make sure that the default export is an object wit
|
||||
named exports attached to it as properties. For example with the example above,
|
||||
`distance` can be attached to the default export, the `Point` class, as a static method.
|
||||
|
||||
<!-- eslint-disable @stylistic/js/semi -->
|
||||
|
||||
```mjs
|
||||
export function distance(a, b) { return Math.sqrt((b.x - a.x) ** 2 + (b.y - a.y) ** 2); }
|
||||
|
||||
@@ -303,7 +299,7 @@ export default class Point {
|
||||
static distance = distance;
|
||||
}
|
||||
|
||||
export { Point as 'module.exports' }
|
||||
export { Point as 'module.exports' };
|
||||
```
|
||||
|
||||
<!-- eslint-disable node-core/no-duplicate-requires -->
|
||||
|
||||
+30
-34
@@ -94,8 +94,6 @@ The properties included on each object include:
|
||||
* `idle` {number} The number of milliseconds the CPU has spent in idle mode.
|
||||
* `irq` {number} The number of milliseconds the CPU has spent in irq mode.
|
||||
|
||||
<!-- eslint-disable @stylistic/js/semi -->
|
||||
|
||||
```js
|
||||
[
|
||||
{
|
||||
@@ -142,7 +140,7 @@ The properties included on each object include:
|
||||
irq: 20,
|
||||
},
|
||||
},
|
||||
]
|
||||
];
|
||||
```
|
||||
|
||||
`nice` values are POSIX-only. On Windows, the `nice` values of all processors
|
||||
@@ -298,46 +296,44 @@ The properties available on the assigned network address object include:
|
||||
in CIDR notation. If the `netmask` is invalid, this property is set
|
||||
to `null`.
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
```json
|
||||
{
|
||||
lo: [
|
||||
"lo:": [
|
||||
{
|
||||
address: '127.0.0.1',
|
||||
netmask: '255.0.0.0',
|
||||
family: 'IPv4',
|
||||
mac: '00:00:00:00:00:00',
|
||||
internal: true,
|
||||
cidr: '127.0.0.1/8'
|
||||
"address:": "127.0.0.1",
|
||||
"netmask:": "255.0.0.0",
|
||||
"family:": "IPv4",
|
||||
"mac:": "00:00:00:00:00:00",
|
||||
"internal:": true,
|
||||
"cidr:": "127.0.0.1/8"
|
||||
},
|
||||
{
|
||||
address: '::1',
|
||||
netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
|
||||
family: 'IPv6',
|
||||
mac: '00:00:00:00:00:00',
|
||||
scopeid: 0,
|
||||
internal: true,
|
||||
cidr: '::1/128'
|
||||
"address:": "::1",
|
||||
"netmask:": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
|
||||
"family:": "IPv6",
|
||||
"mac:": "00:00:00:00:00:00",
|
||||
"scopeid:": 0,
|
||||
"internal:": true,
|
||||
"cidr:": "::1/128"
|
||||
}
|
||||
],
|
||||
eth0: [
|
||||
"eth0:": [
|
||||
{
|
||||
address: '192.168.1.108',
|
||||
netmask: '255.255.255.0',
|
||||
family: 'IPv4',
|
||||
mac: '01:02:03:0a:0b:0c',
|
||||
internal: false,
|
||||
cidr: '192.168.1.108/24'
|
||||
"address:": "192.168.1.108",
|
||||
"netmask:": "255.255.255.0",
|
||||
"family:": "IPv4",
|
||||
"mac:": "01:02:03:0a:0b:0c",
|
||||
"internal:": false,
|
||||
"cidr:": "192.168.1.108/24"
|
||||
},
|
||||
{
|
||||
address: 'fe80::a00:27ff:fe4e:66a1',
|
||||
netmask: 'ffff:ffff:ffff:ffff::',
|
||||
family: 'IPv6',
|
||||
mac: '01:02:03:0a:0b:0c',
|
||||
scopeid: 1,
|
||||
internal: false,
|
||||
cidr: 'fe80::a00:27ff:fe4e:66a1/64'
|
||||
"address:": "fe80::a00:27ff:fe4e:66a1",
|
||||
"netmask:": "ffff:ffff:ffff:ffff::",
|
||||
"family:": "IPv6",
|
||||
"mac:": "01:02:03:0a:0b:0c",
|
||||
"scopeid:": 1,
|
||||
"internal:": false,
|
||||
"cidr:": "fe80::a00:27ff:fe4e:66a1/64"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2167,8 +2167,6 @@ setTimeout(() => {}, 1000);
|
||||
The following example measures the duration of `require()` operations to load
|
||||
dependencies:
|
||||
|
||||
<!-- eslint-disable no-global-assign -->
|
||||
|
||||
```mjs
|
||||
import { performance, PerformanceObserver } from 'node:perf_hooks';
|
||||
|
||||
|
||||
+41
-51
@@ -1105,30 +1105,28 @@ when running the `./configure` script.
|
||||
|
||||
An example of the possible output looks like:
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
```json
|
||||
{
|
||||
target_defaults:
|
||||
{ cflags: [],
|
||||
default_configuration: 'Release',
|
||||
defines: [],
|
||||
include_dirs: [],
|
||||
libraries: [] },
|
||||
variables:
|
||||
"target_defaults":
|
||||
{ "cflags": [],
|
||||
"default_configuration": "Release",
|
||||
"defines": [],
|
||||
"include_dirs": [],
|
||||
"libraries": [] },
|
||||
"variables":
|
||||
{
|
||||
host_arch: 'x64',
|
||||
napi_build_version: 5,
|
||||
node_install_npm: 'true',
|
||||
node_prefix: '',
|
||||
node_shared_cares: 'false',
|
||||
node_shared_http_parser: 'false',
|
||||
node_shared_libuv: 'false',
|
||||
node_shared_zlib: 'false',
|
||||
node_use_openssl: 'true',
|
||||
node_shared_openssl: 'false',
|
||||
target_arch: 'x64',
|
||||
v8_use_snapshot: 1
|
||||
"host_arch": "x64",
|
||||
"napi_build_version": 5,
|
||||
"node_install_npm": "true",
|
||||
"node_prefix": "",
|
||||
"node_shared_cares": "false",
|
||||
"node_shared_http_parser": "false",
|
||||
"node_shared_libuv": "false",
|
||||
"node_shared_zlib": "false",
|
||||
"node_use_openssl": "true",
|
||||
"node_shared_openssl": "false",
|
||||
"target_arch": "x64",
|
||||
"v8_use_snapshot": 1
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -1608,20 +1606,18 @@ See environ(7).
|
||||
|
||||
An example of this object looks like:
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
```json
|
||||
{
|
||||
TERM: 'xterm-256color',
|
||||
SHELL: '/usr/local/bin/bash',
|
||||
USER: 'maciej',
|
||||
PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin',
|
||||
PWD: '/Users/maciej',
|
||||
EDITOR: 'vim',
|
||||
SHLVL: '1',
|
||||
HOME: '/Users/maciej',
|
||||
LOGNAME: 'maciej',
|
||||
_: '/usr/local/bin/node'
|
||||
"TERM": "xterm-256color",
|
||||
"SHELL": "/usr/local/bin/bash",
|
||||
"USER": "maciej",
|
||||
"PATH": "~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin",
|
||||
"PWD": "/Users/maciej",
|
||||
"EDITOR": "vim",
|
||||
"SHLVL": "1",
|
||||
"HOME": "/Users/maciej",
|
||||
"LOGNAME": "maciej",
|
||||
"_": "/usr/local/bin/node"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1750,10 +1746,8 @@ Results in `process.execArgv`:
|
||||
|
||||
And `process.argv`:
|
||||
|
||||
<!-- eslint-disable @stylistic/js/semi -->
|
||||
|
||||
```js
|
||||
['/usr/local/bin/node', 'script.js', '--version']
|
||||
```json
|
||||
["/usr/local/bin/node", "script.js", "--version"]
|
||||
```
|
||||
|
||||
Refer to [`Worker` constructor][] for the detailed behavior of worker
|
||||
@@ -1770,10 +1764,8 @@ added: v0.1.100
|
||||
The `process.execPath` property returns the absolute pathname of the executable
|
||||
that started the Node.js process. Symbolic links, if any, are resolved.
|
||||
|
||||
<!-- eslint-disable @stylistic/js/semi -->
|
||||
|
||||
```js
|
||||
'/usr/local/bin/node'
|
||||
```json
|
||||
"/usr/local/bin/node"
|
||||
```
|
||||
|
||||
## `process.execve(file[, args[, env]])`
|
||||
@@ -3380,15 +3372,13 @@ tarball.
|
||||
* `'Hydrogen'` for the 18.x LTS line beginning with 18.12.0.
|
||||
For other LTS Release code names, see [Node.js Changelog Archive](https://github.com/nodejs/node/blob/HEAD/doc/changelogs/CHANGELOG_ARCHIVE.md)
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
```json
|
||||
{
|
||||
name: 'node',
|
||||
lts: 'Hydrogen',
|
||||
sourceUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz',
|
||||
headersUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz',
|
||||
libUrl: 'https://nodejs.org/download/release/v18.12.0/win-x64/node.lib'
|
||||
"name": "node",
|
||||
"lts": "Hydrogen",
|
||||
"sourceUrl": "https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz",
|
||||
"headersUrl": "https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz",
|
||||
"libUrl": "https://nodejs.org/download/release/v18.12.0/win-x64/node.lib"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -3573,8 +3573,6 @@ of the four basic stream classes (`stream.Writable`, `stream.Readable`,
|
||||
`stream.Duplex`, or `stream.Transform`), making sure they call the appropriate
|
||||
parent class constructor:
|
||||
|
||||
<!-- eslint-disable no-useless-constructor -->
|
||||
|
||||
```js
|
||||
const { Writable } = require('node:stream');
|
||||
|
||||
|
||||
+20
-24
@@ -54,14 +54,12 @@ following properties:
|
||||
* `external_script_source_size` {number}
|
||||
* `cpu_profiler_metadata_size` {number}
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
```json
|
||||
{
|
||||
code_and_metadata_size: 212208,
|
||||
bytecode_and_metadata_size: 161368,
|
||||
external_script_source_size: 1410794,
|
||||
cpu_profiler_metadata_size: 0,
|
||||
"code_and_metadata_size": 212208,
|
||||
"bytecode_and_metadata_size": 161368,
|
||||
"external_script_source_size": 1410794,
|
||||
"cpu_profiler_metadata_size": 0
|
||||
}
|
||||
```
|
||||
|
||||
@@ -263,24 +261,22 @@ used memory size of V8 global handles.
|
||||
`external_memory` The value of external\_memory is the memory size of array
|
||||
buffers and external strings.
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
```json
|
||||
{
|
||||
total_heap_size: 7326976,
|
||||
total_heap_size_executable: 4194304,
|
||||
total_physical_size: 7326976,
|
||||
total_available_size: 1152656,
|
||||
used_heap_size: 3476208,
|
||||
heap_size_limit: 1535115264,
|
||||
malloced_memory: 16384,
|
||||
peak_malloced_memory: 1127496,
|
||||
does_zap_garbage: 0,
|
||||
number_of_native_contexts: 1,
|
||||
number_of_detached_contexts: 0,
|
||||
total_global_handles_size: 8192,
|
||||
used_global_handles_size: 3296,
|
||||
external_memory: 318824
|
||||
"total_heap_size": 7326976,
|
||||
"total_heap_size_executable": 4194304,
|
||||
"total_physical_size": 7326976,
|
||||
"total_available_size": 1152656,
|
||||
"used_heap_size": 3476208,
|
||||
"heap_size_limit": 1535115264,
|
||||
"malloced_memory": 16384,
|
||||
"peak_malloced_memory": 1127496,
|
||||
"does_zap_garbage": 0,
|
||||
"number_of_native_contexts": 1,
|
||||
"number_of_detached_contexts": 0,
|
||||
"total_global_handles_size": 8192,
|
||||
"used_global_handles_size": 3296,
|
||||
"external_memory": 318824
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -1097,8 +1097,6 @@ import foo from 'foo';
|
||||
import source Foo from 'foo';
|
||||
```
|
||||
|
||||
<!-- eslint-enable no-duplicate-imports -->
|
||||
|
||||
The `modules` array must contain two references to the same instance, because the two
|
||||
module requests are identical but in two phases.
|
||||
|
||||
@@ -1138,8 +1136,6 @@ import withAttrs from '../with-attrs.ts' with { arbitraryAttr: 'attr-val' };
|
||||
import source Module from 'wasm-mod.wasm';
|
||||
```
|
||||
|
||||
<!-- eslint-enable no-duplicate-imports -->
|
||||
|
||||
The value of the `sourceTextModule.moduleRequests` will be:
|
||||
|
||||
```js
|
||||
|
||||
@@ -1390,8 +1390,6 @@ not preserved. In particular, {Buffer} objects will be read as
|
||||
plain {Uint8Array}s on the receiving side, and instances of JavaScript
|
||||
classes will be cloned as plain JavaScript objects.
|
||||
|
||||
<!-- eslint-disable no-unused-private-class-members -->
|
||||
|
||||
```js
|
||||
const b = Symbol('b');
|
||||
|
||||
@@ -1402,7 +1400,7 @@ class Foo {
|
||||
this.c = 3;
|
||||
}
|
||||
|
||||
get d() { return 4; }
|
||||
get d() { return this.#a + 3; }
|
||||
}
|
||||
|
||||
const { port1, port2 } = new MessageChannel();
|
||||
|
||||
+1
-3
@@ -454,10 +454,8 @@ From `zlib/zconf.h`, modified for Node.js usage:
|
||||
|
||||
The memory requirements for deflate are (in bytes):
|
||||
|
||||
<!-- eslint-disable @stylistic/js/semi -->
|
||||
|
||||
```js
|
||||
(1 << (windowBits + 2)) + (1 << (memLevel + 9))
|
||||
(1 << (windowBits + 2)) + (1 << (memLevel + 9));
|
||||
```
|
||||
|
||||
That is: 128K for `windowBits` = 15 + 128K for `memLevel` = 8
|
||||
|
||||
@@ -280,25 +280,25 @@ The `Symbol.dispose` method should return `undefined` and the
|
||||
`Symbol.asyncDispose` method should return a `Promise` that resolves to
|
||||
`undefined`.
|
||||
|
||||
<!-- eslint-skip -->
|
||||
<!-- eslint-disable no-useless-return -->
|
||||
|
||||
```js
|
||||
[Symbol.dispose]() {
|
||||
return void this.dispose();
|
||||
// or
|
||||
this.dispose();
|
||||
// or
|
||||
return;
|
||||
// or
|
||||
// no return
|
||||
}
|
||||
class MyIterable {
|
||||
[Symbol.dispose]() {
|
||||
this.dispose();
|
||||
// or
|
||||
return;
|
||||
// or
|
||||
// no return
|
||||
}
|
||||
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.dispose();
|
||||
// or
|
||||
return;
|
||||
// or
|
||||
// no return
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.dispose();
|
||||
// or
|
||||
|
||||
// or
|
||||
// no return
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -312,21 +312,21 @@ directly.
|
||||
|
||||
For example:
|
||||
|
||||
<!-- eslint-skip -->
|
||||
<!-- eslint-disable no-unreachable,no-redeclare -->
|
||||
|
||||
```js
|
||||
// Do something like this:
|
||||
function dispose() { ... }
|
||||
function dispose() { /* ... */ }
|
||||
return {
|
||||
dispose,
|
||||
[Symbol.dispose]() { this.dispose(); }
|
||||
[Symbol.dispose]() { this.dispose(); },
|
||||
};
|
||||
|
||||
// Rather than this:
|
||||
function dispose() { ... }
|
||||
function dispose() { /* ... */ }
|
||||
return {
|
||||
dispose,
|
||||
[Symbol.dispose]: dispose
|
||||
[Symbol.dispose]: dispose,
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@@ -132,8 +132,6 @@ make test-ci
|
||||
|
||||
Also running
|
||||
|
||||
<!-- eslint-disable strict -->
|
||||
|
||||
```js
|
||||
new Intl.DateTimeFormat('es', { month: 'long' }).format(new Date(9E8));
|
||||
```
|
||||
@@ -159,8 +157,6 @@ make
|
||||
|
||||
* Test this newly default-generated Node.js
|
||||
|
||||
<!-- eslint-disable strict -->
|
||||
|
||||
```js
|
||||
process.versions.icu;
|
||||
new Intl.DateTimeFormat('es', { month: 'long' }).format(new Date(9E8));
|
||||
|
||||
@@ -65,17 +65,15 @@ It is possible to create multiple derived
|
||||
classes by providing additional arguments. The other ones will be exposed as
|
||||
properties of the main class:
|
||||
|
||||
<!-- eslint-disable no-unreachable -->
|
||||
|
||||
```js
|
||||
E('EXAMPLE_KEY', 'Error message', TypeError, RangeError);
|
||||
|
||||
// In another module
|
||||
const assert = require('node:assert');
|
||||
const { EXAMPLE_KEY } = require('internal/errors').codes;
|
||||
// TypeError
|
||||
throw new EXAMPLE_KEY();
|
||||
// RangeError
|
||||
throw new EXAMPLE_KEY.RangeError();
|
||||
|
||||
assert.throws(() => { throw new EXAMPLE_KEY(); }, { name: 'TypeError' });
|
||||
assert.throws(() => { throw new EXAMPLE_KEY.RangeError(); }, { name: 'RangeError' });
|
||||
```
|
||||
|
||||
## Documenting new errors
|
||||
|
||||
Reference in new issue
Block a user