diff --git a/.eslintignore b/.eslintignore index 64f34660d87a8f..673185b1ad3929 100644 --- a/.eslintignore +++ b/.eslintignore @@ -13,3 +13,5 @@ doc/changelogs/CHANGELOG_v1*.md !doc/changelogs/CHANGELOG_v18.md !doc/api_assets/*.js !.eslintrc.js +test/es-module/test-require-module-detect-entry-point.js +test/es-module/test-require-module-detect-entry-point-aou.js diff --git a/doc/api/cli.md b/doc/api/cli.md index bdae4a7e771391..cbc40a906505d5 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -871,6 +871,39 @@ added: v11.8.0 Use the specified file as a security policy. +### `--experimental-require-module` + + + +> Stability: 1.1 - Active Developement + +Supports loading a synchronous ES module graph in `require()`. If the module +graph is not synchronous (contains top-level await), Node.js throws an error +without executing the module. If `--print-pending-tla` is passed, Node.js +will evaluate the module, try to locate the top-level awaits, and print +their location to help users fix them. + +With this option alone, the module being `require()`'d should be explicitly +marked as an ES module either using the `"type": "module"` field in +`package.json` or the `.mjs` extension. To load implicit ES modules with +automatic syntax-based module type detection, use +`--experimental-require-module-with-detection`. + +### `--experimental-require-module-with-detection` + + + +> Stability: 1.1 - Active Developement + +In addition to what `--experimental-require-module` supports, when the module +being `require()`'d is not explicitly marked as an ES Module using the +`"type": "module"` field in `package.json` or the `.mjs` extension, it will +try to detect module type based on the syntax of the module. + ### `--experimental-sea-config`