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

babel-plugin-globals

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-globals - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0

25

index.js

@@ -166,13 +166,16 @@ 'use strict';

var replacements = [];
nodePath.node.specifiers.forEach(function(specifier) {
var expr = getGlobalExpression(
state,
removeExtensions(nodePath.node.source.value),
specifier.imported ? specifier.imported.name : null,
t.isImportNamespaceSpecifier(specifier)
);
replacements.push(t.variableDeclaration('var', [
t.variableDeclarator(specifier.local, expr)
]));
});
if ( nodePath.node.source.value.match(/^[\./]/) ) {
nodePath.node.specifiers.forEach(function(specifier) {
var expr = getGlobalExpression(
state,
removeExtensions(nodePath.node.source.value),
specifier.imported ? specifier.imported.name : null,
t.isImportNamespaceSpecifier(specifier)
);
replacements.push(t.variableDeclaration('var', [
t.variableDeclarator(specifier.local, expr)
]));
});
}
nodePath.replaceWithMultiple(replacements);

@@ -179,0 +182,0 @@ },

{
"name": "babel-plugin-globals",
"version": "2.0.1",
"version": "3.0.0",
"description": "A babel plugin that exposes ES6 modules to global variables.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -21,2 +21,5 @@ babel-plugin-globals

Import statements will be removed if the imported file is not a relative or absolute path.
This allows for CDN hosted libraries to be explicitly imported in code whilst still retaining the globals import system.
## API

@@ -23,0 +26,0 @@ This plugin requires passing the following plugin/babel options (besides adding the plugin):

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