Skip to content

Commit 116abd0

Browse files
joyeecheungaduh95GeoffreyBooth
authored
fixup! doc: reorganize docs of module customization hooks
Co-authored-by: Antoine du Hamel <[email protected]> Co-authored-by: Geoffrey Booth <[email protected]>
1 parent 6ae5d4f commit 116abd0

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

β€Ždoc/api/module.mdβ€Ž

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ any worker threads by default as well.
699699
700700
##### Registering hooks before application code runs programmatically
701701
702-
Alternatively, `registerHooks()` can be called from the entry point.
702+
Alternatively, `registerHooks()` can be called from the entry point.
703703
704704
If the entry point needs to load other modules and the loading process needs to be
705705
customized, load them using either `require()` or dynamic `import()` after the hooks
@@ -777,15 +777,11 @@ registerHooks(hook2);
777777
```
778778
779779
In this example, the registered hooks will form chains. These chains run
780-
last-in, first out (LIFO). If both `hook1` and `hook2` define a `resolve`
780+
last-in, first-out (LIFO). If both `hook1` and `hook2` define a `resolve`
781781
hook, they will be called like so (note the right-to-left,
782782
starting with `hook2.resolve`, then `hook1.resolve`, then the Node.js default):
783783
784-
<!-- lint disable prohibited-strings remark-lint-->
785-
786-
Node.js' default ← `hook1.resolve` ← `hook2.resolve`
787-
788-
<!--lint enable prohibited-strings-->
784+
Node.js default `resolve` ← `hook1.resolve` ← `hook2.resolve`
789785
790786
The same applies to all the other hooks.
791787
@@ -1016,7 +1012,7 @@ is not a string, it is converted to a string using [`util.TextDecoder`][].
10161012
10171013
#### Caveats of asynchronous customization hooks
10181014
1019-
The asynchronous customization hooks have many caveats and the it is uncertain if their
1015+
The asynchronous customization hooks have many caveats and it is uncertain if their
10201016
issues can be resolved. Users are encouraged to use the synchronous customization hooks
10211017
via `module.registerHooks()` instead to avoid these caveats.
10221018
@@ -1151,11 +1147,7 @@ import('./my-app.mjs');
11511147
If `foo.mjs` and `bar.mjs` define a `resolve` hook, they will be called like so
11521148
(note the right-to-left, starting with `./bar.mjs`, then `./foo.mjs`, then the Node.js default):
11531149
1154-
<!-- lint disable prohibited-strings remark-lint-->
1155-
1156-
The Node.js' default ← `./foo.mjs` ← `./bar.mjs`
1157-
1158-
<!-- lint enable prohibited-strings remark-lint-->
1150+
Node.js default ← `./foo.mjs` ← `./bar.mjs`
11591151
11601152
When using the asynchronous hooks, the registered hooks also affect subsequent
11611153
`register` calls, which takes care of loading hook modules. In the example above,

0 commit comments

Comments
Β (0)