@parcel/utils 2.0.0-canary.1781 → 2.0.0-canary.1789

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/lib/index.js CHANGED
@@ -34647,7 +34647,7 @@ class $d0205e6a737975d7$export$2e2bcd8739ae039 extends (0, $houHs$stream.Transfo
34647
34647
 
34648
34648
 
34649
34649
 
34650
- function $13647135c22990e2$export$2e2bcd8739ae039(publicURL, assetPath) {
34650
+ function $13647135c22990e2$export$2e2bcd8739ae039(publicURL, assetPath, leadingDotSlash = false) {
34651
34651
  const url = (0, ($parcel$interopDefault($houHs$url))).parse(publicURL, false, true);
34652
34652
  // Leading / ensures that paths with colons are not parsed as a protocol.
34653
34653
  let p = assetPath.startsWith('/') ? assetPath : '/' + assetPath;
@@ -34655,7 +34655,9 @@ function $13647135c22990e2$export$2e2bcd8739ae039(publicURL, assetPath) {
34655
34655
  url.pathname = (0, ($parcel$interopDefault($houHs$path))).posix.join(url.pathname, assetUrl.pathname);
34656
34656
  url.search = assetUrl.search;
34657
34657
  url.hash = assetUrl.hash;
34658
- return (0, ($parcel$interopDefault($houHs$url))).format(url);
34658
+ let result = (0, ($parcel$interopDefault($houHs$url))).format(url);
34659
+ if (url.host == null && result[0] !== '/' && result[0] !== '.' && leadingDotSlash) result = './' + result;
34660
+ return result;
34659
34661
  }
34660
34662
 
34661
34663