bare-module 1.13.5 → 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.
- package/index.js +7 -6
- 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
|
|
95
|
-
|
|
99
|
+
for (const module in this._modules) {
|
|
100
|
+
module.destroy()
|
|
96
101
|
}
|
|
97
102
|
|
|
98
103
|
binding.destroy(this._context)
|
|
@@ -689,7 +694,3 @@ exports._protocols['data:'] = new Protocol({
|
|
|
689
694
|
})
|
|
690
695
|
|
|
691
696
|
process.on('exit', exports._ondestroy.bind(exports))
|
|
692
|
-
|
|
693
|
-
if (process.thread) {
|
|
694
|
-
process.thread.on('exit', exports._ondestroy.bind(exports))
|
|
695
|
-
}
|