Skip to content

Commit b4b7ac6

Browse files
committed
doc: fix nits in esm.md
* Fix some abbreviated wording, a typo and a link. * Wrap long lines at 80 characters. PR-URL: #15315 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent cb94905 commit b4b7ac6

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

doc/api/esm.md

+25-12
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,21 @@
66
77
<!--name=esm-->
88

9-
Node contains support for ES Modules based upon the [the Node EP for ES Modules][].
9+
Node.js contains support for ES Modules based upon the
10+
[Node.js EP for ES Modules][].
1011

11-
Not all features of the EP are complete and will be landing as both VM support and implementation is ready. Error messages are still being polished.
12+
Not all features of the EP are complete and will be landing as both VM support
13+
and implementation is ready. Error messages are still being polished.
1214

1315
## Enabling
1416

1517
<!-- type=misc -->
1618

17-
The `--experimental-modules` flag can be used to enable features for loading ESM modules.
19+
The `--experimental-modules` flag can be used to enable features for loading
20+
ESM modules.
1821

19-
Once this has been set, files ending with `.mjs` will be able to be loaded as ES Modules.
22+
Once this has been set, files ending with `.mjs` will be able to be loaded
23+
as ES Modules.
2024

2125
```sh
2226
node --experimental-modules my-app.mjs
@@ -28,7 +32,9 @@ node --experimental-modules my-app.mjs
2832

2933
### Supported
3034

31-
Only the CLI argument for the main entry point to the program can be an entry point into an ESM graph. In the future `import()` can be used to create entry points into ESM graphs at run time.
35+
Only the CLI argument for the main entry point to the program can be an entry
36+
point into an ESM graph. In the future `import()` can be used to create entry
37+
points into ESM graphs at run time.
3238

3339
### Unsupported
3440

@@ -43,21 +49,26 @@ Only the CLI argument for the main entry point to the program can be an entry po
4349

4450
### No NODE_PATH
4551

46-
`NODE_PATH` is not part of resolving `import` specifiers. Please use symlinks if this behavior is desired.
52+
`NODE_PATH` is not part of resolving `import` specifiers. Please use symlinks
53+
if this behavior is desired.
4754

4855
### No `require.extensions`
4956

50-
`require.extensions` is not used by `import`. The expectation is that loader hooks can provide this workflow in the future.
57+
`require.extensions` is not used by `import`. The expectation is that loader
58+
hooks can provide this workflow in the future.
5159

5260
### No `require.cache`
5361

5462
`require.cache` is not used by `import`. It has a separate cache.
5563

5664
### URL based paths
5765

58-
ESM are resolved and cached based upon [URL](url.spec.whatwg.org) semantics. This means that files containing special characters such as `#` and `?` need to be escaped.
66+
ESM are resolved and cached based upon [URL](https://url.spec.whatwg.org/)
67+
semantics. This means that files containing special characters such as `#` and
68+
`?` need to be escaped.
5969

60-
Modules will be loaded multiple times if the `import` specifier used to resolve them have a different query or fragment.
70+
Modules will be loaded multiple times if the `import` specifier used to resolve
71+
them have a different query or fragment.
6172

6273
```js
6374
import './foo?query=1'; // loads ./foo with query of "?query=1"
@@ -70,9 +81,11 @@ For now, only modules using the `file:` protocol can be loaded.
7081

7182
All CommonJS, JSON, and C++ modules can be used with `import`.
7283

73-
Modules loaded this way will only be loaded once, even if their query or fragment string differs between `import` statements.
84+
Modules loaded this way will only be loaded once, even if their query
85+
or fragment string differs between `import` statements.
7486

75-
When loaded via `import` these modules will provide a single `default` export representing the value of `module.exports` at the time they finished evaluating.
87+
When loaded via `import` these modules will provide a single `default` export
88+
representing the value of `module.exports` at the time they finished evaluating.
7689

7790
```js
7891
import fs from 'fs';
@@ -85,4 +98,4 @@ fs.readFile('./foo.txt', (err, body) => {
8598
});
8699
```
87100

88-
[the Node EP for ES Modules]: https://github.com/nodejs/node-eps/blob/master/002-es-modules.md
101+
[Node.js EP for ES Modules]: https://github.com/nodejs/node-eps/blob/master/002-es-modules.md

0 commit comments

Comments
 (0)