Skip to content

Commit aa88e5e

Browse files
authored
doc: revise data imports and node: imports sections
Revise for conformance with style guide and clarity. PR-URL: #42734 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
1 parent e938515 commit aa88e5e

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

doc/api/esm.md

+10-11
Original file line numberDiff line numberDiff line change
@@ -178,32 +178,31 @@ The volume root may be referenced via `/`, `//` or `file:///`. Given the
178178
differences between [URL][] and path resolution (such as percent encoding
179179
details), it is recommended to use [url.pathToFileURL][] when importing a path.
180180

181-
#### `data:` Imports
181+
#### `data:` imports
182182

183183
<!-- YAML
184184
added: v12.10.0
185185
-->
186186

187187
[`data:` URLs][] are supported for importing with the following MIME types:
188188

189-
* `text/javascript` for ES Modules
189+
* `text/javascript` for ES modules
190190
* `application/json` for JSON
191191
* `application/wasm` for Wasm
192192

193-
`data:` URLs only resolve [_Bare specifiers_][Terminology] for builtin modules
194-
and [_Absolute specifiers_][Terminology]. Resolving
195-
[_Relative specifiers_][Terminology] does not work because `data:` is not a
196-
[special scheme][]. For example, attempting to load `./foo`
197-
from `data:text/javascript,import "./foo";` fails to resolve because there
198-
is no concept of relative resolution for `data:` URLs. An example of a `data:`
199-
URLs being used is:
200-
201193
```js
202194
import 'data:text/javascript,console.log("hello!");';
203195
import _ from 'data:application/json,"world!"' assert { type: 'json' };
204196
```
205197

206-
#### `node:` Imports
198+
`data:` URLs only resolve [bare specifiers][Terminology] for builtin modules
199+
and [absolute specifiers][Terminology]. Resolving
200+
[relative specifiers][Terminology] does not work because `data:` is not a
201+
[special scheme][]. For example, attempting to load `./foo`
202+
from `data:text/javascript,import "./foo";` fails to resolve because there
203+
is no concept of relative resolution for `data:` URLs.
204+
205+
#### `node:` imports
207206

208207
<!-- YAML
209208
added:

0 commit comments

Comments
 (0)