@jsep-plugin/new
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -17,6 +17,9 @@ 'use strict'; | ||
// Change CALL_EXP to NewExpression (could be a nested member) | ||
// Change CALL_EXP to NewExpression (could be a nested member, even within a call expr) | ||
let callNode = env.node; | ||
while (callNode.type === 'MemberExpression') { | ||
callNode = callNode.object; | ||
while (callNode.type === jsep.MEMBER_EXP || ( | ||
callNode.type === jsep.CALL_EXP && callNode.callee.type === jsep.MEMBER_EXP)) { | ||
callNode = callNode.type === jsep.MEMBER_EXP | ||
? callNode.object | ||
: callNode.callee.object; | ||
} | ||
@@ -23,0 +26,0 @@ callNode.type = 'NewExpression'; |
@@ -1,2 +0,2 @@ | ||
"use strict";var e={name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",(function(n){const t=n.node;if(t&&"new"===t.operator){t.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(t.argument.type)||this.throwError("Expected new function()"),n.node=t.argument;let o=n.node;for(;"MemberExpression"===o.type;)o=o.object;o.type="NewExpression"}}))}};module.exports=e; | ||
"use strict";var e={name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",(function(t){const n=t.node;if(n&&"new"===n.operator){n.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(n.argument.type)||this.throwError("Expected new function()"),t.node=n.argument;let o=t.node;for(;o.type===e.MEMBER_EXP||o.type===e.CALL_EXP&&o.callee.type===e.MEMBER_EXP;)o=o.type===e.MEMBER_EXP?o.object:o.callee.object;o.type="NewExpression"}}))}};module.exports=e; | ||
//# sourceMappingURL=index.cjs.min.js.map |
@@ -18,6 +18,9 @@ var index = (function () { | ||
// Change CALL_EXP to NewExpression (could be a nested member) | ||
// Change CALL_EXP to NewExpression (could be a nested member, even within a call expr) | ||
let callNode = env.node; | ||
while (callNode.type === 'MemberExpression') { | ||
callNode = callNode.object; | ||
while (callNode.type === jsep.MEMBER_EXP || ( | ||
callNode.type === jsep.CALL_EXP && callNode.callee.type === jsep.MEMBER_EXP)) { | ||
callNode = callNode.type === jsep.MEMBER_EXP | ||
? callNode.object | ||
: callNode.callee.object; | ||
} | ||
@@ -24,0 +27,0 @@ callNode.type = 'NewExpression'; |
@@ -1,2 +0,2 @@ | ||
var index=function(){"use strict";return{name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",(function(n){const t=n.node;if(t&&"new"===t.operator){t.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(t.argument.type)||this.throwError("Expected new function()"),n.node=t.argument;let r=n.node;for(;"MemberExpression"===r.type;)r=r.object;r.type="NewExpression"}}))}}}(); | ||
var index=function(){"use strict";return{name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",(function(t){const n=t.node;if(n&&"new"===n.operator){n.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(n.argument.type)||this.throwError("Expected new function()"),t.node=n.argument;let o=t.node;for(;o.type===e.MEMBER_EXP||o.type===e.CALL_EXP&&o.callee.type===e.MEMBER_EXP;)o=o.type===e.MEMBER_EXP?o.object:o.callee.object;o.type="NewExpression"}}))}}}(); | ||
//# sourceMappingURL=index.iife.min.js.map |
@@ -15,6 +15,9 @@ var index = { | ||
// Change CALL_EXP to NewExpression (could be a nested member) | ||
// Change CALL_EXP to NewExpression (could be a nested member, even within a call expr) | ||
let callNode = env.node; | ||
while (callNode.type === 'MemberExpression') { | ||
callNode = callNode.object; | ||
while (callNode.type === jsep.MEMBER_EXP || ( | ||
callNode.type === jsep.CALL_EXP && callNode.callee.type === jsep.MEMBER_EXP)) { | ||
callNode = callNode.type === jsep.MEMBER_EXP | ||
? callNode.object | ||
: callNode.callee.object; | ||
} | ||
@@ -21,0 +24,0 @@ callNode.type = 'NewExpression'; |
@@ -1,2 +0,2 @@ | ||
var e={name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",(function(n){const t=n.node;if(t&&"new"===t.operator){t.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(t.argument.type)||this.throwError("Expected new function()"),n.node=t.argument;let o=n.node;for(;"MemberExpression"===o.type;)o=o.object;o.type="NewExpression"}}))}};export{e as default}; | ||
var e={name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",(function(t){const n=t.node;if(n&&"new"===n.operator){n.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(n.argument.type)||this.throwError("Expected new function()"),t.node=n.argument;let o=t.node;for(;o.type===e.MEMBER_EXP||o.type===e.CALL_EXP&&o.callee.type===e.MEMBER_EXP;)o=o.type===e.MEMBER_EXP?o.object:o.callee.object;o.type="NewExpression"}}))}};export{e as default}; | ||
//# sourceMappingURL=index.min.js.map |
{ | ||
"name": "@jsep-plugin/new", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Adds 'new' expression support", | ||
@@ -5,0 +5,0 @@ "author": "Shelly (https://github.com/6utt3rfly)", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15242
101