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
|
-
|
|
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
|
-
|
|
414
|
+
resolved = this._mapConditionalExport(expansion, dirname, info.exports)
|
|
413
415
|
|
|
414
|
-
if (
|
|
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,
|
|
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
|
Binary file
|