Skip to content

Commit 0c64093

Browse files
Trottjuanarbol
authored andcommitted
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 7c700eb commit 0c64093

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
@@ -174,32 +174,31 @@ The volume root may be referenced via `/`, `//` or `file:///`. Given the
174174
differences between [URL][] and path resolution (such as percent encoding
175175
details), it is recommended to use [url.pathToFileURL][] when importing a path.
176176

177-
#### `data:` Imports
177+
#### `data:` imports
178178

179179
<!-- YAML
180180
added: v12.10.0
181181
-->
182182

183183
[`data:` URLs][] are supported for importing with the following MIME types:
184184

185-
* `text/javascript` for ES Modules
185+
* `text/javascript` for ES modules
186186
* `application/json` for JSON
187187
* `application/wasm` for Wasm
188188

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

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

204203
<!-- YAML
205204
added:

0 commit comments

Comments
 (0)