bare-module 1.14.0 → 1.14.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.
Files changed (2) hide show
  1. package/index.js +7 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -19,6 +19,8 @@ module.exports = exports = class Module {
19
19
  this._info = null
20
20
  this._protocol = null
21
21
  this._handle = null
22
+
23
+ Module._modules.add(this)
22
24
  }
23
25
 
24
26
  get type () {
@@ -66,6 +68,8 @@ module.exports = exports = class Module {
66
68
  binding.deleteModule(this._handle)
67
69
  this._handle = null
68
70
  }
71
+
72
+ Module._modules.delete(this)
69
73
  }
70
74
 
71
75
  [Symbol.for('bare.inspect')] () {
@@ -87,12 +91,13 @@ module.exports = exports = class Module {
87
91
  static _imports = Object.create(null)
88
92
  static _cache = Object.create(null)
89
93
  static _bundles = Object.create(null)
94
+ static _modules = new Set()
90
95
 
91
96
  static _context = binding.init(this, this._onimport, this._onevaluate, this._onmeta)
92
97
 
93
98
  static _ondestroy () {
94
- for (const specifier in this._cache) {
95
- this._cache[specifier].destroy()
99
+ for (const module in this._modules) {
100
+ module.destroy()
96
101
  }
97
102
 
98
103
  binding.destroy(this._context)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-module",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "description": "Module support for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [