Skip to content

Commit

Permalink
esm: unflag --experimental-exports
Browse files Browse the repository at this point in the history
PR-URL: #29867
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
guybedford authored and BethGriggs committed Feb 6, 2020
1 parent e7c9042 commit d6e69fb
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 20 deletions.
8 changes: 0 additions & 8 deletions doc/api/cli.md
Expand Up @@ -161,13 +161,6 @@ the ability to import a directory that has an index file.

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

### `--experimental-exports`
<!-- YAML
added: v12.7.0
-->

Enable experimental resolution using the `exports` field in `package.json`.

### `--experimental-json-modules`
<!-- YAML
added: v12.9.0
Expand Down Expand Up @@ -1052,7 +1045,6 @@ Node.js options that are allowed are:
* `--enable-fips`
* `--enable-source-maps`
* `--es-module-specifier-resolution`
* `--experimental-exports`
* `--experimental-json-modules`
* `--experimental-loader`
* `--experimental-modules`
Expand Down
2 changes: 1 addition & 1 deletion doc/api/modules.md
Expand Up @@ -203,7 +203,7 @@ NODE_MODULES_PATHS(START)
5. return DIRS
```

If `--experimental-exports` is enabled, Node.js allows packages loaded via
Node.js allows packages loaded via
`LOAD_NODE_MODULES` to explicitly declare which file paths to expose and how
they should be interpreted. This expands on the control packages already had
using the `main` field.
Expand Down
3 changes: 1 addition & 2 deletions lib/internal/modules/cjs/loader.js
Expand Up @@ -71,7 +71,6 @@ const {
} = require('internal/errors').codes;
const { validateString } = require('internal/validators');
const pendingDeprecation = getOptionValue('--pending-deprecation');
const experimentalExports = getOptionValue('--experimental-exports');

module.exports = Module;

Expand Down Expand Up @@ -373,7 +372,7 @@ function findLongestRegisteredExtension(filename) {
const EXPORTS_PATTERN = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/;
function resolveExports(nmPath, request, absoluteRequest) {
// The implementation's behavior is meant to mirror resolution in ESM.
if (experimentalExports && !absoluteRequest) {
if (!absoluteRequest) {
const [, name, expansion = ''] =
StringPrototype.match(request, EXPORTS_PATTERN) || [];
if (!name) {
Expand Down
4 changes: 1 addition & 3 deletions src/module_wrap.cc
Expand Up @@ -651,8 +651,7 @@ Maybe<const PackageConfig*> GetPackageConfig(Environment* env,
}

Local<Value> exports_v;
if (env->options()->experimental_exports &&
pkg_json->Get(env->context(),
if (pkg_json->Get(env->context(),
env->exports_string()).ToLocal(&exports_v) &&
!exports_v->IsNullOrUndefined()) {
Global<Value> exports;
Expand Down Expand Up @@ -994,7 +993,6 @@ Maybe<URL> PackageExportsResolve(Environment* env,
const std::string& pkg_subpath,
const PackageConfig& pcfg,
const URL& base) {
CHECK(env->options()->experimental_exports);
Isolate* isolate = env->isolate();
Local<Context> context = env->context();
Local<Value> exports = pcfg.exports.Get(isolate);
Expand Down
5 changes: 0 additions & 5 deletions src/node_options.cc
Expand Up @@ -326,10 +326,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"experimental Source Map V3 support",
&EnvironmentOptions::enable_source_maps,
kAllowedInEnvironment);
AddOption("--experimental-exports",
"experimental support for exports in package.json",
&EnvironmentOptions::experimental_exports,
kAllowedInEnvironment);
AddOption("--experimental-json-modules",
"experimental JSON interop support for the ES Module loader",
&EnvironmentOptions::experimental_json_modules,
Expand All @@ -344,7 +340,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"experimental ES Module support and caching modules",
&EnvironmentOptions::experimental_modules,
kAllowedInEnvironment);
Implies("--experimental-modules", "--experimental-exports");
AddOption("--experimental-wasm-modules",
"experimental ES Module support for webassembly modules",
&EnvironmentOptions::experimental_wasm_modules,
Expand Down
1 change: 0 additions & 1 deletion src/node_options.h
Expand Up @@ -101,7 +101,6 @@ class EnvironmentOptions : public Options {
public:
bool abort_on_uncaught_exception = false;
bool enable_source_maps = false;
bool experimental_exports = false;
bool experimental_json_modules = false;
bool experimental_modules = false;
std::string es_module_specifier_resolution;
Expand Down

0 comments on commit d6e69fb

Please sign in to comment.