bare-module-traverse 1.3.0 → 1.3.2
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 +22 -15
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -268,20 +268,20 @@ exports.imports = function* (
|
|
|
268
268
|
url.protocol === builtinProtocol ||
|
|
269
269
|
url.protocol === linkedProtocol
|
|
270
270
|
) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
271
|
+
addResolution(imports, specifier, matchedConditions, url)
|
|
272
|
+
|
|
273
|
+
resolved = yielded = true
|
|
274
274
|
} else {
|
|
275
275
|
const source = yield { module: url }
|
|
276
276
|
|
|
277
277
|
if (source !== null) {
|
|
278
|
-
|
|
279
|
-
yield {
|
|
280
|
-
children: exports.module(url, source, artifacts, visited, opts)
|
|
281
|
-
}
|
|
278
|
+
addResolution(imports, specifier, matchedConditions, url)
|
|
282
279
|
|
|
283
|
-
|
|
280
|
+
yield {
|
|
281
|
+
children: exports.module(url, source, artifacts, visited, opts)
|
|
284
282
|
}
|
|
283
|
+
|
|
284
|
+
resolved = yielded = true
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
|
|
@@ -299,9 +299,20 @@ exports.imports = function* (
|
|
|
299
299
|
matchedConditions.pop()
|
|
300
300
|
|
|
301
301
|
if (resolutions === 0) {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
302
|
+
switch (condition) {
|
|
303
|
+
case 'addon':
|
|
304
|
+
throw errors.ADDON_NOT_FOUND(
|
|
305
|
+
`Cannot find addon '${specifier}' imported from '${parentURL.href}'`
|
|
306
|
+
)
|
|
307
|
+
case 'asset':
|
|
308
|
+
throw errors.ASSET_NOT_FOUND(
|
|
309
|
+
`Cannot find asset '${specifier}' imported from '${parentURL.href}'`
|
|
310
|
+
)
|
|
311
|
+
default:
|
|
312
|
+
throw errors.MODULE_NOT_FOUND(
|
|
313
|
+
`Cannot find module '${specifier}' imported from '${parentURL.href}'`
|
|
314
|
+
)
|
|
315
|
+
}
|
|
305
316
|
}
|
|
306
317
|
}
|
|
307
318
|
|
|
@@ -521,8 +532,6 @@ function addResolution(imports, specifier, conditions, url) {
|
|
|
521
532
|
|
|
522
533
|
const last = conditions[conditions.length - 1]
|
|
523
534
|
|
|
524
|
-
if (last in current) return false
|
|
525
|
-
|
|
526
535
|
current[last] = url.href
|
|
527
536
|
|
|
528
537
|
if ('default' in current) {
|
|
@@ -532,8 +541,6 @@ function addResolution(imports, specifier, conditions, url) {
|
|
|
532
541
|
|
|
533
542
|
current.default = value
|
|
534
543
|
}
|
|
535
|
-
|
|
536
|
-
return true
|
|
537
544
|
}
|
|
538
545
|
|
|
539
546
|
function compressImportsMap(imports) {
|