diff options
author | Rich Trott <rtrott@gmail.com> | 2022-04-14 21:22:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-14 21:22:15 +0300 |
commit | aa88e5e4b90af1f16ece3250fbb840e3790c5c81 (patch) | |
tree | 8738c394b4ba1d21b8b9148fa56b3d4fc5582dee | |
parent | e938515b413d38ffd170f92539e81a7c8b3d548d (diff) |
doc: revise data imports and node: imports sections
Revise for conformance with style guide and clarity.
PR-URL: https://github.com/nodejs/node/pull/42734
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
-rw-r--r-- | doc/api/esm.md | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/doc/api/esm.md b/doc/api/esm.md index c0f7e5fe3f7..bea63a9d20c 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -178,7 +178,7 @@ The volume root may be referenced via `/`, `//` or `file:///`. Given the differences between [URL][] and path resolution (such as percent encoding details), it is recommended to use [url.pathToFileURL][] when importing a path. -#### `data:` Imports +#### `data:` imports <!-- YAML added: v12.10.0 @@ -186,24 +186,23 @@ added: v12.10.0 [`data:` URLs][] are supported for importing with the following MIME types: -* `text/javascript` for ES Modules +* `text/javascript` for ES modules * `application/json` for JSON * `application/wasm` for Wasm -`data:` URLs only resolve [_Bare specifiers_][Terminology] for builtin modules -and [_Absolute specifiers_][Terminology]. Resolving -[_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";` fails to resolve because there -is no concept of relative resolution for `data:` URLs. An example of a `data:` -URLs being used is: - ```js import 'data:text/javascript,console.log("hello!");'; import _ from 'data:application/json,"world!"' assert { type: 'json' }; ``` -#### `node:` Imports +`data:` URLs only resolve [bare specifiers][Terminology] for builtin modules +and [absolute specifiers][Terminology]. Resolving +[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";` fails to resolve because there +is no concept of relative resolution for `data:` URLs. + +#### `node:` imports <!-- YAML added: |