Function
getImageURL
(image, bundleGraph, bundle)
Source from the content-addressed store, hash-verified
| 297 | } |
| 298 | |
| 299 | function getImageURL(image, bundleGraph, bundle) { |
| 300 | if (!image) { |
| 301 | return ''; |
| 302 | } |
| 303 | |
| 304 | let dep = bundle |
| 305 | .getMainEntry() |
| 306 | .getDependencies() |
| 307 | .find(d => d.id === image); |
| 308 | if (!dep) { |
| 309 | return ''; |
| 310 | } |
| 311 | |
| 312 | let resolved = bundleGraph.getReferencedBundle(dep, bundle); |
| 313 | if (!resolved) { |
| 314 | return ''; |
| 315 | } |
| 316 | |
| 317 | return urlJoin(resolved.target.publicUrl, resolved.name); |
| 318 | } |
Tested by
no test coverage detected