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

babel-plugin-transform-amd-to-commonjs

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-amd-to-commonjs - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

16

build.js

@@ -52,4 +52,5 @@ 'use strict';

var isDefineCall = name === 'define';
if (name === 'define' && !t.isProgram(parent)) return;
if (isDefineCall && !t.isProgram(parent)) return;

@@ -68,5 +69,6 @@ var argumentDecoders = {

if (!t.isArrayExpression(dependencyList) && !t.isFunctionExpression(factory)) return;
if (!t.isArrayExpression(dependencyList) && !factory) return;
var injectsModuleOrExports = false;
var isFunctionFactory = t.isFunctionExpression(factory);
var requireExpressions = [];

@@ -86,3 +88,3 @@

}
var paramName = factory && factory.params[i];
var paramName = isFunctionFactory && factory.params[i];
requireExpressions.push(createRequireExpression(el, paramName));

@@ -92,3 +94,3 @@ });

if (factory) {
if (isFunctionFactory) {
var factoryArity = factory.params.length;

@@ -111,3 +113,3 @@ var replacementFuncExpr = t.functionExpression(null, [], t.blockStatement(requireExpressions.concat(factory.body.body)));

injectsModuleOrExports = injectsModuleOrExports || !dependencyList && factoryArity > 1;
if (name === 'define' && !injectsModuleOrExports) {
if (isDefineCall && !injectsModuleOrExports) {
path.replaceWith(createModuleExportsAssignmentExpression(factoryReplacement));

@@ -117,2 +119,6 @@ } else {

}
} else if (factory && isDefineCall) {
var exportExpression = createModuleExportsAssignmentExpression(factory);
var nodes = requireExpressions.concat(exportExpression);
path.replaceWithMultiple(nodes);
} else {

@@ -119,0 +125,0 @@ path.replaceWithMultiple(requireExpressions);

{
"name": "babel-plugin-transform-amd-to-commonjs",
"version": "0.2.1",
"version": "0.2.2",
"description": "Transforms AMD code to CommonJS",

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

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