bare-module 2.0.0 → 2.0.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
@@ -395,8 +395,10 @@ const Module = module.exports = exports = class Module {
395
395
  }
396
396
 
397
397
  static * _resolveNodeModules (specifier, dirname, protocol) {
398
+ const [, name, expansion = '.'] = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/.exec(specifier) || []
399
+
398
400
  for (const nodeModules of this._resolveNodeModulesPaths(dirname)) {
399
- const [, name, expansion = '.'] = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/.exec(specifier) || []
401
+ let resolved = specifier
400
402
 
401
403
  if (name) {
402
404
  const pkg = path.join(nodeModules, name, 'package.json')
@@ -409,16 +411,16 @@ const Module = module.exports = exports = class Module {
409
411
 
410
412
  if (info) {
411
413
  if (info.exports) {
412
- specifier = this._mapConditionalExport(expansion, dirname, info.exports)
414
+ resolved = this._mapConditionalExport(expansion, dirname, info.exports)
413
415
 
414
- if (specifier) specifier = path.join(name, specifier)
416
+ if (resolved) resolved = path.join(name, resolved)
415
417
  else return
416
418
  }
417
419
  }
418
420
  }
419
421
  }
420
422
 
421
- const filename = path.join(nodeModules, specifier)
423
+ const filename = path.join(nodeModules, resolved)
422
424
 
423
425
  yield * this._resolveFile(filename, protocol)
424
426
  yield * this._resolveDirectory(filename, protocol)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-module",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Module support for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [