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

@babel/plugin-transform-spread

Package Overview
Dependencies
Maintainers
6
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-spread - npm Package Compare versions

Comparing version 7.0.0-beta.43 to 7.0.0-beta.44

88

lib/index.js

@@ -9,5 +9,5 @@ "use strict";

function _helperPluginUtils() {
const data = require("@babel/helper-plugin-utils");
var data = require("@babel/helper-plugin-utils");
_helperPluginUtils = function () {
_helperPluginUtils = function _helperPluginUtils() {
return data;

@@ -20,5 +20,5 @@ };

function _core() {
const data = require("@babel/core");
var data = require("@babel/core");
_core = function () {
_core = function _core() {
return data;

@@ -30,7 +30,5 @@ };

var _default = (0, _helperPluginUtils().declare)((api, options) => {
var _default = (0, _helperPluginUtils().declare)(function (api, options) {
api.assertVersion(7);
const {
loose
} = options;
var loose = options.loose;

@@ -48,3 +46,3 @@ function getSpreadLiteral(spread, scope) {

function hasSpread(nodes) {
for (let i = 0; i < nodes.length; i++) {
for (var i = 0; i < nodes.length; i++) {
if (_core().types.isSpreadElement(nodes[i])) {

@@ -65,6 +63,19 @@ return true;

function build(props, scope) {
const nodes = [];
let _props = [];
var nodes = [];
var _props = [];
for (const prop of props) {
for (var _iterator = props, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var prop = _ref;
if (_core().types.isSpreadElement(prop)) {

@@ -84,11 +95,9 @@ _props = push(_props, nodes);

visitor: {
ArrayExpression(path, state) {
const {
node,
scope
} = path;
const elements = node.elements;
ArrayExpression: function ArrayExpression(path, state) {
var node = path.node,
scope = path.scope;
var elements = node.elements;
if (!hasSpread(elements)) return;
const nodes = build(elements, scope, state);
const first = nodes.shift();
var nodes = build(elements, scope, state);
var first = nodes.shift();

@@ -102,15 +111,12 @@ if (nodes.length === 0 && first !== elements[0].argument) {

},
CallExpression(path, state) {
const {
node,
scope
} = path;
const args = node.arguments;
CallExpression: function CallExpression(path, state) {
var node = path.node,
scope = path.scope;
var args = node.arguments;
if (!hasSpread(args)) return;
const calleePath = path.get("callee");
var calleePath = path.get("callee");
if (calleePath.isSuper()) return;
let contextLiteral = scope.buildUndefinedNode();
var contextLiteral = scope.buildUndefinedNode();
node.arguments = [];
let nodes;
var nodes;

@@ -123,3 +129,3 @@ if (args.length === 1 && args[0].argument.name === "arguments") {

const first = nodes.shift();
var first = nodes.shift();

@@ -132,6 +138,6 @@ if (nodes.length) {

const callee = node.callee;
var callee = node.callee;
if (calleePath.isMemberExpression()) {
const temp = scope.maybeGenerateMemoised(callee.object);
var temp = scope.maybeGenerateMemoised(callee.object);

@@ -156,13 +162,10 @@ if (temp) {

},
NewExpression(path, state) {
const {
node,
scope
} = path;
let args = node.arguments;
NewExpression: function NewExpression(path, state) {
var node = path.node,
scope = path.scope;
var args = node.arguments;
if (!hasSpread(args)) return;
const nodes = build(args, scope, state);
var nodes = build(args, scope, state);
const context = _core().types.arrayExpression([_core().types.nullLiteral()]);
var context = _core().types.arrayExpression([_core().types.nullLiteral()]);

@@ -172,3 +175,2 @@ args = _core().types.callExpression(_core().types.memberExpression(context, _core().types.identifier("concat")), nodes);

}
}

@@ -175,0 +177,0 @@ };

{
"name": "@babel/plugin-transform-spread",
"version": "7.0.0-beta.43",
"version": "7.0.0-beta.44",
"description": "Compile ES2015 spread to ES5",

@@ -12,11 +12,11 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-spread",

"dependencies": {
"@babel/helper-plugin-utils": "7.0.0-beta.43"
"@babel/helper-plugin-utils": "7.0.0-beta.44"
},
"peerDependencies": {
"@babel/core": "7.0.0-beta.43"
"@babel/core": "7.0.0-beta.44"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.43",
"@babel/helper-plugin-test-runner": "7.0.0-beta.43"
"@babel/core": "7.0.0-beta.44",
"@babel/helper-plugin-test-runner": "7.0.0-beta.44"
}
}
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