bare-module 1.9.2 → 1.9.4

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
@@ -209,7 +209,7 @@ const Module = module.exports = class Module {
209
209
  }
210
210
 
211
211
  static * _resolveNodeModules (specifier, dirname, protocol) {
212
- for (const nodeModules of this._resolvePaths(dirname)) {
212
+ for (const nodeModules of this._resolveNodeModulesPaths(dirname)) {
213
213
  const filename = path.join(nodeModules, specifier)
214
214
 
215
215
  yield * this._resolveFile(filename, protocol)
@@ -217,7 +217,7 @@ const Module = module.exports = class Module {
217
217
  }
218
218
  }
219
219
 
220
- static * _resolvePaths (start) {
220
+ static * _resolveNodeModulesPaths (start) {
221
221
  if (start === path.sep) return yield path.join(start, 'node_modules')
222
222
 
223
223
  const parts = start.split(path.sep)
@@ -299,8 +299,8 @@ Module._extensions['.js'] = function (module, source, referrer, protocol, import
299
299
  // The package is explicitly declared as an ES module.
300
300
  (module._info && module._info.type === 'module') ||
301
301
 
302
- // The referrer is itself an ES module.
303
- (referrer && referrer._type === 'esm')
302
+ // The source is a data: URI and the referrer is itself an ES module.
303
+ (protocol === this._protocols['data:'] && referrer && referrer._type === 'esm')
304
304
  )
305
305
 
306
306
  const loader = this._extensions[isESM ? '.mjs' : '.cjs']
@@ -449,4 +449,8 @@ Module._protocols['data:'] = new Protocol({
449
449
  }
450
450
  })
451
451
 
452
- process.once('exit', () => binding.destroy(Module._context))
452
+ process.on('exit', () => binding.destroy(Module._context))
453
+
454
+ if (process.thread) {
455
+ process.thread.on('exit', () => binding.destroy(Module._context))
456
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-module",
3
- "version": "1.9.2",
3
+ "version": "1.9.4",
4
4
  "description": "Module support for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [