From 10d75855f6f752ecf3214f07578489b90ac52e78 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Sun, 6 Oct 2019 22:45:14 -0400 Subject: [PATCH] fixup --expose-internals esm facade --- lib/internal/bootstrap/loaders.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index 51e044c5c931b9..a08ff26ab6cdfc 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -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. @@ -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; } } }; @@ -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();