Completely updated React, fixed #11, (hopefully)
This commit is contained in:
24
goTorrentWebUI/node_modules/webpack/lib/dependencies/AMDDefineDependencyParserPlugin.js
generated
vendored
24
goTorrentWebUI/node_modules/webpack/lib/dependencies/AMDDefineDependencyParserPlugin.js
generated
vendored
@@ -23,6 +23,18 @@ function isBoundFunctionExpression(expr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function isUnboundFunctionExpression(expr) {
|
||||
if(expr.type === "FunctionExpression") return true;
|
||||
if(expr.type === "ArrowFunctionExpression") return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function isCallable(expr) {
|
||||
if(isUnboundFunctionExpression(expr)) return true;
|
||||
if(isBoundFunctionExpression(expr)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
class AMDDefineDependencyParserPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
@@ -38,7 +50,7 @@ class AMDDefineDependencyParserPlugin {
|
||||
let array, fn, obj, namedModule;
|
||||
switch(expr.arguments.length) {
|
||||
case 1:
|
||||
if(expr.arguments[0].type === "FunctionExpression" || isBoundFunctionExpression(expr.arguments[0])) {
|
||||
if(isCallable(expr.arguments[0])) {
|
||||
// define(f() {...})
|
||||
fn = expr.arguments[0];
|
||||
} else if(expr.arguments[0].type === "ObjectExpression") {
|
||||
@@ -54,7 +66,7 @@ class AMDDefineDependencyParserPlugin {
|
||||
if(expr.arguments[0].type === "Literal") {
|
||||
namedModule = expr.arguments[0].value;
|
||||
// define("...", ...)
|
||||
if(expr.arguments[1].type === "FunctionExpression" || isBoundFunctionExpression(expr.arguments[1])) {
|
||||
if(isCallable(expr.arguments[1])) {
|
||||
// define("...", f() {...})
|
||||
fn = expr.arguments[1];
|
||||
} else if(expr.arguments[1].type === "ObjectExpression") {
|
||||
@@ -67,7 +79,7 @@ class AMDDefineDependencyParserPlugin {
|
||||
}
|
||||
} else {
|
||||
array = expr.arguments[0];
|
||||
if(expr.arguments[1].type === "FunctionExpression" || isBoundFunctionExpression(expr.arguments[1])) {
|
||||
if(isCallable(expr.arguments[1])) {
|
||||
// define([...], f() {})
|
||||
fn = expr.arguments[1];
|
||||
} else if(expr.arguments[1].type === "ObjectExpression") {
|
||||
@@ -84,7 +96,7 @@ class AMDDefineDependencyParserPlugin {
|
||||
// define("...", [...], f() {...})
|
||||
namedModule = expr.arguments[0].value;
|
||||
array = expr.arguments[1];
|
||||
if(expr.arguments[2].type === "FunctionExpression" || isBoundFunctionExpression(expr.arguments[2])) {
|
||||
if(isCallable(expr.arguments[2])) {
|
||||
// define("...", [...], f() {})
|
||||
fn = expr.arguments[2];
|
||||
} else if(expr.arguments[2].type === "ObjectExpression") {
|
||||
@@ -102,7 +114,7 @@ class AMDDefineDependencyParserPlugin {
|
||||
let fnParams = null;
|
||||
let fnParamsOffset = 0;
|
||||
if(fn) {
|
||||
if(fn.type === "FunctionExpression") fnParams = fn.params;
|
||||
if(isUnboundFunctionExpression(fn)) fnParams = fn.params;
|
||||
else if(isBoundFunctionExpression(fn)) {
|
||||
fnParams = fn.callee.object.params;
|
||||
fnParamsOffset = fn.arguments.length - 1;
|
||||
@@ -134,7 +146,7 @@ class AMDDefineDependencyParserPlugin {
|
||||
});
|
||||
}
|
||||
let inTry;
|
||||
if(fn && fn.type === "FunctionExpression") {
|
||||
if(fn && isUnboundFunctionExpression(fn)) {
|
||||
inTry = parser.scope.inTry;
|
||||
parser.inScope(fnParams, () => {
|
||||
parser.scope.renames = fnRenames;
|
||||
|
Reference in New Issue
Block a user