bare-module-traverse 2.3.0 → 2.3.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 +11 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -360,6 +360,10 @@ exports.imports = function* (parentURL, source, imports, artifacts, lexer, visit
|
|
|
360
360
|
condition = 'addon'
|
|
361
361
|
} else if (entry.type & lex.constants.ASSET) {
|
|
362
362
|
condition = 'asset'
|
|
363
|
+
} else if (entry.type & lex.constants.REQUIRE) {
|
|
364
|
+
condition = 'require'
|
|
365
|
+
} else if (entry.type & lex.constants.IMPORT) {
|
|
366
|
+
condition = 'import'
|
|
363
367
|
}
|
|
364
368
|
|
|
365
369
|
if (entry.attributes.imports) {
|
|
@@ -466,7 +470,7 @@ exports.imports = function* (parentURL, source, imports, artifacts, lexer, visit
|
|
|
466
470
|
matchedConditions.pop()
|
|
467
471
|
|
|
468
472
|
if (resolutions === 0) {
|
|
469
|
-
let message = `Cannot find ${condition === '
|
|
473
|
+
let message = `Cannot find ${condition === 'addon' || condition === 'asset' ? condition : 'module'} '${specifier}' imported from '${parentURL.href}'`
|
|
470
474
|
|
|
471
475
|
if (candidates.length > 0) {
|
|
472
476
|
message += '\nCandidates:'
|
|
@@ -765,6 +769,12 @@ function compressImportsMapEntry(resolved) {
|
|
|
765
769
|
if (entry[0] === 'default') primary = entry[1]
|
|
766
770
|
}
|
|
767
771
|
|
|
772
|
+
if (entries.length === 0) return resolved
|
|
773
|
+
|
|
774
|
+
const [, first] = entries[0]
|
|
775
|
+
|
|
776
|
+
if (entries.every(([, resolved]) => resolved === first)) return first
|
|
777
|
+
|
|
768
778
|
entries = entries.filter(
|
|
769
779
|
([condition, resolved]) => condition === 'default' || resolved !== primary
|
|
770
780
|
)
|