New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-universal-import

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-universal-import - npm Package Compare versions

Comparing version 1.3.4 to 1.4.0

55

importCss.js

@@ -35,3 +35,2 @@ /* eslint-disable */

link.href = href
link.charset = 'utf-8'

@@ -44,3 +43,18 @@ link.type = 'text/css'

var timeout
var img
var onload = function() {
// Check if we created the img tag.
// If we did then the chunk was loaded via img.src
// and we need to set the link.href which will then
// load the resource from cache
if (img) {
link.href = href
img.onerror = null // avoid mem leaks in IE.
}
link.onerror = null // avoid mem leaks in IE.
clearTimeout(timeout)
resolve()
}
link.onerror = function() {

@@ -53,9 +67,14 @@ link.onerror = link.onload = null // avoid mem leaks in IE.

// link.onload doesn't work well enough, but this will handle it
// since images can't load css (this is a popular fix)
var img = document.createElement('img')
img.onerror = function() {
link.onerror = img.onerror = null // avoid mem leaks in IE.
clearTimeout(timeout)
resolve()
if (isOnloadSupported() && 'onload' in link) {
link.onload = onload
link.href = href
} else {
// Use img.src as a fallback to loading the css chunk in browsers
// which don’t support link.onload
// We use the img.onerror handler because an error will always fire
// when parsing the response
// Then we know the resource has been loaded
img = document.createElement('img')
img.onerror = onload
img.src = href
}

@@ -65,3 +84,2 @@

head.appendChild(link)
img.src = href
})

@@ -74,1 +92,20 @@ }

}
// Checks whether the browser supports link.onload
// Reference: https://pie.gd/test/script-link-events/
function isOnloadSupported() {
var userAgent = navigator.userAgent
var supportedMajor = 535
var supportedMinor = 24
var match = userAgent.match(/\ AppleWebKit\/(\d+)\.(\d+)/)
if (match) {
var major = +match[1]
var minor = +match[2]
return (
(major === supportedMajor && minor >= supportedMinor) ||
major > supportedMajor
)
}
// All other browsers support it
return true
}

2

package.json
{
"name": "babel-plugin-universal-import",
"version": "1.3.4",
"version": "1.4.0",
"description": "Babel plugin to transform import() into its Universal counterpart",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc