Skip to content

Commit

Permalink
esm: unflag --experimental-exports
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Oct 10, 2019
1 parent 1294c7e commit 8ff42aa
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
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,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 @@ -998,7 +991,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
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,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
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const {
} = require('internal/errors').codes;
const { validateString } = require('internal/validators');
const pendingDeprecation = getOptionValue('--pending-deprecation');
const experimentalExports = getOptionValue('--experimental-exports');

module.exports = { wrapSafe, Module };

Expand Down Expand Up @@ -369,7 +368,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
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,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 @@ -995,7 +994,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
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,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 @@ -335,7 +331,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
Original file line number Diff line number Diff line change
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 8ff42aa

Please sign in to comment.