@parcel/runtime-js
Advanced tools
Comparing version 2.0.0-canary.1769 to 2.0.0-canary.1770
@@ -6,6 +6,13 @@ "use strict"; | ||
return new Promise(function (resolve, reject) { | ||
if (typeof document === 'undefined') { | ||
return resolve(); | ||
} | ||
var link = document.createElement('link'); | ||
link.rel = 'stylesheet'; | ||
link.href = bundle; | ||
// Don't insert the same link element twice (e.g. if it was already in the HTML) | ||
var existingLinks = document.getElementsByTagName('link'); | ||
if ([].concat(existingLinks).some(function (link) { | ||
return link.href === bundle && link.rel.indexOf('stylesheet') > -1; | ||
if (Array.from(existingLinks).some(function (existing) { | ||
return existing.href === link.href && existing.rel.indexOf('stylesheet') > -1; | ||
})) { | ||
@@ -15,5 +22,2 @@ resolve(); | ||
} | ||
var link = document.createElement('link'); | ||
link.rel = 'stylesheet'; | ||
link.href = bundle; | ||
link.onerror = function (e) { | ||
@@ -20,0 +24,0 @@ link.onerror = link.onload = null; |
{ | ||
"name": "@parcel/runtime-js", | ||
"version": "2.0.0-canary.1769+337c31c68", | ||
"version": "2.0.0-canary.1770+e3a2b726d", | ||
"license": "MIT", | ||
@@ -20,11 +20,11 @@ "publishConfig": { | ||
"node": ">= 16.0.0", | ||
"parcel": "^2.0.0-canary.1767+337c31c68" | ||
"parcel": "^2.0.0-canary.1768+e3a2b726d" | ||
}, | ||
"dependencies": { | ||
"@parcel/diagnostic": "2.0.0-canary.1769+337c31c68", | ||
"@parcel/plugin": "2.0.0-canary.1769+337c31c68", | ||
"@parcel/utils": "2.0.0-canary.1769+337c31c68", | ||
"@parcel/diagnostic": "2.0.0-canary.1770+e3a2b726d", | ||
"@parcel/plugin": "2.0.0-canary.1770+e3a2b726d", | ||
"@parcel/utils": "2.0.0-canary.1770+e3a2b726d", | ||
"nullthrows": "^1.1.1" | ||
}, | ||
"gitHead": "337c31c68ff350f1a971752746bb0e01583f5ef4" | ||
"gitHead": "e3a2b726db9382a873834da82746671d54557d2b" | ||
} |
@@ -5,9 +5,19 @@ const cacheLoader = require('../cacheLoader'); | ||
return new Promise(function (resolve, reject) { | ||
if (typeof document === 'undefined') { | ||
return resolve(); | ||
} | ||
var link = document.createElement('link'); | ||
link.rel = 'stylesheet'; | ||
link.href = bundle; | ||
// Don't insert the same link element twice (e.g. if it was already in the HTML) | ||
let existingLinks = document.getElementsByTagName('link'); | ||
let isCurrentBundle = function (link) { | ||
return link.href === bundle && link.rel.indexOf('stylesheet') > -1; | ||
let isCurrentBundle = function (existing) { | ||
return ( | ||
existing.href === link.href && existing.rel.indexOf('stylesheet') > -1 | ||
); | ||
}; | ||
if ([].concat(existingLinks).some(isCurrentBundle)) { | ||
if (Array.from(existingLinks).some(isCurrentBundle)) { | ||
resolve(); | ||
@@ -17,5 +27,2 @@ return; | ||
var link = document.createElement('link'); | ||
link.rel = 'stylesheet'; | ||
link.href = bundle; | ||
link.onerror = function (e) { | ||
@@ -22,0 +29,0 @@ link.onerror = link.onload = null; |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
76938
1904