Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-universal-import

Package Overview
Dependencies
Maintainers
2
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 4.0.0-alpha.6 to 4.0.0

coverage/clover.xml

26

index.js

@@ -39,6 +39,2 @@ 'use-strict'

function prepareChunkNamePath(path) {
return path.replace(/\//g, '-')
}
function getImport(p, { source, nameHint }) {

@@ -50,3 +46,3 @@ return addDefault(p, source, { nameHint })

if (importArgNode.quasis) {
const quasis = importArgNode.quasis.slice(0)
let quasis = importArgNode.quasis.slice(0)
const baseDir = trimChunkNameBaseDir(quasis[0].value.cooked)

@@ -57,2 +53,4 @@ quasis[0] = Object.assign({}, quasis[0], {

quasis = quasis.map((quasi, i) => (i > 0 ? prepareQuasi(quasi) : quasi))
return Object.assign({}, importArgNode, {

@@ -67,2 +65,8 @@ quasis

function prepareQuasi(quasi) {
return Object.assign({}, quasi, {
value: { raw: quasi.value.cooked, cooked: quasi.value.cooked }
})
}
function getMagicWebpackComments(importArgNode) {

@@ -197,10 +201,2 @@ const { leadingComments } = importArgNode

function checkForNestedChunkName(node) {
const generatedChunkName = getMagicCommentChunkName(node)
const isNested =
generatedChunkName.indexOf('[request]') === -1 &&
generatedChunkName.indexOf('/') > -1
return isNested && prepareChunkNamePath(generatedChunkName)
}
module.exports = function universalImportPlugin({ types: t, template }) {

@@ -224,5 +220,3 @@ const chunkNameTemplate = template('() => MODULE')

// no existing chunkname, no problem - we will reuse that for fixing nested chunk names
if (!t.existingChunkName) {
t.existingChunkName = checkForNestedChunkName(importArgNode)
}
const universalImport = getImport(p, IMPORT_UNIVERSAL_DEFAULT)

@@ -229,0 +223,0 @@

{
"name": "babel-plugin-universal-import",
"version": "4.0.0-alpha.6",
"version": "4.0.0",
"description": "Babel plugin to transform import() into its Universal counterpart",

@@ -88,2 +88,2 @@ "main": "index.js",

}
}
}
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