Socket
Socket
Sign inDemoInstall

@babel/helpers

Package Overview
Dependencies
Maintainers
4
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helpers - npm Package Compare versions

Comparing version 7.20.0 to 7.20.1

5

lib/helpers-generated.js

@@ -7,3 +7,2 @@ "use strict";

exports.default = void 0;
var _template = require("@babel/template");

@@ -19,3 +18,2 @@

}
var _default = Object.freeze({

@@ -33,7 +31,6 @@ AsyncGenerator: helper("7.0.0-beta.0", 'import OverloadYield from"OverloadYield";export default function AsyncGenerator(gen){var front,back;function resume(key,arg){try{var result=gen[key](arg),value=result.value,overloaded=value instanceof OverloadYield;Promise.resolve(overloaded?value.v:value).then((function(arg){if(overloaded){var nextKey="return"===key?"return":"next";if(!value.k||arg.done)return resume(nextKey,arg);arg=gen[nextKey](arg).value}settle(result.done?"return":"normal",arg)}),(function(err){resume("throw",err)}))}catch(err){settle("throw",err)}}function settle(type,value){switch(type){case"return":front.resolve({value:value,done:!0});break;case"throw":front.reject(value);break;default:front.resolve({value:value,done:!1})}(front=front.next)?resume(front.key,front.arg):back=null}this._invoke=function(key,arg){return new Promise((function(resolve,reject){var request={key:key,arg:arg,resolve:resolve,reject:reject,next:null};back?back=back.next=request:(front=back=request,resume(key,arg))}))},"function"!=typeof gen.return&&(this.return=void 0)}AsyncGenerator.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},AsyncGenerator.prototype.next=function(arg){return this._invoke("next",arg)},AsyncGenerator.prototype.throw=function(arg){return this._invoke("throw",arg)},AsyncGenerator.prototype.return=function(arg){return this._invoke("return",arg)};'),

typeof: helper("7.0.0-beta.0", 'export default function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}'),
wrapRegExp: helper("7.19.0", 'import setPrototypeOf from"setPrototypeOf";import inherits from"inherits";export default function _wrapRegExp(){_wrapRegExp=function(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);return result&&(result.groups=buildGroups(result,this)),result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\\$<([^>]+)>/g,(function(_,name){return"$"+groups[name]})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=typeof args[args.length-1]&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},_wrapRegExp.apply(this,arguments)}')
wrapRegExp: helper("7.19.0", 'import setPrototypeOf from"setPrototypeOf";import inherits from"inherits";export default function _wrapRegExp(){_wrapRegExp=function(re,groups){return new BabelRegExp(re,void 0,groups)};var _super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);return _groups.set(_this,groups||_groups.get(re)),setPrototypeOf(_this,BabelRegExp.prototype)}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){var i=g[name];if("number"==typeof i)groups[name]=result[i];else{for(var k=0;void 0===result[i[k]]&&k+1<i.length;)k++;groups[name]=result[i[k]]}return groups}),Object.create(null))}return inherits(BabelRegExp,RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result){result.groups=buildGroups(result,this);var indices=result.indices;indices&&(indices.groups=buildGroups(indices,this))}return result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\\$<([^>]+)>/g,(function(_,name){var group=groups[name];return"$"+(Array.isArray(group)?group.join("$"):group)})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=arguments;return"object"!=typeof args[args.length-1]&&(args=[].slice.call(args)).push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},_wrapRegExp.apply(this,arguments)}')
});
exports.default = _default;
//# sourceMappingURL=helpers-generated.js.map

15

lib/helpers.js

@@ -7,7 +7,4 @@ "use strict";

