Skip to content

Commit

Permalink
fixup --expose-internals esm facade
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Oct 7, 2019
1 parent d85bb91 commit 10d7585
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/internal/bootstrap/loaders.js
Expand Up @@ -155,6 +155,7 @@ function NativeModule(id) {
this.loaded = false;
this.loading = false;
this.canBeRequiredByUsers = !id.startsWith('internal/');
this.defaultOnly = false;
}

// To be called during pre-execution when --expose-internals is on.
Expand All @@ -164,6 +165,7 @@ NativeModule.exposeInternals = function() {
// Do not expose this to user land even with --expose-internals.
if (id !== loaderId) {
mod.canBeRequiredByUsers = true;
mod.defaultOnly = true;
}
}
};
Expand Down Expand Up @@ -219,7 +221,7 @@ NativeModule.prototype.compileForPublicLoader = function() {
}
this.compile();
if (!this.exportKeys) {
this.exportKeys = Object.keys(this.exports);
this.exportKeys = this.defaultOnly ? [] : Object.keys(this.exports);
}
this.getESMFacade();
this.syncExports();
Expand Down

0 comments on commit 10d7585

Please sign in to comment.