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 +5 -8
- package/lib/constants.js +2 -1
- package/package.json +1 -1
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
|
|
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
|
|
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
|
|
506
|
+
module._state |= constants.states.SYNTHESIZED
|
|
510
507
|
}
|
|
511
508
|
}
|
|
512
509
|
|
package/lib/constants.js
CHANGED