Skip to content

Commit a0494cf

Browse files
guybedfordtargos
authored andcommitted
esm: unflag --experimental-exports
PR-URL: #29867 Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 17e0bf4 commit a0494cf

File tree

6 files changed

+3
-20
lines changed

6 files changed

+3
-20
lines changed

doc/api/cli.md

-8
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,6 @@ the ability to import a directory that has an index file.
161161

162162
Please see [customizing esm specifier resolution][] for example usage.
163163

164-
### `--experimental-exports`
165-
<!-- YAML
166-
added: v12.7.0
167-
-->
168-
169-
Enable experimental resolution using the `exports` field in `package.json`.
170-
171164
### `--experimental-json-modules`
172165
<!-- YAML
173166
added: v12.9.0
@@ -1042,7 +1035,6 @@ Node.js options that are allowed are:
10421035
* `--enable-fips`
10431036
* `--enable-source-maps`
10441037
* `--es-module-specifier-resolution`
1045-
* `--experimental-exports`
10461038
* `--experimental-json-modules`
10471039
* `--experimental-loader`
10481040
* `--experimental-modules`

doc/api/modules.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ NODE_MODULES_PATHS(START)
203203
5. return DIRS
204204
```
205205

206-
If `--experimental-exports` is enabled, Node.js allows packages loaded via
206+
Node.js allows packages loaded via
207207
`LOAD_NODE_MODULES` to explicitly declare which file paths to expose and how
208208
they should be interpreted. This expands on the control packages already had
209209
using the `main` field.

lib/internal/modules/cjs/loader.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ const {
7171
} = require('internal/errors').codes;
7272
const { validateString } = require('internal/validators');
7373
const pendingDeprecation = getOptionValue('--pending-deprecation');
74-
const experimentalExports = getOptionValue('--experimental-exports');
7574

7675
module.exports = Module;
7776

@@ -373,7 +372,7 @@ function findLongestRegisteredExtension(filename) {
373372
const EXPORTS_PATTERN = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/;
374373
function resolveExports(nmPath, request, absoluteRequest) {
375374
// The implementation's behavior is meant to mirror resolution in ESM.
376-
if (experimentalExports && !absoluteRequest) {
375+
if (!absoluteRequest) {
377376
const [, name, expansion = ''] =
378377
StringPrototype.match(request, EXPORTS_PATTERN) || [];
379378
if (!name) {

src/module_wrap.cc

+1-3
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,7 @@ Maybe<const PackageConfig*> GetPackageConfig(Environment* env,
651651
}
652652

653653
Local<Value> exports_v;
654-
if (env->options()->experimental_exports &&
655-
pkg_json->Get(env->context(),
654+
if (pkg_json->Get(env->context(),
656655
env->exports_string()).ToLocal(&exports_v) &&
657656
!exports_v->IsNullOrUndefined()) {
658657
Global<Value> exports;
@@ -994,7 +993,6 @@ Maybe<URL> PackageExportsResolve(Environment* env,
994993
const std::string& pkg_subpath,
995994
const PackageConfig& pcfg,
996995
const URL& base) {
997-
CHECK(env->options()->experimental_exports);
998996
Isolate* isolate = env->isolate();
999997
Local<Context> context = env->context();
1000998
Local<Value> exports = pcfg.exports.Get(isolate);

src/node_options.cc

-5
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
326326
"experimental Source Map V3 support",
327327
&EnvironmentOptions::enable_source_maps,
328328
kAllowedInEnvironment);
329-
AddOption("--experimental-exports",
330-
"experimental support for exports in package.json",
331-
&EnvironmentOptions::experimental_exports,
332-
kAllowedInEnvironment);
333329
AddOption("--experimental-json-modules",
334330
"experimental JSON interop support for the ES Module loader",
335331
&EnvironmentOptions::experimental_json_modules,
@@ -344,7 +340,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
344340
"experimental ES Module support and caching modules",
345341
&EnvironmentOptions::experimental_modules,
346342
kAllowedInEnvironment);
347-
Implies("--experimental-modules", "--experimental-exports");
348343
AddOption("--experimental-wasm-modules",
349344
"experimental ES Module support for webassembly modules",
350345
&EnvironmentOptions::experimental_wasm_modules,

src/node_options.h

-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ class EnvironmentOptions : public Options {
101101
public:
102102
bool abort_on_uncaught_exception = false;
103103
bool enable_source_maps = false;
104-
bool experimental_exports = false;
105104
bool experimental_json_modules = false;
106105
bool experimental_modules = false;
107106
std::string es_module_specifier_resolution;

0 commit comments

Comments
 (0)