bare-module 1.13.0 → 1.13.1

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.
package/index.js CHANGED
@@ -465,16 +465,11 @@ module.exports = exports = class Module {
465
465
 
466
466
  static _transform (module, referrer = null, dynamic = false) {
467
467
  if (dynamic) {
468
- if (module._type !== constants.types.MODULE && module._handle === null) {
469
- this._synthesize(module)
470
- }
471
-
468
+ if (module._type !== constants.types.MODULE) this._synthesize(module)
472
469
  this._evaluate(module)
473
470
  } else if (referrer) {
474
471
  if (referrer._type === constants.types.MODULE) {
475
- if (module._type !== constants.types.MODULE && module._handle === null) {
476
- this._synthesize(module)
477
- }
472
+ if (module._type !== constants.types.MODULE) this._synthesize(module)
478
473
  } else if (module._type === constants.types.MODULE) {
479
474
  this._evaluate(module)
480
475
  }
@@ -498,6 +493,8 @@ module.exports = exports = class Module {
498
493
  }
499
494
 
500
495
  static _synthesize (module) {
496
+ if ((module._state & constants.states.SYNTHESIZED) !== 0) return
497
+
501
498
  const names = ['default']
502
499
 
503
500
  for (const key of Object.keys(module.exports)) {
@@ -506,7 +503,7 @@ module.exports = exports = class Module {
506
503
 
507
504
  module._handle = binding.createSyntheticModule(module.filename, names, this._context)
508
505
 
509
- module._state &= ~constants.states.EVALUATED
506
+ module._state |= constants.states.SYNTHESIZED
510
507
  }
511
508
  }
512
509
 
package/lib/constants.js CHANGED
@@ -1,6 +1,7 @@
1
1
  module.exports = {
2
2
  states: {
3
- EVALUATED: 1
3
+ EVALUATED: 1,
4
+ SYNTHESIZED: 2
4
5
  },
5
6
 
6
7
  types: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-module",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "Module support for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [