bare-module-traverse 1.2.3 → 1.2.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 +14 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -229,7 +229,7 @@ exports.preresolved = function * (url, source, resolutions, artifacts, visited,
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
exports.imports = function * (parentURL, source, imports, artifacts, visited, opts = {}) {
|
|
232
|
-
const { resolve = exports.resolve.default } = opts
|
|
232
|
+
const { resolve = exports.resolve.default, builtinProtocol = 'builtin:', linkedProtocol = 'linked:' } = opts
|
|
233
233
|
|
|
234
234
|
let yielded = false
|
|
235
235
|
|
|
@@ -252,12 +252,21 @@ exports.imports = function * (parentURL, source, imports, artifacts, visited, op
|
|
|
252
252
|
const value = next.value
|
|
253
253
|
|
|
254
254
|
if (value.package) {
|
|
255
|
-
|
|
256
|
-
const source = yield { module: url }
|
|
257
|
-
|
|
258
|
-
next = resolver.next(JSON.parse(source))
|
|
255
|
+
next = resolver.next(JSON.parse(yield { module: value.package }))
|
|
259
256
|
} else {
|
|
260
257
|
const url = value.resolution
|
|
258
|
+
|
|
259
|
+
if (url.protocol === builtinProtocol || url.protocol === linkedProtocol) {
|
|
260
|
+
if (key === 'addon') addURL(artifacts.addons, url)
|
|
261
|
+
else if (key === 'asset') addURL(artifacts.assets, url)
|
|
262
|
+
|
|
263
|
+
imports[specifier] = { [key]: url.href, ...imports[specifier] }
|
|
264
|
+
|
|
265
|
+
resolved = yielded = true
|
|
266
|
+
|
|
267
|
+
break
|
|
268
|
+
}
|
|
269
|
+
|
|
261
270
|
const source = yield { module: url }
|
|
262
271
|
|
|
263
272
|
if (source !== null) {
|