bare-module 3.1.7 → 3.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +6 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -29,6 +29,7 @@ const Module = module.exports = exports = class Module {
29
29
  this._protocol = null
30
30
  this._bundle = null
31
31
  this._function = null
32
+ this._names = null
32
33
  this._handle = null
33
34
 
34
35
  Module._modules.add(this)
@@ -179,7 +180,9 @@ const Module = module.exports = exports = class Module {
179
180
  }
180
181
  }
181
182
 
182
- this._handle = binding.createSyntheticModule(this._url.href, names, Module._handle)
183
+ this._names = names
184
+
185
+ this._handle = binding.createSyntheticModule(this._url.href, this._names, Module._handle)
183
186
  }
184
187
 
185
188
  _evaluate (eagerRun = false) {
@@ -280,10 +283,8 @@ const Module = module.exports = exports = class Module {
280
283
 
281
284
  module._evaluate()
282
285
 
283
- binding.setExport(module._handle, 'default', module._exports)
284
-
285
- for (const [key, value] of Object.entries(module._exports)) {
286
- binding.setExport(module._handle, key, value)
286
+ for (const name of module._names) {
287
+ binding.setExport(module._handle, name, name === 'default' ? module._exports : module._exports[name])
287
288
  }
288
289
  }
289
290
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-module",
3
- "version": "3.1.7",
3
+ "version": "3.1.8",
4
4
  "description": "Module support for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [