diff --git a/async_hooks/asynchook_enable.md b/async_hooks/asynchook_enable.md
index e2838174..4524eb0b 100644
--- a/async_hooks/asynchook_enable.md
+++ b/async_hooks/asynchook_enable.md
@@ -2,7 +2,7 @@
* Returns: {AsyncHook} A reference to `asyncHook`.
Enable the callbacks for a given `AsyncHook` instance. If no callbacks are
-provided enabling is a noop.
+provided, enabling is a no-op.
The `AsyncHook` instance is disabled by default. If the `AsyncHook` instance
should be enabled immediately after creation, the following pattern can be used.
diff --git a/child_process/child_process.md b/child_process/child_process.md
index 137d5f0b..b6e62d5c 100644
--- a/child_process/child_process.md
+++ b/child_process/child_process.md
@@ -31,9 +31,13 @@ ls.on('close', (code) => {
这与 shell 中的管道的行为相同。
如果不消费输出,则使用 `{ stdio: 'ignore' }` 选项。
-如果传入 `options` 对象,则会使用 `options.env.PATH` 环境变量来执行命令查找,否则会使用 `process.env.PATH`。
-考虑到 Windows 的环境变量不区分大小写,Node.js 会按字典顺序对所有 `env` 的键进行排序,并且不区分大小写地选择第一个匹配的 `PATH` 来执行命令查找。
-当传给 `env` 选项的对象具有多个 `PATH` 变量时,在 Windows 上可能会出现问题。
+如果 `options` 对象中有 `options.env.PATH` 环境变量,则使用它来执行命令查找。
+否则,则使用 `process.env.PATH`。
+
+在 Windows 上,环境变量不区分大小写。
+Node.js 按字典顺序对 `env` 的键进行排序,并使用不区分大小写的第一个键。
+只有第一个(按字典顺序)条目会被传给子流程。
+当传给 `env` 选项的对象具有多个相同键名的变量时(例如 `PATH` 和 `Path`),在 Windows 上可能会出现问题。
[`child_process.spawn()`] 方法会异步地衍生子进程,且不阻塞 Node.js 事件循环。
[`child_process.spawnSync()`] 函数则以同步的方式提供了等效的功能,但会阻塞事件循环直到衍生的进程退出或被终止。
diff --git a/console/console_time_label.md b/console/console_time_label.md
index f2973e3d..12fd63db 100644
--- a/console/console_time_label.md
+++ b/console/console_time_label.md
@@ -5,6 +5,6 @@ added: v0.1.104
启动一个计时器,用以计算一个操作的持续时间。
计时器由一个唯一的 `label` 标识。
-当调用 [`console.timeEnd()`] 时,可以使用相同的 `label` 来停止计时器,并以毫秒为单位将持续时间输出到 `stdout`。
-计时器持续时间精确到亚毫秒。
+当调用 [`console.timeEnd()`] 时,可以使用相同的 `label` 来停止计时器,并以合适的时间单位将持续时间输出到 `stdout`。
+例如,如果持续时间为 3869 毫秒,则 `console.timeEnd()` 显示 "3.869s"。
diff --git a/console/console_timeend_label.md b/console/console_timeend_label.md
index a1a6bb72..920c2d9a 100644
--- a/console/console_timeend_label.md
+++ b/console/console_timeend_label.md
@@ -1,6 +1,9 @@
```js
@@ -72,8 +72,8 @@ directly on the ES module namespace when the module is imported.
Live binding updates or new exports added to `module.exports` are not detected
for these named exports.
-The detection of named exports is based on common syntax patterns but will not
-always correctly detect named exports, in these cases using the default
+The detection of named exports is based on common syntax patterns but does not
+always correctly detect named exports. In these cases, using the default
import form described above can be a better option.
Named exports detection covers many common export patterns, reexport patterns
diff --git a/esm/data_imports.md b/esm/data_imports.md
index 586b48f1..263fdb2f 100644
--- a/esm/data_imports.md
+++ b/esm/data_imports.md
@@ -7,13 +7,13 @@ added: v12.10.0
* `text/javascript` for ES Modules
* `application/json` for JSON
-* `application/wasm` for WASM.
+* `application/wasm` for Wasm
`data:` URLs only resolve [_Bare specifiers_][Terminology] for builtin modules
and [_Absolute specifiers_][Terminology]. Resolving
-[_Relative specifiers_][Terminology] will not work because `data:` is not a
+[_Relative specifiers_][Terminology] does not work because `data:` is not a
[special scheme][]. For example, attempting to load `./foo`
-from `data:text/javascript,import "./foo";` will fail to resolve since there
+from `data:text/javascript,import "./foo";` fails to resolve because there
is no concept of relative resolution for `data:` URLs. An example of a `data:`
URLs being used is:
diff --git a/esm/enabling.md b/esm/enabling.md
index 53d21d25..35d6017b 100644
--- a/esm/enabling.md
+++ b/esm/enabling.md
@@ -5,7 +5,7 @@ Node.js treats JavaScript code as CommonJS modules by default.
Authors can tell Node.js to treat JavaScript code as ECMAScript modules
via the `.mjs` file extension, the `package.json` [`"type"`][] field, or the
`--input-type` flag. See
-[Modules: Packages](packages.html#packages_determining_module_system) for more
+[Modules: Packages](packages.md#packages_determining_module_system) for more
details.
diff --git a/esm/experimental_json_modules.md b/esm/experimental_json_modules.md
index d1a1ed0e..d26c5700 100644
--- a/esm/experimental_json_modules.md
+++ b/esm/experimental_json_modules.md
@@ -4,11 +4,11 @@ and are loaded using the CJS loader. [WHATWG JSON modules specification][] are
still being standardized, and are experimentally supported by including the
additional flag `--experimental-json-modules` when running Node.js.
-When the `--experimental-json-modules` flag is included both the
-`commonjs` and `module` mode will use the new experimental JSON
-loader. The imported JSON only exposes a `default`, there is no
+When the `--experimental-json-modules` flag is included, both the
+`commonjs` and `module` mode use the new experimental JSON
+loader. The imported JSON only exposes a `default`. There is no
support for named exports. A cache entry is created in the CommonJS
-cache, to avoid duplication. The same object will be returned in
+cache to avoid duplication. The same object is returned in
CommonJS if the JSON module has already been imported from the
same path.
diff --git a/esm/getformat_url_context_defaultgetformat.md b/esm/getformat_url_context_defaultgetformat.md
index be286022..1c48ce44 100644
--- a/esm/getformat_url_context_defaultgetformat.md
+++ b/esm/getformat_url_context_defaultgetformat.md
@@ -27,7 +27,7 @@ Note: These types all correspond to classes defined in ECMAScript.
* The specific [`TypedArray`][] object is a [`Uint8Array`][].
Note: If the source value of a text-based format (i.e., `'json'`, `'module'`) is
-not a string, it will be converted to a string using [`util.TextDecoder`][].
+not a string, it is converted to a string using [`util.TextDecoder`][].
```js
/**
diff --git a/esm/getglobalpreloadcode.md b/esm/getglobalpreloadcode.md
index 69db2089..66b56cb9 100644
--- a/esm/getglobalpreloadcode.md
+++ b/esm/getglobalpreloadcode.md
@@ -4,15 +4,15 @@
* Returns: {string}
-Sometimes it can be necessary to run some code inside of the same global scope
-that the application will run in. This hook allows to return a string that will
-be ran as sloppy-mode script on startup.
+Sometimes it might be necessary to run some code inside of the same global scope
+that the application runs in. This hook allows the return of a string that is
+run as sloppy-mode script on startup.
Similar to how CommonJS wrappers work, the code runs in an implicit function
scope. The only argument is a `require`-like function that can be used to load
builtins like "fs": `getBuiltin(request: string)`.
-If the code needs more advanced `require` features, it will have to construct
+If the code needs more advanced `require` features, it has to construct
its own `require` using `module.createRequire()`.
```js
diff --git a/esm/https_loader.md b/esm/https_loader.md
index 673615c0..f6597086 100644
--- a/esm/https_loader.md
+++ b/esm/https_loader.md
@@ -67,12 +67,8 @@ import { VERSION } from 'https://coffeescript.org/browser-compiler-modern/coffee
console.log(VERSION);
```
-With this loader, running:
-
-```bash
-node --experimental-loader ./https-loader.mjs ./main.mjs
-```
-
-Will print the current version of CoffeeScript per the module at the URL in
+With the preceding loader, running
+`node --experimental-loader ./https-loader.mjs ./main.mjs`
+prints the current version of CoffeeScript per the module at the URL in
`main.mjs`.
diff --git a/esm/modules_ecmascript_modules.md b/esm/modules_ecmascript_modules.md
index 54035bd9..7178587a 100644
--- a/esm/modules_ecmascript_modules.md
+++ b/esm/modules_ecmascript_modules.md
@@ -1,6 +1,27 @@
+
> Stability: 1 - Experimental
diff --git a/esm/no_require_resolve.md b/esm/no_require_resolve.md
index 371e7ce2..1de16ddd 100644
--- a/esm/no_require_resolve.md
+++ b/esm/no_require_resolve.md
@@ -19,7 +19,7 @@ from which to resolve from:
})();
```
-This function is asynchronous since the ES module resolver in Node.js is
+This function is asynchronous because the ES module resolver in Node.js is
asynchronous. With the introduction of [Top-Level Await][], these use cases
will be easier as they won't require an async function wrapper.
diff --git a/esm/node_imports.md b/esm/node_imports.md
new file mode 100644
index 00000000..df222ce0
--- /dev/null
+++ b/esm/node_imports.md
@@ -0,0 +1,13 @@
+
+
+
+`node:` URLs are supported as a means to load Node.js builtin modules. This
+URL scheme allows for builtin modules to be referenced by valid absolute URL
+strings.
+
+```js
+import fs from 'node:fs/promises';
+```
+
diff --git a/esm/packages.md b/esm/packages.md
index 70cbaf7f..d9210600 100644
--- a/esm/packages.md
+++ b/esm/packages.md
@@ -1,3 +1,3 @@
-This section was moved to [Modules: Packages](packages.html).
+This section was moved to [Modules: Packages](packages.md).
diff --git a/esm/resolve_specifier_context_defaultresolve.md b/esm/resolve_specifier_context_defaultresolve.md
index ca985f2b..e2fd54b2 100644
--- a/esm/resolve_specifier_context_defaultresolve.md
+++ b/esm/resolve_specifier_context_defaultresolve.md
@@ -20,7 +20,7 @@ The `conditions` property on the `context` is an array of conditions for
for looking up conditional mappings elsewhere or to modify the list when calling
the default resolution logic.
-The current [package exports conditions][Conditional Exports] will always be in
+The current [package exports conditions][Conditional Exports] are always in
the `context.conditions` array passed into the hook. To guarantee _default
Node.js module specifier resolution behavior_ when calling `defaultResolve`, the
`context.conditions` array passed to it _must_ include _all_ elements of the
diff --git a/esm/resolver_algorithm.md b/esm/resolver_algorithm.md
index 9449b277..d12d78e9 100644
--- a/esm/resolver_algorithm.md
+++ b/esm/resolver_algorithm.md
@@ -28,260 +28,3 @@ The resolver can throw the following errors:
* _Package Import Not Defined_: Package imports do not define the specifier.
* _Module Not Found_: The package or module requested does not exist.
-
-Resolver algorithm specification
-
-**ESM_RESOLVE**(_specifier_, _parentURL_)
-
-> 1. Let _resolved_ be **undefined**.
-> 1. If _specifier_ is a valid URL, then
-> 1. Set _resolved_ to the result of parsing and reserializing
-> _specifier_ as a URL.
-> 1. Otherwise, if _specifier_ starts with _"/"_, _"./"_ or _"../"_, then
-> 1. Set _resolved_ to the URL resolution of _specifier_ relative to
-> _parentURL_.
-> 1. Otherwise, if _specifier_ starts with _"#"_, then
-> 1. Set _resolved_ to the destructured value of the result of
-> **PACKAGE_IMPORTS_RESOLVE**(_specifier_, _parentURL_,
-> _defaultConditions_).
-> 1. Otherwise,
-> 1. Note: _specifier_ is now a bare specifier.
-> 1. Set _resolved_ the result of
-> **PACKAGE_RESOLVE**(_specifier_, _parentURL_).
-> 1. If _resolved_ contains any percent encodings of _"/"_ or _"\\"_ (_"%2f"_
-> and _"%5C"_ respectively), then
-> 1. Throw an _Invalid Module Specifier_ error.
-> 1. If the file at _resolved_ is a directory, then
-> 1. Throw an _Unsupported Directory Import_ error.
-> 1. If the file at _resolved_ does not exist, then
-> 1. Throw a _Module Not Found_ error.
-> 1. Set _resolved_ to the real path of _resolved_.
-> 1. Let _format_ be the result of **ESM_FORMAT**(_resolved_).
-> 1. Load _resolved_ as module format, _format_.
-> 1. Return _resolved_.
-
-**PACKAGE_RESOLVE**(_packageSpecifier_, _parentURL_)
-
-> 1. Let _packageName_ be **undefined**.
-> 1. If _packageSpecifier_ is an empty string, then
-> 1. Throw an _Invalid Module Specifier_ error.
-> 1. If _packageSpecifier_ does not start with _"@"_, then
-> 1. Set _packageName_ to the substring of _packageSpecifier_ until the first
-> _"/"_ separator or the end of the string.
-> 1. Otherwise,
-> 1. If _packageSpecifier_ does not contain a _"/"_ separator, then
-> 1. Throw an _Invalid Module Specifier_ error.
-> 1. Set _packageName_ to the substring of _packageSpecifier_
-> until the second _"/"_ separator or the end of the string.
-> 1. If _packageName_ starts with _"."_ or contains _"\\"_ or _"%"_, then
-> 1. Throw an _Invalid Module Specifier_ error.
-> 1. Let _packageSubpath_ be _"."_ concatenated with the substring of
-> _packageSpecifier_ from the position at the length of _packageName_.
-> 1. Let _selfUrl_ be the result of
-> **PACKAGE_SELF_RESOLVE**(_packageName_, _packageSubpath_, _parentURL_).
-> 1. If _selfUrl_ is not **undefined**, return _selfUrl_.
-> 1. If _packageSubpath_ is _"."_ and _packageName_ is a Node.js builtin
-> module, then
-> 1. Return the string _"nodejs:"_ concatenated with _packageSpecifier_.
-> 1. While _parentURL_ is not the file system root,
-> 1. Let _packageURL_ be the URL resolution of _"node_modules/"_
-> concatenated with _packageSpecifier_, relative to _parentURL_.
-> 1. Set _parentURL_ to the parent folder URL of _parentURL_.
-> 1. If the folder at _packageURL_ does not exist, then
-> 1. Set _parentURL_ to the parent URL path of _parentURL_.
-> 1. Continue the next loop iteration.
-> 1. Let _pjson_ be the result of **READ_PACKAGE_JSON**(_packageURL_).
-> 1. If _pjson_ is not **null** and _pjson_._exports_ is not **null** or
-> **undefined**, then
-> 1. Let _exports_ be _pjson.exports_.
-> 1. Return the _resolved_ destructured value of the result of
-> **PACKAGE_EXPORTS_RESOLVE**(_packageURL_, _packageSubpath_,
-> _pjson.exports_, _defaultConditions_).
-> 1. Otherwise, if _packageSubpath_ is equal to _"."_, then
-> 1. Return the result applying the legacy **LOAD_AS_DIRECTORY**
-> CommonJS resolver to _packageURL_, throwing a _Module Not Found_
-> error for no resolution.
-> 1. Otherwise,
-> 1. Return the URL resolution of _packageSubpath_ in _packageURL_.
-> 1. Throw a _Module Not Found_ error.
-
-**PACKAGE_SELF_RESOLVE**(_packageName_, _packageSubpath_, _parentURL_)
-
-> 1. Let _packageURL_ be the result of **READ_PACKAGE_SCOPE**(_parentURL_).
-> 1. If _packageURL_ is **null**, then
-> 1. Return **undefined**.
-> 1. Let _pjson_ be the result of **READ_PACKAGE_JSON**(_packageURL_).
-> 1. If _pjson_ is **null** or if _pjson_._exports_ is **null** or
-> **undefined**, then
-> 1. Return **undefined**.
-> 1. If _pjson.name_ is equal to _packageName_, then
-> 1. Return the _resolved_ destructured value of the result of
-> **PACKAGE_EXPORTS_RESOLVE**(_packageURL_, _subpath_, _pjson.exports_,
-> _defaultConditions_).
-> 1. Otherwise, return **undefined**.
-
-**PACKAGE_EXPORTS_RESOLVE**(_packageURL_, _subpath_, _exports_, _conditions_)
-
-> 1. If _exports_ is an Object with both a key starting with _"."_ and a key not
-> starting with _"."_, throw an _Invalid Package Configuration_ error.
-> 1. If _subpath_ is equal to _"."_, then
-> 1. Let _mainExport_ be **undefined**.
-> 1. If _exports_ is a String or Array, or an Object containing no keys
-> starting with _"."_, then
-> 1. Set _mainExport_ to _exports_.
-> 1. Otherwise if _exports_ is an Object containing a _"."_ property, then
-> 1. Set _mainExport_ to _exports_\[_"."_\].
-> 1. If _mainExport_ is not **undefined**, then
-> 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**(
-> _packageURL_, _mainExport_, _""_, **false**, **false**,
-> _conditions_).
-> 1. If _resolved_ is not **null** or **undefined**, then
-> 1. Return _resolved_.
-> 1. Otherwise, if _exports_ is an Object and all keys of _exports_ start with
-> _"."_, then
-> 1. Let _matchKey_ be the string _"./"_ concatenated with _subpath_.
-> 1. Let _resolvedMatch_ be result of **PACKAGE_IMPORTS_EXPORTS_RESOLVE**(
-> _matchKey_, _exports_, _packageURL_, **false**, _conditions_).
-> 1. If _resolvedMatch_._resolve_ is not **null** or **undefined**, then
-> 1. Return _resolvedMatch_.
-> 1. Throw a _Package Path Not Exported_ error.
-
-**PACKAGE_IMPORTS_RESOLVE**(_specifier_, _parentURL_, _conditions_)
-
-> 1. Assert: _specifier_ begins with _"#"_.
-> 1. If _specifier_ is exactly equal to _"#"_ or starts with _"#/"_, then
-> 1. Throw an _Invalid Module Specifier_ error.
-> 1. Let _packageURL_ be the result of **READ_PACKAGE_SCOPE**(_parentURL_).
-> 1. If _packageURL_ is not **null**, then
-> 1. Let _pjson_ be the result of **READ_PACKAGE_JSON**(_packageURL_).
-> 1. If _pjson.imports_ is a non-null Object, then
-> 1. Let _resolvedMatch_ be the result of
-> **PACKAGE_IMPORTS_EXPORTS_RESOLVE**(_specifier_, _pjson.imports_,
-> _packageURL_, **true**, _conditions_).
-> 1. If _resolvedMatch_._resolve_ is not **null** or **undefined**, then
-> 1. Return _resolvedMatch_.
-> 1. Throw a _Package Import Not Defined_ error.
-
-**PACKAGE_IMPORTS_EXPORTS_RESOLVE**(_matchKey_, _matchObj_, _packageURL_,
-_isImports_, _conditions_)
-
-> 1. If _matchKey_ is a key of _matchObj_, and does not end in _"*"_, then
-> 1. Let _target_ be the value of _matchObj_\[_matchKey_\].
-> 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**(
-> _packageURL_, _target_, _""_, **false**, _isImports_, _conditions_).
-> 1. Return the object _{ resolved, exact: **true** }_.
-> 1. Let _expansionKeys_ be the list of keys of _matchObj_ ending in _"/"_
-> or _"*"_, sorted by length descending.
-> 1. For each key _expansionKey_ in _expansionKeys_, do
-> 1. If _expansionKey_ ends in _"*"_ and _matchKey_ starts with but is
-> not equal to the substring of _expansionKey_ excluding the last _"*"_
-> character, then
-> 1. Let _target_ be the value of _matchObj_\[_expansionKey_\].
-> 1. Let _subpath_ be the substring of _matchKey_ starting at the
-> index of the length of _expansionKey_ minus one.
-> 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**(
-> _packageURL_, _target_, _subpath_, **true**, _isImports_,
-> _conditions_).
-> 1. Return the object _{ resolved, exact: **true** }_.
-> 1. If _matchKey_ starts with _expansionKey_, then
-> 1. Let _target_ be the value of _matchObj_\[_expansionKey_\].
-> 1. Let _subpath_ be the substring of _matchKey_ starting at the
-> index of the length of _expansionKey_.
-> 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**(
-> _packageURL_, _target_, _subpath_, **false**, _isImports_,
-> _conditions_).
-> 1. Return the object _{ resolved, exact: **false** }_.
-> 1. Return the object _{ resolved: **null**, exact: **true** }_.
-
-**PACKAGE_TARGET_RESOLVE**(_packageURL_, _target_, _subpath_, _pattern_,
-_internal_, _conditions_)
-
-> 1. If _target_ is a String, then
-> 1. If _pattern_ is **false**, _subpath_ has non-zero length and _target_
-> does not end with _"/"_, throw an _Invalid Module Specifier_ error.
-> 1. If _target_ does not start with _"./"_, then
-> 1. If _internal_ is **true** and _target_ does not start with _"../"_ or
-> _"/"_ and is not a valid URL, then
-> 1. If _pattern_ is **true**, then
-> 1. Return **PACKAGE_RESOLVE**(_target_ with every instance of
-> _"*"_ replaced by _subpath_, _packageURL_ + _"/"_)_.
-> 1. Return **PACKAGE_RESOLVE**(_target_ + _subpath_,
-> _packageURL_ + _"/"_)_.
-> 1. Otherwise, throw an _Invalid Package Target_ error.
-> 1. If _target_ split on _"/"_ or _"\\"_ contains any _"."_, _".."_ or
-> _"node_modules"_ segments after the first segment, throw an
-> _Invalid Package Target_ error.
-> 1. Let _resolvedTarget_ be the URL resolution of the concatenation of
-> _packageURL_ and _target_.
-> 1. Assert: _resolvedTarget_ is contained in _packageURL_.
-> 1. If _subpath_ split on _"/"_ or _"\\"_ contains any _"."_, _".."_ or
-> _"node_modules"_ segments, throw an _Invalid Module Specifier_ error.
-> 1. If _pattern_ is **true**, then
-> 1. Return the URL resolution of _resolvedTarget_ with every instance of
-> _"*"_ replaced with _subpath_.
-> 1. Otherwise,
-> 1. Return the URL resolution of the concatenation of _subpath_ and
-> _resolvedTarget_.
-> 1. Otherwise, if _target_ is a non-null Object, then
-> 1. If _exports_ contains any index property keys, as defined in ECMA-262
-> [6.1.7 Array Index][], throw an _Invalid Package Configuration_ error.
-> 1. For each property _p_ of _target_, in object insertion order as,
-> 1. If _p_ equals _"default"_ or _conditions_ contains an entry for _p_,
-> then
-> 1. Let _targetValue_ be the value of the _p_ property in _target_.
-> 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**(
-> _packageURL_, _targetValue_, _subpath_, _pattern_, _internal_,
-> _conditions_).
-> 1. If _resolved_ is equal to **undefined**, continue the loop.
-> 1. Return _resolved_.
-> 1. Return **undefined**.
-> 1. Otherwise, if _target_ is an Array, then
-> 1. If _target.length is zero, return **null**.
-> 1. For each item _targetValue_ in _target_, do
-> 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**(
-> _packageURL_, _targetValue_, _subpath_, _pattern_, _internal_,
-> _conditions_), continuing the loop on any _Invalid Package Target_
-> error.
-> 1. If _resolved_ is **undefined**, continue the loop.
-> 1. Return _resolved_.
-> 1. Return or throw the last fallback resolution **null** return or error.
-> 1. Otherwise, if _target_ is _null_, return **null**.
-> 1. Otherwise throw an _Invalid Package Target_ error.
-
-**ESM_FORMAT**(_url_)
-
-> 1. Assert: _url_ corresponds to an existing file.
-> 1. Let _pjson_ be the result of **READ_PACKAGE_SCOPE**(_url_).
-> 1. If _url_ ends in _".mjs"_, then
-> 1. Return _"module"_.
-> 1. If _url_ ends in _".cjs"_, then
-> 1. Return _"commonjs"_.
-> 1. If _pjson?.type_ exists and is _"module"_, then
-> 1. If _url_ ends in _".js"_, then
-> 1. Return _"module"_.
-> 1. Throw an _Unsupported File Extension_ error.
-> 1. Otherwise,
-> 1. Throw an _Unsupported File Extension_ error.
-
-**READ_PACKAGE_SCOPE**(_url_)
-
-> 1. Let _scopeURL_ be _url_.
-> 1. While _scopeURL_ is not the file system root,
-> 1. Set _scopeURL_ to the parent URL of _scopeURL_.
-> 1. If _scopeURL_ ends in a _"node_modules"_ path segment, return **null**.
-> 1. Let _pjson_ be the result of **READ_PACKAGE_JSON**(_scopeURL_).
-> 1. If _pjson_ is not **null**, then
-> 1. Return _pjson_.
-> 1. Return **null**.
-
-**READ_PACKAGE_JSON**(_packageURL_)
-
-> 1. Let _pjsonURL_ be the resolution of _"package.json"_ within _packageURL_.
-> 1. If the file at _pjsonURL_ does not exist, then
-> 1. Return **null**.
-> 1. If the file at _packageURL_ does not parse as valid JSON, then
-> 1. Throw an _Invalid Package Configuration_ error.
-> 1. Return the parsed JSON source of the file at _pjsonURL_.
-
-
-
diff --git a/esm/resolver_algorithm_specification.md b/esm/resolver_algorithm_specification.md
new file mode 100644
index 00000000..6857284d
--- /dev/null
+++ b/esm/resolver_algorithm_specification.md
@@ -0,0 +1,253 @@
+
+**ESM_RESOLVE**(_specifier_, _parentURL_)
+
+> 1. Let _resolved_ be **undefined**.
+> 1. If _specifier_ is a valid URL, then
+> 1. Set _resolved_ to the result of parsing and reserializing
+> _specifier_ as a URL.
+> 1. Otherwise, if _specifier_ starts with _"/"_, _"./"_ or _"../"_, then
+> 1. Set _resolved_ to the URL resolution of _specifier_ relative to
+> _parentURL_.
+> 1. Otherwise, if _specifier_ starts with _"#"_, then
+> 1. Set _resolved_ to the destructured value of the result of
+> **PACKAGE_IMPORTS_RESOLVE**(_specifier_, _parentURL_,
+> _defaultConditions_).
+> 1. Otherwise,
+> 1. Note: _specifier_ is now a bare specifier.
+> 1. Set _resolved_ the result of
+> **PACKAGE_RESOLVE**(_specifier_, _parentURL_).
+> 1. If _resolved_ contains any percent encodings of _"/"_ or _"\\"_ (_"%2f"_
+> and _"%5C"_ respectively), then
+> 1. Throw an _Invalid Module Specifier_ error.
+> 1. If the file at _resolved_ is a directory, then
+> 1. Throw an _Unsupported Directory Import_ error.
+> 1. If the file at _resolved_ does not exist, then
+> 1. Throw a _Module Not Found_ error.
+> 1. Set _resolved_ to the real path of _resolved_.
+> 1. Let _format_ be the result of **ESM_FORMAT**(_resolved_).
+> 1. Load _resolved_ as module format, _format_.
+> 1. Return _resolved_.
+
+**PACKAGE_RESOLVE**(_packageSpecifier_, _parentURL_)
+
+> 1. Let _packageName_ be **undefined**.
+> 1. If _packageSpecifier_ is an empty string, then
+> 1. Throw an _Invalid Module Specifier_ error.
+> 1. If _packageSpecifier_ does not start with _"@"_, then
+> 1. Set _packageName_ to the substring of _packageSpecifier_ until the first
+> _"/"_ separator or the end of the string.
+> 1. Otherwise,
+> 1. If _packageSpecifier_ does not contain a _"/"_ separator, then
+> 1. Throw an _Invalid Module Specifier_ error.
+> 1. Set _packageName_ to the substring of _packageSpecifier_
+> until the second _"/"_ separator or the end of the string.
+> 1. If _packageName_ starts with _"."_ or contains _"\\"_ or _"%"_, then
+> 1. Throw an _Invalid Module Specifier_ error.
+> 1. Let _packageSubpath_ be _"."_ concatenated with the substring of
+> _packageSpecifier_ from the position at the length of _packageName_.
+> 1. Let _selfUrl_ be the result of
+> **PACKAGE_SELF_RESOLVE**(_packageName_, _packageSubpath_, _parentURL_).
+> 1. If _selfUrl_ is not **undefined**, return _selfUrl_.
+> 1. If _packageSubpath_ is _"."_ and _packageName_ is a Node.js builtin
+> module, then
+> 1. Return the string _"node:"_ concatenated with _packageSpecifier_.
+> 1. While _parentURL_ is not the file system root,
+> 1. Let _packageURL_ be the URL resolution of _"node_modules/"_
+> concatenated with _packageSpecifier_, relative to _parentURL_.
+> 1. Set _parentURL_ to the parent folder URL of _parentURL_.
+> 1. If the folder at _packageURL_ does not exist, then
+> 1. Set _parentURL_ to the parent URL path of _parentURL_.
+> 1. Continue the next loop iteration.
+> 1. Let _pjson_ be the result of **READ_PACKAGE_JSON**(_packageURL_).
+> 1. If _pjson_ is not **null** and _pjson_._exports_ is not **null** or
+> **undefined**, then
+> 1. Let _exports_ be _pjson.exports_.
+> 1. Return the _resolved_ destructured value of the result of
+> **PACKAGE_EXPORTS_RESOLVE**(_packageURL_, _packageSubpath_,
+> _pjson.exports_, _defaultConditions_).
+> 1. Otherwise, if _packageSubpath_ is equal to _"."_, then
+> 1. Return the result applying the legacy **LOAD_AS_DIRECTORY**
+> CommonJS resolver to _packageURL_, throwing a _Module Not Found_
+> error for no resolution.
+> 1. Otherwise,
+> 1. Return the URL resolution of _packageSubpath_ in _packageURL_.
+> 1. Throw a _Module Not Found_ error.
+
+**PACKAGE_SELF_RESOLVE**(_packageName_, _packageSubpath_, _parentURL_)
+
+> 1. Let _packageURL_ be the result of **READ_PACKAGE_SCOPE**(_parentURL_).
+> 1. If _packageURL_ is **null**, then
+> 1. Return **undefined**.
+> 1. Let _pjson_ be the result of **READ_PACKAGE_JSON**(_packageURL_).
+> 1. If _pjson_ is **null** or if _pjson_._exports_ is **null** or
+> **undefined**, then
+> 1. Return **undefined**.
+> 1. If _pjson.name_ is equal to _packageName_, then
+> 1. Return the _resolved_ destructured value of the result of
+> **PACKAGE_EXPORTS_RESOLVE**(_packageURL_, _subpath_, _pjson.exports_,
+> _defaultConditions_).
+> 1. Otherwise, return **undefined**.
+
+**PACKAGE_EXPORTS_RESOLVE**(_packageURL_, _subpath_, _exports_, _conditions_)
+
+> 1. If _exports_ is an Object with both a key starting with _"."_ and a key not
+> starting with _"."_, throw an _Invalid Package Configuration_ error.
+> 1. If _subpath_ is equal to _"."_, then
+> 1. Let _mainExport_ be **undefined**.
+> 1. If _exports_ is a String or Array, or an Object containing no keys
+> starting with _"."_, then
+> 1. Set _mainExport_ to _exports_.
+> 1. Otherwise if _exports_ is an Object containing a _"."_ property, then
+> 1. Set _mainExport_ to _exports_\[_"."_\].
+> 1. If _mainExport_ is not **undefined**, then
+> 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**(
+> _packageURL_, _mainExport_, _""_, **false**, **false**,
+> _conditions_).
+> 1. If _resolved_ is not **null** or **undefined**, then
+> 1. Return _resolved_.
+> 1. Otherwise, if _exports_ is an Object and all keys of _exports_ start with
+> _"."_, then
+> 1. Let _matchKey_ be the string _"./"_ concatenated with _subpath_.
+> 1. Let _resolvedMatch_ be result of **PACKAGE_IMPORTS_EXPORTS_RESOLVE**(
+> _matchKey_, _exports_, _packageURL_, **false**, _conditions_).
+> 1. If _resolvedMatch_._resolve_ is not **null** or **undefined**, then
+> 1. Return _resolvedMatch_.
+> 1. Throw a _Package Path Not Exported_ error.
+
+**PACKAGE_IMPORTS_RESOLVE**(_specifier_, _parentURL_, _conditions_)
+
+> 1. Assert: _specifier_ begins with _"#"_.
+> 1. If _specifier_ is exactly equal to _"#"_ or starts with _"#/"_, then
+> 1. Throw an _Invalid Module Specifier_ error.
+> 1. Let _packageURL_ be the result of **READ_PACKAGE_SCOPE**(_parentURL_).
+> 1. If _packageURL_ is not **null**, then
+> 1. Let _pjson_ be the result of **READ_PACKAGE_JSON**(_packageURL_).
+> 1. If _pjson.imports_ is a non-null Object, then
+> 1. Let _resolvedMatch_ be the result of
+> **PACKAGE_IMPORTS_EXPORTS_RESOLVE**(_specifier_, _pjson.imports_,
+> _packageURL_, **true**, _conditions_).
+> 1. If _resolvedMatch_._resolve_ is not **null** or **undefined**, then
+> 1. Return _resolvedMatch_.
+> 1. Throw a _Package Import Not Defined_ error.
+
+**PACKAGE_IMPORTS_EXPORTS_RESOLVE**(_matchKey_, _matchObj_, _packageURL_,
+_isImports_, _conditions_)
+
+> 1. If _matchKey_ is a key of _matchObj_, and does not end in _"*"_, then
+> 1. Let _target_ be the value of _matchObj_\[_matchKey_\].
+> 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**(
+> _packageURL_, _target_, _""_, **false**, _isImports_, _conditions_).
+> 1. Return the object _{ resolved, exact: **true** }_.
+> 1. Let _expansionKeys_ be the list of keys of _matchObj_ ending in _"/"_
+> or _"*"_, sorted by length descending.
+> 1. For each key _expansionKey_ in _expansionKeys_, do
+> 1. If _expansionKey_ ends in _"*"_ and _matchKey_ starts with but is
+> not equal to the substring of _expansionKey_ excluding the last _"*"_
+> character, then
+> 1. Let _target_ be the value of _matchObj_\[_expansionKey_\].
+> 1. Let _subpath_ be the substring of _matchKey_ starting at the
+> index of the length of _expansionKey_ minus one.
+> 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**(
+> _packageURL_, _target_, _subpath_, **true**, _isImports_,
+> _conditions_).
+> 1. Return the object _{ resolved, exact: **true** }_.
+> 1. If _matchKey_ starts with _expansionKey_, then
+> 1. Let _target_ be the value of _matchObj_\[_expansionKey_\].
+> 1. Let _subpath_ be the substring of _matchKey_ starting at the
+> index of the length of _expansionKey_.
+> 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**(
+> _packageURL_, _target_, _subpath_, **false**, _isImports_,
+> _conditions_).
+> 1. Return the object _{ resolved, exact: **false** }_.
+> 1. Return the object _{ resolved: **null**, exact: **true** }_.
+
+**PACKAGE_TARGET_RESOLVE**(_packageURL_, _target_, _subpath_, _pattern_,
+_internal_, _conditions_)
+
+> 1. If _target_ is a String, then
+> 1. If _pattern_ is **false**, _subpath_ has non-zero length and _target_
+> does not end with _"/"_, throw an _Invalid Module Specifier_ error.
+> 1. If _target_ does not start with _"./"_, then
+> 1. If _internal_ is **true** and _target_ does not start with _"../"_ or
+> _"/"_ and is not a valid URL, then
+> 1. If _pattern_ is **true**, then
+> 1. Return **PACKAGE_RESOLVE**(_target_ with every instance of
+> _"*"_ replaced by _subpath_, _packageURL_ + _"/"_)_.
+> 1. Return **PACKAGE_RESOLVE**(_target_ + _subpath_,
+> _packageURL_ + _"/"_)_.
+> 1. Otherwise, throw an _Invalid Package Target_ error.
+> 1. If _target_ split on _"/"_ or _"\\"_ contains any _"."_, _".."_ or
+> _"node_modules"_ segments after the first segment, throw an
+> _Invalid Package Target_ error.
+> 1. Let _resolvedTarget_ be the URL resolution of the concatenation of
+> _packageURL_ and _target_.
+> 1. Assert: _resolvedTarget_ is contained in _packageURL_.
+> 1. If _subpath_ split on _"/"_ or _"\\"_ contains any _"."_, _".."_ or
+> _"node_modules"_ segments, throw an _Invalid Module Specifier_ error.
+> 1. If _pattern_ is **true**, then
+> 1. Return the URL resolution of _resolvedTarget_ with every instance of
+> _"*"_ replaced with _subpath_.
+> 1. Otherwise,
+> 1. Return the URL resolution of the concatenation of _subpath_ and
+> _resolvedTarget_.
+> 1. Otherwise, if _target_ is a non-null Object, then
+> 1. If _exports_ contains any index property keys, as defined in ECMA-262
+> [6.1.7 Array Index][], throw an _Invalid Package Configuration_ error.
+> 1. For each property _p_ of _target_, in object insertion order as,
+> 1. If _p_ equals _"default"_ or _conditions_ contains an entry for _p_,
+> then
+> 1. Let _targetValue_ be the value of the _p_ property in _target_.
+> 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**(
+> _packageURL_, _targetValue_, _subpath_, _pattern_, _internal_,
+> _conditions_).
+> 1. If _resolved_ is equal to **undefined**, continue the loop.
+> 1. Return _resolved_.
+> 1. Return **undefined**.
+> 1. Otherwise, if _target_ is an Array, then
+> 1. If _target.length is zero, return **null**.
+> 1. For each item _targetValue_ in _target_, do
+> 1. Let _resolved_ be the result of **PACKAGE_TARGET_RESOLVE**(
+> _packageURL_, _targetValue_, _subpath_, _pattern_, _internal_,
+> _conditions_), continuing the loop on any _Invalid Package Target_
+> error.
+> 1. If _resolved_ is **undefined**, continue the loop.
+> 1. Return _resolved_.
+> 1. Return or throw the last fallback resolution **null** return or error.
+> 1. Otherwise, if _target_ is _null_, return **null**.
+> 1. Otherwise throw an _Invalid Package Target_ error.
+
+**ESM_FORMAT**(_url_)
+
+> 1. Assert: _url_ corresponds to an existing file.
+> 1. Let _pjson_ be the result of **READ_PACKAGE_SCOPE**(_url_).
+> 1. If _url_ ends in _".mjs"_, then
+> 1. Return _"module"_.
+> 1. If _url_ ends in _".cjs"_, then
+> 1. Return _"commonjs"_.
+> 1. If _pjson?.type_ exists and is _"module"_, then
+> 1. If _url_ ends in _".js"_, then
+> 1. Return _"module"_.
+> 1. Throw an _Unsupported File Extension_ error.
+> 1. Otherwise,
+> 1. Throw an _Unsupported File Extension_ error.
+
+**READ_PACKAGE_SCOPE**(_url_)
+
+> 1. Let _scopeURL_ be _url_.
+> 1. While _scopeURL_ is not the file system root,
+> 1. Set _scopeURL_ to the parent URL of _scopeURL_.
+> 1. If _scopeURL_ ends in a _"node_modules"_ path segment, return **null**.
+> 1. Let _pjson_ be the result of **READ_PACKAGE_JSON**(_scopeURL_).
+> 1. If _pjson_ is not **null**, then
+> 1. Return _pjson_.
+> 1. Return **null**.
+
+**READ_PACKAGE_JSON**(_packageURL_)
+
+> 1. Let _pjsonURL_ be the resolution of _"package.json"_ within _packageURL_.
+> 1. If the file at _pjsonURL_ does not exist, then
+> 1. Return **null**.
+> 1. If the file at _packageURL_ does not parse as valid JSON, then
+> 1. Throw an _Invalid Package Configuration_ error.
+> 1. Return the parsed JSON source of the file at _pjsonURL_.
+
diff --git a/esm/terminology.md b/esm/terminology.md
index 3f08b501..4f97ce9e 100644
--- a/esm/terminology.md
+++ b/esm/terminology.md
@@ -20,7 +20,7 @@ There are four types of specifiers:
Bare specifiers, and the bare specifier portion of deep import specifiers, are
strings; but everything else in a specifier is a URL.
-Only `file:` and `data:` URLs are supported. A specifier like
+`file:`, `node:`, and `data:` URLs are supported. A specifier like
`'https://example.com/app.js'` may be supported by browsers but it is not
supported in Node.js.
diff --git a/esm/transpiler_loader.md b/esm/transpiler_loader.md
index fcd80053..20e2e8d0 100644
--- a/esm/transpiler_loader.md
+++ b/esm/transpiler_loader.md
@@ -75,13 +75,9 @@ console.log "Brought to you by Node.js version #{version}"
export scream = (str) -> str.toUpperCase()
```
-With this loader, running:
-
-```console
-node --experimental-loader ./coffeescript-loader.mjs main.coffee
-```
-
-Will cause `main.coffee` to be turned into JavaScript after its source code is
+With the preceding loader, running
+`node --experimental-loader ./coffeescript-loader.mjs main.coffee`
+causes `main.coffee` to be turned into JavaScript after its source code is
loaded from disk but before Node.js executes it; and so on for any `.coffee`,
`.litcoffee` or `.coffee.md` files referenced via `import` statements of any
loaded file.
diff --git a/esm/url_based_paths.md b/esm/url_based_paths.md
index 1dc644de..d7995628 100644
--- a/esm/url_based_paths.md
+++ b/esm/url_based_paths.md
@@ -3,8 +3,8 @@ ES modules are resolved and cached based upon
[URL](https://url.spec.whatwg.org/) semantics. This means that files containing
special characters such as `#` and `?` need to be escaped.
-Modules will be loaded multiple times if the `import` specifier used to resolve
-them have a different query or fragment.
+Modules are loaded multiple times if the `import` specifier used to resolve
+them has a different query or fragment.
```js
import './foo.mjs?query=1'; // loads ./foo.mjs with query of "?query=1"
diff --git a/fs/filehandle_read_buffer_offset_length_position.md b/fs/filehandle_read_buffer_offset_length_position.md
index 1dea383d..824708ce 100644
--- a/fs/filehandle_read_buffer_offset_length_position.md
+++ b/fs/filehandle_read_buffer_offset_length_position.md
@@ -21,3 +21,4 @@ added: v10.0.0
成功读取之后,`Promise` 会被解决并带上一个对象,对象上有一个 `bytesRead` 属性(指定读取的字节数)和一个 `buffer` 属性(指向传入的 `buffer` 参数)。
+如果文件没有被同时地修改,则当读取的字节数为零时,即到达文件的末尾。
diff --git a/fs/fs_read_fd_buffer_offset_length_position_callback.md b/fs/fs_read_fd_buffer_offset_length_position_callback.md
index e19af018..9cae82d7 100644
--- a/fs/fs_read_fd_buffer_offset_length_position_callback.md
+++ b/fs/fs_read_fd_buffer_offset_length_position_callback.md
@@ -36,5 +36,7 @@ changes:
回调有三个参数 `(err, bytesRead, buffer)`。
+如果文件没有被同时地修改,则当读取的字节数为零时,即到达文件的末尾。
+
如果调用此方法的 [`util.promisify()`] 版本,则返回 `Promise`(会传入具有 `bytesRead` 属性和 `buffer` 属性的 `Object`)。
diff --git a/fs/fs_rmdir_path_options_callback.md b/fs/fs_rmdir_path_options_callback.md
index af03d978..d82898c6 100644
--- a/fs/fs_rmdir_path_options_callback.md
+++ b/fs/fs_rmdir_path_options_callback.md
@@ -26,8 +26,6 @@ changes:
如果不传入,则会触发弃用警告(id 为 DEP0013)。
-->
-> 稳定性: 1 - 递归的删除是实验的。
-
* `path` {string|Buffer|URL}
* `options` {Object}
* `maxRetries` {integer} 如果遇到 `EBUSY`、`EMFILE`、`ENFILE`、`ENOTEMPTY` 或 `EPERM` 错误,则 Node.js 会重试该操作(每次尝试时使用 `retryDelay` 毫秒时长的线性回退等待)。
diff --git a/fs/fs_rmdirsync_path_options.md b/fs/fs_rmdirsync_path_options.md
index 68149570..f731d979 100644
--- a/fs/fs_rmdirsync_path_options.md
+++ b/fs/fs_rmdirsync_path_options.md
@@ -18,8 +18,6 @@ changes:
该支持目前仍是实验的。
-->
-> 稳定性: 1 - 递归的删除是实验性的。
-
* `path` {string|Buffer|URL}
* `options` {Object}
* `maxRetries` {integer} 如果遇到 `EBUSY`、`EMFILE`、`ENFILE`、`ENOTEMPTY` 或 `EPERM` 错误,则 Node.js 会重试该操作(每次尝试时使用 `retryDelay` 毫秒时长的线性回退等待)。
diff --git a/fs/fspromises_rmdir_path_options.md b/fs/fspromises_rmdir_path_options.md
index f3c2e79c..86f1cb3e 100644
--- a/fs/fspromises_rmdir_path_options.md
+++ b/fs/fspromises_rmdir_path_options.md
@@ -35,3 +35,8 @@ changes:
对文件(而不是目录)使用 `fsPromises.rmdir()` 会导致 `Promise` 被拒绝,在 Windows 上会带上 `ENOENT` 错误、在 POSIX 上会带上 `ENOTDIR` 错误。
+Setting `recursive` to `true` results in behavior similar to the Unix command
+`rm -rf`: an error will not be raised for paths that do not exist, and paths
+that represent files will be deleted. The permissive behavior of the
+`recursive` option is deprecated, `ENOTDIR` and `ENOENT` will be thrown in
+the future.
diff --git a/http/event_connection.md b/http/event_connection.md
index fe782cf5..c0015cc8 100644
--- a/http/event_connection.md
+++ b/http/event_connection.md
@@ -8,7 +8,7 @@ added: v0.1.0
`socket` 通常是 [`net.Socket`] 类型的对象。
通常用户无需访问此事件。
特别是,由于协议解析器附加到套接字的方式,套接字将不会触发 `'readable'` 事件。
-也可以通过 `request.connection` 访问 `socket`。
+也可以通过 `request.socket` 访问 `socket`。
用户也可以显式触发此事件,以将连接注入 HTTP 服务器。
在这种情况下,可以传入任何 [`Duplex`] 流。
diff --git a/http/message_settimeout_msecs_callback.md b/http/message_settimeout_msecs_callback.md
index 84ac5d4c..c3593e59 100644
--- a/http/message_settimeout_msecs_callback.md
+++ b/http/message_settimeout_msecs_callback.md
@@ -6,6 +6,6 @@ added: v0.5.9
* `callback` {Function}
* 返回: {http.IncomingMessage}
-调用 `message.connection.setTimeout(msecs, callback)`。
+调用 `message.socket.setTimeout(msecs, callback)`。
diff --git a/http/request_socket.md b/http/request_socket.md
index a1a39238..1a15a281 100644
--- a/http/request_socket.md
+++ b/http/request_socket.md
@@ -6,8 +6,7 @@ added: v0.3.0
指向底层套接字。
通常用户无需访问此属性。
-特别是,由于协议解析器附加到套接字的方式,套接字将不会触发 `'readable'` 事件。
-也可以通过 `request.connection` 访问 `socket`。
+特别是,由于协议解析器附加到套接字的方式,套接字将不会触发 `'readable'` 事件。
```js
diff --git a/http/response_socket.md b/http/response_socket.md
index 12b5c013..1ab2d46d 100644
--- a/http/response_socket.md
+++ b/http/response_socket.md
@@ -8,7 +8,6 @@ added: v0.3.0
通常用户不需要访问此属性。
特别是,由于协议解析器附加到套接字的方式,套接字将不会触发 `'readable'` 事件。
在调用 `response.end()` 之后,此属性将为空。
-也可以通过 `response.connection` 访问 `socket`。
```js
diff --git a/inspector/inspector_open_port_host_wait.md b/inspector/inspector_open_port_host_wait.md
index 8690af71..e279a34b 100644
--- a/inspector/inspector_open_port_host_wait.md
+++ b/inspector/inspector_open_port_host_wait.md
@@ -13,6 +13,6 @@ started.
If wait is `true`, will block until a client has connected to the inspect port
and flow control has been passed to the debugger client.
-See the [security warning](cli.html#inspector_security) regarding the `host`
+See the [security warning](cli.md#inspector_security) regarding the `host`
parameter usage.
diff --git a/modules/source_map_v3_support.md b/modules/source_map_v3_support.md
index 5fd4f0eb..4e44b992 100644
--- a/modules/source_map_v3_support.md
+++ b/modules/source_map_v3_support.md
@@ -1,6 +1,6 @@
This section was moved to
-[Modules: `module` core module](module.html#module_source_map_v3_support).
+[Modules: `module` core module](module.md#module_source_map_v3_support).
* `module.findSourceMap(path[, error])`
diff --git a/packages/approach_2_isolate_state.md b/packages/approach_2_isolate_state.md
index 967656c5..ada3257d 100644
--- a/packages/approach_2_isolate_state.md
+++ b/packages/approach_2_isolate_state.md
@@ -20,7 +20,7 @@ the package’s management of state is carefully isolated (or the package is
stateless).
The reason that state is an issue is because both the CommonJS and ES module
-versions of the package may get used within an application; for example, the
+versions of the package might get used within an application; for example, the
user’s application code could `import` the ES module version while a dependency
`require`s the CommonJS version. If that were to occur, two copies of the
package would be loaded in memory and therefore two separate states would be
diff --git a/packages/conditional_exports.md b/packages/conditional_exports.md
index 91098b72..19cd01dc 100644
--- a/packages/conditional_exports.md
+++ b/packages/conditional_exports.md
@@ -21,20 +21,20 @@ For example, a package that wants to provide different ES module exports for
Node.js supports the following conditions out of the box:
-* `"import"` - matched when the package is loaded via `import` or
+* `"import"` - matches when the package is loaded via `import` or
`import()`, or via any top-level import or resolve operation by the
ECMAScript module loader. Applies regardless of the module format of the
target file. _Always mutually exclusive with `"require"`._
-* `"require"` - matched when the package is loaded via `require()`. The
+* `"require"` - matches when the package is loaded via `require()`. The
referenced file should be loadable with `require()` although the condition
- will be matched regardless of the module format of the target file. Expected
+ matches regardless of the module format of the target file. Expected
formats include CommonJS, JSON, and native addons but not ES modules as
`require()` doesn't support them. _Always mutually exclusive with
`"import"`._
-* `"node"` - matched for any Node.js environment. Can be a CommonJS or ES
+* `"node"` - matches for any Node.js environment. Can be a CommonJS or ES
module file. _This condition should always come after `"import"` or
`"require"`._
-* `"default"` - the generic fallback that will always match. Can be a CommonJS
+* `"default"` - the generic fallback that always matches. Can be a CommonJS
or ES module file. _This condition should always come last._
Within the [`"exports"`][] object, key order is significant. During condition
@@ -43,9 +43,9 @@ entries. _The general rule is that conditions should be from most specific to
least specific in object order_.
Other conditions such as `"browser"`, `"electron"`, `"deno"`, `"react-native"`,
-etc. are unknown to, and thus ignored by Node.js. Runtimes or tools other than
-Node.js may use them at their discretion. Further restrictions, definitions, or
-guidance on condition names may occur in the future.
+etc., are unknown to Node.js, and thus ignored. Runtimes or tools other than
+Node.js can use them at their discretion. Further restrictions, definitions, or
+guidance on condition names might occur in the future.
Using the `"import"` and `"require"` conditions can lead to some hazards,
which are further explained in [the dual CommonJS/ES module packages section][].
diff --git a/packages/exports.md b/packages/exports.md
index 035b95b9..7a957b9b 100644
--- a/packages/exports.md
+++ b/packages/exports.md
@@ -7,7 +7,7 @@ changes:
pr-url: https://github.com/nodejs/node/pull/29978
description: Implement conditional exports.
- version:
- - v12.15.0
+ - v12.16.0
- v13.7.0
pr-url: https://github.com/nodejs/node/pull/31001
description: Remove the `--experimental-conditional-exports` option.
diff --git a/packages/input_type_flag.md b/packages/input_type_flag.md
index c1e0ed2f..b13b9c20 100644
--- a/packages/input_type_flag.md
+++ b/packages/input_type_flag.md
@@ -1,6 +1,6 @@
Strings passed in as an argument to `--eval` (or `-e`), or piped to `node` via
-`STDIN`, will be treated as [ES modules][] when the `--input-type=module` flag
+`STDIN`, are treated as [ES modules][] when the `--input-type=module` flag
is set.
```bash
diff --git a/packages/main.md b/packages/main.md
index 6c0d390c..e26155f7 100644
--- a/packages/main.md
+++ b/packages/main.md
@@ -11,7 +11,7 @@ added: v0.4.0
```
The `"main"` field defines the script that is used when the [package directory
-is loaded via `require()`](modules.html#modules_folders_as_modules). Its value
+is loaded via `require()`](modules.md#modules_folders_as_modules). Its value
is interpreted as a path.
```js
diff --git a/packages/main_entry_point_export.md b/packages/main_entry_point_export.md
index 6a5cc94f..800f56f2 100644
--- a/packages/main_entry_point_export.md
+++ b/packages/main_entry_point_export.md
@@ -9,9 +9,9 @@ To set the main entry point for a package, it is advisable to define both
}
```
-When defining the [`"exports"`][] field, all subpaths of the package will be
+When the [`"exports"`][] field is defined, all subpaths of the package are
encapsulated and no longer available to importers. For example,
-`require('pkg/subpath.js')` would throw an [`ERR_PACKAGE_PATH_NOT_EXPORTED`][]
+`require('pkg/subpath.js')` throws an [`ERR_PACKAGE_PATH_NOT_EXPORTED`][]
error.
This encapsulation of exports provides more reliable guarantees
diff --git a/packages/modules_packages.md b/packages/modules_packages.md
index de16202d..37acff1e 100644
--- a/packages/modules_packages.md
+++ b/packages/modules_packages.md
@@ -1,3 +1,33 @@
+
diff --git a/packages/name.md b/packages/name.md
index 7ee8607d..7a879731 100644
--- a/packages/name.md
+++ b/packages/name.md
@@ -19,7 +19,7 @@ changes:
```
The `"name"` field defines your package’s name. Publishing to the
-_npm_ registry may require a name that satisfies
+_npm_ registry requires a name that satisfies
[certain requirements](https://docs.npmjs.com/files/package.json#name).
The `"name"` field can be used in addition to the [`"exports"`][] field to
diff --git a/packages/node_js_package_json_field_definitions.md b/packages/node_js_package_json_field_definitions.md
index f925c8a1..80ab812e 100644
--- a/packages/node_js_package_json_field_definitions.md
+++ b/packages/node_js_package_json_field_definitions.md
@@ -1,6 +1,6 @@
This section describes the fields used by the Node.js runtime. Other tools (such
-as [npm](https://docs.npmjs.com/creating-a-package-json-file)) may use
+as [npm](https://docs.npmjs.com/creating-a-package-json-file)) use
additional fields which are ignored by Node.js and not documented here.
The following fields in `package.json` files are used in Node.js:
@@ -10,7 +10,7 @@ The following fields in `package.json` files are used in Node.js:
* [`"type"`][] - The package type determining whether to load `.js` files as
CommonJS or ES modules.
* [`"exports"`][] - Package exports and conditional exports. When present,
- limits which submodules may be loaded from within the package.
+ limits which submodules can be loaded from within the package.
* [`"main"`][] - The default module when loading the package, if exports is not
specified, and in versions of Node.js prior to the introduction of exports.
* [`"imports"`][] - Package imports, for use by modules within the package
diff --git a/packages/package_entry_points.md b/packages/package_entry_points.md
index 3866d594..35390929 100644
--- a/packages/package_entry_points.md
+++ b/packages/package_entry_points.md
@@ -12,7 +12,7 @@ their package.
If both [`"exports"`][] and [`"main"`][] are defined, the [`"exports"`][] field
takes precedence over [`"main"`][]. [`"exports"`][] are not specific to ES
-modules or CommonJS; [`"main"`][] will be overridden by [`"exports"`][] if it
+modules or CommonJS; [`"main"`][] is overridden by [`"exports"`][] if it
exists. As such [`"main"`][] cannot be used as a fallback for CommonJS but it
can be used as a fallback for legacy versions of Node.js that do not support the
[`"exports"`][] field.
@@ -66,12 +66,12 @@ Alternatively a project could choose to export entire folders:
```
As a last resort, package encapsulation can be disabled entirely by creating an
-export for the root of the package `"./*": "./*"`. This will expose every file
+export for the root of the package `"./*": "./*"`. This exposes every file
in the package at the cost of disabling the encapsulation and potential tooling
benefits this provides. As the ES Module loader in Node.js enforces the use of
[the full specifier path][], exporting the root rather than being explicit
about entry is less expressive than either of the prior examples. Not only
-will encapsulation be lost but module consumers will be unable to
-`import feature from 'my-mod/feature'` as they will need to provide the full
+is encapsulation lost but module consumers are unable to
+`import feature from 'my-mod/feature'` as they need to provide the full
path `import feature from 'my-mod/feature/index.js`.
diff --git a/packages/package_json_and_file_extensions.md b/packages/package_json_and_file_extensions.md
index 1065643b..14397d9f 100644
--- a/packages/package_json_and_file_extensions.md
+++ b/packages/package_json_and_file_extensions.md
@@ -40,7 +40,7 @@ import 'commonjs-package/src/index.mjs';
// Loaded as ES module since .mjs is always loaded as ES module.
```
-The `.mjs` and `.cjs` extensions may be used to mix types within the same
+The `.mjs` and `.cjs` extensions can be used to mix types within the same
package:
* Within a `"type": "module"` package, Node.js can be instructed to
diff --git a/packages/type.md b/packages/type.md
index 9eadf35f..91ff87ba 100644
--- a/packages/type.md
+++ b/packages/type.md
@@ -10,10 +10,10 @@ changes:
* Type: {string}
-The `"type"` field defines the module format that Node.js will use for all
+The `"type"` field defines the module format that Node.js uses for all
`.js` files that have that `package.json` file as their nearest parent.
-Files ending with `.js` will be loaded as ES modules when the nearest parent
+Files ending with `.js` are loaded as ES modules when the nearest parent
`package.json` file contains a top-level field `"type"` with a value of
`"module"`.
diff --git a/packages/writing_dual_packages_while_avoiding_or_minimizing_hazards.md b/packages/writing_dual_packages_while_avoiding_or_minimizing_hazards.md
index a50b2272..ea65f867 100644
--- a/packages/writing_dual_packages_while_avoiding_or_minimizing_hazards.md
+++ b/packages/writing_dual_packages_while_avoiding_or_minimizing_hazards.md
@@ -2,13 +2,13 @@
First, the hazard described in the previous section occurs when a package
contains both CommonJS and ES module sources and both sources are provided for
use in Node.js, either via separate main entry points or exported paths. A
-package could instead be written where any version of Node.js receives only
-CommonJS sources, and any separate ES module sources the package may contain
-could be intended only for other environments such as browsers. Such a package
+package might instead be written where any version of Node.js receives only
+CommonJS sources, and any separate ES module sources the package might contain
+are intended only for other environments such as browsers. Such a package
would be usable by any version of Node.js, since `import` can refer to CommonJS
files; but it would not provide any of the advantages of using ES module syntax.
-A package could also switch from CommonJS to ES module syntax in a [breaking
+A package might also switch from CommonJS to ES module syntax in a [breaking
change](https://semver.org/) version bump. This has the disadvantage that the
newest version of the package would only be usable in ES module-supporting
versions of Node.js.
diff --git a/perf_hooks/performance_eventlooputilization_utilization1_utilization2.md b/perf_hooks/performance_eventlooputilization_utilization1_utilization2.md
index 76e430f3..df6bfc7b 100644
--- a/perf_hooks/performance_eventlooputilization_utilization1_utilization2.md
+++ b/perf_hooks/performance_eventlooputilization_utilization1_utilization2.md
@@ -2,9 +2,10 @@
added: v14.10.0
-->
-* `utilization1` {Object} The result of a previous call to `eventLoopUtilization()`
-* `utilization2` {Object} The result of a previous call to `eventLoopUtilization()`
- prior to `util1`
+* `utilization1` {Object} The result of a previous call to
+ `eventLoopUtilization()`.
+* `utilization2` {Object} The result of a previous call to
+ `eventLoopUtilization()` prior to `utilization1`.
* Returns {Object}
* `idle` {number}
* `active` {number}
@@ -14,9 +15,9 @@ The `eventLoopUtilization()` method returns an object that contains the
cumulative duration of time the event loop has been both idle and active as a
high resolution milliseconds timer. The `utilization` value is the calculated
Event Loop Utilization (ELU). If bootstrapping has not yet finished, the
-properties have the value of 0.
+properties have the value of `0`.
-`utilization1` and `utilization2` are optional parameters.
+Both `utilization1` and `utilization2` are optional parameters.
If `utilization1` is passed, then the delta between the current call's `active`
and `idle` times, as well as the corresponding `utilization` value are
@@ -46,8 +47,8 @@ setImmediate(() => {
```
Although the CPU is mostly idle while running this script, the value of
-`utilization` is 1. This is because the call to [`child_process.spawnSync()`][]
-blocks the event loop from proceeding.
+`utilization` is `1`. This is because the call to
+[`child_process.spawnSync()`][] blocks the event loop from proceeding.
Passing in a user-defined object instead of the result of a previous call to
`eventLoopUtilization()` will lead to undefined behavior. The return values
diff --git a/repl/commands_and_special_keys.md b/repl/commands_and_special_keys.md
index 4d9556d1..8b5459b0 100644
--- a/repl/commands_and_special_keys.md
+++ b/repl/commands_and_special_keys.md
@@ -1,7 +1,7 @@
所有 REPL 的实例都支持下列特殊命令:
-* `.break` - 在输入一个多行表达式的过程中,输入 `.break` 命令(或按下 **Ctrl+C**)将终止表达式的继续输入。
+* `.break` - 在输入一个多行表达式的过程中,输入 `.break` 命令(或按下 Ctrl+C)将终止表达式的继续输入。
* `.clear` - 重置 REPL 的 `context` 为一个空对象,并清除正在输入中的所有多行表达式。
* `.exit` - 关闭输入输出流,退出 REPL。
* `.help` - 显示特定命令的帮助列表。
@@ -9,7 +9,7 @@
`> .save ./file/to/save.js`
* `.load` - 读取一个文件到当前 REPL 会话。
`> .load ./file/to/load.js`
-* `.editor` 进入编辑模式(**Ctrl+D** 完成,**Ctrl+C** 取消)
+* `.editor` 进入编辑模式(Ctrl+D 完成,Ctrl+C 取消)
```console
> .editor
@@ -27,9 +27,9 @@ welcome('Node.js 用户');
REPL 中下列按键组合有特殊作用:
-* **Ctrl+C**: 当按下一次时,与 `.break` 命令的效果一样。当在空白行按下两次时,与 `.exit` 命令的效果一样。
-* **Ctrl+D**: 与 `.exit` 命令的效果一样。
-* ``: 当在空白行按下时,显示全局和本地作用域内的变量。当在输入时按下,显示相关的自动补全选项。
+* Ctrl+C: 当按下一次时,与 `.break` 命令的效果一样。当在空白行按下两次时,与 `.exit` 命令的效果一样。
+* Ctrl+D: 与 `.exit` 命令的效果一样。
+* Tab: 当在空白行按下时,显示全局和本地作用域内的变量。当在输入时按下,显示相关的自动补全选项。
有关与反向i搜索相关的快捷键,请参见[反向i搜索][`reverse-i-search`]。
有关所有的其他快捷键,请参见 [TTY 快捷键][TTY keybindings]。
diff --git a/repl/event_exit.md b/repl/event_exit.md
index 973bbbc3..993fde37 100644
--- a/repl/event_exit.md
+++ b/repl/event_exit.md
@@ -2,7 +2,7 @@
added: v0.7.7
-->
-当接收到 `.exit` 命令、或按下两次 **Ctrl+C** 发出 `SIGINT` 信号、或按下 **Ctrl+D** 发出 `'end'` 信号而使 REPL 被退出时,触发 `'exit'` 事件。
+当接收到 `.exit` 命令、或按下两次 Ctrl+C 发出 `SIGINT` 信号、或按下 Ctrl+D 发出 `'end'` 信号而使 REPL 被退出时,触发 `'exit'` 事件。
监听器的回调函数被调用时不带任何参数。
```js
diff --git a/repl/repl_start_options.md b/repl/repl_start_options.md
index d8c675b9..0db04238 100644
--- a/repl/repl_start_options.md
+++ b/repl/repl_start_options.md
@@ -43,7 +43,7 @@ changes:
可选的值有:
* `repl.REPL_MODE_SLOPPY` 要使用默认模式解释表达式。
* `repl.REPL_MODE_STRICT` 要使用严格模式解释表达式。该模式等同于在每个 repl 声明前加上 `'use strict'`。
- * `breakEvalOnSigint` {boolean} 当接收到 `SIGINT` 时停止解释当前代码,比如当按下 `Ctrl+C`。
+ * `breakEvalOnSigint` {boolean} 当接收到 `SIGINT` 时停止解释当前代码,比如当按下 Ctrl+C。
不能与自定义的 `eval` 函数同时使用。
**默认值:** `false`。
* `preview` {boolean} 定义 repl 是否打印自动补全并输出预览。
diff --git a/repl/reverse_i_search.md b/repl/reverse_i_search.md
index cbb486b1..e2f8c8bf 100644
--- a/repl/reverse_i_search.md
+++ b/repl/reverse_i_search.md
@@ -3,14 +3,15 @@ added: v13.6.0
-->
The REPL supports bi-directional reverse-i-search similar to [ZSH][]. It is
-triggered with **Ctrl+R** to search backward and **Ctrl+S** to search
+triggered with Ctrl+R to search backward and
+Ctrl+S to search
forwards.
Duplicated history entires will be skipped.
Entries are accepted as soon as any button is pressed that doesn't correspond
-with the reverse search. Cancelling is possible by pressing **Esc** or
-**Ctrl+C**.
+with the reverse search. Cancelling is possible by pressing Esc or
+Ctrl+C.
Changing the direction immediately searches for the next entry in the expected
direction from the current position on.
diff --git a/stream/readable_construct_callback.md b/stream/readable_construct_callback.md
new file mode 100644
index 00000000..ac51862d
--- /dev/null
+++ b/stream/readable_construct_callback.md
@@ -0,0 +1,56 @@
+
+
+* `callback` {Function} Call this function (optionally with an error
+ argument) when the stream has finished initializing.
+
+The `_construct()` method MUST NOT be called directly. It may be implemented
+by child classes, and if so, will be called by the internal `Readable`
+class methods only.
+
+This optional function will be scheduled in the next tick by the stream
+constructor, delaying any `_read()` and `_destroy()` calls until `callback` is
+called. This is useful to initialize state or asynchronously initialize
+resources before the stream can be used.
+
+```js
+const { Readable } = require('stream');
+const fs = require('fs');
+
+class ReadStream extends Readable {
+ constructor(filename) {
+ super();
+ this.filename = filename;
+ this.fd = null;
+ }
+ _construct(callback) {
+ fs.open(this.filename, (fd, err) => {
+ if (err) {
+ callback(err);
+ } else {
+ this.fd = fd;
+ callback();
+ }
+ });
+ }
+ _read(n) {
+ const buf = Buffer.alloc(n);
+ fs.read(this.fd, buf, 0, n, null, (err, bytesRead) => {
+ if (err) {
+ this.destroy(err);
+ } else {
+ this.push(bytesRead > 0 ? buf.slice(0, bytesRead) : null);
+ }
+ });
+ }
+ _destroy(err, callback) {
+ if (this.fd) {
+ fs.close(this.fd, (er) => callback(er || err));
+ } else {
+ callback(err);
+ }
+ }
+}
+```
+
diff --git a/stream/readable_destroy_error.md b/stream/readable_destroy_error.md
index 57e57f8a..06c5d933 100644
--- a/stream/readable_destroy_error.md
+++ b/stream/readable_destroy_error.md
@@ -3,7 +3,7 @@ added: v8.0.0
changes:
- version: v14.0.0
pr-url: https://github.com/nodejs/node/pull/29197
- description: Work as noop when called on an already `destroyed` stream.
+ description: Work as a no-op on a stream that has already been destroyed.
-->
* `error` {Error} 将会在 `'error'` 事件中作为负载传入的错误。
@@ -13,7 +13,7 @@ changes:
可选地触发 `'error'` 事件,并触发 `'close'` 事件(除非将 `emitClose` 设置为 `false`)。
在此调用之后,可读流将会释放所有内部的资源,并且将会忽略对 `push()` 的后续调用。
-一旦调用 `destroy()`,则不会再执行任何其他操作,并且除了 `_destroy` 以外的其他错误都不会作为 `'error'` 触发。
+一旦调用 `destroy()`,则不会再执行任何其他操作,并且除了 `_destroy()` 以外的其他错误都不会作为 `'error'` 触发。
实现者不应该重写此方法,而应该实现 [`readable._destroy()`][readable-_destroy]。
diff --git a/stream/transform_destroy_error.md b/stream/transform_destroy_error.md
index 30dfa0c4..bf4efdde 100644
--- a/stream/transform_destroy_error.md
+++ b/stream/transform_destroy_error.md
@@ -3,7 +3,7 @@ added: v8.0.0
changes:
- version: v14.0.0
pr-url: https://github.com/nodejs/node/pull/29197
- description: Work as noop when called on an already `destroyed` stream.
+ description: Work as a no-op on a stream that has already been destroyed.
-->
* `error` {Error}
@@ -14,5 +14,5 @@ changes:
实现者不应该重写此方法,而应该实现 [`readable._destroy()`][readable-_destroy]。
`Transform` 流的 `_destroy()` 方法的默认实现会触发 `'close'` 事件,除非 `emitClose` 被设置为 `false`。
-一旦调用 `destroy()`,则不会再执行任何其他操作,并且除了 `_destroy` 以外的其他错误都不会作为 `'error'` 触发。
+一旦调用 `destroy()`,则不会再执行任何其他操作,并且除了 `_destroy()` 以外的其他错误都不会作为 `'error'` 触发。
diff --git a/stream/writable_construct_callback.md b/stream/writable_construct_callback.md
new file mode 100644
index 00000000..0b179e26
--- /dev/null
+++ b/stream/writable_construct_callback.md
@@ -0,0 +1,49 @@
+
+
+* `callback` {Function} Call this function (optionally with an error
+ argument) when the stream has finished initializing.
+
+The `_construct()` method MUST NOT be called directly. It may be implemented
+by child classes, and if so, will be called by the internal `Writable`
+class methods only.
+
+This optional function will be called in a tick after the stream constructor
+has returned, delaying any `_write()`, `_final()` and `_destroy()` calls until
+`callback` is called. This is useful to initialize state or asynchronously
+initialize resources before the stream can be used.
+
+```js
+const { Writable } = require('stream');
+const fs = require('fs');
+
+class WriteStream extends Writable {
+ constructor(filename) {
+ super();
+ this.filename = filename;
+ this.fd = fd;
+ }
+ _construct(callback) {
+ fs.open(this.filename, (fd, err) => {
+ if (err) {
+ callback(err);
+ } else {
+ this.fd = fd;
+ callback();
+ }
+ });
+ }
+ _write(chunk, encoding, callback) {
+ fs.write(this.fd, chunk, callback);
+ }
+ _destroy(err, callback) {
+ if (this.fd) {
+ fs.close(this.fd, (er) => callback(er || err));
+ } else {
+ callback(err);
+ }
+ }
+}
+```
+
diff --git a/stream/writable_destroy_error.md b/stream/writable_destroy_error.md
index 88d3476e..9fe43b71 100644
--- a/stream/writable_destroy_error.md
+++ b/stream/writable_destroy_error.md
@@ -3,7 +3,7 @@ added: v8.0.0
changes:
- version: v14.0.0
pr-url: https://github.com/nodejs/node/pull/29197
- description: Work as noop when called on an already `destroyed` stream.
+ description: Work as a no-op on a stream that has already been destroyed.
-->
* `error` {Error} 可选,使用 `'error'` 事件触发的错误。
@@ -16,7 +16,7 @@ changes:
前面对 `write()` 的调用可能没有耗尽,并且可能触发 `ERR_STREAM_DESTROYED` 错误。
如果数据在关闭之前应该刷新,则使用 `end()` 而不是销毁,或者在销毁流之前等待 `'drain'` 事件。
-一旦调用 `destroy()`,则不会再执行任何其他操作,并且除了 `_destroy` 以外的其他错误都不会作为 `'error'` 触发。
+一旦调用 `destroy()`,则不会再执行任何其他操作,并且除了 `_destroy()` 以外的其他错误都不会作为 `'error'` 触发。
实现者不应该重写此方法,而应该实现 [`writable._destroy()`][writable-_destroy]。