MCPcopy
hub / github.com/vercel/next.js / CatchClause

Function CatchClause

packages/next/src/compiled/babel-packages/packages-bundle.js:261–261  ·  view source on GitHub ↗
({node:e,scope:r})

Source from the content-addressed store, hash-verified

259 `;o._compact=true}var i=r["default"]=(0,a.declare)(((e,r)=>{var t;e.assertVersion(7);const a=(t=e.assumption("setComputedProperties"))!=null?t:r.loose;const n=a?pushComputedPropsLoose:pushComputedPropsSpec;function buildDefineAccessor(e,r,t){const a=t.kind;const n=!t.computed&&s.types.isIdentifier(t.key)?s.types.stringLiteral(t.key.name):t.key;const i=getValue(t);{let t;if(e.availableHelper("defineAccessor")){t=e.addHelper("defineAccessor")}else{const r=e.file;t=r.get("fallbackDefineAccessorHelper");if(!t){const e=r.scope.generateUidIdentifier("defineAccessor");r.scope.push({id:e,init:o});r.set("fallbackDefineAccessorHelper",t=e)}t=s.types.cloneNode(t)}return s.types.callExpression(t,[s.types.stringLiteral(a),r,n,i])}}function getValue(e){if(s.types.isObjectProperty(e)){return e.value}else if(s.types.isObjectMethod(e)){return s.types.functionExpression(null,e.params,e.body,e.generator,e.async)}}function pushAssign(e,r,t){t.push(s.types.expressionStatement(s.types.assignmentExpression("=",s.types.memberExpression(s.types.cloneNode(e),r.key,r.computed||s.types.isLiteral(r.key)),getValue(r))))}function pushComputedPropsLoose(e){const{computedProps:r,state:t,initPropExpression:a,objId:n,body:o}=e;for(const e of r){if(s.types.isObjectMethod(e)&&(e.kind==="get"||e.kind==="set")){if(r.length===1){return buildDefineAccessor(t,a,e)}else{o.push(s.types.expressionStatement(buildDefineAccessor(t,s.types.cloneNode(n),e)))}}else{pushAssign(s.types.cloneNode(n),e,o)}}}function pushComputedPropsSpec(e){const{objId:r,body:t,computedProps:a,state:n}=e;const o=10;let i=null;const l=[];for(const e of a){if(!i||i.length===o){i=[];l.push(i)}i.push(e)}for(const a of l){const o=l.length===1;let i=o?e.initPropExpression:s.types.cloneNode(r);for(const r of a){if(s.types.isObjectMethod(r)&&(r.kind==="get"||r.kind==="set")){i=buildDefineAccessor(e.state,i,r)}else{i=s.types.callExpression(n.addHelper("defineProperty"),[i,s.types.toComputedKey(r),getValue(r)])}}if(o)return i;t.push(s.types.expressionStatement(i))}}return{name:"transform-computed-properties",visitor:{ObjectExpression:{exit(e,r){const{node:t,parent:o,scope:i}=e;let l=false;for(const e of t.properties){l=e.computed===true;if(l)break}if(!l)return;const c=[];const d=[];let u=false;for(const e of t.properties){if(s.types.isSpreadElement(e)){continue}if(e.computed){u=true}if(u){d.push(e)}else{c.push(e)}}const p=i.generateUidIdentifierBasedOnNode(o);const f=s.types.objectExpression(c);const y=[];y.push(s.types.variableDeclaration("var",[s.types.variableDeclarator(p,f)]));const g=n({scope:i,objId:p,body:y,computedProps:d,initPropExpression:f,state:r});if(g){e.replaceWith(g)}else{if(a){y.push(s.types.expressionStatement(s.types.cloneNode(p)))}e.replaceWithMultiple(y)}}}}}}))},2610:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});var s=t(9045);var a=t(8304);function isPureVoid(e){return a.types.isUnaryExpression(e)&&e.operator==="void"&&a.types.isPureish(e.argument)}function unshiftForXStatementBody(e,r){e.ensureBlock();const{scope:t,node:s}=e;const n=e.get("body").scope.bindings;const o=Object.keys(n).some((e=>t.hasBinding(e)));if(o){s.body=a.types.blockStatement([...r,s.body])}else{s.body.body.unshift(...r)}}function hasArrayRest(e){return e.elements.some((e=>a.types.isRestElement(e)))}function hasObjectRest(e){return e.properties.some((e=>a.types.isRestElement(e)))}const n={};const arrayUnpackVisitor=(e,r,t)=>{if(!r.length){return}if(a.types.isIdentifier(e)&&a.types.isReferenced(e,r[r.length-1].node)&&t.bindings[e.name]){t.deopt=true;throw n}};class DestructuringTransformer{constructor(e){this.blockHoist=void 0;this.operator=void 0;this.arrayRefSet=void 0;this.nodes=void 0;this.scope=void 0;this.kind=void 0;this.iterableIsArray=void 0;this.arrayLikeIsIterable=void 0;this.objectRestNoSymbols=void 0;this.useBuiltIns=void 0;this.addHelper=void 0;this.blockHoist=e.blockHoist;this.operator=e.operator;this.arrayRefSet=new Set;this.nodes=e.nodes||[];this.scope=e.scope;this.kind=e.kind;this.iterableIsArray=e.iterableIsArray;this.arrayLikeIsIterable=e.arrayLikeIsIterable;this.objectRestNoSymbols=e.objectRestNoSymbols;this.useBuiltIns=e.useBuiltIns;this.addHelper=e.addHelper}getExtendsHelper(){return this.useBuiltIns?a.types.memberExpression(a.types.identifier("Object"),a.types.identifier("assign")):this.addHelper("extends")}buildVariableAssignment(e,r){let t=this.operator;if(a.types.isMemberExpression(e)||a.types.isOptionalMemberExpression(e))t="=";let s;if(t){s=a.types.expressionStatement(a.types.assignmentExpression(t,e,a.types.cloneNode(r)||this.scope.buildUndefinedNode()))}else{let t;if((this.kind==="const"||this.kind==="using")&&r===null){t=this.scope.buildUndefinedNode()}else{t=a.types.cloneNode(r)}s=a.types.variableDeclaration(this.kind,[a.types.variableDeclarator(e,t)])}s._blockHoist=this.blockHoist;return s}buildVariableDeclaration(e,r){const t=a.types.variableDeclaration("var",[a.types.variableDeclarator(a.types.cloneNode(e),a.types.cloneNode(r))]);t._blockHoist=this.blockHoist;return t}push(e,r){const t=a.types.cloneNode(r);if(a.types.isObjectPattern(e)){this.pushObjectPattern(e,t)}else if(a.types.isArrayPattern(e)){this.pushArrayPattern(e,t)}else if(a.types.isAssignmentPattern(e)){this.pushAssignmentPattern(e,t)}else{this.nodes.push(this.buildVariableAssignment(e,t))}}toArray(e,r){if(this.iterableIsArray||a.types.isIdentifier(e)&&this.arrayRefSet.has(e.name)){return e}else{const{scope:t,arrayLikeIsIterable:s}=this;if(a.types.isIdentifier(e)){const r=t.getBinding(e.name);if(r!=null&&r.constant&&r.path.isGenericType("Array")){return e}}if(a.types.isArrayExpression(e)){return e}if(a.types.isIdentifier(e,{name:"arguments"})){return a.template.expression.ast`
260 Array.prototype.slice.call(${e})
261 `}let n;const o=[e];if(typeof r==="number"){o.push(a.types.numericLiteral(r));n="slicedToArray"}else{n="toArray"}if(s){o.unshift(t.path.hub.addHelper(n));n="maybeArrayLike"}return a.types.callExpression(t.path.hub.addHelper(n),o)}}pushAssignmentPattern({left:e,right:r},t){if(isPureVoid(t)){this.push(e,r);return}const s=this.scope.generateUidIdentifierBasedOnNode(t);this.nodes.push(this.buildVariableDeclaration(s,t));const n=a.types.conditionalExpression(a.types.binaryExpression("===",a.types.cloneNode(s),this.scope.buildUndefinedNode()),r,a.types.cloneNode(s));if(a.types.isPattern(e)){let r;let t;if(this.kind==="const"||this.kind==="let"||this.kind==="using"){r=this.scope.generateUidIdentifier(s.name);t=this.buildVariableDeclaration(r,n)}else{r=s;t=a.types.expressionStatement(a.types.assignmentExpression("=",a.types.cloneNode(s),n))}this.nodes.push(t);this.push(e,r)}else{this.nodes.push(this.buildVariableAssignment(e,n))}}pushObjectRest(e,r,t,s){const a=buildObjectExcludingKeys(e.properties.slice(0,s),r,this.scope,(e=>this.addHelper(e)),this.objectRestNoSymbols,this.useBuiltIns);this.nodes.push(this.buildVariableAssignment(t.argument,a))}pushObjectProperty(e,r){if(a.types.isLiteral(e.key))e.computed=true;const t=e.value;const s=a.types.memberExpression(a.types.cloneNode(r),e.key,e.computed);if(a.types.isPattern(t)){this.push(t,s)}else{this.nodes.push(this.buildVariableAssignment(t,s))}}pushObjectPattern(e,r){if(!e.properties.length){this.nodes.push(a.types.expressionStatement(a.types.callExpression(this.addHelper("objectDestructuringEmpty"),isPureVoid(r)?[]:[r])));return}if(e.properties.length>1&&!this.scope.isStatic(r)){const e=this.scope.generateUidIdentifierBasedOnNode(r);this.nodes.push(this.buildVariableDeclaration(e,r));r=e}if(hasObjectRest(e)){let r;for(let t=0;t<e.properties.length;t++){const s=e.properties[t];if(a.types.isRestElement(s)){break}const n=s.key;if(s.computed&&!this.scope.isPure(n)){const a=this.scope.generateUidIdentifierBasedOnNode(n);this.nodes.push(this.buildVariableDeclaration(a,n));if(!r){r=e=Object.assign({},e,{properties:e.properties.slice()})}r.properties[t]=Object.assign({},s,{key:a})}}}for(let t=0;t<e.properties.length;t++){const s=e.properties[t];if(a.types.isRestElement(s)){this.pushObjectRest(e,r,s,t)}else{this.pushObjectProperty(s,r)}}}canUnpackArrayPattern(e,r){if(!a.types.isArrayExpression(r))return false;if(e.elements.length>r.elements.length)return;if(e.elements.length<r.elements.length&&!hasArrayRest(e)){return false}for(const r of e.elements){if(!r)return false;if(a.types.isMemberExpression(r))return false}for(const e of r.elements){if(a.types.isSpreadElement(e))return false;if(a.types.isCallExpression(e))return false;if(a.types.isMemberExpression(e))return false}const t=a.types.getBindingIdentifiers(e);const s={deopt:false,bindings:t};try{a.types.traverse(r,arrayUnpackVisitor,s)}catch(e){if(e!==n)throw e}return!s.deopt}pushUnpackedArrayPattern(e,r){const holeToUndefined=e=>e!=null?e:this.scope.buildUndefinedNode();for(let t=0;t<e.elements.length;t++){const s=e.elements[t];if(a.types.isRestElement(s)){this.push(s.argument,a.types.arrayExpression(r.elements.slice(t).map(holeToUndefined)))}else{this.push(s,holeToUndefined(r.elements[t]))}}}pushArrayPattern(e,r){if(r===null){this.nodes.push(a.types.expressionStatement(a.types.callExpression(this.addHelper("objectDestructuringEmpty"),[])));return}if(!e.elements)return;if(this.canUnpackArrayPattern(e,r)){this.pushUnpackedArrayPattern(e,r);return}const t=!hasArrayRest(e)&&e.elements.length;const s=this.toArray(r,t);if(a.types.isIdentifier(s)){r=s}else{r=this.scope.generateUidIdentifierBasedOnNode(r);this.arrayRefSet.add(r.name);this.nodes.push(this.buildVariableDeclaration(r,s))}for(let t=0;t<e.elements.length;t++){const s=e.elements[t];if(!s)continue;let n;if(a.types.isRestElement(s)){n=this.toArray(r);n=a.types.callExpression(a.types.memberExpression(n,a.types.identifier("slice")),[a.types.numericLiteral(t)]);this.push(s.argument,n)}else{n=a.types.memberExpression(r,a.types.numericLiteral(t),true);this.push(s,n)}}}init(e,r){if(!a.types.isArrayExpression(r)&&!a.types.isMemberExpression(r)){const e=this.scope.maybeGenerateMemoised(r,true);if(e){this.nodes.push(this.buildVariableDeclaration(e,a.types.cloneNode(r)));r=e}}this.push(e,r);return this.nodes}}function buildObjectExcludingKeys(e,r,t,s,n,o){const i=[];let l=true;let c=false;for(let r=0;r<e.length;r++){const t=e[r];const s=t.key;if(a.types.isIdentifier(s)&&!t.computed){i.push(a.types.stringLiteral(s.name))}else if(a.types.isTemplateLiteral(s)){i.push(a.types.cloneNode(s));c=true}else if(a.types.isLiteral(s)){i.push(a.types.stringLiteral(String(s.value)))}else if(a.types.isPrivateName(s));else{i.push(a.types.cloneNode(s));l=false}}let d;if(i.length===0){const e=o?a.types.memberExpression(a.types.identifier("Object"),a.types.identifier("assign")):s("extends");d=a.types.callExpression(e,[a.types.objectExpression([]),a.types.sequenceExpression([a.types.callExpression(s("objectDestructuringEmpty"),[a.types.cloneNode(r)]),a.types.cloneNode(r)])])}else{let e=a.types.arrayExpression(i);if(!l){e=a.types.callExpression(a.types.memberExpression(e,a.types.identifier("map")),[s("toPropertyKey")])}else if(!c&&!a.types.isProgram(t.block)){const r=t.getProgramParent();const s=r.generateUidIdentifier("excluded");r.push({id:s,init:e,kind:"const"});e=a.types.cloneNode(s)}d=a.types.callExpression(s(`objectWithoutProperties${n?"Loose":""}`),[a.types.cloneNode(r),e])}return d}function convertVariableDeclaration(e,r,t,s,n,o){const{node:i,scope:l}=e;const c=i.kind;const d=i.loc;const u=[];for(let e=0;e<i.declarations.length;e++){const c=i.declarations[e];const d=c.init;const p=c.id;const f=new DestructuringTransformer({blockHoist:i._blockHoist,nodes:u,scope:l,kind:i.kind,iterableIsArray:s,arrayLikeIsIterable:t,useBuiltIns:o,objectRestNoSymbols:n,addHelper:r});if(a.types.isPattern(p)){f.init(p,d);if(+e!==i.declarations.length-1){a.types.inherits(u[u.length-1],c)}}else{u.push(a.types.inherits(f.buildVariableAssignment(p,d),c))}}let p=null;let f=[];for(const e of u){if(a.types.isVariableDeclaration(e)){if(p!==null){p.declarations.push(...e.declarations);continue}else{e.kind=c;p=e}}else{p=null}if(!e.loc){e.loc=d}f.push(e)}if(f.length===2&&a.types.isVariableDeclaration(f[0])&&a.types.isExpressionStatement(f[1])&&a.types.isCallExpression(f[1].expression)&&f[0].declarations.length===1){const e=f[1].expression;e.arguments=[f[0].declarations[0].init];f=[e]}else{if(a.types.isForStatement(e.parent,{init:i})&&!f.some((e=>a.types.isVariableDeclaration(e)))){for(let e=0;e<f.length;e++){const r=f[e];if(a.types.isExpressionStatement(r)){f[e]=r.expression}}}}if(f.length===1){e.replaceWith(f[0])}else{e.replaceWithMultiple(f)}l.crawl()}function convertAssignmentExpression(e,r,t,s,n,o){const{node:i,scope:l,parentPath:c}=e;const d=[];const u=new DestructuringTransformer({operator:i.operator,scope:l,nodes:d,arrayLikeIsIterable:t,iterableIsArray:s,objectRestNoSymbols:n,useBuiltIns:o,addHelper:r});let p;if(!c.isExpressionStatement()&&!c.isSequenceExpression()||e.isCompletionRecord()){p=l.generateUidIdentifierBasedOnNode(i.right,"ref");d.push(a.types.variableDeclaration("var",[a.types.variableDeclarator(p,i.right)]));if(a.types.isArrayExpression(i.right)){u.arrayRefSet.add(p.name)}}u.init(i.left,p||i.right);if(p){if(c.isArrowFunctionExpression()){e.replaceWith(a.types.blockStatement([]));d.push(a.types.returnStatement(a.types.cloneNode(p)))}else{d.push(a.types.expressionStatement(a.types.cloneNode(p)))}}e.replaceWithMultiple(d);l.crawl()}function variableDeclarationHasPattern(e){for(const r of e.declarations){if(a.types.isPattern(r.id)){return true}}return false}var o=s.declare(((e,r)=>{var t,s,n,o,i,l;e.assertVersion(7);const{useBuiltIns:c=false}=r;const d=(t=(s=e.assumption("iterableIsArray"))!=null?s:r.loose)!=null?t:false;const u=(n=(o=r.allowArrayLike)!=null?o:e.assumption("arrayLikeIsIterable"))!=null?n:false;const p=(i=(l=e.assumption("objectRestNoSymbols"))!=null?l:r.loose)!=null?i:false;return{name:"transform-destructuring",visitor:{ExportNamedDeclaration(e){const r=e.get("declaration");if(!r.isVariableDeclaration())return;if(!variableDeclarationHasPattern(r.node))return;const t=[];for(const r of Object.keys(e.getOuterBindingIdentifiers())){t.push(a.types.exportSpecifier(a.types.identifier(r),a.types.identifier(r)))}e.replaceWith(r.node);e.insertAfter(a.types.exportNamedDeclaration(null,t));e.scope.crawl()},ForXStatement(e){const{node:r,scope:t}=e;const s=r.left;if(a.types.isPattern(s)){const n=t.generateUidIdentifier("ref");r.left=a.types.variableDeclaration("var",[a.types.variableDeclarator(n)]);e.ensureBlock();const o=e.node.body.body;const i=[];if(o.length===0&&e.isCompletionRecord()){i.unshift(a.types.expressionStatement(t.buildUndefinedNode()))}i.unshift(a.types.expressionStatement(a.types.assignmentExpression("=",s,a.types.cloneNode(n))));unshiftForXStatementBody(e,i);t.crawl();return}if(!a.types.isVariableDeclaration(s))return;const n=s.declarations[0].id;if(!a.types.isPattern(n))return;const o=t.generateUidIdentifier("ref");r.left=a.types.variableDeclaration(s.kind,[a.types.variableDeclarator(o,null)]);const i=[];const l=new DestructuringTransformer({kind:s.kind,scope:t,nodes:i,arrayLikeIsIterable:u,iterableIsArray:d,objectRestNoSymbols:p,useBuiltIns:c,addHelper:e=>this.addHelper(e)});l.init(n,o);unshiftForXStatementBody(e,i);t.crawl()},CatchClause({node:e,scope:r}){const t=e.param;if(!a.types.isPattern(t))return;const s=r.generateUidIdentifier("ref");e.param=s;const n=[];const o=new DestructuringTransformer({kind:"let",scope:r,nodes:n,arrayLikeIsIterable:u,iterableIsArray:d,objectRestNoSymbols:p,useBuiltIns:c,addHelper:e=>this.addHelper(e)});o.init(t,s);e.body.body=[...n,...e.body.body];r.crawl()},AssignmentExpression(e,r){if(!a.types.isPattern(e.node.left))return;convertAssignmentExpression(e,(e=>r.addHelper(e)),u,d,p,c)},VariableDeclaration(e,r){const{node:t,parent:s}=e;if(a.types.isForXStatement(s))return;if(!s||!e.container)return;if(!variableDeclarationHasPattern(t))return;convertVariableDeclaration(e,(e=>r.addHelper(e)),u,d,p,c)}}}}));r.buildObjectExcludingKeys=buildObjectExcludingKeys;r["default"]=o;r.unshiftForXStatementBody=unshiftForXStatementBody},4408:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var s=t(5436);var a=t(9045);var n=r["default"]=(0,a.declare)((e=>{e.assertVersion("^7.0.0-0 || >8.0.0-alpha <8.0.0-beta");return(0,s.createRegExpFeaturePlugin)({name:"transform-dotall-regex",feature:"dotAllFlag"})}))},9744:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var s=t(9045);var a=t(8304);function getName(e){if(a.types.isIdentifier(e)){return e.name}return e.value.toString()}var n=r["default"]=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-duplicate-keys",visitor:{ObjectExpression(e){const{node:r}=e;const t=r.properties.filter((e=>!a.types.isSpreadElement(e)&&!e.computed));const s=Object.create(null);const n=Object.create(null);const o=Object.create(null);for(const e of t){const r=getName(e.key);let t=false;switch(e.kind){case"get":if(s[r]||n[r]){t=true}n[r]=true;break;case"set":if(s[r]||o[r]){t=true}o[r]=true;break;default:if(s[r]||n[r]||o[r]){t=true}s[r]=true}if(t){e.computed=true;e.key=a.types.stringLiteral(r)}}}}}}))},1737:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var s=t(5436);var a=t(9045);var n=r["default"]=(0,a.declare)(((e,r)=>{e.assertVersion("^7.19.0 || >8.0.0-alpha <8.0.0-beta");const{runtime:t}=r;if(t!==undefined&&typeof t!=="boolean"){throw new Error("The 'runtime' option must be boolean")}return(0,s.createRegExpFeaturePlugin)({name:"transform-duplicate-named-capturing-groups-regex",feature:"duplicateNamedCaptureGroups",options:{runtime:t}})}))},5802:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var s=t(9045);const a=new Set(["commonjs","amd","systemjs"]);const n=`@babel/plugin-transform-dynamic-import depends on a modules\ntransform plugin. Supported plugins are:\n - @babel/plugin-transform-modules-commonjs ^7.4.0\n - @babel/plugin-transform-modules-amd ^7.4.0\n - @babel/plugin-transform-modules-systemjs ^7.4.0\n\nIf you are using Webpack or Rollup and thus don't want\nBabel to transpile your imports and exports, you can use\nthe @babel/plugin-syntax-dynamic-import plugin and let your\nbundler handle dynamic imports.\n`;var o=r["default"]=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-dynamic-import",manipulateOptions:(e,r)=>r.plugins.push("dynamicImport"),pre(){this.file.set("@babel/plugin-proposal-dynamic-import","7.25.9")},visitor:{Program(){const e=this.file.get("@babel/plugin-transform-modules-*");if(!a.has(e)){throw new Error(n)}}}}}))},6155:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var s=t(9045);var a=r["default"]=(0,s.declare)((e=>{e.assertVersion("^7.0.0-0 || >8.0.0-alpha <8.0.0-beta");const{types:r,template:t}=e;function build(e,t){return r.callExpression(r.memberExpression(r.identifier("Math"),r.identifier("pow")),[e,t])}function maybeMemoize(e,t){if(t.isStatic(e)){return{assign:e,ref:r.cloneNode(e)}}if(t.path.isPattern()){return null}const s=t.generateUidIdentifierBasedOnNode(e);t.push({id:s});return{assign:r.assignmentExpression("=",r.cloneNode(s),e),ref:r.cloneNode(s)}}return{name:"transform-exponentiation-operator",visitor:{AssignmentExpression(e){const{node:s,scope:a}=e;if(s.operator!=="**=")return;if(r.isMemberExpression(s.left)){let n;let o;const i=maybeMemoize(s.left.object,a);if(!i){e.replaceWith(t.expression.ast`(() => ${e.node})()`);return}const{property:l,computed:c}=s.left;if(c){const e=maybeMemoize(l,a);n=r.memberExpression(i.assign,e.assign,true);o=r.memberExpression(i.ref,e.ref,true)}else{n=r.memberExpression(i.assign,l,false);o=r.memberExpression(i.ref,r.cloneNode(l),false)}e.replaceWith(r.assignmentExpression("=",n,build(o,s.right)))}else{e.replaceWith(r.assignmentExpression("=",s.left,build(r.cloneNode(s.left),s.right)))}},BinaryExpression(e){const{node:r}=e;if(r.operator==="**"){e.replaceWith(build(r.left,r.right))}}}}}))},4530:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var s=t(9045);var a=t(8304);var n=r["default"]=(0,s.declare)((e=>{e.assertVersion(7);return{name:"transform-export-namespace-from",manipulateOptions:(e,r)=>r.plugins.push("exportNamespaceFrom"),visitor:{ExportNamedDeclaration(e){var r;const{node:t,scope:s}=e;const{specifiers:n}=t;const o=a.types.isExportDefaultSpecifier(n[0])?1:0;if(!a.types.isExportNamespaceSpecifier(n[o]))return;const i=[];if(o===1){i.push(a.types.exportNamedDeclaration(null,[n.shift()],t.source))}const l=n.shift();const{exported:c}=l;const d=s.generateUidIdentifier((r=c.name)!=null?r:c.value);i.push(a.types.importDeclaration([a.types.importNamespaceSpecifier(d)],a.types.cloneNode(t.source)),a.types.exportNamedDeclaration(null,[a.types.exportSpecifier(a.types.cloneNode(d),c)]));if(t.specifiers.length>=1){i.push(t)}const[u]=e.replaceWithMultiple(i);e.scope.registerDeclaration(u)}}}}))},9928:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var s=t(9045);var a=t(8304);var n=t(8774);var o=t(9102);function buildLoopBody(e,r,t){let s;const n=e.get("body");const o=t!=null?t:n.node;if(a.types.isBlockStatement(o)&&Object.keys(e.getBindingIdentifiers()).some((e=>n.scope.hasOwnBinding(e)))){s=a.types.blockStatement([r,o])}else{s=a.types.toBlock(o);s.body.unshift(r)}return s}var i=r["default"]=(0,s.declare)(((e,r)=>{var t,s,i;e.assertVersion(7);{const{assumeArray:t,allowArrayLike:s,loose:a}=r;if(a===true&&t===true){throw new Error(`The loose and assumeArray options cannot be used together in @babel/plugin-transform-for-of`)}if(t===true&&s===true){throw new Error(`The assumeArray and allowArrayLike options cannot be used together in @babel/plugin-transform-for-of`)}{if(s&&/^7\.\d\./.test(e.version)){throw new Error(`The allowArrayLike is only supported when using @babel/core@^7.10.0`)}}}const l=(t=r.assumeArray)!=null?t:!r.loose&&e.assumption("iterableIsArray");const c=(s=r.allowArrayLike)!=null?s:e.assumption("arrayLikeIsIterable");const d=(i=e.assumption("skipForOfIteratorClosing"))!=null?i:r.loose;if(l&&c){throw new Error(`The "iterableIsArray" and "arrayLikeIsIterable" assumptions are not compatible.`)}if(l){return{name:"transform-for-of",visitor:{ForOfStatement(e){const{scope:r}=e;const{left:t,await:s}=e.node;if(s){return}const n=(0,o.skipTransparentExprWrapperNodes)(e.node.right);const i=r.generateUidIdentifier("i");let l=r.maybeGenerateMemoised(n,true);if(!l&&a.types.isIdentifier(n)&&e.get("body").scope.hasOwnBinding(n.name)){l=r.generateUidIdentifier("arr")}const c=[a.types.variableDeclarator(i,a.types.numericLiteral(0))];if(l){c.push(a.types.variableDeclarator(l,n))}else{l=n}const d=a.types.memberExpression(a.types.cloneNode(l),a.types.cloneNode(i),true);let u;if(a.types.isVariableDeclaration(t)){u=t;u.declarations[0].init=d}else{u=a.types.expressionStatement(a.types.assignmentExpression("=",t,d))}e.replaceWith(a.types.forStatement(a.types.variableDeclaration("let",c),a.types.binaryExpression("<",a.types.cloneNode(i),a.types.memberExpression(a.types.cloneNode(l),a.types.identifier("length"))),a.types.updateExpression("++",a.types.cloneNode(i)),buildLoopBody(e,u)))}}}}const u=(0,a.template)`
262 for (var KEY = 0, NAME = ARR; KEY < NAME.length; KEY++) BODY;
263 `;const p=a.template.statements`
264 for (var ITERATOR_HELPER = CREATE_ITERATOR_HELPER(OBJECT, ARRAY_LIKE_IS_ITERABLE), STEP_KEY;

Callers

nothing calls this directly

Calls 8

initMethod · 0.95
generateUidIdentifierMethod · 0.80
crawlMethod · 0.80
replaceWithMethod · 0.80
replaceRestElementFunction · 0.70
getMethod · 0.65
isPatternMethod · 0.45
addHelperMethod · 0.45

Tested by

no test coverage detected