exports.default = void 0;
var _template = require("@babel/template");
var _helpersGenerated = require("./helpers-generated");
const helpers = Object.assign({

@@ -18,3 +15,2 @@ __proto__: null

exports.default = _default;
const helper = minVersion => tpl => ({

@@ -24,3 +20,2 @@ minVersion,

});
{

@@ -159,2 +154,3 @@ helpers.AwaitValue = helper("7.0.0-beta.0")`

`;
helpers.extends = helper("7.0.0-beta.0")`

@@ -177,2 +173,3 @@ export default function _extends() {

`;
helpers.objectSpread = helper("7.0.0-beta.0")`

@@ -227,2 +224,3 @@ import defineProperty from "defineProperty";

`;
helpers.getPrototypeOf = helper("7.0.0-beta.0")`

@@ -276,2 +274,3 @@ export default function _getPrototypeOf(o) {

`;
helpers.construct = helper("7.0.0-beta.0")`

@@ -307,2 +306,3 @@ import setPrototypeOf from "setPrototypeOf";

`;
helpers.wrapNativeSuper = helper("7.0.0-beta.0")`

@@ -476,2 +476,3 @@ import getPrototypeOf from "getPrototypeOf";

`;
helpers.createSuper = helper("7.9.0")`

@@ -510,2 +511,3 @@ import getPrototypeOf from "getPrototypeOf";

`;
helpers.get = helper("7.0.0-beta.0")`

@@ -928,2 +930,3 @@ import superPropBase from "superPropBase";

`;
helpers.initializerWarningHelper = helper("7.0.0-beta.0")`

@@ -937,2 +940,3 @@ export default function _initializerWarningHelper(descriptor, context){

`;
helpers.initializerDefineProperty = helper("7.0.0-beta.0")`

@@ -950,2 +954,3 @@ export default function _initializerDefineProperty(target, property, descriptor, context){

`;
helpers.applyDecoratedDescriptor = helper("7.0.0-beta.0")`

@@ -952,0 +957,0 @@ export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context){

@@ -15,6 +15,4 @@ "use strict";

if (metadataForKey === void 0) return void 0;
if (kind === 1) {
var pub = metadataForKey.public;
if (pub !== void 0) {

@@ -25,3 +23,2 @@ return pub[property];

var priv = metadataForKey.private;
if (priv !== void 0) {

@@ -38,22 +35,16 @@ return priv.get(property);

var metadataForKey = metadataMap[key];
if (metadataForKey === void 0) {
metadataForKey = metadataMap[key] = {};
}
if (kind === 1) {
var pub = metadataForKey.public;
if (pub === void 0) {
pub = metadataForKey.public = {};
}
pub[property] = value;
} else if (kind === 2) {
var priv = metadataForKey.priv;
if (priv === void 0) {
priv = metadataForKey.private = new Map();
}
priv.set(property, value);

@@ -66,3 +57,2 @@ } else {

}
function old_convertMetadataMapToFinal(obj, metadataMap) {

@@ -72,3 +62,2 @@ var parentMetadataMap = obj[Symbol.metadata || Symbol.for("Symbol.metadata")];

if (metadataKeys.length === 0) return;
for (var i = 0; i < metadataKeys.length; i++) {

@@ -80,20 +69,14 @@ var key = metadataKeys[i];

var parentPub = parentMetaForKey ? parentMetaForKey.public : null;
if (pub && parentPub) {
Object.setPrototypeOf(pub, parentPub);
}
var priv = metaForKey.private;
if (priv) {
var privArr = Array.from(priv.values());
var parentPriv = parentMetaForKey ? parentMetaForKey.private : null;
if (parentPriv) {
privArr = privArr.concat(parentPriv);
}
metaForKey.private = privArr;
}
if (parentMetaForKey) {

@@ -103,10 +86,7 @@ Object.setPrototypeOf(metaForKey, parentMetaForKey);

}
if (parentMetadataMap) {
Object.setPrototypeOf(metadataMap, parentMetadataMap);
}
obj[Symbol.metadata || Symbol.for("Symbol.metadata")] = metadataMap;
}
function old_createAddInitializerMethod(initializers, decoratorFinishedRef) {

@@ -119,6 +99,4 @@ return function addInitializer(initializer) {

}
function old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value) {
var kindStr;
switch (kind) {

@@ -128,19 +106,14 @@ case 1:

break;
case 2:
kindStr = "method";
break;
case 3:
kindStr = "getter";
break;
case 4:
kindStr = "setter";
break;
default:
kindStr = "field";
}
var ctx = {

@@ -155,9 +128,6 @@ kind: kindStr,

};
if (kind !== 0) {
ctx.addInitializer = old_createAddInitializerMethod(initializers, decoratorFinishedRef);
}
var metadataKind, metadataName;
if (isPrivate) {

@@ -167,3 +137,2 @@ metadataKind = 2;

var access = {};
if (kind === 0) {

@@ -182,3 +151,2 @@ access.get = desc.get;

}
if (kind === 1 || kind === 4) {

@@ -190,3 +158,2 @@ access.set = function (v) {

}
ctx.access = access;

@@ -197,3 +164,2 @@ } else {

}
try {

@@ -205,3 +171,2 @@ return dec(value, Object.assign(ctx, old_createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName, decoratorFinishedRef)));

}
function old_assertNotFinished(decoratorFinishedRef, fnName) {

@@ -212,3 +177,2 @@ if (decoratorFinishedRef.v) {

}
function old_assertMetadataKey(key) {

@@ -219,3 +183,2 @@ if (typeof key !== "symbol") {

}
function old_assertCallable(fn, hint) {

@@ -226,6 +189,4 @@ if (typeof fn !== "function") {

}
function old_assertValidReturnValue(kind, value) {
var type = typeof value;
if (kind === 1) {

@@ -235,15 +196,11 @@ if (type !== "object" || value === null) {

}
if (value.get !== undefined) {
old_assertCallable(value.get, "accessor.get");
}
if (value.set !== undefined) {
old_assertCallable(value.set, "accessor.set");
}
if (value.init !== undefined) {
old_assertCallable(value.init, "accessor.init");
}
if (value.initializer !== undefined) {

@@ -254,3 +211,2 @@ old_assertCallable(value.initializer, "accessor.initializer");

var hint;
if (kind === 0) {

@@ -263,21 +219,15 @@ hint = "field";

}
throw new TypeError(hint + " decorators must return a function or void 0");
}
}
function old_getInit(desc) {
var initializer;
if ((initializer = desc.init) == null && (initializer = desc.initializer) && typeof console !== "undefined") {
console.warn(".initializer has been renamed to .init as of March 2022");
}
return initializer;
}
function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) {
var decs = decInfo[0];
var desc, initializer, value;
if (isPrivate) {

@@ -305,3 +255,2 @@ if (kind === 0 || kind === 1) {

}
if (kind === 1) {

@@ -319,11 +268,7 @@ value = {

}
var newValue, get, set;
if (typeof decs === "function") {
newValue = old_memberDec(decs, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value);
if (newValue !== void 0) {
old_assertValidReturnValue(kind, newValue);
if (kind === 0) {

@@ -347,7 +292,5 @@ initializer = newValue;

newValue = old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value);
if (newValue !== void 0) {
old_assertValidReturnValue(kind, newValue);
var newInit;
if (kind === 0) {

@@ -366,3 +309,2 @@ newInit = newValue;

}
if (newInit !== void 0) {

@@ -380,3 +322,2 @@ if (initializer === void 0) {

}
if (kind === 0 || kind === 1) {

@@ -389,10 +330,7 @@ if (initializer === void 0) {

var ownInitializers = initializer;
initializer = function (instance, init) {
var value = init;
for (var i = 0; i < ownInitializers.length; i++) {
value = ownInitializers[i].call(instance, value);
}
return value;

@@ -402,3 +340,2 @@ };

var originalInitializer = initializer;
initializer = function (instance, init) {

@@ -408,6 +345,4 @@ return originalInitializer.call(instance, init);

}
ret.push(initializer);
}
if (kind !== 0) {

@@ -424,3 +359,2 @@ if (kind === 1) {

}
if (isPrivate) {

@@ -446,3 +380,2 @@ if (kind === 1) {

}
function old_applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) {

@@ -453,5 +386,5 @@ var protoInitializers;

var existingStaticNonFields = new Map();
for (var i = 0; i < decInfos.length; i++) {
var decInfo = decInfos[i];
if (!Array.isArray(decInfo)) continue;

@@ -465,3 +398,2 @@ var kind = decInfo[1];

var initializers;
if (isStatic) {

@@ -471,3 +403,2 @@ base = Class;

kind = kind - 5;
if (kind !== 0) {

@@ -480,3 +411,2 @@ staticInitializers = staticInitializers || [];

metadataMap = protoMetadataMap;
if (kind !== 0) {

@@ -487,7 +417,5 @@ protoInitializers = protoInitializers || [];

}
if (kind !== 0 && !isPrivate) {
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
var existingKind = existingNonFields.get(name) || 0;
if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {

@@ -501,10 +429,7 @@ throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);

}
old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers);
}
old_pushInitializers(ret, protoInitializers);
old_pushInitializers(ret, staticInitializers);
}
function old_pushInitializers(ret, initializers) {

@@ -516,3 +441,2 @@ if (initializers) {

}
return instance;

@@ -522,3 +446,2 @@ });

}
function old_applyClassDecs(ret, targetClass, metadataMap, classDecs) {

@@ -529,3 +452,2 @@ if (classDecs.length > 0) {

var name = targetClass.name;
for (var i = classDecs.length - 1; i >= 0; i--) {

@@ -535,3 +457,2 @@ var decoratorFinishedRef = {

};
try {

@@ -547,3 +468,2 @@ var ctx = Object.assign({

}
if (nextNewClass !== undefined) {

@@ -554,3 +474,2 @@ old_assertValidReturnValue(10, nextNewClass);

}
ret.push(newClass, function () {

@@ -557,0 +476,0 @@ for (var i = 0; i < initializers.length; i++) {

@@ -15,6 +15,4 @@ "use strict";

}
function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value) {
var kindStr;
switch (kind) {

@@ -24,19 +22,14 @@ case 1:

break;
case 2:
kindStr = "method";
break;
case 3:
kindStr = "getter";
break;
case 4:
kindStr = "setter";
break;
default:
kindStr = "field";
}
var ctx = {

@@ -51,9 +44,6 @@ kind: kindStr,

};
if (kind !== 0) {
ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
}
var get, set;
if (kind === 0) {

@@ -67,3 +57,2 @@ if (isPrivate) {

};
set = function (v) {

@@ -83,3 +72,2 @@ this[name] = v;

}
if (kind === 1 || kind === 4) {

@@ -91,3 +79,2 @@ set = function (v) {

}
ctx.access = get && set ? {

@@ -101,3 +88,2 @@ get: get,

};
try {

@@ -109,3 +95,2 @@ return dec(value, ctx);

}
function assertNotFinished(decoratorFinishedRef, fnName) {

@@ -116,3 +101,2 @@ if (decoratorFinishedRef.v) {

}
function assertCallable(fn, hint) {

@@ -123,6 +107,4 @@ if (typeof fn !== "function") {

}
function assertValidReturnValue(kind, value) {
var type = typeof value;
if (kind === 1) {

@@ -132,11 +114,8 @@ if (type !== "object" || value === null) {

}
if (value.get !== undefined) {
assertCallable(value.get, "accessor.get");
}
if (value.set !== undefined) {
assertCallable(value.set, "accessor.set");
}
if (value.init !== undefined) {

@@ -147,3 +126,2 @@ assertCallable(value.init, "accessor.init");

var hint;
if (kind === 0) {

@@ -156,11 +134,8 @@ hint = "field";

}
throw new TypeError(hint + " decorators must return a function or void 0");
}
}
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers) {
var decs = decInfo[0];
var desc, init, value;
if (isPrivate) {

@@ -188,3 +163,2 @@ if (kind === 0 || kind === 1) {

}
if (kind === 1) {

@@ -202,11 +176,7 @@ value = {

}
var newValue, get, set;
if (typeof decs === "function") {
newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, value);
if (newValue !== void 0) {
assertValidReturnValue(kind, newValue);
if (kind === 0) {

@@ -230,7 +200,5 @@ init = newValue;

newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value);
if (newValue !== void 0) {
assertValidReturnValue(kind, newValue);
var newInit;
if (kind === 0) {

@@ -249,3 +217,2 @@ newInit = newValue;

}
if (newInit !== void 0) {

@@ -263,3 +230,2 @@ if (init === void 0) {

}
if (kind === 0 || kind === 1) {

@@ -272,10 +238,7 @@ if (init === void 0) {

var ownInitializers = init;
init = function (instance, init) {
var value = init;
for (var i = 0; i < ownInitializers.length; i++) {
value = ownInitializers[i].call(instance, value);
}
return value;

@@ -285,3 +248,2 @@ };

var originalInitializer = init;
init = function (instance, init) {

@@ -291,6 +253,4 @@ return originalInitializer.call(instance, init);

}
ret.push(init);
}
if (kind !== 0) {

@@ -307,3 +267,2 @@ if (kind === 1) {

}
if (isPrivate) {

@@ -329,3 +288,2 @@ if (kind === 1) {

}
function applyMemberDecs(ret, Class, decInfos) {

@@ -336,5 +294,5 @@ var protoInitializers;

var existingStaticNonFields = new Map();
for (var i = 0; i < decInfos.length; i++) {
var decInfo = decInfos[i];
if (!Array.isArray(decInfo)) continue;

@@ -347,7 +305,5 @@ var kind = decInfo[1];

var initializers;
if (isStatic) {
base = Class;
kind = kind - 5;
if (kind !== 0) {

@@ -359,3 +315,2 @@ staticInitializers = staticInitializers || [];

base = Class.prototype;
if (kind !== 0) {

@@ -366,7 +321,5 @@ protoInitializers = protoInitializers || [];

}
if (kind !== 0 && !isPrivate) {
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
var existingKind = existingNonFields.get(name) || 0;
if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {

@@ -380,10 +333,7 @@ throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);

}
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers);
}
pushInitializers(ret, protoInitializers);
pushInitializers(ret, staticInitializers);
}
function pushInitializers(ret, initializers) {

@@ -395,3 +345,2 @@ if (initializers) {

}
return instance;

@@ -401,3 +350,2 @@ });

}
function applyClassDecs(ret, targetClass, classDecs) {

@@ -408,3 +356,2 @@ if (classDecs.length > 0) {

var name = targetClass.name;
for (var i = classDecs.length - 1; i >= 0; i--) {

@@ -414,3 +361,2 @@ var decoratorFinishedRef = {

};
try {

@@ -425,3 +371,2 @@ var nextNewClass = classDecs[i](newClass, {

}
if (nextNewClass !== undefined) {

@@ -432,3 +377,2 @@ assertValidReturnValue(10, nextNewClass);

}
ret.push(newClass, function () {

@@ -435,0 +379,0 @@ for (var i = 0; i < initializers.length; i++) {

@@ -7,3 +7,2 @@ "use strict";

exports.default = AsyncGenerator;
var _OverloadYield = require("OverloadYield");

@@ -13,3 +12,2 @@

var front, back;
function send(key, arg) {

@@ -24,3 +22,2 @@ return new Promise(function (resolve, reject) {

};
if (back) {

@@ -34,3 +31,2 @@ back = back.next = request;

}
function resume(key, arg) {

@@ -44,3 +40,2 @@ try {

var nextKey = key === "return" ? "return" : "next";
if (!value.k || arg.done) {

@@ -52,3 +47,2 @@ return resume(nextKey, arg);

}
settle(result.done ? "return" : "normal", arg);

@@ -62,3 +56,2 @@ }, function (err) {

}
function settle(type, value) {

@@ -72,7 +65,5 @@ switch (type) {

break;
case "throw":
front.reject(value);
break;
default:

@@ -85,5 +76,3 @@ front.resolve({

}
front = front.next;
if (front) {

@@ -95,3 +84,2 @@ resume(front.key, front.arg);

}
this._invoke = send;

@@ -103,15 +91,11 @@

}
AsyncGenerator.prototype[typeof Symbol === "function" && Symbol.asyncIterator || "@@asyncIterator"] = function () {
return this;
};
AsyncGenerator.prototype.next = function (arg) {
return this._invoke("next", arg);
};
AsyncGenerator.prototype.throw = function (arg) {
return this._invoke("throw", arg);
};
AsyncGenerator.prototype.return = function (arg) {

@@ -118,0 +102,0 @@ return this._invoke("return", arg);

@@ -7,3 +7,2 @@ "use strict";

exports.default = _asyncGeneratorDelegate;
var _OverloadYield = require("OverloadYield");

@@ -13,4 +12,3 @@

var iter = {},
waiting = false;
waiting = false;
function pump(key, value) {

@@ -26,7 +24,5 @@ waiting = true;

}
iter[typeof Symbol !== "undefined" && Symbol.iterator || "@@iterator"] = function () {
return this;
};
iter.next = function (value) {

@@ -37,6 +33,4 @@ if (waiting) {

}
return pump("next", value);
};
if (typeof inner.throw === "function") {

@@ -48,7 +42,5 @@ iter.throw = function (value) {

}
return pump("throw", value);
};
}
if (typeof inner.return === "function") {

@@ -60,7 +52,5 @@ iter.return = function (value) {

}
return pump("return", value);
};
}
return iter;

@@ -67,0 +57,0 @@ }

@@ -10,6 +10,5 @@ "use strict";

var method,
async,
sync,
retry = 2;
async,
sync,
retry = 2;
if (typeof Symbol !== "undefined") {

@@ -19,3 +18,2 @@ async = Symbol.asyncIterator;

}
while (retry--) {

@@ -25,14 +23,10 @@ if (async && (method = iterable[async]) != null) {

}
if (sync && (method = iterable[sync]) != null) {
return new AsyncFromSyncIterator(method.call(iterable));
}
async = "@@asyncIterator";
sync = "@@iterator";
}
throw new TypeError("Object is not async iterable");
}
function AsyncFromSyncIterator(s) {

@@ -43,3 +37,2 @@ AsyncFromSyncIterator = function (s) {

};
AsyncFromSyncIterator.prototype = {

@@ -53,3 +46,2 @@ s: null,

var ret = this.s.return;
if (ret === undefined) {

@@ -61,3 +53,2 @@ return Promise.resolve({

}
return AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));

@@ -71,3 +62,2 @@ },

};
function AsyncFromSyncIteratorContinuation(r) {

@@ -77,3 +67,2 @@ if (Object(r) !== r) {

}
var done = r.done;

@@ -87,3 +76,2 @@ return Promise.resolve(r.value).then(function (value) {

}
return new AsyncFromSyncIterator(s);

@@ -90,0 +78,0 @@ }

@@ -7,3 +7,2 @@ "use strict";

exports.default = _awaitAsyncGenerator;
var _OverloadYield = require("OverloadYield");

@@ -10,0 +9,0 @@

@@ -7,12 +7,11 @@ "use strict";

exports.default = _createRawReactElement;
var REACT_ELEMENT_TYPE;
function _createRawReactElement(type, props, key, children) {
if (!REACT_ELEMENT_TYPE) {
REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7;
REACT_ELEMENT_TYPE = typeof Symbol === "function" &&
Symbol["for"] && Symbol["for"]("react.element") || 0xeac7;
}
var defaultProps = type && type.defaultProps;
var childrenLength = arguments.length - 3;
if (!props && childrenLength !== 0) {

@@ -23,3 +22,2 @@ props = {

}
if (childrenLength === 1) {

@@ -29,10 +27,7 @@ props.children = children;

var childArray = new Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 3];
}
props.children = childArray;
}
if (props && defaultProps) {

@@ -47,3 +42,2 @@ for (var propName in defaultProps) {

}
return {

@@ -50,0 +44,0 @@ $$typeof: REACT_ELEMENT_TYPE,

@@ -7,3 +7,2 @@ "use strict";

exports.default = _objectSpread2;
var _defineProperty = require("defineProperty");

@@ -13,6 +12,4 @@

var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {

@@ -23,13 +20,9 @@ symbols = symbols.filter(function (sym) {

}
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {

@@ -47,3 +40,2 @@ ownKeys(Object(source), true).forEach(function (key) {

}
return target;

@@ -50,0 +42,0 @@ }

@@ -14,11 +14,8 @@ "use strict";

};
var _exports = {};
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
var defineProperty = Object.defineProperty || function (obj, key, desc) {
obj[key] = desc.value;
};
var undefined;

@@ -29,3 +26,2 @@ var $Symbol = typeof Symbol === "function" ? Symbol : {};

var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {

@@ -40,3 +36,2 @@ Object.defineProperty(obj, key, {

}
try {

@@ -49,3 +44,2 @@ define({}, "");

}
function wrap(innerFn, outerFn, self, tryLocsList) {

@@ -55,2 +49,3 @@ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;

var context = new Context(tryLocsList || []);
defineProperty(generator, "_invoke", {

@@ -61,3 +56,2 @@ value: makeInvokeMethod(innerFn, self, context)

}
_exports.wrap = wrap;

@@ -78,3 +72,2 @@

}
var GenStateSuspendedStart = "suspendedStart";

@@ -84,8 +77,7 @@ var GenStateSuspendedYield = "suspendedYield";

var GenStateCompleted = "completed";
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}

@@ -99,7 +91,5 @@

var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
IteratorPrototype = NativeIteratorPrototype;
}
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);

@@ -124,8 +114,7 @@ GeneratorFunction.prototype = GeneratorFunctionPrototype;

}
_exports.isGeneratorFunction = function (genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
return ctor ? ctor === GeneratorFunction ||
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
};
_exports.mark = function (genFun) {

@@ -138,3 +127,2 @@ if (Object.setPrototypeOf) {

}
genFun.prototype = Object.create(Gp);

@@ -149,7 +137,5 @@ return genFun;

};
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {

@@ -160,3 +146,2 @@ reject(record.arg);

var value = result.value;
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {

@@ -169,3 +154,2 @@ return PromiseImpl.resolve(value.__await).then(function (value) {

}
return PromiseImpl.resolve(value).then(function (unwrapped) {

@@ -179,5 +163,3 @@ result.value = unwrapped;

}
var previousPromise;
function enqueue(method, arg) {

@@ -189,4 +171,5 @@ function callInvokeWithMethodAndArg() {

}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
return previousPromise =
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
}

@@ -198,3 +181,2 @@

}
defineIteratorMethods(AsyncIterator.prototype);

@@ -213,3 +195,2 @@ define(AsyncIterator.prototype, asyncIteratorSymbol, function () {

};
function makeInvokeMethod(innerFn, self, context) {

@@ -221,3 +202,2 @@ var state = GenStateSuspendedStart;

}
if (state === GenStateCompleted) {

@@ -230,12 +210,8 @@ if (method === "throw") {

}
context.method = method;
context.arg = arg;
while (true) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {

@@ -246,3 +222,2 @@ if (delegateResult === ContinueSentinel) continue;

}
if (context.method === "next") {

@@ -255,3 +230,2 @@ context.sent = context._sent = context.arg;

}
context.dispatchException(context.arg);

@@ -261,13 +235,9 @@ } else if (context.method === "return") {

}
state = GenStateExecuting;
var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
if (record.arg === ContinueSentinel) {
continue;
}
return {

@@ -288,6 +258,4 @@ value: record.arg,

var method = delegate.iterator[context.method];
if (method === undefined) {
context.delegate = null;
if (context.method === "throw") {

@@ -298,3 +266,2 @@ if (delegate.iterator["return"]) {

maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {

@@ -304,12 +271,8 @@ return ContinueSentinel;

}
context.method = "throw";
context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if (record.type === "throw") {

@@ -321,5 +284,3 @@ context.method = "throw";

}
var info = record.arg;
if (!info) {

@@ -331,5 +292,5 @@ context.method = "throw";

}
if (info.done) {
context[delegate.resultName] = info.value;
context.next = delegate.nextLoc;

@@ -351,2 +312,3 @@

define(Gp, toStringTagSymbol, "Generator");
define(Gp, iteratorSymbol, function () {

@@ -358,3 +320,2 @@ return this;

});
function pushTryEntry(locs) {

@@ -364,7 +325,5 @@ var entry = {

};
if (1 in locs) {
entry.catchLoc = locs[1];
}
if (2 in locs) {

@@ -374,6 +333,4 @@ entry.finallyLoc = locs[2];

}
this.tryEntries.push(entry);
}
function resetTryEntry(entry) {

@@ -385,3 +342,2 @@ var record = entry.completion || {};

}
function Context(tryLocsList) {

@@ -394,16 +350,13 @@ this.tryEntries = [{

}
_exports.keys = function (val) {
var object = Object(val);
var keys = [];
for (var key in object) {
keys.push(key);
}
keys.reverse();
keys.reverse();
return function next() {
while (keys.length) {
var key = keys.pop();
if (key in object) {

@@ -420,31 +373,25 @@ next.value = key;

};
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
}
if (typeof iterable.next === "function") {
return iterable;
}
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
while (++i < iterable.length) {
if (hasOwn.call(iterable, i)) {
next.value = iterable[i];
next.done = false;
return next;
next = function next() {
while (++i < iterable.length) {
if (hasOwn.call(iterable, i)) {
next.value = iterable[i];
next.done = false;
return next;
}
}
}
next.value = undefined;
next.done = true;
return next;
};
next.value = undefined;
next.done = true;
return next;
};
return next.next = next;

@@ -458,5 +405,3 @@ }

}
_exports.values = values;
function doneResult() {

@@ -468,3 +413,2 @@ return {

}
Context.prototype = {

@@ -481,3 +425,2 @@ constructor: Context,

this.tryEntries.forEach(resetTryEntry);
if (!skipTempReset) {

@@ -495,7 +438,5 @@ for (var name in this) {

var rootRecord = rootEntry.completion;
if (rootRecord.type === "throw") {
throw rootRecord.arg;
}
return this.rval;

@@ -507,5 +448,3 @@ },

}
var context = this;
function handle(loc, caught) {

@@ -515,3 +454,2 @@ record.type = "throw";

context.next = loc;
if (caught) {

@@ -521,18 +459,13 @@ context.method = "next";

}
return !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
var record = entry.completion;
if (entry.tryLoc === "root") {
return handle("end");
}
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc");
var hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {

@@ -561,3 +494,2 @@ if (this.prev < entry.catchLoc) {

var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {

@@ -568,11 +500,8 @@ var finallyEntry = entry;

}
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
finallyEntry = null;
}
var record = finallyEntry ? finallyEntry.completion : {};
record.type = type;
record.arg = arg;
if (finallyEntry) {

@@ -583,3 +512,2 @@ this.method = "next";

}
return this.complete(record);

@@ -591,3 +519,2 @@ },

}
if (record.type === "break" || record.type === "continue") {

@@ -602,3 +529,2 @@ this.next = record.arg;

}
return ContinueSentinel;

@@ -609,3 +535,2 @@ },

var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) {

@@ -621,6 +546,4 @@ this.complete(entry.completion, entry.afterLoc);

var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if (record.type === "throw") {

@@ -630,3 +553,2 @@ var thrown = record.arg;

}
return thrown;

@@ -644,10 +566,9 @@ }

};
if (this.method === "next") {
this.arg = undefined;
}
return ContinueSentinel;
}
};
return _exports;

@@ -654,0 +575,0 @@ }

@@ -20,3 +20,2 @@ "use strict";

}
return _typeof(obj);

@@ -23,0 +22,0 @@ }

@@ -7,5 +7,3 @@ "use strict";

exports.default = _wrapRegExp;
var _setPrototypeOf = require("setPrototypeOf");
var _inherits = require("inherits");

@@ -17,37 +15,30 @@

};
var _super = RegExp.prototype;
var _groups = new WeakMap();
function BabelRegExp(re, flags, groups) {
var _this = new RegExp(re, flags);
_groups.set(_this, groups || _groups.get(re));
return _setPrototypeOf(_this, BabelRegExp.prototype);
}
_inherits(BabelRegExp, RegExp);
BabelRegExp.prototype.exec = function (str) {
var result = _super.exec.call(this, str);
if (result) result.groups = buildGroups(result, this);
if (result) {
result.groups = buildGroups(result, this);
var indices = result.indices;
if (indices) indices.groups = buildGroups(indices, this);
}
return result;
};
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
if (typeof substitution === "string") {
var groups = _groups.get(this);
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
return "$" + groups[name];
var group = groups[name];
return "$" + (Array.isArray(group) ? group.join("$") : group);
}));
} else if (typeof substitution === "function") {
var _this = this;
return _super[Symbol.replace].call(this, str, function () {
var args = arguments;
if (typeof args[args.length - 1] !== "object") {

@@ -57,3 +48,2 @@ args = [].slice.call(args);

}
return substitution.apply(this, args);

@@ -65,6 +55,5 @@ });

};
function buildGroups(result, re) {
function buildGroups(result, re) {
var g = _groups.get(re);
return Object.keys(g).reduce(function (groups, name) {

@@ -74,5 +63,3 @@ var i = g[name];

var k = 0;
while (result[i[k]] === undefined && k + 1 < i.length) k++;
groups[name] = result[i[k]];

@@ -83,3 +70,2 @@ }

}
return _wrapRegExp.apply(this, arguments);

@@ -86,0 +72,0 @@ }

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

exports.minVersion = minVersion;
var _traverse = require("@babel/traverse");
var _t = require("@babel/types");
var _helpers = require("./helpers");
const {

@@ -27,6 +23,4 @@ assignmentExpression,

} = _t;
function makePath(path) {
const parts = [];
for (; path.parentPath; path = path.parentPath) {

@@ -36,8 +30,5 @@ parts.push(path.key);

}
return parts.reverse().join(".");
}
let FileClass = undefined;
function getHelperMetadata(file) {

@@ -55,11 +46,9 @@ const globals = new Set();

const name = child.node.source.value;
if (!_helpers.default[name]) {
throw child.buildCodeFrameError(`Unknown helper ${name}`);
}
if (child.get("specifiers").length !== 1 || !child.get("specifiers.0").isImportDefaultSpecifier()) {
if (child.get("specifiers").length !== 1 ||
!child.get("specifiers.0").isImportDefaultSpecifier()) {
throw child.buildCodeFrameError("Helpers can only import a default value");
}
const bindingIdentifier = child.node.specifiers[0].local;

@@ -69,22 +58,16 @@ dependencies.set(bindingIdentifier, name);

},
ExportDefaultDeclaration(child) {
const decl = child.get("declaration");
if (!decl.isFunctionDeclaration() || !decl.node.id) {
throw decl.buildCodeFrameError("Helpers can only export named function declarations");
}
exportName = decl.node.id.name;
exportPath = makePath(child);
},
ExportAllDeclaration(child) {
throw child.buildCodeFrameError("Helpers can only export default");
},
ExportNamedDeclaration(child) {
throw child.buildCodeFrameError("Helpers can only export default");
},
Statement(child) {

@@ -94,3 +77,2 @@ if (child.isModuleDeclaration()) return;

}
};

@@ -106,7 +88,5 @@ const referenceVisitor = {

},
ReferencedIdentifier(child) {
const name = child.node.name;
const binding = child.scope.getBinding(name);
if (!binding) {

@@ -118,13 +98,9 @@ globals.add(name);

},
AssignmentExpression(child) {
const left = child.get("left");
if (!(exportName in left.getBindingIdentifiers())) return;
if (!left.isIdentifier()) {
throw left.buildCodeFrameError("Only simple assignments to exports are allowed in helpers");
}
const binding = child.scope.getBinding(exportName);
if (binding != null && binding.scope.path.isProgram()) {

@@ -134,3 +110,2 @@ exportBindingAssignments.push(makePath(child));

}
};

@@ -140,2 +115,3 @@ (0, _traverse.default)(file.ast, dependencyVisitor, file.scope);

if (!exportPath) throw new Error("Helpers must have a default export.");
exportBindingAssignments.reverse();

@@ -153,3 +129,2 @@ return {

}
function permuteHelperAST(file, metadata, id, localBindings, getDependency) {

@@ -159,3 +134,2 @@ if (localBindings && !id) {

}
if (!id) return;

@@ -179,20 +153,17 @@ const {

let newName = name;
while (bindings.has(newName)) newName = "_" + newName;
if (newName !== name) toRename[name] = newName;
});
if (id.type === "Identifier" && exportName !== id.name) {
toRename[exportName] = id.name;
}
const {
path
} = file;
const exp = path.get(exportPath);
const imps = importPaths.map(p => path.get(p));
const impsBindingRefs = importBindingsReferences.map(p => path.get(p));
const decl = exp.get("declaration");
if (id.type === "Identifier") {

@@ -210,9 +181,6 @@ exp.replaceWith(decl);

}
Object.keys(toRename).forEach(name => {
path.scope.rename(name, toRename[name]);
});
for (const path of imps) path.remove();
for (const path of impsBindingRefs) {

@@ -223,9 +191,6 @@ const node = cloneNode(dependenciesRefs[path.node.name]);

}
const helperData = Object.create(null);
function loadHelper(name) {
if (!helperData[name]) {
const helper = _helpers.default[name];
if (!helper) {

@@ -237,3 +202,2 @@ throw Object.assign(new ReferenceError(`Unknown helper ${name}`), {

}
const fn = () => {

@@ -264,3 +228,2 @@ {

minVersion: helper.minVersion,
build(getDependency, id, localBindings) {

@@ -275,3 +238,2 @@ const file = fn();

},
getDependencies() {

@@ -281,21 +243,15 @@ metadata || (metadata = getHelperMetadata(fn()));

}
};
}
return helperData[name];
}
function get(name, getDependency, id, localBindings) {
return loadHelper(name).build(getDependency, id, localBindings);
}
function minVersion(name) {
return loadHelper(name).minVersion;
}
function getDependencies(name) {
return loadHelper(name).getDependencies();
}
function ensure(name, newFileClass) {

@@ -305,3 +261,2 @@ FileClass || (FileClass = newFileClass);

}
const list = Object.keys(_helpers.default).map(name => name.replace(/^_/, ""));

@@ -308,0 +263,0 @@ exports.list = list;

{
"name": "@babel/helpers",
"version": "7.20.0",
"version": "7.20.1",
"description": "Collection of helper functions used by Babel transforms.",

@@ -19,9 +19,9 @@ "author": "The Babel Team (https://babel.dev/team)",

"@babel/template": "^7.18.10",
"@babel/traverse": "^7.20.0",
"@babel/traverse": "^7.20.1",
"@babel/types": "^7.20.0"
},
"devDependencies": {
"@babel/generator": "^7.20.0",
"@babel/generator": "^7.20.1",
"@babel/helper-plugin-test-runner": "^7.18.6",
"@babel/parser": "^7.20.0",
"@babel/parser": "^7.20.1",
"regenerator-runtime": "^0.13.10",

@@ -28,0 +28,0 @@ "terser": "^5.9.0"

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

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

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

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

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