Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGeoffrey Booth <456802+GeoffreyBooth@users.noreply.github.com>2022-02-01 01:16:37 +0300
committerGitHub <noreply@github.com>2022-02-01 01:16:37 +0300
commit15f1a45c5f52fbf3d35389428846a5c86d684a87 (patch)
treef4c693c2ee6ce31d2d1027b7fa2970512ed3096c /doc
parent0ff62b4e03fe7ab7b3022f8bf316d691e6fffb54 (diff)
module: unflag esm json modules
PR-URL: https://github.com/nodejs/node/pull/41736 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/cli.md8
-rw-r--r--doc/api/esm.md45
-rw-r--r--doc/api/packages.md3
-rw-r--r--doc/node.13
4 files changed, 7 insertions, 52 deletions
diff --git a/doc/api/cli.md b/doc/api/cli.md
index 76c122fc16d..694fa66181c 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -290,14 +290,6 @@ added:
Enable experimental `import.meta.resolve()` support.
-### `--experimental-json-modules`
-
-<!-- YAML
-added: v12.9.0
--->
-
-Enable experimental JSON support for the ES Module loader.
-
### `--experimental-loader=module`
<!-- YAML
diff --git a/doc/api/esm.md b/doc/api/esm.md
index a27e407b859..5d0c99ab340 100644
--- a/doc/api/esm.md
+++ b/doc/api/esm.md
@@ -477,22 +477,6 @@ These CommonJS variables are not available in ES modules.
`__filename` and `__dirname` use cases can be replicated via
[`import.meta.url`][].
-#### No JSON Module Loading
-
-JSON imports are still experimental and only supported via the
-`--experimental-json-modules` flag.
-
-Local JSON files can be loaded relative to `import.meta.url` with `fs` directly:
-
-<!-- eslint-skip -->
-
-```js
-import { readFile } from 'fs/promises';
-const json = JSON.parse(await readFile(new URL('./dat.json', import.meta.url)));
-```
-
-Alternatively `module.createRequire()` can be used.
-
#### No Native Module Loading
Native modules are not currently supported with ES module imports.
@@ -530,35 +514,19 @@ separate cache.
> Stability: 1 - Experimental
-Currently importing JSON modules are only supported in the `commonjs` mode
-and are loaded using the CJS loader. [WHATWG JSON modules specification][] are
-still being standardized, and are experimentally supported by including the
-additional flag `--experimental-json-modules` when running Node.js.
-
-When the `--experimental-json-modules` flag is included, both the
-`commonjs` and `module` mode use the new experimental JSON
-loader. The imported JSON only exposes a `default`. There is no
-support for named exports. A cache entry is created in the CommonJS
-cache to avoid duplication. The same object is returned in
-CommonJS if the JSON module has already been imported from the
-same path.
-
-Assuming an `index.mjs` with
+JSON files can be referenced by `import`:
```js
import packageConfig from './package.json' assert { type: 'json' };
```
-The `--experimental-json-modules` flag is needed for the module
-to work.
-
-```bash
-node index.mjs # fails
-node --experimental-json-modules index.mjs # works
-```
-
The `assert { type: 'json' }` syntax is mandatory; see [Import Assertions][].
+The imported JSON only exposes a `default` export. There is no support for named
+exports. A cache entry is created in the CommonJS cache to avoid duplication.
+The same object is returned in CommonJS if the JSON module has already been
+imported from the same path.
+
<i id="esm_experimental_wasm_modules"></i>
## Wasm modules
@@ -1452,7 +1420,6 @@ success!
[Node.js Module Resolution Algorithm]: #resolver-algorithm-specification
[Terminology]: #terminology
[URL]: https://url.spec.whatwg.org/
-[WHATWG JSON modules specification]: https://html.spec.whatwg.org/#creating-a-json-module-script
[`"exports"`]: packages.md#exports
[`"type"`]: packages.md#type
[`--input-type`]: cli.md#--input-typetype
diff --git a/doc/api/packages.md b/doc/api/packages.md
index 4638c7cc28d..7e89d37cbd1 100644
--- a/doc/api/packages.md
+++ b/doc/api/packages.md
@@ -117,8 +117,7 @@ There is the ECMAScript module loader:
`'./startup/index.js'`) must be fully specified.
* It does no extension searching. A file extension must be provided
when the specifier is a relative or absolute file URL.
-* It can load JSON modules, but an import assertion is required (behind
- `--experimental-json-modules` flag).
+* It can load JSON modules, but an import assertion is required.
* It accepts only `.js`, `.mjs`, and `.cjs` extensions for JavaScript text
files.
* It can be used to load JavaScript CommonJS modules. Such modules
diff --git a/doc/node.1 b/doc/node.1
index fa56276b3ca..c4f5118bcae 100644
--- a/doc/node.1
+++ b/doc/node.1
@@ -142,9 +142,6 @@ Enable Source Map V3 support for stack traces.
.It Fl -experimental-import-meta-resolve
Enable experimental ES modules support for import.meta.resolve().
.
-.It Fl -experimental-json-modules
-Enable experimental JSON interop support for the ES Module loader.
-.
.It Fl -experimental-loader Ns = Ns Ar module
Specify the
.Ar module