First commit
This commit is contained in:
142
hGameTest/node_modules/webpack/lib/dependencies/AMDDefineDependency.js
generated
vendored
Normal file
142
hGameTest/node_modules/webpack/lib/dependencies/AMDDefineDependency.js
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
class AMDDefineDependency extends NullDependency {
|
||||
constructor(range, arrayRange, functionRange, objectRange, namedModule) {
|
||||
super();
|
||||
this.range = range;
|
||||
this.arrayRange = arrayRange;
|
||||
this.functionRange = functionRange;
|
||||
this.objectRange = objectRange;
|
||||
this.namedModule = namedModule;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "amd define";
|
||||
}
|
||||
}
|
||||
|
||||
AMDDefineDependency.Template = class AMDDefineDependencyTemplate {
|
||||
get definitions() {
|
||||
return {
|
||||
f: [
|
||||
"var __WEBPACK_AMD_DEFINE_RESULT__;",
|
||||
`!(__WEBPACK_AMD_DEFINE_RESULT__ = (#).call(exports, __webpack_require__, exports, module),
|
||||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`
|
||||
],
|
||||
o: [
|
||||
"",
|
||||
"!(module.exports = #)"
|
||||
],
|
||||
of: [
|
||||
"var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;",
|
||||
`!(__WEBPACK_AMD_DEFINE_FACTORY__ = (#),
|
||||
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
||||
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
|
||||
__WEBPACK_AMD_DEFINE_FACTORY__),
|
||||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`
|
||||
],
|
||||
af: [
|
||||
"var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;",
|
||||
`!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_RESULT__ = (#).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
|
||||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`
|
||||
],
|
||||
ao: [
|
||||
"",
|
||||
"!(#, module.exports = #)"
|
||||
],
|
||||
aof: [
|
||||
"var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;",
|
||||
`!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_FACTORY__ = (#),
|
||||
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
||||
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
||||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`
|
||||
],
|
||||
lf: [
|
||||
"var XXX, XXXmodule;",
|
||||
"!(XXXmodule = { id: YYY, exports: {}, loaded: false }, XXX = #.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule), XXXmodule.loaded = true, XXX === undefined && (XXX = XXXmodule.exports))"
|
||||
],
|
||||
lo: [
|
||||
"var XXX;",
|
||||
"!(XXX = #)"
|
||||
],
|
||||
lof: [
|
||||
"var XXX, XXXfactory, XXXmodule;",
|
||||
"!(XXXfactory = (#), (XXXmodule = { id: YYY, exports: {}, loaded: false }), XXX = (typeof XXXfactory === 'function' ? (XXXfactory.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule)) : XXXfactory), (XXXmodule.loaded = true), XXX === undefined && (XXX = XXXmodule.exports))"
|
||||
],
|
||||
laf: [
|
||||
"var __WEBPACK_AMD_DEFINE_ARRAY__, XXX;",
|
||||
"!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, XXX = ((#).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)))"
|
||||
],
|
||||
lao: [
|
||||
"var XXX;",
|
||||
"!(#, XXX = #)"
|
||||
],
|
||||
laof: [
|
||||
"var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_FACTORY__, XXX;",
|
||||
`!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_FACTORY__ = (#),
|
||||
XXX = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
||||
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__))`
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
apply(dependency, source) {
|
||||
const branch = this.branch(dependency);
|
||||
const defAndText = this.definitions[branch];
|
||||
const definitions = defAndText[0];
|
||||
const text = defAndText[1];
|
||||
this.replace(dependency, source, definitions, text);
|
||||
}
|
||||
|
||||
localModuleVar(dependency) {
|
||||
return dependency.localModule && dependency.localModule.used && dependency.localModule.variableName();
|
||||
}
|
||||
|
||||
branch(dependency) {
|
||||
const localModuleVar = this.localModuleVar(dependency) ? "l" : "";
|
||||
const arrayRange = dependency.arrayRange ? "a" : "";
|
||||
const objectRange = dependency.objectRange ? "o" : "";
|
||||
const functionRange = dependency.functionRange ? "f" : "";
|
||||
return localModuleVar + arrayRange + objectRange + functionRange;
|
||||
}
|
||||
|
||||
replace(dependency, source, definition, text) {
|
||||
const localModuleVar = this.localModuleVar(dependency);
|
||||
if(localModuleVar) {
|
||||
text = text.replace(/XXX/g, localModuleVar.replace(/\$/g, "$$$$"));
|
||||
definition = definition.replace(/XXX/g, localModuleVar.replace(/\$/g, "$$$$"));
|
||||
}
|
||||
|
||||
if(dependency.namedModule) {
|
||||
text = text.replace(/YYY/g, JSON.stringify(dependency.namedModule));
|
||||
}
|
||||
|
||||
const texts = text.split("#");
|
||||
|
||||
if(definition) source.insert(0, definition);
|
||||
|
||||
let current = dependency.range[0];
|
||||
if(dependency.arrayRange) {
|
||||
source.replace(current, dependency.arrayRange[0] - 1, texts.shift());
|
||||
current = dependency.arrayRange[1];
|
||||
}
|
||||
|
||||
if(dependency.objectRange) {
|
||||
source.replace(current, dependency.objectRange[0] - 1, texts.shift());
|
||||
current = dependency.objectRange[1];
|
||||
} else if(dependency.functionRange) {
|
||||
source.replace(current, dependency.functionRange[0] - 1, texts.shift());
|
||||
current = dependency.functionRange[1];
|
||||
}
|
||||
source.replace(current, dependency.range[1] - 1, texts.shift());
|
||||
if(texts.length > 0)
|
||||
throw new Error("Implementation error");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AMDDefineDependency;
|
||||
266
hGameTest/node_modules/webpack/lib/dependencies/AMDDefineDependencyParserPlugin.js
generated
vendored
Normal file
266
hGameTest/node_modules/webpack/lib/dependencies/AMDDefineDependencyParserPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,266 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const AMDRequireItemDependency = require("./AMDRequireItemDependency");
|
||||
const AMDRequireContextDependency = require("./AMDRequireContextDependency");
|
||||
const ConstDependency = require("./ConstDependency");
|
||||
const AMDDefineDependency = require("./AMDDefineDependency");
|
||||
const AMDRequireArrayDependency = require("./AMDRequireArrayDependency");
|
||||
const LocalModuleDependency = require("./LocalModuleDependency");
|
||||
const ContextDependencyHelpers = require("./ContextDependencyHelpers");
|
||||
const LocalModulesHelpers = require("./LocalModulesHelpers");
|
||||
|
||||
function isBoundFunctionExpression(expr) {
|
||||
if(expr.type !== "CallExpression") return false;
|
||||
if(expr.callee.type !== "MemberExpression") return false;
|
||||
if(expr.callee.computed) return false;
|
||||
if(expr.callee.object.type !== "FunctionExpression") return false;
|
||||
if(expr.callee.property.type !== "Identifier") return false;
|
||||
if(expr.callee.property.name !== "bind") return false;
|
||||
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;
|
||||
}
|
||||
|
||||
newDefineDependency(range, arrayRange, functionRange, objectRange, namedModule) {
|
||||
return new AMDDefineDependency(range, arrayRange, functionRange, objectRange, namedModule);
|
||||
}
|
||||
|
||||
apply(parser) {
|
||||
const options = this.options;
|
||||
parser.plugin("call define", (expr) => {
|
||||
let array, fn, obj, namedModule;
|
||||
switch(expr.arguments.length) {
|
||||
case 1:
|
||||
if(isCallable(expr.arguments[0])) {
|
||||
// define(f() {...})
|
||||
fn = expr.arguments[0];
|
||||
} else if(expr.arguments[0].type === "ObjectExpression") {
|
||||
// define({...})
|
||||
obj = expr.arguments[0];
|
||||
} else {
|
||||
// define(expr)
|
||||
// unclear if function or object
|
||||
obj = fn = expr.arguments[0];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(expr.arguments[0].type === "Literal") {
|
||||
namedModule = expr.arguments[0].value;
|
||||
// define("...", ...)
|
||||
if(isCallable(expr.arguments[1])) {
|
||||
// define("...", f() {...})
|
||||
fn = expr.arguments[1];
|
||||
} else if(expr.arguments[1].type === "ObjectExpression") {
|
||||
// define("...", {...})
|
||||
obj = expr.arguments[1];
|
||||
} else {
|
||||
// define("...", expr)
|
||||
// unclear if function or object
|
||||
obj = fn = expr.arguments[1];
|
||||
}
|
||||
} else {
|
||||
array = expr.arguments[0];
|
||||
if(isCallable(expr.arguments[1])) {
|
||||
// define([...], f() {})
|
||||
fn = expr.arguments[1];
|
||||
} else if(expr.arguments[1].type === "ObjectExpression") {
|
||||
// define([...], {...})
|
||||
obj = expr.arguments[1];
|
||||
} else {
|
||||
// define([...], expr)
|
||||
// unclear if function or object
|
||||
obj = fn = expr.arguments[1];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
// define("...", [...], f() {...})
|
||||
namedModule = expr.arguments[0].value;
|
||||
array = expr.arguments[1];
|
||||
if(isCallable(expr.arguments[2])) {
|
||||
// define("...", [...], f() {})
|
||||
fn = expr.arguments[2];
|
||||
} else if(expr.arguments[2].type === "ObjectExpression") {
|
||||
// define("...", [...], {...})
|
||||
obj = expr.arguments[2];
|
||||
} else {
|
||||
// define("...", [...], expr)
|
||||
// unclear if function or object
|
||||
obj = fn = expr.arguments[2];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
let fnParams = null;
|
||||
let fnParamsOffset = 0;
|
||||
if(fn) {
|
||||
if(isUnboundFunctionExpression(fn)) fnParams = fn.params;
|
||||
else if(isBoundFunctionExpression(fn)) {
|
||||
fnParams = fn.callee.object.params;
|
||||
fnParamsOffset = fn.arguments.length - 1;
|
||||
if(fnParamsOffset < 0) fnParamsOffset = 0;
|
||||
}
|
||||
}
|
||||
let fnRenames = Object.create(parser.scope.renames);
|
||||
let identifiers;
|
||||
if(array) {
|
||||
identifiers = {};
|
||||
const param = parser.evaluateExpression(array);
|
||||
const result = parser.applyPluginsBailResult("call define:amd:array", expr, param, identifiers, namedModule);
|
||||
if(!result) return;
|
||||
if(fnParams) fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => {
|
||||
if(identifiers[idx]) {
|
||||
fnRenames["$" + param.name] = identifiers[idx];
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
} else {
|
||||
identifiers = ["require", "exports", "module"];
|
||||
if(fnParams) fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => {
|
||||
if(identifiers[idx]) {
|
||||
fnRenames["$" + param.name] = identifiers[idx];
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
let inTry;
|
||||
if(fn && isUnboundFunctionExpression(fn)) {
|
||||
inTry = parser.scope.inTry;
|
||||
parser.inScope(fnParams, () => {
|
||||
parser.scope.renames = fnRenames;
|
||||
parser.scope.inTry = inTry;
|
||||
if(fn.body.type === "BlockStatement")
|
||||
parser.walkStatement(fn.body);
|
||||
else
|
||||
parser.walkExpression(fn.body);
|
||||
});
|
||||
} else if(fn && isBoundFunctionExpression(fn)) {
|
||||
inTry = parser.scope.inTry;
|
||||
parser.inScope(fn.callee.object.params.filter((i) => ["require", "module", "exports"].indexOf(i.name) < 0), () => {
|
||||
parser.scope.renames = fnRenames;
|
||||
parser.scope.inTry = inTry;
|
||||
if(fn.callee.object.body.type === "BlockStatement")
|
||||
parser.walkStatement(fn.callee.object.body);
|
||||
else
|
||||
parser.walkExpression(fn.callee.object.body);
|
||||
});
|
||||
if(fn.arguments)
|
||||
parser.walkExpressions(fn.arguments);
|
||||
} else if(fn || obj) {
|
||||
parser.walkExpression(fn || obj);
|
||||
}
|
||||
|
||||
const dep = this.newDefineDependency(
|
||||
expr.range,
|
||||
array ? array.range : null,
|
||||
fn ? fn.range : null,
|
||||
obj ? obj.range : null,
|
||||
namedModule ? namedModule : null
|
||||
);
|
||||
dep.loc = expr.loc;
|
||||
if(namedModule) {
|
||||
dep.localModule = LocalModulesHelpers.addLocalModule(parser.state, namedModule);
|
||||
}
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
parser.plugin("call define:amd:array", (expr, param, identifiers, namedModule) => {
|
||||
if(param.isArray()) {
|
||||
param.items.forEach((param, idx) => {
|
||||
if(param.isString() && ["require", "module", "exports"].indexOf(param.string) >= 0)
|
||||
identifiers[idx] = param.string;
|
||||
const result = parser.applyPluginsBailResult("call define:amd:item", expr, param, namedModule);
|
||||
if(result === undefined) {
|
||||
parser.applyPluginsBailResult("call define:amd:context", expr, param);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} else if(param.isConstArray()) {
|
||||
const deps = [];
|
||||
param.array.forEach((request, idx) => {
|
||||
let dep;
|
||||
let localModule;
|
||||
if(request === "require") {
|
||||
identifiers[idx] = request;
|
||||
dep = "__webpack_require__";
|
||||
} else if(["exports", "module"].indexOf(request) >= 0) {
|
||||
identifiers[idx] = request;
|
||||
dep = request;
|
||||
} else if(localModule = LocalModulesHelpers.getLocalModule(parser.state, request)) { // eslint-disable-line no-cond-assign
|
||||
dep = new LocalModuleDependency(localModule);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
} else {
|
||||
dep = new AMDRequireItemDependency(request);
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
parser.state.current.addDependency(dep);
|
||||
}
|
||||
deps.push(dep);
|
||||
});
|
||||
const dep = new AMDRequireArrayDependency(deps, param.range);
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
parser.plugin("call define:amd:item", (expr, param, namedModule) => {
|
||||
if(param.isConditional()) {
|
||||
param.options.forEach((param) => {
|
||||
const result = parser.applyPluginsBailResult("call define:amd:item", expr, param);
|
||||
if(result === undefined) {
|
||||
parser.applyPluginsBailResult("call define:amd:context", expr, param);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} else if(param.isString()) {
|
||||
let dep, localModule;
|
||||
if(param.string === "require") {
|
||||
dep = new ConstDependency("__webpack_require__", param.range);
|
||||
} else if(["require", "exports", "module"].indexOf(param.string) >= 0) {
|
||||
dep = new ConstDependency(param.string, param.range);
|
||||
} else if(localModule = LocalModulesHelpers.getLocalModule(parser.state, param.string, namedModule)) { // eslint-disable-line no-cond-assign
|
||||
dep = new LocalModuleDependency(localModule, param.range);
|
||||
} else {
|
||||
dep = new AMDRequireItemDependency(param.string, param.range);
|
||||
}
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
parser.plugin("call define:amd:context", (expr, param) => {
|
||||
const dep = ContextDependencyHelpers.create(AMDRequireContextDependency, param.range, param, expr, options);
|
||||
if(!dep) return;
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = AMDDefineDependencyParserPlugin;
|
||||
119
hGameTest/node_modules/webpack/lib/dependencies/AMDPlugin.js
generated
vendored
Normal file
119
hGameTest/node_modules/webpack/lib/dependencies/AMDPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
const AMDRequireDependency = require("./AMDRequireDependency");
|
||||
const AMDRequireItemDependency = require("./AMDRequireItemDependency");
|
||||
const AMDRequireArrayDependency = require("./AMDRequireArrayDependency");
|
||||
const AMDRequireContextDependency = require("./AMDRequireContextDependency");
|
||||
const AMDDefineDependency = require("./AMDDefineDependency");
|
||||
const UnsupportedDependency = require("./UnsupportedDependency");
|
||||
const LocalModuleDependency = require("./LocalModuleDependency");
|
||||
|
||||
const NullFactory = require("../NullFactory");
|
||||
|
||||
const AMDRequireDependenciesBlockParserPlugin = require("./AMDRequireDependenciesBlockParserPlugin");
|
||||
const AMDDefineDependencyParserPlugin = require("./AMDDefineDependencyParserPlugin");
|
||||
|
||||
const AliasPlugin = require("enhanced-resolve/lib/AliasPlugin");
|
||||
|
||||
const ParserHelpers = require("../ParserHelpers");
|
||||
|
||||
class AMDPlugin {
|
||||
constructor(options, amdOptions) {
|
||||
this.amdOptions = amdOptions;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
const options = this.options;
|
||||
const amdOptions = this.amdOptions;
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
const contextModuleFactory = params.contextModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(AMDRequireDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(AMDRequireDependency, new AMDRequireDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(AMDRequireItemDependency, normalModuleFactory);
|
||||
compilation.dependencyTemplates.set(AMDRequireItemDependency, new AMDRequireItemDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(AMDRequireArrayDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(AMDRequireArrayDependency, new AMDRequireArrayDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(AMDRequireContextDependency, contextModuleFactory);
|
||||
compilation.dependencyTemplates.set(AMDRequireContextDependency, new AMDRequireContextDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(AMDDefineDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(AMDDefineDependency, new AMDDefineDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(UnsupportedDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(UnsupportedDependency, new UnsupportedDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(LocalModuleDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(LocalModuleDependency, new LocalModuleDependency.Template());
|
||||
|
||||
params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
|
||||
|
||||
if(typeof parserOptions.amd !== "undefined" && !parserOptions.amd)
|
||||
return;
|
||||
|
||||
function setExpressionToModule(outerExpr, module) {
|
||||
parser.plugin("expression " + outerExpr, (expr) => {
|
||||
const dep = new AMDRequireItemDependency(module, expr.range);
|
||||
dep.userRequest = outerExpr;
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
parser.apply(
|
||||
new AMDRequireDependenciesBlockParserPlugin(options),
|
||||
new AMDDefineDependencyParserPlugin(options)
|
||||
);
|
||||
setExpressionToModule("require.amd", "!!webpack amd options");
|
||||
setExpressionToModule("define.amd", "!!webpack amd options");
|
||||
setExpressionToModule("define", "!!webpack amd define");
|
||||
parser.plugin("expression __webpack_amd_options__", () =>
|
||||
parser.state.current.addVariable("__webpack_amd_options__", JSON.stringify(amdOptions)));
|
||||
parser.plugin("evaluate typeof define.amd", ParserHelpers.evaluateToString(typeof amdOptions));
|
||||
parser.plugin("evaluate typeof require.amd", ParserHelpers.evaluateToString(typeof amdOptions));
|
||||
parser.plugin("evaluate Identifier define.amd", ParserHelpers.evaluateToIdentifier("define.amd", true));
|
||||
parser.plugin("evaluate Identifier require.amd", ParserHelpers.evaluateToIdentifier("require.amd", true));
|
||||
parser.plugin("typeof define", ParserHelpers.toConstantDependency(JSON.stringify("function")));
|
||||
parser.plugin("evaluate typeof define", ParserHelpers.evaluateToString("function"));
|
||||
parser.plugin("can-rename define", ParserHelpers.approve);
|
||||
parser.plugin("rename define", (expr) => {
|
||||
const dep = new AMDRequireItemDependency("!!webpack amd define", expr.range);
|
||||
dep.userRequest = "define";
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
return false;
|
||||
});
|
||||
parser.plugin("typeof require", ParserHelpers.toConstantDependency(JSON.stringify("function")));
|
||||
parser.plugin("evaluate typeof require", ParserHelpers.evaluateToString("function"));
|
||||
});
|
||||
});
|
||||
compiler.plugin("after-resolvers", () => {
|
||||
compiler.resolvers.normal.apply(
|
||||
new AliasPlugin("described-resolve", {
|
||||
name: "amdefine",
|
||||
alias: path.join(__dirname, "..", "..", "buildin", "amd-define.js")
|
||||
}, "resolve"),
|
||||
new AliasPlugin("described-resolve", {
|
||||
name: "webpack amd options",
|
||||
alias: path.join(__dirname, "..", "..", "buildin", "amd-options.js")
|
||||
}, "resolve"),
|
||||
new AliasPlugin("described-resolve", {
|
||||
name: "webpack amd define",
|
||||
alias: path.join(__dirname, "..", "..", "buildin", "amd-define.js")
|
||||
}, "resolve")
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = AMDPlugin;
|
||||
58
hGameTest/node_modules/webpack/lib/dependencies/AMDRequireArrayDependency.js
generated
vendored
Normal file
58
hGameTest/node_modules/webpack/lib/dependencies/AMDRequireArrayDependency.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const Dependency = require("../Dependency");
|
||||
const webpackMissingModuleModule = require("./WebpackMissingModule").module;
|
||||
|
||||
class AMDRequireArrayDependency extends Dependency {
|
||||
constructor(depsArray, range) {
|
||||
super();
|
||||
this.depsArray = depsArray;
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "amd require array";
|
||||
}
|
||||
}
|
||||
|
||||
AMDRequireArrayDependency.Template = class AMDRequireArrayDependencyTemplate {
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
const content = this.getContent(dep, outputOptions, requestShortener);
|
||||
source.replace(dep.range[0], dep.range[1] - 1, content);
|
||||
}
|
||||
|
||||
getContent(dep, outputOptions, requestShortener) {
|
||||
const requires = dep.depsArray.map((dependency) => {
|
||||
const optionalComment = this.optionalComment(outputOptions.pathinfo, requestShortener.shorten(dependency.request));
|
||||
return this.contentForDependency(dependency, optionalComment);
|
||||
});
|
||||
return `[${requires.join(", ")}]`;
|
||||
}
|
||||
|
||||
optionalComment(pathInfo, shortenedRequest) {
|
||||
if(!pathInfo) {
|
||||
return "";
|
||||
}
|
||||
return `/*! ${shortenedRequest} */ `;
|
||||
}
|
||||
|
||||
contentForDependency(dep, comment) {
|
||||
if(typeof dep === "string") {
|
||||
return dep;
|
||||
}
|
||||
|
||||
if(dep.module) {
|
||||
const stringifiedId = JSON.stringify(dep.module.id);
|
||||
return `__webpack_require__(${comment}${stringifiedId})`;
|
||||
} else if(dep.localModule) {
|
||||
return dep.localModule.variableName();
|
||||
}
|
||||
|
||||
return webpackMissingModuleModule(dep.request);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AMDRequireArrayDependency;
|
||||
20
hGameTest/node_modules/webpack/lib/dependencies/AMDRequireContextDependency.js
generated
vendored
Normal file
20
hGameTest/node_modules/webpack/lib/dependencies/AMDRequireContextDependency.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ContextDependency = require("./ContextDependency");
|
||||
class AMDRequireContextDependency extends ContextDependency {
|
||||
constructor(request, recursive, regExp, range, valueRange) {
|
||||
super(request, recursive, regExp);
|
||||
this.range = range;
|
||||
this.valueRange = valueRange;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "amd require context";
|
||||
}
|
||||
}
|
||||
AMDRequireContextDependency.Template = require("./ContextDependencyTemplateAsRequireCall");
|
||||
module.exports = AMDRequireContextDependency;
|
||||
33
hGameTest/node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlock.js
generated
vendored
Normal file
33
hGameTest/node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlock.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
|
||||
const AMDRequireDependency = require("./AMDRequireDependency");
|
||||
|
||||
module.exports = class AMDRequireDependenciesBlock extends AsyncDependenciesBlock {
|
||||
constructor(expr, arrayRange, functionRange, errorCallbackRange, module, loc) {
|
||||
super(null, module, loc);
|
||||
this.expr = expr;
|
||||
this.outerRange = expr.range;
|
||||
this.arrayRange = arrayRange;
|
||||
this.functionRange = functionRange;
|
||||
this.errorCallbackRange = errorCallbackRange;
|
||||
this.bindThis = true;
|
||||
if(arrayRange && functionRange && errorCallbackRange) {
|
||||
this.range = [arrayRange[0], errorCallbackRange[1]];
|
||||
} else if(arrayRange && functionRange) {
|
||||
this.range = [arrayRange[0], functionRange[1]];
|
||||
} else if(arrayRange) {
|
||||
this.range = arrayRange;
|
||||
} else if(functionRange) {
|
||||
this.range = functionRange;
|
||||
} else {
|
||||
this.range = expr.range;
|
||||
}
|
||||
const dep = new AMDRequireDependency(this);
|
||||
dep.loc = loc;
|
||||
this.addDependency(dep);
|
||||
}
|
||||
};
|
||||
177
hGameTest/node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js
generated
vendored
Normal file
177
hGameTest/node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const AMDRequireItemDependency = require("./AMDRequireItemDependency");
|
||||
const AMDRequireArrayDependency = require("./AMDRequireArrayDependency");
|
||||
const AMDRequireContextDependency = require("./AMDRequireContextDependency");
|
||||
const AMDRequireDependenciesBlock = require("./AMDRequireDependenciesBlock");
|
||||
const UnsupportedDependency = require("./UnsupportedDependency");
|
||||
const LocalModuleDependency = require("./LocalModuleDependency");
|
||||
const ContextDependencyHelpers = require("./ContextDependencyHelpers");
|
||||
const LocalModulesHelpers = require("./LocalModulesHelpers");
|
||||
const ConstDependency = require("./ConstDependency");
|
||||
const getFunctionExpression = require("./getFunctionExpression");
|
||||
const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
|
||||
|
||||
class AMDRequireDependenciesBlockParserPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
processFunctionArgument(parser, expression) {
|
||||
let bindThis = true;
|
||||
const fnData = getFunctionExpression(expression);
|
||||
if(fnData) {
|
||||
parser.inScope(fnData.fn.params.filter((i) => {
|
||||
return ["require", "module", "exports"].indexOf(i.name) < 0;
|
||||
}), () => {
|
||||
if(fnData.fn.body.type === "BlockStatement")
|
||||
parser.walkStatement(fnData.fn.body);
|
||||
else
|
||||
parser.walkExpression(fnData.fn.body);
|
||||
});
|
||||
parser.walkExpressions(fnData.expressions);
|
||||
if(fnData.needThis === false) {
|
||||
bindThis = false;
|
||||
}
|
||||
} else {
|
||||
parser.walkExpression(expression);
|
||||
}
|
||||
return bindThis;
|
||||
}
|
||||
|
||||
apply(parser) {
|
||||
const options = this.options;
|
||||
parser.plugin("call require", (expr) => {
|
||||
let param;
|
||||
let dep;
|
||||
let result;
|
||||
|
||||
const old = parser.state.current;
|
||||
|
||||
if(expr.arguments.length >= 1) {
|
||||
param = parser.evaluateExpression(expr.arguments[0]);
|
||||
dep = new AMDRequireDependenciesBlock(
|
||||
expr,
|
||||
param.range,
|
||||
(expr.arguments.length > 1) ? expr.arguments[1].range : null,
|
||||
(expr.arguments.length > 2) ? expr.arguments[2].range : null,
|
||||
parser.state.module,
|
||||
expr.loc
|
||||
);
|
||||
parser.state.current = dep;
|
||||
}
|
||||
|
||||
if(expr.arguments.length === 1) {
|
||||
parser.inScope([], () => {
|
||||
result = parser.applyPluginsBailResult("call require:amd:array", expr, param);
|
||||
});
|
||||
parser.state.current = old;
|
||||
if(!result) return;
|
||||
parser.state.current.addBlock(dep);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(expr.arguments.length === 2 || expr.arguments.length === 3) {
|
||||
try {
|
||||
parser.inScope([], () => {
|
||||
result = parser.applyPluginsBailResult("call require:amd:array", expr, param);
|
||||
});
|
||||
if(!result) {
|
||||
dep = new UnsupportedDependency("unsupported", expr.range);
|
||||
old.addDependency(dep);
|
||||
if(parser.state.module)
|
||||
parser.state.module.errors.push(new UnsupportedFeatureWarning(parser.state.module, "Cannot statically analyse 'require(..., ...)' in line " + expr.loc.start.line));
|
||||
dep = null;
|
||||
return true;
|
||||
}
|
||||
dep.functionBindThis = this.processFunctionArgument(parser, expr.arguments[1]);
|
||||
if(expr.arguments.length === 3) {
|
||||
dep.errorCallbackBindThis = this.processFunctionArgument(parser, expr.arguments[2]);
|
||||
}
|
||||
} finally {
|
||||
parser.state.current = old;
|
||||
if(dep)
|
||||
parser.state.current.addBlock(dep);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
parser.plugin("call require:amd:array", (expr, param) => {
|
||||
if(param.isArray()) {
|
||||
param.items.forEach((param) => {
|
||||
const result = parser.applyPluginsBailResult("call require:amd:item", expr, param);
|
||||
if(result === undefined) {
|
||||
parser.applyPluginsBailResult("call require:amd:context", expr, param);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} else if(param.isConstArray()) {
|
||||
const deps = [];
|
||||
param.array.forEach((request) => {
|
||||
let dep, localModule;
|
||||
if(request === "require") {
|
||||
dep = "__webpack_require__";
|
||||
} else if(["exports", "module"].indexOf(request) >= 0) {
|
||||
dep = request;
|
||||
} else if(localModule = LocalModulesHelpers.getLocalModule(parser.state, request)) { // eslint-disable-line no-cond-assign
|
||||
dep = new LocalModuleDependency(localModule);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
} else {
|
||||
dep = new AMDRequireItemDependency(request);
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
parser.state.current.addDependency(dep);
|
||||
}
|
||||
deps.push(dep);
|
||||
});
|
||||
const dep = new AMDRequireArrayDependency(deps, param.range);
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
parser.plugin("call require:amd:item", (expr, param) => {
|
||||
if(param.isConditional()) {
|
||||
param.options.forEach((param) => {
|
||||
const result = parser.applyPluginsBailResult("call require:amd:item", expr, param);
|
||||
if(result === undefined) {
|
||||
parser.applyPluginsBailResult("call require:amd:context", expr, param);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} else if(param.isString()) {
|
||||
let dep, localModule;
|
||||
if(param.string === "require") {
|
||||
dep = new ConstDependency("__webpack_require__", param.string);
|
||||
} else if(param.string === "module") {
|
||||
dep = new ConstDependency(parser.state.module.moduleArgument || "module", param.range);
|
||||
} else if(param.string === "exports") {
|
||||
dep = new ConstDependency(parser.state.module.exportsArgument || "exports", param.range);
|
||||
} else if(localModule = LocalModulesHelpers.getLocalModule(parser.state, param.string)) { // eslint-disable-line no-cond-assign
|
||||
dep = new LocalModuleDependency(localModule, param.range);
|
||||
} else {
|
||||
dep = new AMDRequireItemDependency(param.string, param.range);
|
||||
}
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
parser.plugin("call require:amd:context", (expr, param) => {
|
||||
const dep = ContextDependencyHelpers.create(AMDRequireContextDependency, param.range, param, expr, options);
|
||||
if(!dep) return;
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = AMDRequireDependenciesBlockParserPlugin;
|
||||
67
hGameTest/node_modules/webpack/lib/dependencies/AMDRequireDependency.js
generated
vendored
Normal file
67
hGameTest/node_modules/webpack/lib/dependencies/AMDRequireDependency.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
const DepBlockHelpers = require("./DepBlockHelpers");
|
||||
|
||||
class AMDRequireDependency extends NullDependency {
|
||||
constructor(block) {
|
||||
super();
|
||||
this.block = block;
|
||||
}
|
||||
}
|
||||
|
||||
AMDRequireDependency.Template = class AMDRequireDependencyTemplate {
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
const depBlock = dep.block;
|
||||
const wrapper = DepBlockHelpers.getLoadDepBlockWrapper(depBlock, outputOptions, requestShortener, "require");
|
||||
|
||||
// has array range but no function range
|
||||
if(depBlock.arrayRange && !depBlock.functionRange) {
|
||||
const startBlock = wrapper[0] + "function() {";
|
||||
const endBlock = `;}${wrapper[1]}__webpack_require__.oe${wrapper[2]}`;
|
||||
source.replace(depBlock.outerRange[0], depBlock.arrayRange[0] - 1, startBlock);
|
||||
source.replace(depBlock.arrayRange[1], depBlock.outerRange[1] - 1, endBlock);
|
||||
return;
|
||||
}
|
||||
|
||||
// has function range but no array range
|
||||
if(depBlock.functionRange && !depBlock.arrayRange) {
|
||||
const startBlock = wrapper[0] + "function() {(";
|
||||
const endBlock = `.call(exports, __webpack_require__, exports, module));}${wrapper[1]}__webpack_require__.oe${wrapper[2]}`;
|
||||
source.replace(depBlock.outerRange[0], depBlock.functionRange[0] - 1, startBlock);
|
||||
source.replace(depBlock.functionRange[1], depBlock.outerRange[1] - 1, endBlock);
|
||||
return;
|
||||
}
|
||||
|
||||
// has array range, function range, and errorCallbackRange
|
||||
if(depBlock.arrayRange && depBlock.functionRange && depBlock.errorCallbackRange) {
|
||||
const startBlock = wrapper[0] + "function() { ";
|
||||
const errorRangeBlock = `}${depBlock.functionBindThis ? ".bind(this)" : ""}${wrapper[1]}`;
|
||||
const endBlock = `${depBlock.errorCallbackBindThis ? ".bind(this)" : ""}${wrapper[2]}`;
|
||||
|
||||
source.replace(depBlock.outerRange[0], depBlock.arrayRange[0] - 1, startBlock);
|
||||
source.insert(depBlock.arrayRange[0] + 0.9, "var __WEBPACK_AMD_REQUIRE_ARRAY__ = ");
|
||||
source.replace(depBlock.arrayRange[1], depBlock.functionRange[0] - 1, "; ((");
|
||||
source.insert(depBlock.functionRange[1], ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));");
|
||||
source.replace(depBlock.functionRange[1], depBlock.errorCallbackRange[0] - 1, errorRangeBlock);
|
||||
source.replace(depBlock.errorCallbackRange[1], depBlock.outerRange[1] - 1, endBlock);
|
||||
return;
|
||||
}
|
||||
|
||||
// has array range, function range, but no errorCallbackRange
|
||||
if(depBlock.arrayRange && depBlock.functionRange) {
|
||||
const startBlock = wrapper[0] + "function() { ";
|
||||
const endBlock = `}${depBlock.functionBindThis ? ".bind(this)" : ""}${wrapper[1]}__webpack_require__.oe${wrapper[2]}`;
|
||||
source.replace(depBlock.outerRange[0], depBlock.arrayRange[0] - 1, startBlock);
|
||||
source.insert(depBlock.arrayRange[0] + 0.9, "var __WEBPACK_AMD_REQUIRE_ARRAY__ = ");
|
||||
source.replace(depBlock.arrayRange[1], depBlock.functionRange[0] - 1, "; ((");
|
||||
source.insert(depBlock.functionRange[1], ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));");
|
||||
source.replace(depBlock.functionRange[1], depBlock.outerRange[1] - 1, endBlock);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AMDRequireDependency;
|
||||
22
hGameTest/node_modules/webpack/lib/dependencies/AMDRequireItemDependency.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/dependencies/AMDRequireItemDependency.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
const ModuleDependencyTemplateAsRequireId = require("./ModuleDependencyTemplateAsRequireId");
|
||||
|
||||
class AMDRequireItemDependency extends ModuleDependency {
|
||||
constructor(request, range) {
|
||||
super(request);
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "amd require";
|
||||
}
|
||||
}
|
||||
|
||||
AMDRequireItemDependency.Template = ModuleDependencyTemplateAsRequireId;
|
||||
|
||||
module.exports = AMDRequireItemDependency;
|
||||
89
hGameTest/node_modules/webpack/lib/dependencies/CommonJsPlugin.js
generated
vendored
Normal file
89
hGameTest/node_modules/webpack/lib/dependencies/CommonJsPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ConstDependency = require("./ConstDependency");
|
||||
const CommonJsRequireDependency = require("./CommonJsRequireDependency");
|
||||
const CommonJsRequireContextDependency = require("./CommonJsRequireContextDependency");
|
||||
const RequireResolveDependency = require("./RequireResolveDependency");
|
||||
const RequireResolveContextDependency = require("./RequireResolveContextDependency");
|
||||
const RequireResolveHeaderDependency = require("./RequireResolveHeaderDependency");
|
||||
const RequireHeaderDependency = require("./RequireHeaderDependency");
|
||||
|
||||
const NullFactory = require("../NullFactory");
|
||||
|
||||
const RequireResolveDependencyParserPlugin = require("./RequireResolveDependencyParserPlugin");
|
||||
const CommonJsRequireDependencyParserPlugin = require("./CommonJsRequireDependencyParserPlugin");
|
||||
|
||||
const ParserHelpers = require("../ParserHelpers");
|
||||
|
||||
class CommonJsPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
const options = this.options;
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
const contextModuleFactory = params.contextModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(CommonJsRequireDependency, normalModuleFactory);
|
||||
compilation.dependencyTemplates.set(CommonJsRequireDependency, new CommonJsRequireDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(CommonJsRequireContextDependency, contextModuleFactory);
|
||||
compilation.dependencyTemplates.set(CommonJsRequireContextDependency, new CommonJsRequireContextDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(RequireResolveDependency, normalModuleFactory);
|
||||
compilation.dependencyTemplates.set(RequireResolveDependency, new RequireResolveDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(RequireResolveContextDependency, contextModuleFactory);
|
||||
compilation.dependencyTemplates.set(RequireResolveContextDependency, new RequireResolveContextDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(RequireResolveHeaderDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(RequireResolveHeaderDependency, new RequireResolveHeaderDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(RequireHeaderDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(RequireHeaderDependency, new RequireHeaderDependency.Template());
|
||||
|
||||
params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
|
||||
|
||||
if(typeof parserOptions.commonjs !== "undefined" && !parserOptions.commonjs)
|
||||
return;
|
||||
|
||||
const requireExpressions = ["require", "require.resolve", "require.resolveWeak"];
|
||||
for(let expression of requireExpressions) {
|
||||
parser.plugin(`typeof ${expression}`, ParserHelpers.toConstantDependency(JSON.stringify("function")));
|
||||
parser.plugin(`evaluate typeof ${expression}`, ParserHelpers.evaluateToString("function"));
|
||||
parser.plugin(`evaluate Identifier ${expression}`, ParserHelpers.evaluateToIdentifier(expression, true));
|
||||
}
|
||||
|
||||
parser.plugin("evaluate typeof module", ParserHelpers.evaluateToString("object"));
|
||||
parser.plugin("assign require", (expr) => {
|
||||
// to not leak to global "require", we need to define a local require here.
|
||||
const dep = new ConstDependency("var require;", 0);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
parser.scope.definitions.push("require");
|
||||
return true;
|
||||
});
|
||||
parser.plugin("can-rename require", () => true);
|
||||
parser.plugin("rename require", (expr) => {
|
||||
// define the require variable. It's still undefined, but not "not defined".
|
||||
const dep = new ConstDependency("var require;", 0);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
return false;
|
||||
});
|
||||
parser.plugin("typeof module", () => true);
|
||||
parser.plugin("evaluate typeof exports", ParserHelpers.evaluateToString("object"));
|
||||
parser.apply(
|
||||
new CommonJsRequireDependencyParserPlugin(options),
|
||||
new RequireResolveDependencyParserPlugin(options)
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = CommonJsPlugin;
|
||||
24
hGameTest/node_modules/webpack/lib/dependencies/CommonJsRequireContextDependency.js
generated
vendored
Normal file
24
hGameTest/node_modules/webpack/lib/dependencies/CommonJsRequireContextDependency.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ContextDependency = require("./ContextDependency");
|
||||
const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");
|
||||
|
||||
class CommonJsRequireContextDependency extends ContextDependency {
|
||||
constructor(request, recursive, regExp, range, valueRange) {
|
||||
super(request, recursive, regExp);
|
||||
this.range = range;
|
||||
this.valueRange = valueRange;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "cjs require context";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CommonJsRequireContextDependency.Template = ContextDependencyTemplateAsRequireCall;
|
||||
|
||||
module.exports = CommonJsRequireContextDependency;
|
||||
22
hGameTest/node_modules/webpack/lib/dependencies/CommonJsRequireDependency.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/dependencies/CommonJsRequireDependency.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
const ModuleDependencyTemplateAsId = require("./ModuleDependencyTemplateAsId");
|
||||
|
||||
class CommonJsRequireDependency extends ModuleDependency {
|
||||
constructor(request, range) {
|
||||
super(request);
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "cjs require";
|
||||
}
|
||||
}
|
||||
|
||||
CommonJsRequireDependency.Template = ModuleDependencyTemplateAsId;
|
||||
|
||||
module.exports = CommonJsRequireDependency;
|
||||
89
hGameTest/node_modules/webpack/lib/dependencies/CommonJsRequireDependencyParserPlugin.js
generated
vendored
Normal file
89
hGameTest/node_modules/webpack/lib/dependencies/CommonJsRequireDependencyParserPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const CommonJsRequireDependency = require("./CommonJsRequireDependency");
|
||||
const CommonJsRequireContextDependency = require("./CommonJsRequireContextDependency");
|
||||
const RequireHeaderDependency = require("./RequireHeaderDependency");
|
||||
const LocalModuleDependency = require("./LocalModuleDependency");
|
||||
const ContextDependencyHelpers = require("./ContextDependencyHelpers");
|
||||
const LocalModulesHelpers = require("./LocalModulesHelpers");
|
||||
const ParserHelpers = require("../ParserHelpers");
|
||||
|
||||
class CommonJsRequireDependencyParserPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(parser) {
|
||||
const options = this.options;
|
||||
parser.plugin("expression require.cache", ParserHelpers.toConstantDependency("__webpack_require__.c"));
|
||||
parser.plugin("expression require", (expr) => {
|
||||
const dep = new CommonJsRequireContextDependency(options.unknownContextRequest, options.unknownContextRecursive, options.unknownContextRegExp, expr.range);
|
||||
dep.critical = options.unknownContextCritical && "require function is used in a way in which dependencies cannot be statically extracted";
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
parser.plugin("call require", (expr) => {
|
||||
if(expr.arguments.length !== 1) return;
|
||||
let localModule;
|
||||
const param = parser.evaluateExpression(expr.arguments[0]);
|
||||
if(param.isConditional()) {
|
||||
let isExpression = false;
|
||||
const prevLength = parser.state.current.dependencies.length;
|
||||
const dep = new RequireHeaderDependency(expr.callee.range);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
param.options.forEach(function(param) {
|
||||
const result = parser.applyPluginsBailResult("call require:commonjs:item", expr, param);
|
||||
if(result === undefined) {
|
||||
isExpression = true;
|
||||
}
|
||||
});
|
||||
if(isExpression) {
|
||||
parser.state.current.dependencies.length = prevLength;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(param.isString() && (localModule = LocalModulesHelpers.getLocalModule(parser.state, param.string))) {
|
||||
const dep = new LocalModuleDependency(localModule, expr.range);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
} else {
|
||||
const result = parser.applyPluginsBailResult("call require:commonjs:item", expr, param);
|
||||
if(result === undefined) {
|
||||
parser.applyPluginsBailResult("call require:commonjs:context", expr, param);
|
||||
} else {
|
||||
const dep = new RequireHeaderDependency(expr.callee.range);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
parser.plugin("call require:commonjs:item", (expr, param) => {
|
||||
if(param.isString()) {
|
||||
const dep = new CommonJsRequireDependency(param.string, param.range);
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
parser.plugin("call require:commonjs:context", (expr, param) => {
|
||||
const dep = ContextDependencyHelpers.create(CommonJsRequireContextDependency, expr.range, param, expr, options);
|
||||
if(!dep) return;
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = CommonJsRequireDependencyParserPlugin;
|
||||
32
hGameTest/node_modules/webpack/lib/dependencies/ConstDependency.js
generated
vendored
Normal file
32
hGameTest/node_modules/webpack/lib/dependencies/ConstDependency.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
class ConstDependency extends NullDependency {
|
||||
constructor(expression, range) {
|
||||
super();
|
||||
this.expression = expression;
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
hash.update(this.range + "");
|
||||
hash.update(this.expression + "");
|
||||
}
|
||||
}
|
||||
|
||||
ConstDependency.Template = class ConstDependencyTemplate {
|
||||
apply(dep, source) {
|
||||
if(typeof dep.range === "number") {
|
||||
source.insert(dep.range, dep.expression);
|
||||
return;
|
||||
}
|
||||
|
||||
source.replace(dep.range[0], dep.range[1] - 1, dep.expression);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ConstDependency;
|
||||
49
hGameTest/node_modules/webpack/lib/dependencies/ContextDependency.js
generated
vendored
Normal file
49
hGameTest/node_modules/webpack/lib/dependencies/ContextDependency.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const Dependency = require("../Dependency");
|
||||
const CriticalDependencyWarning = require("./CriticalDependencyWarning");
|
||||
|
||||
class ContextDependency extends Dependency {
|
||||
constructor(request, recursive, regExp) {
|
||||
super();
|
||||
this.request = request;
|
||||
this.userRequest = request;
|
||||
this.recursive = recursive;
|
||||
this.regExp = regExp;
|
||||
this.async = false;
|
||||
|
||||
this.hadGlobalOrStickyRegExp = false;
|
||||
if(this.regExp.global || this.regExp.sticky) {
|
||||
this.regExp = null;
|
||||
this.hadGlobalOrStickyRegExp = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
isEqualResource(other) {
|
||||
if(!(other instanceof ContextDependency))
|
||||
return false;
|
||||
|
||||
return this.request === other.request &&
|
||||
this.recursive === other.recursive &&
|
||||
this.regExp === other.regExp &&
|
||||
this.async === other.async;
|
||||
}
|
||||
|
||||
getWarnings() {
|
||||
let warnings = super.getWarnings() || [];
|
||||
if(this.critical) {
|
||||
warnings.push(new CriticalDependencyWarning(this.critical));
|
||||
}
|
||||
if(this.hadGlobalOrStickyRegExp) {
|
||||
warnings.push(new CriticalDependencyWarning("Contexts can't use RegExps with the 'g' or 'y' flags."));
|
||||
}
|
||||
return warnings;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = ContextDependency;
|
||||
71
hGameTest/node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
generated
vendored
Normal file
71
hGameTest/node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ContextDependencyHelpers = exports;
|
||||
|
||||
/**
|
||||
* Escapes regular expression metacharacters
|
||||
* @param {string} str String to quote
|
||||
* @return {string} Escaped string
|
||||
*/
|
||||
function quotemeta(str) {
|
||||
return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
|
||||
}
|
||||
|
||||
ContextDependencyHelpers.create = function(Dep, range, param, expr, options, chunkName) {
|
||||
let dep;
|
||||
let prefix;
|
||||
let postfix;
|
||||
let prefixRange;
|
||||
let valueRange;
|
||||
let idx;
|
||||
let context;
|
||||
let regExp;
|
||||
if(param.isTemplateString()) {
|
||||
prefix = param.quasis[0].string;
|
||||
postfix = param.quasis.length > 1 ? param.quasis[param.quasis.length - 1].string : "";
|
||||
prefixRange = [param.quasis[0].range[0], param.quasis[0].range[1]];
|
||||
valueRange = param.range;
|
||||
idx = prefix.lastIndexOf("/");
|
||||
context = ".";
|
||||
if(idx >= 0) {
|
||||
context = prefix.substr(0, idx);
|
||||
prefix = `.${prefix.substr(idx)}`;
|
||||
}
|
||||
// If there are more than two quasis, maybe the generated RegExp can be more precise?
|
||||
regExp = new RegExp(`^${quotemeta(prefix)}${options.wrappedContextRegExp.source}${quotemeta(postfix)}$`);
|
||||
dep = new Dep(context, options.wrappedContextRecursive, regExp, range, valueRange, chunkName);
|
||||
dep.loc = expr.loc;
|
||||
dep.replaces = [{
|
||||
range: prefixRange,
|
||||
value: prefix
|
||||
}];
|
||||
dep.critical = options.wrappedContextCritical && "a part of the request of a dependency is an expression";
|
||||
return dep;
|
||||
} else if(param.isWrapped() && (param.prefix && param.prefix.isString() || param.postfix && param.postfix.isString())) {
|
||||
prefix = param.prefix && param.prefix.isString() ? param.prefix.string : "";
|
||||
postfix = param.postfix && param.postfix.isString() ? param.postfix.string : "";
|
||||
prefixRange = param.prefix && param.prefix.isString() ? param.prefix.range : null;
|
||||
valueRange = [prefixRange ? prefixRange[1] : param.range[0], param.range[1]];
|
||||
idx = prefix.lastIndexOf("/");
|
||||
context = ".";
|
||||
if(idx >= 0) {
|
||||
context = prefix.substr(0, idx);
|
||||
prefix = `.${prefix.substr(idx)}`;
|
||||
}
|
||||
regExp = new RegExp(`^${quotemeta(prefix)}${options.wrappedContextRegExp.source}${quotemeta(postfix)}$`);
|
||||
dep = new Dep(context, options.wrappedContextRecursive, regExp, range, valueRange, chunkName);
|
||||
dep.loc = expr.loc;
|
||||
dep.prepend = param.prefix && param.prefix.isString() ? prefix : null;
|
||||
dep.critical = options.wrappedContextCritical && "a part of the request of a dependency is an expression";
|
||||
return dep;
|
||||
} else {
|
||||
dep = new Dep(options.exprContextRequest, options.exprContextRecursive, options.exprContextRegExp, range, param.range, chunkName);
|
||||
dep.loc = expr.loc;
|
||||
dep.critical = options.exprContextCritical && "the request of a dependency is an expression";
|
||||
return dep;
|
||||
}
|
||||
};
|
||||
32
hGameTest/node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsId.js
generated
vendored
Normal file
32
hGameTest/node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsId.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class ContextDependencyTemplateAsId {
|
||||
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
const comment = outputOptions.pathinfo ?
|
||||
"/*! " + requestShortener.shorten(dep.request) + " */ " : "";
|
||||
|
||||
if(dep.module && dep.module.dependencies && dep.module.dependencies.length > 0) {
|
||||
if(dep.valueRange) {
|
||||
if(Array.isArray(dep.replaces)) {
|
||||
for(let i = 0; i < dep.replaces.length; i++) {
|
||||
const rep = dep.replaces[i];
|
||||
source.replace(rep.range[0], rep.range[1] - 1, rep.value);
|
||||
}
|
||||
}
|
||||
source.replace(dep.valueRange[1], dep.range[1] - 1, ")");
|
||||
source.replace(dep.range[0], dep.valueRange[0] - 1, "__webpack_require__(" + comment + JSON.stringify(dep.module.id) + ").resolve(" + (typeof dep.prepend === "string" ? JSON.stringify(dep.prepend) : "") + "");
|
||||
} else {
|
||||
source.replace(dep.range[0], dep.range[1] - 1, "__webpack_require__(" + comment + JSON.stringify(dep.module.id) + ").resolve");
|
||||
}
|
||||
} else {
|
||||
const content = require("./WebpackMissingModule").module(dep.request);
|
||||
source.replace(dep.range[0], dep.range[1] - 1, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = ContextDependencyTemplateAsId;
|
||||
34
hGameTest/node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsRequireCall.js
generated
vendored
Normal file
34
hGameTest/node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsRequireCall.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class ContextDependencyTemplateAsRequireCall {
|
||||
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
const comment = outputOptions.pathinfo ?
|
||||
"/*! " + requestShortener.shorten(dep.request) + " */ " : "";
|
||||
|
||||
const containsDeps = dep.module && dep.module.dependencies && dep.module.dependencies.length > 0;
|
||||
const isAsync = dep.module && dep.module.async;
|
||||
if(dep.module && (isAsync || containsDeps)) {
|
||||
if(dep.valueRange) {
|
||||
if(Array.isArray(dep.replaces)) {
|
||||
for(let i = 0; i < dep.replaces.length; i++) {
|
||||
const rep = dep.replaces[i];
|
||||
source.replace(rep.range[0], rep.range[1] - 1, rep.value);
|
||||
}
|
||||
}
|
||||
source.replace(dep.valueRange[1], dep.range[1] - 1, ")");
|
||||
source.replace(dep.range[0], dep.valueRange[0] - 1, "__webpack_require__(" + comment + JSON.stringify(dep.module.id) + ")(" + (typeof dep.prepend === "string" ? JSON.stringify(dep.prepend) : "") + "");
|
||||
} else {
|
||||
source.replace(dep.range[0], dep.range[1] - 1, "__webpack_require__(" + comment + JSON.stringify(dep.module.id) + ")");
|
||||
}
|
||||
} else {
|
||||
const content = require("./WebpackMissingModule").module(dep.request);
|
||||
source.replace(dep.range[0], dep.range[1] - 1, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = ContextDependencyTemplateAsRequireCall;
|
||||
21
hGameTest/node_modules/webpack/lib/dependencies/ContextElementDependency.js
generated
vendored
Normal file
21
hGameTest/node_modules/webpack/lib/dependencies/ContextElementDependency.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
class ContextElementDependency extends ModuleDependency {
|
||||
constructor(request, userRequest) {
|
||||
super(request);
|
||||
if(userRequest) {
|
||||
this.userRequest = userRequest;
|
||||
}
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "context element";
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ContextElementDependency;
|
||||
20
hGameTest/node_modules/webpack/lib/dependencies/CriticalDependencyWarning.js
generated
vendored
Normal file
20
hGameTest/node_modules/webpack/lib/dependencies/CriticalDependencyWarning.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const WebpackError = require("../WebpackError");
|
||||
|
||||
class CriticalDependencyWarning extends WebpackError {
|
||||
constructor(message) {
|
||||
super();
|
||||
|
||||
this.name = "CriticalDependencyWarning";
|
||||
this.message = "Critical dependency: " + message;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CriticalDependencyWarning;
|
||||
33
hGameTest/node_modules/webpack/lib/dependencies/DelegatedExportsDependency.js
generated
vendored
Normal file
33
hGameTest/node_modules/webpack/lib/dependencies/DelegatedExportsDependency.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
class DelegatedExportsDependency extends NullDependency {
|
||||
constructor(originModule, exports) {
|
||||
super();
|
||||
this.originModule = originModule;
|
||||
this.exports = exports;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "delegated exports";
|
||||
}
|
||||
|
||||
getReference() {
|
||||
return {
|
||||
module: this.originModule,
|
||||
importedNames: true
|
||||
};
|
||||
}
|
||||
|
||||
getExports() {
|
||||
return {
|
||||
exports: this.exports
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DelegatedExportsDependency;
|
||||
18
hGameTest/node_modules/webpack/lib/dependencies/DelegatedSourceDependency.js
generated
vendored
Normal file
18
hGameTest/node_modules/webpack/lib/dependencies/DelegatedSourceDependency.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
class DelegatedSourceDependency extends ModuleDependency {
|
||||
constructor(request) {
|
||||
super(request);
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "delegated source";
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DelegatedSourceDependency;
|
||||
39
hGameTest/node_modules/webpack/lib/dependencies/DepBlockHelpers.js
generated
vendored
Normal file
39
hGameTest/node_modules/webpack/lib/dependencies/DepBlockHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const DepBlockHelpers = exports;
|
||||
|
||||
DepBlockHelpers.getLoadDepBlockWrapper = (depBlock, outputOptions, requestShortener, name) => {
|
||||
const promiseCode = DepBlockHelpers.getDepBlockPromise(depBlock, outputOptions, requestShortener, name);
|
||||
return [
|
||||
promiseCode + ".then(",
|
||||
").catch(",
|
||||
")"
|
||||
];
|
||||
};
|
||||
|
||||
DepBlockHelpers.getDepBlockPromise = (depBlock, outputOptions, requestShortener, name) => {
|
||||
if(depBlock.chunks) {
|
||||
const chunks = depBlock.chunks.filter(chunk => !chunk.hasRuntime() && chunk.id !== null);
|
||||
const pathChunkCheck = outputOptions.pathinfo && depBlock.chunkName;
|
||||
const shortChunkName = requestShortener.shorten(depBlock.chunkName);
|
||||
const chunkReason = asComment(depBlock.chunkReason);
|
||||
const requireChunkId = chunk => "__webpack_require__.e(" + JSON.stringify(chunk.id) + ")";
|
||||
name = asComment(name);
|
||||
if(chunks.length === 1) {
|
||||
const chunkId = JSON.stringify(chunks[0].id);
|
||||
return `__webpack_require__.e${name}(${chunkId}${pathChunkCheck ? "/*! " + shortChunkName + " */" : ""}${chunkReason})`;
|
||||
} else if(chunks.length > 0) {
|
||||
return `Promise.all${name}(${pathChunkCheck ? "/*! " + shortChunkName + " */" : ""}[${chunks.map(requireChunkId).join(", ")}])`;
|
||||
}
|
||||
}
|
||||
return "new Promise(function(resolve) { resolve(); })";
|
||||
};
|
||||
|
||||
function asComment(str) {
|
||||
if(!str) return "";
|
||||
return `/* ${str} */`;
|
||||
}
|
||||
20
hGameTest/node_modules/webpack/lib/dependencies/DllEntryDependency.js
generated
vendored
Normal file
20
hGameTest/node_modules/webpack/lib/dependencies/DllEntryDependency.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const Dependency = require("../Dependency");
|
||||
|
||||
class DllEntryDependency extends Dependency {
|
||||
constructor(dependencies, name) {
|
||||
super();
|
||||
this.dependencies = dependencies;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "dll entry";
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DllEntryDependency;
|
||||
42
hGameTest/node_modules/webpack/lib/dependencies/HarmonyAcceptDependency.js
generated
vendored
Normal file
42
hGameTest/node_modules/webpack/lib/dependencies/HarmonyAcceptDependency.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
const makeHarmonyImportStatement = require("./HarmonyImportDependency").makeImportStatement;
|
||||
|
||||
class HarmonyAcceptDependency extends NullDependency {
|
||||
constructor(range, dependencies, hasCallback) {
|
||||
super();
|
||||
this.range = range;
|
||||
this.dependencies = dependencies;
|
||||
this.hasCallback = hasCallback;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "accepted harmony modules";
|
||||
}
|
||||
}
|
||||
|
||||
HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate {
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
const content = dep.dependencies
|
||||
.map(dependency => makeHarmonyImportStatement(
|
||||
false,
|
||||
dependency,
|
||||
outputOptions,
|
||||
requestShortener
|
||||
)).join("");
|
||||
|
||||
if(dep.hasCallback) {
|
||||
source.insert(dep.range[0], `function(__WEBPACK_OUTDATED_DEPENDENCIES__) { ${content}(`);
|
||||
source.insert(dep.range[1], ")(__WEBPACK_OUTDATED_DEPENDENCIES__); }");
|
||||
return;
|
||||
}
|
||||
|
||||
source.insert(dep.range[1] - 0.5, `, function() { ${content} }`);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HarmonyAcceptDependency;
|
||||
22
hGameTest/node_modules/webpack/lib/dependencies/HarmonyAcceptImportDependency.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/dependencies/HarmonyAcceptImportDependency.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const HarmonyImportDependency = require("./HarmonyImportDependency");
|
||||
|
||||
class HarmonyAcceptImportDependency extends HarmonyImportDependency {
|
||||
constructor(request, importedVar, range) {
|
||||
super(request, importedVar, range);
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "harmony accept";
|
||||
}
|
||||
}
|
||||
|
||||
HarmonyAcceptImportDependency.Template = class HarmonyAcceptImportDependencyTemplate {
|
||||
apply(dep, source, outputOptions, requestShortener) {}
|
||||
};
|
||||
|
||||
module.exports = HarmonyAcceptImportDependency;
|
||||
30
hGameTest/node_modules/webpack/lib/dependencies/HarmonyCompatibilityDependency.js
generated
vendored
Normal file
30
hGameTest/node_modules/webpack/lib/dependencies/HarmonyCompatibilityDependency.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
class HarmonyCompatibilityDependency extends NullDependency {
|
||||
constructor(originModule) {
|
||||
super();
|
||||
this.originModule = originModule;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "harmony export header";
|
||||
}
|
||||
}
|
||||
|
||||
HarmonyCompatibilityDependency.Template = class HarmonyExportDependencyTemplate {
|
||||
apply(dep, source) {
|
||||
const usedExports = dep.originModule.usedExports;
|
||||
if(usedExports && !Array.isArray(usedExports)) {
|
||||
const exportName = dep.originModule.exportsArgument || "exports";
|
||||
const content = `Object.defineProperty(${exportName}, "__esModule", { value: true });\n`;
|
||||
source.insert(-10, content);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HarmonyCompatibilityDependency;
|
||||
56
hGameTest/node_modules/webpack/lib/dependencies/HarmonyDetectionParserPlugin.js
generated
vendored
Normal file
56
hGameTest/node_modules/webpack/lib/dependencies/HarmonyDetectionParserPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const HarmonyCompatibilityDependency = require("./HarmonyCompatibilityDependency");
|
||||
|
||||
module.exports = class HarmonyDetectionParserPlugin {
|
||||
apply(parser) {
|
||||
parser.plugin("program", (ast) => {
|
||||
const isHarmony = ast.body.some(statement => {
|
||||
return /^(Import|Export).*Declaration$/.test(statement.type);
|
||||
});
|
||||
if(isHarmony) {
|
||||
const module = parser.state.module;
|
||||
const dep = new HarmonyCompatibilityDependency(module);
|
||||
dep.loc = {
|
||||
start: {
|
||||
line: -1,
|
||||
column: 0
|
||||
},
|
||||
end: {
|
||||
line: -1,
|
||||
column: 0
|
||||
},
|
||||
index: -2
|
||||
};
|
||||
module.addDependency(dep);
|
||||
module.meta.harmonyModule = true;
|
||||
module.strict = true;
|
||||
module.exportsArgument = "__webpack_exports__";
|
||||
}
|
||||
});
|
||||
const nonHarmonyIdentifiers = ["define", "exports"];
|
||||
nonHarmonyIdentifiers.forEach(identifer => {
|
||||
parser.plugin(`evaluate typeof ${identifer}`, nullInHarmony);
|
||||
parser.plugin(`typeof ${identifer}`, skipInHarmony);
|
||||
parser.plugin(`evaluate ${identifer}`, nullInHarmony);
|
||||
parser.plugin(`expression ${identifer}`, skipInHarmony);
|
||||
parser.plugin(`call ${identifer}`, skipInHarmony);
|
||||
});
|
||||
|
||||
function skipInHarmony() {
|
||||
const module = this.state.module;
|
||||
if(module && module.meta && module.meta.harmonyModule)
|
||||
return true;
|
||||
}
|
||||
|
||||
function nullInHarmony() {
|
||||
const module = this.state.module;
|
||||
if(module && module.meta && module.meta.harmonyModule)
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
87
hGameTest/node_modules/webpack/lib/dependencies/HarmonyExportDependencyParserPlugin.js
generated
vendored
Normal file
87
hGameTest/node_modules/webpack/lib/dependencies/HarmonyExportDependencyParserPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const HarmonyExportExpressionDependency = require("./HarmonyExportExpressionDependency");
|
||||
const HarmonyExportHeaderDependency = require("./HarmonyExportHeaderDependency");
|
||||
const HarmonyExportSpecifierDependency = require("./HarmonyExportSpecifierDependency");
|
||||
const HarmonyExportImportedSpecifierDependency = require("./HarmonyExportImportedSpecifierDependency");
|
||||
const HarmonyImportDependency = require("./HarmonyImportDependency");
|
||||
const HarmonyModulesHelpers = require("./HarmonyModulesHelpers");
|
||||
|
||||
module.exports = class HarmonyExportDependencyParserPlugin {
|
||||
apply(parser) {
|
||||
parser.plugin("export", statement => {
|
||||
const dep = new HarmonyExportHeaderDependency(statement.declaration && statement.declaration.range, statement.range);
|
||||
dep.loc = Object.create(statement.loc);
|
||||
dep.loc.index = -1;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
parser.plugin("export import", (statement, source) => {
|
||||
const dep = new HarmonyImportDependency(source, HarmonyModulesHelpers.getNewModuleVar(parser.state, source), statement.range);
|
||||
dep.loc = Object.create(statement.loc);
|
||||
dep.loc.index = -1;
|
||||
parser.state.current.addDependency(dep);
|
||||
parser.state.lastHarmonyImport = dep;
|
||||
return true;
|
||||
});
|
||||
parser.plugin("export expression", (statement, expr) => {
|
||||
const dep = new HarmonyExportExpressionDependency(parser.state.module, expr.range, statement.range);
|
||||
dep.loc = Object.create(statement.loc);
|
||||
dep.loc.index = -1;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
parser.plugin("export declaration", statement => {});
|
||||
parser.plugin("export specifier", (statement, id, name, idx) => {
|
||||
const rename = parser.scope.renames[`$${id}`];
|
||||
let dep;
|
||||
const harmonyNamedExports = parser.state.harmonyNamedExports = parser.state.harmonyNamedExports || new Set();
|
||||
harmonyNamedExports.add(name);
|
||||
if(rename === "imported var") {
|
||||
const settings = parser.state.harmonySpecifier[`$${id}`];
|
||||
dep = new HarmonyExportImportedSpecifierDependency(parser.state.module, settings[0], settings[1], settings[2], name, harmonyNamedExports, null);
|
||||
} else {
|
||||
const immutable = statement.declaration && isImmutableStatement(statement.declaration);
|
||||
const hoisted = statement.declaration && isHoistedStatement(statement.declaration);
|
||||
dep = new HarmonyExportSpecifierDependency(parser.state.module, id, name, !immutable || hoisted ? -2 : (statement.range[1] + 0.5), immutable);
|
||||
}
|
||||
dep.loc = Object.create(statement.loc);
|
||||
dep.loc.index = idx;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
parser.plugin("export import specifier", (statement, source, id, name, idx) => {
|
||||
const harmonyNamedExports = parser.state.harmonyNamedExports = parser.state.harmonyNamedExports || new Set();
|
||||
let harmonyStarExports = null;
|
||||
if(name) {
|
||||
harmonyNamedExports.add(name);
|
||||
} else {
|
||||
harmonyStarExports = parser.state.harmonyStarExports = parser.state.harmonyStarExports || [];
|
||||
}
|
||||
const dep = new HarmonyExportImportedSpecifierDependency(parser.state.module, parser.state.lastHarmonyImport, HarmonyModulesHelpers.getModuleVar(parser.state, source), id, name, harmonyNamedExports, harmonyStarExports && harmonyStarExports.slice());
|
||||
if(harmonyStarExports) {
|
||||
harmonyStarExports.push(dep);
|
||||
}
|
||||
dep.loc = Object.create(statement.loc);
|
||||
dep.loc.index = idx;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function isImmutableStatement(statement) {
|
||||
if(statement.type === "FunctionDeclaration") return true;
|
||||
if(statement.type === "ClassDeclaration") return true;
|
||||
if(statement.type === "VariableDeclaration" && statement.kind === "const") return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function isHoistedStatement(statement) {
|
||||
if(statement.type === "FunctionDeclaration") return true;
|
||||
return false;
|
||||
}
|
||||
50
hGameTest/node_modules/webpack/lib/dependencies/HarmonyExportExpressionDependency.js
generated
vendored
Normal file
50
hGameTest/node_modules/webpack/lib/dependencies/HarmonyExportExpressionDependency.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
class HarmonyExportExpressionDependency extends NullDependency {
|
||||
constructor(originModule, range, rangeStatement) {
|
||||
super();
|
||||
this.originModule = originModule;
|
||||
this.range = range;
|
||||
this.rangeStatement = rangeStatement;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "harmony export expression";
|
||||
}
|
||||
|
||||
getExports() {
|
||||
return {
|
||||
exports: ["default"]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTemplate {
|
||||
apply(dep, source) {
|
||||
const used = dep.originModule.isUsed("default");
|
||||
const content = this.getContent(dep.originModule, used);
|
||||
|
||||
if(dep.range) {
|
||||
source.replace(dep.rangeStatement[0], dep.range[0] - 1, content + "(");
|
||||
source.replace(dep.range[1], dep.rangeStatement[1] - 1, ");");
|
||||
return;
|
||||
}
|
||||
|
||||
source.replace(dep.rangeStatement[0], dep.rangeStatement[1] - 1, content);
|
||||
}
|
||||
|
||||
getContent(module, used) {
|
||||
const exportsName = module.exportsArgument || "exports";
|
||||
if(used) {
|
||||
return `/* harmony default export */ ${exportsName}[${JSON.stringify(used)}] = `;
|
||||
}
|
||||
return "/* unused harmony default export */ var _unused_webpack_default_export = ";
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HarmonyExportExpressionDependency;
|
||||
28
hGameTest/node_modules/webpack/lib/dependencies/HarmonyExportHeaderDependency.js
generated
vendored
Normal file
28
hGameTest/node_modules/webpack/lib/dependencies/HarmonyExportHeaderDependency.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
class HarmonyExportHeaderDependency extends NullDependency {
|
||||
constructor(range, rangeStatement) {
|
||||
super();
|
||||
this.range = range;
|
||||
this.rangeStatement = rangeStatement;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "harmony export header";
|
||||
}
|
||||
}
|
||||
|
||||
HarmonyExportHeaderDependency.Template = class HarmonyExportDependencyTemplate {
|
||||
apply(dep, source) {
|
||||
const content = "";
|
||||
const replaceUntil = dep.range ? dep.range[0] - 1 : dep.rangeStatement[1] - 1;
|
||||
source.replace(dep.rangeStatement[0], replaceUntil, content);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HarmonyExportHeaderDependency;
|
||||
285
hGameTest/node_modules/webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency.js
generated
vendored
Normal file
285
hGameTest/node_modules/webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency.js
generated
vendored
Normal file
@@ -0,0 +1,285 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
class HarmonyExportImportedSpecifierDependency extends NullDependency {
|
||||
constructor(originModule, importDependency, importedVar, id, name, activeExports, otherStarExports) {
|
||||
super();
|
||||
this.originModule = originModule;
|
||||
this.importDependency = importDependency;
|
||||
this.importedVar = importedVar;
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.activeExports = activeExports;
|
||||
this.otherStarExports = otherStarExports;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "harmony export imported specifier";
|
||||
}
|
||||
|
||||
getReference() {
|
||||
const name = this.name;
|
||||
const used = this.originModule.isUsed(name);
|
||||
const importedModule = this.importDependency.module;
|
||||
|
||||
if(!importedModule || !used || !this.originModule.usedExports) return null;
|
||||
|
||||
const hasUsedExports = Array.isArray(this.originModule.usedExports);
|
||||
|
||||
if(name) {
|
||||
const nameIsNotInUsedExports = hasUsedExports && this.originModule.usedExports.indexOf(name) < 0;
|
||||
if(nameIsNotInUsedExports) return null;
|
||||
|
||||
// export { name as name }
|
||||
if(this.id) {
|
||||
return {
|
||||
module: importedModule,
|
||||
importedNames: [this.id]
|
||||
};
|
||||
}
|
||||
|
||||
// export { * as name }
|
||||
return {
|
||||
module: importedModule,
|
||||
importedNames: true
|
||||
};
|
||||
}
|
||||
|
||||
const hasProvidedExports = Array.isArray(importedModule.providedExports);
|
||||
const activeFromOtherStarExports = this._discoverActiveExportsFromOtherStartExports();
|
||||
|
||||
// export *
|
||||
if(hasUsedExports) {
|
||||
// reexport * with known used exports
|
||||
const importedNames = this.originModule.usedExports.filter(id => {
|
||||
if(id === "default") return false;
|
||||
if(this.activeExports.has(id)) return false;
|
||||
if(activeFromOtherStarExports.has(id)) return false;
|
||||
if(hasProvidedExports && importedModule.providedExports.indexOf(id) < 0) return false;
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
return {
|
||||
module: importedModule,
|
||||
importedNames
|
||||
};
|
||||
}
|
||||
|
||||
if(hasProvidedExports) {
|
||||
return {
|
||||
module: importedModule,
|
||||
importedNames: importedModule.providedExports.filter(id => {
|
||||
if(id === "default") return false;
|
||||
if(this.activeExports.has(id)) return false;
|
||||
if(activeFromOtherStarExports.has(id)) return false;
|
||||
|
||||
return true;
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
module: importedModule,
|
||||
importedNames: true,
|
||||
};
|
||||
}
|
||||
|
||||
_discoverActiveExportsFromOtherStartExports() {
|
||||
if(!this.otherStarExports)
|
||||
return new Set();
|
||||
const result = new Set();
|
||||
// try to learn impossible exports from other star exports with provided exports
|
||||
for(const otherStarExport of this.otherStarExports) {
|
||||
const otherImportedModule = otherStarExport.importDependency.module;
|
||||
if(otherImportedModule && Array.isArray(otherImportedModule.providedExports)) {
|
||||
for(const exportName of otherImportedModule.providedExports)
|
||||
result.add(exportName);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
getExports() {
|
||||
if(this.name) {
|
||||
return {
|
||||
exports: [this.name]
|
||||
};
|
||||
}
|
||||
|
||||
const importedModule = this.importDependency.module;
|
||||
|
||||
if(!importedModule) {
|
||||
// no imported module available
|
||||
return {
|
||||
exports: null
|
||||
};
|
||||
}
|
||||
|
||||
if(Array.isArray(importedModule.providedExports)) {
|
||||
return {
|
||||
exports: importedModule.providedExports.filter(id => id !== "default"),
|
||||
dependencies: [importedModule]
|
||||
};
|
||||
}
|
||||
|
||||
if(importedModule.providedExports) {
|
||||
return {
|
||||
exports: true
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
exports: null,
|
||||
dependencies: [importedModule]
|
||||
};
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
super.updateHash(hash);
|
||||
const hashValue = this.getHashValue(this.importDependency.module);
|
||||
hash.update(hashValue);
|
||||
}
|
||||
|
||||
getHashValue(importedModule) {
|
||||
if(!importedModule) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const stringifiedUsedExport = JSON.stringify(importedModule.usedExports);
|
||||
const stringifiedProvidedExport = JSON.stringify(importedModule.providedExports);
|
||||
return importedModule.used + stringifiedUsedExport + stringifiedProvidedExport;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HarmonyExportImportedSpecifierDependency;
|
||||
|
||||
HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedSpecifierDependencyTemplate {
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
const content = this.getContent(dep);
|
||||
source.insert(-1, content);
|
||||
}
|
||||
|
||||
getContent(dep) {
|
||||
const name = dep.importedVar;
|
||||
const used = dep.originModule.isUsed(dep.name);
|
||||
const importedModule = dep.importDependency.module;
|
||||
const importsExportsUnknown = !importedModule || !Array.isArray(importedModule.providedExports);
|
||||
|
||||
const getReexportStatement = this.reexportStatementCreator(dep.originModule, importsExportsUnknown, name);
|
||||
|
||||
// we want to rexport something, but the export isn't used
|
||||
if(!used) {
|
||||
return "/* unused harmony reexport " + dep.name + " */\n";
|
||||
}
|
||||
|
||||
// we want to reexport the default export from a non-hamory module
|
||||
const isNotAHarmonyModule = !(importedModule && (!importedModule.meta || importedModule.meta.harmonyModule));
|
||||
if(dep.name && dep.id === "default" && isNotAHarmonyModule) {
|
||||
return "/* harmony reexport (default from non-hamory) */ " + getReexportStatement(JSON.stringify(used), null);
|
||||
}
|
||||
|
||||
// we want to reexport a key as new key
|
||||
if(dep.name && dep.id) {
|
||||
var idUsed = importedModule && importedModule.isUsed(dep.id);
|
||||
return "/* harmony reexport (binding) */ " + getReexportStatement(JSON.stringify(used), JSON.stringify(idUsed));
|
||||
}
|
||||
|
||||
// we want to reexport the module object as named export
|
||||
if(dep.name) {
|
||||
return "/* harmony reexport (module object) */ " + getReexportStatement(JSON.stringify(used), "");
|
||||
}
|
||||
|
||||
const hasProvidedExports = importedModule && Array.isArray(importedModule.providedExports);
|
||||
|
||||
const activeFromOtherStarExports = dep._discoverActiveExportsFromOtherStartExports();
|
||||
|
||||
// we know which exports are used
|
||||
if(Array.isArray(dep.originModule.usedExports)) {
|
||||
const items = dep.originModule.usedExports.map(id => {
|
||||
if(id === "default") return;
|
||||
if(dep.activeExports.has(id)) return;
|
||||
if(importedModule.isProvided(id) === false) return;
|
||||
if(activeFromOtherStarExports.has(id)) return;
|
||||
var exportUsed = dep.originModule.isUsed(id);
|
||||
var idUsed = importedModule && importedModule.isUsed(id);
|
||||
return [exportUsed, idUsed];
|
||||
}).filter(Boolean);
|
||||
|
||||
if(items.length === 0) {
|
||||
return "/* unused harmony namespace reexport */\n";
|
||||
}
|
||||
|
||||
return items.map(function(item) {
|
||||
return "/* harmony namespace reexport (by used) */ " + getReexportStatement(JSON.stringify(item[0]), JSON.stringify(item[1]));
|
||||
}).join("");
|
||||
}
|
||||
|
||||
// not sure which exports are used, but we know which are provided
|
||||
if(dep.originModule.usedExports && importedModule && hasProvidedExports) {
|
||||
const items = importedModule.providedExports.map(id => {
|
||||
if(id === "default") return;
|
||||
if(dep.activeExports.has(id)) return;
|
||||
if(activeFromOtherStarExports.has(id)) return;
|
||||
var exportUsed = dep.originModule.isUsed(id);
|
||||
var idUsed = importedModule && importedModule.isUsed(id);
|
||||
return [exportUsed, idUsed];
|
||||
}).filter(Boolean);
|
||||
|
||||
if(items.length === 0) {
|
||||
return "/* empty harmony namespace reexport */\n";
|
||||
}
|
||||
|
||||
return items.map(function(item) {
|
||||
return "/* harmony namespace reexport (by provided) */ " + getReexportStatement(JSON.stringify(item[0]), JSON.stringify(item[1]));
|
||||
}).join("");
|
||||
}
|
||||
|
||||
// not sure which exports are used and provided
|
||||
if(dep.originModule.usedExports) {
|
||||
const activeExports = Array.from(dep.activeExports).concat(Array.from(activeFromOtherStarExports));
|
||||
let content = "/* harmony namespace reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in " + name + ") ";
|
||||
|
||||
// Filter out exports which are defined by other exports
|
||||
// and filter out default export because it cannot be reexported with *
|
||||
if(activeExports.length > 0)
|
||||
content += "if(" + JSON.stringify(activeExports.concat("default")) + ".indexOf(__WEBPACK_IMPORT_KEY__) < 0) ";
|
||||
else
|
||||
content += "if(__WEBPACK_IMPORT_KEY__ !== 'default') ";
|
||||
const exportsName = dep.originModule.exportsArgument || "exports";
|
||||
return content + `(function(key) { __webpack_require__.d(${exportsName}, key, function() { return ${name}[key]; }) }(__WEBPACK_IMPORT_KEY__));\n`;
|
||||
}
|
||||
|
||||
return "/* unused harmony reexport namespace */\n";
|
||||
}
|
||||
|
||||
reexportStatementCreator(module, importsExportsUnknown, name) {
|
||||
const exportsName = module.exportsArgument || "exports";
|
||||
const getReexportStatement = (key, valueKey) => {
|
||||
const conditional = this.getConditional(importsExportsUnknown, valueKey, name);
|
||||
const returnValue = this.getReturnValue(valueKey);
|
||||
return `${conditional}__webpack_require__.d(${exportsName}, ${key}, function() { return ${name}${returnValue}; });\n`;
|
||||
};
|
||||
return getReexportStatement;
|
||||
}
|
||||
|
||||
getConditional(importsExportsUnknown, valueKey, name) {
|
||||
if(!importsExportsUnknown || !valueKey) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return `if(__webpack_require__.o(${name}, ${valueKey})) `;
|
||||
}
|
||||
|
||||
getReturnValue(valueKey) {
|
||||
if(valueKey === null) {
|
||||
return "_default.a";
|
||||
}
|
||||
|
||||
return valueKey && "[" + valueKey + "]";
|
||||
}
|
||||
};
|
||||
54
hGameTest/node_modules/webpack/lib/dependencies/HarmonyExportSpecifierDependency.js
generated
vendored
Normal file
54
hGameTest/node_modules/webpack/lib/dependencies/HarmonyExportSpecifierDependency.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
class HarmonyExportSpecifierDependency extends NullDependency {
|
||||
constructor(originModule, id, name, position, immutable) {
|
||||
super();
|
||||
this.originModule = originModule;
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.position = position;
|
||||
this.immutable = immutable;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "harmony export specifier";
|
||||
}
|
||||
|
||||
getExports() {
|
||||
return {
|
||||
exports: [this.name]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
HarmonyExportSpecifierDependency.Template = class HarmonyExportSpecifierDependencyTemplate {
|
||||
apply(dep, source) {
|
||||
const content = this.getPrefix(dep) + this.getContent(dep);
|
||||
source.insert(dep.position, content);
|
||||
}
|
||||
|
||||
getPrefix(dep) {
|
||||
return dep.position > 0 ? "\n" : "";
|
||||
}
|
||||
|
||||
getContent(dep) {
|
||||
const used = dep.originModule.isUsed(dep.name);
|
||||
if(!used) {
|
||||
return `/* unused harmony export ${(dep.name || "namespace")} */\n`;
|
||||
}
|
||||
|
||||
const exportsName = dep.originModule.exportsArgument || "exports";
|
||||
if(dep.immutable) {
|
||||
return `/* harmony export (immutable) */ ${exportsName}[${JSON.stringify(used)}] = ${dep.id};\n`;
|
||||
}
|
||||
|
||||
return `/* harmony export (binding) */ __webpack_require__.d(${exportsName}, ${JSON.stringify(used)}, function() { return ${dep.id}; });\n`;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HarmonyExportSpecifierDependency;
|
||||
72
hGameTest/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js
generated
vendored
Normal file
72
hGameTest/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
class HarmonyImportDependency extends ModuleDependency {
|
||||
constructor(request, importedVar, range) {
|
||||
super(request);
|
||||
this.range = range;
|
||||
this.importedVar = importedVar;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "harmony import";
|
||||
}
|
||||
|
||||
getReference() {
|
||||
if(!this.module) return null;
|
||||
|
||||
return {
|
||||
module: this.module,
|
||||
importedNames: false
|
||||
};
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
super.updateHash(hash);
|
||||
hash.update((this.module && (!this.module.meta || this.module.meta.harmonyModule)) + "");
|
||||
}
|
||||
}
|
||||
|
||||
HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate {
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
const content = makeImportStatement(true, dep, outputOptions, requestShortener);
|
||||
source.replace(dep.range[0], dep.range[1] - 1, "");
|
||||
source.insert(-1, content);
|
||||
}
|
||||
};
|
||||
|
||||
function getOptionalComment(pathinfo, shortenedRequest) {
|
||||
if(!pathinfo) {
|
||||
return "";
|
||||
}
|
||||
return `/*! ${shortenedRequest} */ `;
|
||||
}
|
||||
|
||||
function makeImportStatement(declare, dep, outputOptions, requestShortener) {
|
||||
const comment = getOptionalComment(outputOptions.pathinfo, requestShortener.shorten(dep.request));
|
||||
const declaration = declare ? "var " : "";
|
||||
const newline = declare ? "\n" : " ";
|
||||
|
||||
if(!dep.module) {
|
||||
const stringifiedError = JSON.stringify(`Cannot find module "${dep.request}"`);
|
||||
return `throw new Error(${stringifiedError});${newline}`;
|
||||
}
|
||||
|
||||
if(dep.importedVar) {
|
||||
const isHarmonyModule = dep.module.meta && dep.module.meta.harmonyModule;
|
||||
const content = `/* harmony import */ ${declaration}${dep.importedVar} = __webpack_require__(${comment}${JSON.stringify(dep.module.id)});${newline}`;
|
||||
if(isHarmonyModule) {
|
||||
return content;
|
||||
}
|
||||
return `${content}/* harmony import */ ${declaration}${dep.importedVar}_default = __webpack_require__.n(${dep.importedVar});${newline}`;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
HarmonyImportDependency.makeImportStatement = makeImportStatement;
|
||||
|
||||
module.exports = HarmonyImportDependency;
|
||||
124
hGameTest/node_modules/webpack/lib/dependencies/HarmonyImportDependencyParserPlugin.js
generated
vendored
Normal file
124
hGameTest/node_modules/webpack/lib/dependencies/HarmonyImportDependencyParserPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const HarmonyImportDependency = require("./HarmonyImportDependency");
|
||||
const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDependency");
|
||||
const HarmonyAcceptImportDependency = require("./HarmonyAcceptImportDependency");
|
||||
const HarmonyAcceptDependency = require("./HarmonyAcceptDependency");
|
||||
const HarmonyModulesHelpers = require("./HarmonyModulesHelpers");
|
||||
|
||||
module.exports = class HarmonyImportDependencyParserPlugin {
|
||||
constructor(moduleOptions) {
|
||||
this.strictExportPresence = moduleOptions.strictExportPresence;
|
||||
this.strictThisContextOnImports = moduleOptions.strictThisContextOnImports;
|
||||
}
|
||||
|
||||
apply(parser) {
|
||||
parser.plugin("import", (statement, source) => {
|
||||
const dep = new HarmonyImportDependency(source, HarmonyModulesHelpers.getNewModuleVar(parser.state, source), statement.range);
|
||||
dep.loc = statement.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
parser.state.lastHarmonyImport = dep;
|
||||
return true;
|
||||
});
|
||||
parser.plugin("import specifier", (statement, source, id, name) => {
|
||||
parser.scope.definitions.length--;
|
||||
parser.scope.renames[`$${name}`] = "imported var";
|
||||
if(!parser.state.harmonySpecifier) parser.state.harmonySpecifier = {};
|
||||
parser.state.harmonySpecifier[`$${name}`] = [parser.state.lastHarmonyImport, HarmonyModulesHelpers.getModuleVar(parser.state, source), id];
|
||||
return true;
|
||||
});
|
||||
parser.plugin("expression imported var", (expr) => {
|
||||
const name = expr.name;
|
||||
const settings = parser.state.harmonySpecifier[`$${name}`];
|
||||
const dep = new HarmonyImportSpecifierDependency(settings[0], settings[1], settings[2], name, expr.range, this.strictExportPresence);
|
||||
dep.shorthand = parser.scope.inShorthand;
|
||||
dep.directImport = true;
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
parser.plugin("expression imported var.*", (expr) => {
|
||||
const name = expr.object.name;
|
||||
const settings = parser.state.harmonySpecifier[`$${name}`];
|
||||
if(settings[2] !== null)
|
||||
return false;
|
||||
const dep = new HarmonyImportSpecifierDependency(settings[0], settings[1], expr.property.name || expr.property.value, name, expr.range, this.strictExportPresence);
|
||||
dep.shorthand = parser.scope.inShorthand;
|
||||
dep.directImport = false;
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
if(this.strictThisContextOnImports) {
|
||||
// only in case when we strictly follow the spec we need a special case here
|
||||
parser.plugin("call imported var.*", (expr) => {
|
||||
if(expr.callee.type !== "MemberExpression") return;
|
||||
if(expr.callee.object.type !== "Identifier") return;
|
||||
const name = expr.callee.object.name;
|
||||
const settings = parser.state.harmonySpecifier[`$${name}`];
|
||||
if(settings[2] !== null)
|
||||
return false;
|
||||
const dep = new HarmonyImportSpecifierDependency(settings[0], settings[1], expr.callee.property.name || expr.callee.property.value, name, expr.callee.range, this.strictExportPresence);
|
||||
dep.shorthand = parser.scope.inShorthand;
|
||||
dep.directImport = false;
|
||||
dep.namespaceObjectAsContext = true;
|
||||
dep.loc = expr.callee.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
if(expr.arguments)
|
||||
parser.walkExpressions(expr.arguments);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
parser.plugin("call imported var", (expr) => {
|
||||
const args = expr.arguments;
|
||||
const fullExpr = expr;
|
||||
expr = expr.callee;
|
||||
if(expr.type !== "Identifier") return;
|
||||
const name = expr.name;
|
||||
const settings = parser.state.harmonySpecifier[`$${name}`];
|
||||
const dep = new HarmonyImportSpecifierDependency(settings[0], settings[1], settings[2], name, expr.range, this.strictExportPresence);
|
||||
dep.directImport = true;
|
||||
dep.callArgs = args;
|
||||
dep.call = fullExpr;
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
if(args)
|
||||
parser.walkExpressions(args);
|
||||
return true;
|
||||
});
|
||||
parser.plugin("hot accept callback", (expr, requests) => {
|
||||
const dependencies = requests
|
||||
.filter(request => HarmonyModulesHelpers.checkModuleVar(parser.state, request))
|
||||
.map(request => {
|
||||
const dep = new HarmonyAcceptImportDependency(request, HarmonyModulesHelpers.getModuleVar(parser.state, request), expr.range);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
return dep;
|
||||
});
|
||||
if(dependencies.length > 0) {
|
||||
const dep = new HarmonyAcceptDependency(expr.range, dependencies, true);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
}
|
||||
});
|
||||
parser.plugin("hot accept without callback", (expr, requests) => {
|
||||
const dependencies = requests
|
||||
.filter(request => HarmonyModulesHelpers.checkModuleVar(parser.state, request))
|
||||
.map(request => {
|
||||
const dep = new HarmonyAcceptImportDependency(request, HarmonyModulesHelpers.getModuleVar(parser.state, request), expr.range);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
return dep;
|
||||
});
|
||||
if(dependencies.length > 0) {
|
||||
const dep = new HarmonyAcceptDependency(expr.range, dependencies, false);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
129
hGameTest/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js
generated
vendored
Normal file
129
hGameTest/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
class HarmonyImportSpecifierDependency extends NullDependency {
|
||||
constructor(importDependency, importedVar, id, name, range, strictExportPresence) {
|
||||
super();
|
||||
this.importDependency = importDependency;
|
||||
this.importedVar = importedVar;
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.range = range;
|
||||
this.strictExportPresence = strictExportPresence;
|
||||
this.namespaceObjectAsContext = false;
|
||||
this.callArgs = undefined;
|
||||
this.call = undefined;
|
||||
this.directImport = undefined;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "harmony import specifier";
|
||||
}
|
||||
|
||||
getReference() {
|
||||
if(!this.importDependency.module) return null;
|
||||
return {
|
||||
module: this.importDependency.module,
|
||||
importedNames: this.id && !this.namespaceObjectAsContext ? [this.id] : true
|
||||
};
|
||||
}
|
||||
|
||||
getWarnings() {
|
||||
if(this.strictExportPresence) {
|
||||
return [];
|
||||
}
|
||||
return this._getErrors();
|
||||
}
|
||||
|
||||
getErrors() {
|
||||
if(this.strictExportPresence) {
|
||||
return this._getErrors();
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
_getErrors() {
|
||||
const importedModule = this.importDependency.module;
|
||||
if(!importedModule || !importedModule.meta || !importedModule.meta.harmonyModule) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!this.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(importedModule.isProvided(this.id) !== false) {
|
||||
return;
|
||||
}
|
||||
|
||||
const idIsNotNameMessage = this.id !== this.name ? ` (imported as '${this.name}')` : "";
|
||||
const errorMessage = `"export '${this.id}'${idIsNotNameMessage} was not found in '${this.importDependency.userRequest}'`;
|
||||
const err = new Error(errorMessage);
|
||||
err.hideStack = true;
|
||||
return [err];
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
super.updateHash(hash);
|
||||
const importedModule = this.importDependency.module;
|
||||
hash.update((importedModule && importedModule.id) + "");
|
||||
hash.update((importedModule && this.id) + "");
|
||||
hash.update((importedModule && this.importedVar) + "");
|
||||
hash.update((importedModule && this.id && importedModule.isUsed(this.id)) + "");
|
||||
hash.update((importedModule && (!importedModule.meta || importedModule.meta.harmonyModule)) + "");
|
||||
hash.update((importedModule && (importedModule.used + JSON.stringify(importedModule.usedExports))) + "");
|
||||
}
|
||||
}
|
||||
|
||||
HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependencyTemplate {
|
||||
apply(dep, source) {
|
||||
const content = this.getContent(dep);
|
||||
source.replace(dep.range[0], dep.range[1] - 1, content);
|
||||
}
|
||||
|
||||
getContent(dep) {
|
||||
const importedModule = dep.importDependency.module;
|
||||
const defaultImport = dep.directImport && dep.id === "default" && !(importedModule && (!importedModule.meta || importedModule.meta.harmonyModule));
|
||||
const shortHandPrefix = this.getShortHandPrefix(dep);
|
||||
const importedVar = dep.importedVar;
|
||||
const importedVarSuffix = this.getImportVarSuffix(dep, defaultImport, importedModule);
|
||||
|
||||
if(dep.call && defaultImport) {
|
||||
return `${shortHandPrefix}${importedVar}_default()`;
|
||||
}
|
||||
|
||||
if(dep.call && dep.id) {
|
||||
return `${shortHandPrefix}Object(${importedVar}${importedVarSuffix})`;
|
||||
}
|
||||
|
||||
return `${shortHandPrefix}${importedVar}${importedVarSuffix}`;
|
||||
}
|
||||
|
||||
getImportVarSuffix(dep, defaultImport, importedModule) {
|
||||
if(defaultImport) {
|
||||
return "_default.a";
|
||||
}
|
||||
|
||||
if(dep.id) {
|
||||
const used = importedModule ? importedModule.isUsed(dep.id) : dep.id;
|
||||
const optionalComment = dep.id !== used ? " /* " + dep.id + " */" : "";
|
||||
return `[${JSON.stringify(used)}${optionalComment}]`;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
getShortHandPrefix(dep) {
|
||||
if(!dep.shorthand) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return dep.name + ": ";
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = HarmonyImportSpecifierDependency;
|
||||
32
hGameTest/node_modules/webpack/lib/dependencies/HarmonyModulesHelpers.js
generated
vendored
Normal file
32
hGameTest/node_modules/webpack/lib/dependencies/HarmonyModulesHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class HarmonyModulesHelpers {
|
||||
|
||||
static getModuleVar(state, request) {
|
||||
if(!state.harmonyModules) state.harmonyModules = [];
|
||||
let idx = state.harmonyModules.indexOf(request);
|
||||
if(idx < 0) {
|
||||
idx = state.harmonyModules.length;
|
||||
state.harmonyModules.push(request);
|
||||
}
|
||||
return `__WEBPACK_IMPORTED_MODULE_${idx}_${request.replace(/[^A-Za-z0-9_]/g, "_").replace(/__+/g, "_")}__`;
|
||||
}
|
||||
|
||||
static getNewModuleVar(state, request) {
|
||||
if(state.harmonyModules && state.harmonyModules.indexOf(request) >= 0)
|
||||
return null;
|
||||
return this.getModuleVar(state, request);
|
||||
}
|
||||
|
||||
static checkModuleVar(state, request) {
|
||||
if(!state.harmonyModules || state.harmonyModules.indexOf(request) < 0)
|
||||
return null;
|
||||
return this.getModuleVar(state, request);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HarmonyModulesHelpers;
|
||||
72
hGameTest/node_modules/webpack/lib/dependencies/HarmonyModulesPlugin.js
generated
vendored
Normal file
72
hGameTest/node_modules/webpack/lib/dependencies/HarmonyModulesPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const HarmonyImportDependency = require("./HarmonyImportDependency");
|
||||
const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDependency");
|
||||
const HarmonyCompatiblilityDependency = require("./HarmonyCompatibilityDependency");
|
||||
const HarmonyExportHeaderDependency = require("./HarmonyExportHeaderDependency");
|
||||
const HarmonyExportExpressionDependency = require("./HarmonyExportExpressionDependency");
|
||||
const HarmonyExportSpecifierDependency = require("./HarmonyExportSpecifierDependency");
|
||||
const HarmonyExportImportedSpecifierDependency = require("./HarmonyExportImportedSpecifierDependency");
|
||||
const HarmonyAcceptDependency = require("./HarmonyAcceptDependency");
|
||||
const HarmonyAcceptImportDependency = require("./HarmonyAcceptImportDependency");
|
||||
|
||||
const NullFactory = require("../NullFactory");
|
||||
|
||||
const HarmonyDetectionParserPlugin = require("./HarmonyDetectionParserPlugin");
|
||||
const HarmonyImportDependencyParserPlugin = require("./HarmonyImportDependencyParserPlugin");
|
||||
const HarmonyExportDependencyParserPlugin = require("./HarmonyExportDependencyParserPlugin");
|
||||
|
||||
class HarmonyModulesPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(HarmonyImportDependency, normalModuleFactory);
|
||||
compilation.dependencyTemplates.set(HarmonyImportDependency, new HarmonyImportDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(HarmonyImportSpecifierDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(HarmonyImportSpecifierDependency, new HarmonyImportSpecifierDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(HarmonyCompatiblilityDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(HarmonyCompatiblilityDependency, new HarmonyCompatiblilityDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(HarmonyExportHeaderDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(HarmonyExportHeaderDependency, new HarmonyExportHeaderDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(HarmonyExportExpressionDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(HarmonyExportExpressionDependency, new HarmonyExportExpressionDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(HarmonyExportSpecifierDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(HarmonyExportSpecifierDependency, new HarmonyExportSpecifierDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(HarmonyExportImportedSpecifierDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(HarmonyExportImportedSpecifierDependency, new HarmonyExportImportedSpecifierDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(HarmonyAcceptDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(HarmonyAcceptDependency, new HarmonyAcceptDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(HarmonyAcceptImportDependency, normalModuleFactory);
|
||||
compilation.dependencyTemplates.set(HarmonyAcceptImportDependency, new HarmonyAcceptImportDependency.Template());
|
||||
|
||||
params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
|
||||
|
||||
if(typeof parserOptions.harmony !== "undefined" && !parserOptions.harmony)
|
||||
return;
|
||||
|
||||
parser.apply(
|
||||
new HarmonyDetectionParserPlugin(),
|
||||
new HarmonyImportDependencyParserPlugin(this.options),
|
||||
new HarmonyExportDependencyParserPlugin()
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = HarmonyModulesPlugin;
|
||||
25
hGameTest/node_modules/webpack/lib/dependencies/ImportContextDependency.js
generated
vendored
Normal file
25
hGameTest/node_modules/webpack/lib/dependencies/ImportContextDependency.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ContextDependency = require("./ContextDependency");
|
||||
const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");
|
||||
|
||||
class ImportContextDependency extends ContextDependency {
|
||||
constructor(request, recursive, regExp, range, valueRange, chunkName) {
|
||||
super(request, recursive, regExp);
|
||||
this.range = range;
|
||||
this.valueRange = valueRange;
|
||||
this.chunkName = chunkName;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "import() context";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ImportContextDependency.Template = ContextDependencyTemplateAsRequireCall;
|
||||
|
||||
module.exports = ImportContextDependency;
|
||||
17
hGameTest/node_modules/webpack/lib/dependencies/ImportDependenciesBlock.js
generated
vendored
Normal file
17
hGameTest/node_modules/webpack/lib/dependencies/ImportDependenciesBlock.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
|
||||
const ImportDependency = require("./ImportDependency");
|
||||
|
||||
module.exports = class ImportDependenciesBlock extends AsyncDependenciesBlock {
|
||||
constructor(request, range, chunkName, module, loc) {
|
||||
super(chunkName, module, loc);
|
||||
this.range = range;
|
||||
const dep = new ImportDependency(request, this);
|
||||
dep.loc = loc;
|
||||
this.addDependency(dep);
|
||||
}
|
||||
};
|
||||
54
hGameTest/node_modules/webpack/lib/dependencies/ImportDependency.js
generated
vendored
Normal file
54
hGameTest/node_modules/webpack/lib/dependencies/ImportDependency.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
const DepBlockHelpers = require("./DepBlockHelpers");
|
||||
const webpackMissingPromiseModule = require("./WebpackMissingModule").promise;
|
||||
|
||||
class ImportDependency extends ModuleDependency {
|
||||
constructor(request, block) {
|
||||
super(request);
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "import()";
|
||||
}
|
||||
}
|
||||
|
||||
ImportDependency.Template = class ImportDependencyTemplate {
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
const depBlock = dep.block;
|
||||
const promise = DepBlockHelpers.getDepBlockPromise(depBlock, outputOptions, requestShortener, "import()");
|
||||
const comment = this.getOptionalComment(outputOptions.pathinfo, requestShortener.shorten(dep.request));
|
||||
|
||||
const content = this.getContent(promise, dep, comment);
|
||||
source.replace(depBlock.range[0], depBlock.range[1] - 1, content);
|
||||
}
|
||||
|
||||
getOptionalComment(pathinfo, shortenedRequest) {
|
||||
if(!pathinfo) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return `/*! ${shortenedRequest} */ `;
|
||||
}
|
||||
|
||||
getContent(promise, dep, comment) {
|
||||
if(promise && dep.module) {
|
||||
const stringifiedId = JSON.stringify(dep.module.id);
|
||||
return `${promise}.then(__webpack_require__.bind(null, ${comment}${stringifiedId}))`;
|
||||
}
|
||||
|
||||
if(dep.module) {
|
||||
const stringifiedId = JSON.stringify(dep.module.id);
|
||||
return `new Promise(function(resolve) { resolve(__webpack_require__(${comment}${stringifiedId})); })`;
|
||||
}
|
||||
|
||||
return webpackMissingPromiseModule(dep.request);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ImportDependency;
|
||||
22
hGameTest/node_modules/webpack/lib/dependencies/ImportEagerContextDependency.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/dependencies/ImportEagerContextDependency.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ImportContextDependency = require("./ImportContextDependency");
|
||||
const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");
|
||||
|
||||
class ImportEagerContextDependency extends ImportContextDependency {
|
||||
constructor(request, recursive, regExp, range, valueRange, chunkName) {
|
||||
super(request, recursive, regExp, range, valueRange, chunkName);
|
||||
this.async = "eager";
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "import() context eager";
|
||||
}
|
||||
}
|
||||
|
||||
ImportEagerContextDependency.Template = ContextDependencyTemplateAsRequireCall;
|
||||
|
||||
module.exports = ImportEagerContextDependency;
|
||||
46
hGameTest/node_modules/webpack/lib/dependencies/ImportEagerDependency.js
generated
vendored
Normal file
46
hGameTest/node_modules/webpack/lib/dependencies/ImportEagerDependency.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
const webpackMissingPromiseModule = require("./WebpackMissingModule").promise;
|
||||
|
||||
class ImportEagerDependency extends ModuleDependency {
|
||||
constructor(request, range) {
|
||||
super(request);
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "import()";
|
||||
}
|
||||
}
|
||||
|
||||
ImportEagerDependency.Template = class ImportEagerDependencyTemplate {
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
const comment = this.getOptionalComment(outputOptions.pathinfo, requestShortener.shorten(dep.request));
|
||||
|
||||
const content = this.getContent(dep, comment);
|
||||
source.replace(dep.range[0], dep.range[1] - 1, content);
|
||||
}
|
||||
|
||||
getOptionalComment(pathinfo, shortenedRequest) {
|
||||
if(!pathinfo) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return `/*! ${shortenedRequest} */ `;
|
||||
}
|
||||
|
||||
getContent(dep, comment) {
|
||||
if(dep.module) {
|
||||
const stringifiedId = JSON.stringify(dep.module.id);
|
||||
return `new Promise(function(resolve) { resolve(__webpack_require__(${comment}${stringifiedId})); })`;
|
||||
}
|
||||
|
||||
return webpackMissingPromiseModule(dep.request);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ImportEagerDependency;
|
||||
22
hGameTest/node_modules/webpack/lib/dependencies/ImportLazyContextDependency.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/dependencies/ImportLazyContextDependency.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ImportContextDependency = require("./ImportContextDependency");
|
||||
const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");
|
||||
|
||||
class ImportLazyContextDependency extends ImportContextDependency {
|
||||
constructor(request, recursive, regExp, range, valueRange, chunkName) {
|
||||
super(request, recursive, regExp, range, valueRange, chunkName);
|
||||
this.async = "lazy";
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "import() context lazy";
|
||||
}
|
||||
}
|
||||
|
||||
ImportLazyContextDependency.Template = ContextDependencyTemplateAsRequireCall;
|
||||
|
||||
module.exports = ImportLazyContextDependency;
|
||||
22
hGameTest/node_modules/webpack/lib/dependencies/ImportLazyOnceContextDependency.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/dependencies/ImportLazyOnceContextDependency.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ImportContextDependency = require("./ImportContextDependency");
|
||||
const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");
|
||||
|
||||
class ImportLazyOnceContextDependency extends ImportContextDependency {
|
||||
constructor(request, recursive, regExp, range, valueRange, chunkName) {
|
||||
super(request, recursive, regExp, range, valueRange, chunkName);
|
||||
this.async = "lazy-once";
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "import() context lazy-once";
|
||||
}
|
||||
}
|
||||
|
||||
ImportLazyOnceContextDependency.Template = ContextDependencyTemplateAsRequireCall;
|
||||
|
||||
module.exports = ImportLazyOnceContextDependency;
|
||||
89
hGameTest/node_modules/webpack/lib/dependencies/ImportParserPlugin.js
generated
vendored
Normal file
89
hGameTest/node_modules/webpack/lib/dependencies/ImportParserPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ImportEagerContextDependency = require("./ImportEagerContextDependency");
|
||||
const ImportWeakDependency = require("./ImportWeakDependency");
|
||||
const ImportWeakContextDependency = require("./ImportWeakContextDependency");
|
||||
const ImportLazyOnceContextDependency = require("./ImportLazyOnceContextDependency");
|
||||
const ImportLazyContextDependency = require("./ImportLazyContextDependency");
|
||||
const ImportDependenciesBlock = require("./ImportDependenciesBlock");
|
||||
const ImportEagerDependency = require("./ImportEagerDependency");
|
||||
const ContextDependencyHelpers = require("./ContextDependencyHelpers");
|
||||
const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
|
||||
|
||||
class ImportParserPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(parser) {
|
||||
const options = this.options;
|
||||
|
||||
parser.plugin(["call System.import", "import-call"], (expr) => {
|
||||
if(expr.arguments.length !== 1)
|
||||
throw new Error("Incorrect number of arguments provided to 'import(module: string) -> Promise'.");
|
||||
|
||||
const param = parser.evaluateExpression(expr.arguments[0]);
|
||||
|
||||
let chunkName = null;
|
||||
let mode = "lazy";
|
||||
|
||||
const importOptions = parser.getCommentOptions(expr.range);
|
||||
if(importOptions) {
|
||||
if(typeof importOptions.webpackChunkName !== "undefined") {
|
||||
if(typeof importOptions.webpackChunkName !== "string")
|
||||
parser.state.module.warnings.push(new UnsupportedFeatureWarning(parser.state.module, `\`webpackChunkName\` expected a string, but received: ${importOptions.webpackChunkName}.`));
|
||||
else
|
||||
chunkName = importOptions.webpackChunkName;
|
||||
}
|
||||
if(typeof importOptions.webpackMode !== "undefined") {
|
||||
if(typeof importOptions.webpackMode !== "string")
|
||||
parser.state.module.warnings.push(new UnsupportedFeatureWarning(parser.state.module, `\`webpackMode\` expected a string, but received: ${importOptions.webpackMode}.`));
|
||||
else
|
||||
mode = importOptions.webpackMode;
|
||||
}
|
||||
}
|
||||
|
||||
if(param.isString()) {
|
||||
if(mode !== "lazy" && mode !== "eager" && mode !== "weak") {
|
||||
parser.state.module.warnings.push(new UnsupportedFeatureWarning(parser.state.module, `\`webpackMode\` expected 'lazy', 'eager' or 'weak', but received: ${mode}.`));
|
||||
}
|
||||
|
||||
if(mode === "eager") {
|
||||
const dep = new ImportEagerDependency(param.string, expr.range);
|
||||
parser.state.current.addDependency(dep);
|
||||
} else if(mode === "weak") {
|
||||
const dep = new ImportWeakDependency(param.string, expr.range);
|
||||
parser.state.current.addDependency(dep);
|
||||
} else {
|
||||
const depBlock = new ImportDependenciesBlock(param.string, expr.range, chunkName, parser.state.module, expr.loc);
|
||||
parser.state.current.addBlock(depBlock);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
if(mode !== "lazy" && mode !== "lazy-once" && mode !== "eager" && mode !== "weak") {
|
||||
parser.state.module.warnings.push(new UnsupportedFeatureWarning(parser.state.module, `\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${mode}.`));
|
||||
}
|
||||
|
||||
let Dep = ImportLazyContextDependency;
|
||||
if(mode === "eager") {
|
||||
Dep = ImportEagerContextDependency;
|
||||
} else if(mode === "weak") {
|
||||
Dep = ImportWeakContextDependency;
|
||||
} else if(mode === "lazy-once") {
|
||||
Dep = ImportLazyOnceContextDependency;
|
||||
}
|
||||
const dep = ContextDependencyHelpers.create(Dep, expr.range, param, expr, options, chunkName);
|
||||
if(!dep) return;
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = ImportParserPlugin;
|
||||
60
hGameTest/node_modules/webpack/lib/dependencies/ImportPlugin.js
generated
vendored
Normal file
60
hGameTest/node_modules/webpack/lib/dependencies/ImportPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ImportDependency = require("./ImportDependency");
|
||||
const ImportEagerDependency = require("./ImportEagerDependency");
|
||||
const ImportWeakDependency = require("./ImportWeakDependency");
|
||||
const ImportEagerContextDependency = require("./ImportEagerContextDependency");
|
||||
const ImportWeakContextDependency = require("./ImportWeakContextDependency");
|
||||
const ImportLazyOnceContextDependency = require("./ImportLazyOnceContextDependency");
|
||||
const ImportLazyContextDependency = require("./ImportLazyContextDependency");
|
||||
const ImportParserPlugin = require("./ImportParserPlugin");
|
||||
|
||||
class ImportPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
const options = this.options;
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
const contextModuleFactory = params.contextModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(ImportDependency, normalModuleFactory);
|
||||
compilation.dependencyTemplates.set(ImportDependency, new ImportDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(ImportEagerDependency, normalModuleFactory);
|
||||
compilation.dependencyTemplates.set(ImportEagerDependency, new ImportEagerDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(ImportWeakDependency, normalModuleFactory);
|
||||
compilation.dependencyTemplates.set(ImportWeakDependency, new ImportWeakDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(ImportEagerContextDependency, contextModuleFactory);
|
||||
compilation.dependencyTemplates.set(ImportEagerContextDependency, new ImportEagerContextDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(ImportWeakContextDependency, contextModuleFactory);
|
||||
compilation.dependencyTemplates.set(ImportWeakContextDependency, new ImportWeakContextDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(ImportLazyOnceContextDependency, contextModuleFactory);
|
||||
compilation.dependencyTemplates.set(ImportLazyOnceContextDependency, new ImportLazyOnceContextDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(ImportLazyContextDependency, contextModuleFactory);
|
||||
compilation.dependencyTemplates.set(ImportLazyContextDependency, new ImportLazyContextDependency.Template());
|
||||
|
||||
normalModuleFactory.plugin("parser", (parser, parserOptions) => {
|
||||
|
||||
if(typeof parserOptions.import !== "undefined" && !parserOptions.import)
|
||||
return;
|
||||
|
||||
parser.apply(
|
||||
new ImportParserPlugin(options)
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = ImportPlugin;
|
||||
22
hGameTest/node_modules/webpack/lib/dependencies/ImportWeakContextDependency.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/dependencies/ImportWeakContextDependency.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ImportContextDependency = require("./ImportContextDependency");
|
||||
const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");
|
||||
|
||||
class ImportWeakContextDependency extends ImportContextDependency {
|
||||
constructor(request, recursive, regExp, range, valueRange, chunkName) {
|
||||
super(request, recursive, regExp, range, valueRange, chunkName);
|
||||
this.async = "async-weak";
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "import() context weak";
|
||||
}
|
||||
}
|
||||
|
||||
ImportWeakContextDependency.Template = ContextDependencyTemplateAsRequireCall;
|
||||
|
||||
module.exports = ImportWeakContextDependency;
|
||||
47
hGameTest/node_modules/webpack/lib/dependencies/ImportWeakDependency.js
generated
vendored
Normal file
47
hGameTest/node_modules/webpack/lib/dependencies/ImportWeakDependency.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
const webpackMissingPromiseModule = require("./WebpackMissingModule").promise;
|
||||
|
||||
class ImportWeakDependency extends ModuleDependency {
|
||||
constructor(request, range) {
|
||||
super(request);
|
||||
this.range = range;
|
||||
this.weak = true;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "import() weak";
|
||||
}
|
||||
}
|
||||
|
||||
ImportWeakDependency.Template = class ImportDependencyTemplate {
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
const comment = this.getOptionalComment(outputOptions.pathinfo, requestShortener.shorten(dep.request));
|
||||
|
||||
const content = this.getContent(dep, comment);
|
||||
source.replace(dep.range[0], dep.range[1] - 1, content);
|
||||
}
|
||||
|
||||
getOptionalComment(pathinfo, shortenedRequest) {
|
||||
if(!pathinfo) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return `/*! ${shortenedRequest} */ `;
|
||||
}
|
||||
|
||||
getContent(dep, comment) {
|
||||
if(dep.module) {
|
||||
const stringifiedId = JSON.stringify(dep.module.id);
|
||||
return `Promise.resolve(${comment}${stringifiedId}).then(function(id) { if(!__webpack_require__.m[id]) throw new Error("Module '" + id + "' is not available (weak dependency)"); return __webpack_require__(id); })`;
|
||||
}
|
||||
|
||||
return webpackMissingPromiseModule(dep.request);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ImportWeakDependency;
|
||||
18
hGameTest/node_modules/webpack/lib/dependencies/LoaderDependency.js
generated
vendored
Normal file
18
hGameTest/node_modules/webpack/lib/dependencies/LoaderDependency.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
class LoaderDependency extends ModuleDependency {
|
||||
constructor(request) {
|
||||
super(request);
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "loader";
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LoaderDependency;
|
||||
60
hGameTest/node_modules/webpack/lib/dependencies/LoaderPlugin.js
generated
vendored
Normal file
60
hGameTest/node_modules/webpack/lib/dependencies/LoaderPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const LoaderDependency = require("./LoaderDependency");
|
||||
|
||||
class LoaderPlugin {
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(LoaderDependency, normalModuleFactory);
|
||||
});
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.plugin("normal-module-loader", (loaderContext, module) => {
|
||||
loaderContext.loadModule = function loadModule(request, callback) {
|
||||
const dep = new LoaderDependency(request);
|
||||
dep.loc = request;
|
||||
compilation.addModuleDependencies(module, [
|
||||
[dep]
|
||||
], true, "lm", false, (err) => {
|
||||
if(err) return callback(err);
|
||||
|
||||
if(!dep.module) return callback(new Error("Cannot load the module"));
|
||||
if(dep.module.building) dep.module.building.push(next);
|
||||
else next();
|
||||
|
||||
function next(err) {
|
||||
if(err) return callback(err);
|
||||
|
||||
if(dep.module.error) return callback(dep.module.error);
|
||||
if(!dep.module._source) throw new Error("The module created for a LoaderDependency must have a property _source");
|
||||
let source, map;
|
||||
const moduleSource = dep.module._source;
|
||||
if(moduleSource.sourceAndMap) {
|
||||
const sourceAndMap = moduleSource.sourceAndMap();
|
||||
map = sourceAndMap.map;
|
||||
source = sourceAndMap.source;
|
||||
} else {
|
||||
map = moduleSource.map();
|
||||
source = moduleSource.source();
|
||||
}
|
||||
if(dep.module.fileDependencies) {
|
||||
dep.module.fileDependencies.forEach((dep) => loaderContext.addDependency(dep));
|
||||
}
|
||||
if(dep.module.contextDependencies) {
|
||||
dep.module.contextDependencies.forEach((dep) => loaderContext.addContextDependency(dep));
|
||||
}
|
||||
return callback(null, source, map, dep.module);
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = LoaderPlugin;
|
||||
23
hGameTest/node_modules/webpack/lib/dependencies/LocalModule.js
generated
vendored
Normal file
23
hGameTest/node_modules/webpack/lib/dependencies/LocalModule.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class LocalModule {
|
||||
constructor(module, name, idx) {
|
||||
this.module = module;
|
||||
this.name = name;
|
||||
this.idx = idx;
|
||||
this.used = false;
|
||||
}
|
||||
|
||||
flagUsed() {
|
||||
this.used = true;
|
||||
}
|
||||
|
||||
variableName() {
|
||||
return "__WEBPACK_LOCAL_MODULE_" + this.idx + "__";
|
||||
}
|
||||
}
|
||||
module.exports = LocalModule;
|
||||
24
hGameTest/node_modules/webpack/lib/dependencies/LocalModuleDependency.js
generated
vendored
Normal file
24
hGameTest/node_modules/webpack/lib/dependencies/LocalModuleDependency.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
class LocalModuleDependency extends NullDependency {
|
||||
constructor(localModule, range) {
|
||||
super();
|
||||
localModule.flagUsed();
|
||||
this.localModule = localModule;
|
||||
this.range = range;
|
||||
}
|
||||
}
|
||||
|
||||
LocalModuleDependency.Template = class LocalModuleDependencyTemplate {
|
||||
apply(dep, source) {
|
||||
if(!dep.range) return;
|
||||
source.replace(dep.range[0], dep.range[1] - 1, dep.localModule.variableName());
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = LocalModuleDependency;
|
||||
46
hGameTest/node_modules/webpack/lib/dependencies/LocalModulesHelpers.js
generated
vendored
Normal file
46
hGameTest/node_modules/webpack/lib/dependencies/LocalModulesHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const LocalModule = require("./LocalModule");
|
||||
const LocalModulesHelpers = exports;
|
||||
|
||||
const lookup = (parent, mod) => {
|
||||
if(mod.charAt(0) !== ".") return mod;
|
||||
|
||||
var path = parent.split("/"),
|
||||
segs = mod.split("/");
|
||||
path.pop();
|
||||
|
||||
for(let i = 0; i < segs.length; i++) {
|
||||
const seg = segs[i];
|
||||
if(seg === "..") path.pop();
|
||||
else if(seg !== ".") path.push(seg);
|
||||
}
|
||||
|
||||
return path.join("/");
|
||||
};
|
||||
|
||||
LocalModulesHelpers.addLocalModule = (state, name) => {
|
||||
if(!state.localModules) state.localModules = [];
|
||||
const m = new LocalModule(state.module, name, state.localModules.length);
|
||||
state.localModules.push(m);
|
||||
return m;
|
||||
};
|
||||
|
||||
LocalModulesHelpers.getLocalModule = (state, name, namedModule) => {
|
||||
if(!state.localModules) return null;
|
||||
if(namedModule) {
|
||||
// resolve dependency name relative to the defining named module
|
||||
name = lookup(namedModule, name);
|
||||
}
|
||||
for(let i = 0; i < state.localModules.length; i++) {
|
||||
if(state.localModules[i].name === name)
|
||||
return state.localModules[i];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
module.exports = LocalModulesHelpers;
|
||||
23
hGameTest/node_modules/webpack/lib/dependencies/ModuleDependency.js
generated
vendored
Normal file
23
hGameTest/node_modules/webpack/lib/dependencies/ModuleDependency.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const Dependency = require("../Dependency");
|
||||
|
||||
class ModuleDependency extends Dependency {
|
||||
constructor(request) {
|
||||
super();
|
||||
this.request = request;
|
||||
this.userRequest = request;
|
||||
}
|
||||
|
||||
isEqualResource(other) {
|
||||
if(!(other instanceof ModuleDependency))
|
||||
return false;
|
||||
|
||||
return this.request === other.request;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ModuleDependency;
|
||||
21
hGameTest/node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsId.js
generated
vendored
Normal file
21
hGameTest/node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsId.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class ModuleDependencyTemplateAsId {
|
||||
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
if(!dep.range) return;
|
||||
const comment = outputOptions.pathinfo ?
|
||||
`/*! ${requestShortener.shorten(dep.request)} */ ` : "";
|
||||
let content;
|
||||
if(dep.module)
|
||||
content = comment + JSON.stringify(dep.module.id);
|
||||
else
|
||||
content = require("./WebpackMissingModule").module(dep.request);
|
||||
source.replace(dep.range[0], dep.range[1] - 1, content);
|
||||
}
|
||||
}
|
||||
module.exports = ModuleDependencyTemplateAsId;
|
||||
21
hGameTest/node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsRequireId.js
generated
vendored
Normal file
21
hGameTest/node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsRequireId.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class ModuleDependencyTemplateAsRequireId {
|
||||
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
if(!dep.range) return;
|
||||
const comment = outputOptions.pathinfo ?
|
||||
`/*! ${requestShortener.shorten(dep.request)} */ ` : "";
|
||||
let content;
|
||||
if(dep.module)
|
||||
content = `__webpack_require__(${comment}${JSON.stringify(dep.module.id)})`;
|
||||
else
|
||||
content = require("./WebpackMissingModule").module(dep.request);
|
||||
source.replace(dep.range[0], dep.range[1] - 1, content);
|
||||
}
|
||||
}
|
||||
module.exports = ModuleDependencyTemplateAsRequireId;
|
||||
23
hGameTest/node_modules/webpack/lib/dependencies/ModuleHotAcceptDependency.js
generated
vendored
Normal file
23
hGameTest/node_modules/webpack/lib/dependencies/ModuleHotAcceptDependency.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
const ModuleDependencyTemplateAsId = require("./ModuleDependencyTemplateAsId");
|
||||
|
||||
class ModuleHotAcceptDependency extends ModuleDependency {
|
||||
constructor(request, range) {
|
||||
super(request);
|
||||
this.range = range;
|
||||
this.weak = true;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "module.hot.accept";
|
||||
}
|
||||
}
|
||||
|
||||
ModuleHotAcceptDependency.Template = ModuleDependencyTemplateAsId;
|
||||
|
||||
module.exports = ModuleHotAcceptDependency;
|
||||
23
hGameTest/node_modules/webpack/lib/dependencies/ModuleHotDeclineDependency.js
generated
vendored
Normal file
23
hGameTest/node_modules/webpack/lib/dependencies/ModuleHotDeclineDependency.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
const ModuleDependencyTemplateAsId = require("./ModuleDependencyTemplateAsId");
|
||||
|
||||
class ModuleHotDeclineDependency extends ModuleDependency {
|
||||
constructor(request, range) {
|
||||
super(request);
|
||||
this.range = range;
|
||||
this.weak = true;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "module.hot.decline";
|
||||
}
|
||||
}
|
||||
|
||||
ModuleHotDeclineDependency.Template = ModuleDependencyTemplateAsId;
|
||||
|
||||
module.exports = ModuleHotDeclineDependency;
|
||||
20
hGameTest/node_modules/webpack/lib/dependencies/MultiEntryDependency.js
generated
vendored
Normal file
20
hGameTest/node_modules/webpack/lib/dependencies/MultiEntryDependency.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const Dependency = require("../Dependency");
|
||||
|
||||
class MultiEntryDependency extends Dependency {
|
||||
constructor(dependencies, name) {
|
||||
super();
|
||||
this.dependencies = dependencies;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "multi entry";
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MultiEntryDependency;
|
||||
24
hGameTest/node_modules/webpack/lib/dependencies/NullDependency.js
generated
vendored
Normal file
24
hGameTest/node_modules/webpack/lib/dependencies/NullDependency.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const Dependency = require("../Dependency");
|
||||
|
||||
class NullDependency extends Dependency {
|
||||
get type() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
isEqualResource() {
|
||||
return false;
|
||||
}
|
||||
|
||||
updateHash() {}
|
||||
}
|
||||
|
||||
NullDependency.Template = class NullDependencyTemplate {
|
||||
apply() {}
|
||||
};
|
||||
|
||||
module.exports = NullDependency;
|
||||
18
hGameTest/node_modules/webpack/lib/dependencies/PrefetchDependency.js
generated
vendored
Normal file
18
hGameTest/node_modules/webpack/lib/dependencies/PrefetchDependency.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
class PrefetchDependency extends ModuleDependency {
|
||||
constructor(request) {
|
||||
super(request);
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "prefetch";
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = PrefetchDependency;
|
||||
26
hGameTest/node_modules/webpack/lib/dependencies/RequireContextDependency.js
generated
vendored
Normal file
26
hGameTest/node_modules/webpack/lib/dependencies/RequireContextDependency.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ContextDependency = require("./ContextDependency");
|
||||
const ModuleDependencyTemplateAsRequireId = require("./ModuleDependencyTemplateAsRequireId");
|
||||
|
||||
class RequireContextDependency extends ContextDependency {
|
||||
constructor(request, recursive, regExp, asyncMode, range) {
|
||||
super(request, recursive, regExp);
|
||||
this.range = range;
|
||||
|
||||
if(asyncMode) {
|
||||
this.async = asyncMode;
|
||||
}
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "require.context";
|
||||
}
|
||||
}
|
||||
|
||||
RequireContextDependency.Template = ModuleDependencyTemplateAsRequireId;
|
||||
|
||||
module.exports = RequireContextDependency;
|
||||
50
hGameTest/node_modules/webpack/lib/dependencies/RequireContextDependencyParserPlugin.js
generated
vendored
Normal file
50
hGameTest/node_modules/webpack/lib/dependencies/RequireContextDependencyParserPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const RequireContextDependency = require("./RequireContextDependency");
|
||||
|
||||
module.exports = class RequireContextDependencyParserPlugin {
|
||||
apply(parser) {
|
||||
parser.plugin("call require.context", expr => {
|
||||
let regExp = /^\.\/.*$/;
|
||||
let recursive = true;
|
||||
let asyncMode;
|
||||
switch(expr.arguments.length) {
|
||||
case 4:
|
||||
{
|
||||
const asyncModeExpr = parser.evaluateExpression(expr.arguments[3]);
|
||||
if(!asyncModeExpr.isString()) return;
|
||||
asyncMode = asyncModeExpr.string;
|
||||
}
|
||||
// falls through
|
||||
case 3:
|
||||
{
|
||||
const regExpExpr = parser.evaluateExpression(expr.arguments[2]);
|
||||
if(!regExpExpr.isRegExp()) return;
|
||||
regExp = regExpExpr.regExp;
|
||||
}
|
||||
// falls through
|
||||
case 2:
|
||||
{
|
||||
const recursiveExpr = parser.evaluateExpression(expr.arguments[1]);
|
||||
if(!recursiveExpr.isBoolean()) return;
|
||||
recursive = recursiveExpr.bool;
|
||||
}
|
||||
// falls through
|
||||
case 1:
|
||||
{
|
||||
const requestExpr = parser.evaluateExpression(expr.arguments[0]);
|
||||
if(!requestExpr.isString()) return;
|
||||
const dep = new RequireContextDependency(requestExpr.string, recursive, regExp, asyncMode, expr.range);
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = parser.scope.inTry;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
96
hGameTest/node_modules/webpack/lib/dependencies/RequireContextPlugin.js
generated
vendored
Normal file
96
hGameTest/node_modules/webpack/lib/dependencies/RequireContextPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const RequireContextDependency = require("./RequireContextDependency");
|
||||
const ContextElementDependency = require("./ContextElementDependency");
|
||||
|
||||
const RequireContextDependencyParserPlugin = require("./RequireContextDependencyParserPlugin");
|
||||
|
||||
class RequireContextPlugin {
|
||||
constructor(modulesDirectories, extensions, mainFiles) {
|
||||
if(!Array.isArray(modulesDirectories))
|
||||
throw new Error("modulesDirectories must be an array");
|
||||
if(!Array.isArray(extensions))
|
||||
throw new Error("extensions must be an array");
|
||||
this.modulesDirectories = modulesDirectories;
|
||||
this.extensions = extensions;
|
||||
this.mainFiles = mainFiles;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const contextModuleFactory = params.contextModuleFactory;
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(RequireContextDependency, contextModuleFactory);
|
||||
compilation.dependencyTemplates.set(RequireContextDependency, new RequireContextDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(ContextElementDependency, normalModuleFactory);
|
||||
|
||||
params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
|
||||
|
||||
if(typeof parserOptions.requireContext !== "undefined" && !parserOptions.requireContext)
|
||||
return;
|
||||
|
||||
parser.apply(new RequireContextDependencyParserPlugin());
|
||||
});
|
||||
|
||||
params.contextModuleFactory.plugin("alternatives", (items, callback) => {
|
||||
if(items.length === 0) return callback(null, items);
|
||||
|
||||
callback(null, items.map((obj) => {
|
||||
return this.extensions.filter((ext) => {
|
||||
const l = obj.request.length;
|
||||
return l > ext.length && obj.request.substr(l - ext.length, l) === ext;
|
||||
}).map((ext) => {
|
||||
const l = obj.request.length;
|
||||
return {
|
||||
context: obj.context,
|
||||
request: obj.request.substr(0, l - ext.length)
|
||||
};
|
||||
}).concat(obj);
|
||||
}).reduce((a, b) => a.concat(b), []));
|
||||
});
|
||||
|
||||
params.contextModuleFactory.plugin("alternatives", (items, callback) => {
|
||||
if(items.length === 0) return callback(null, items);
|
||||
|
||||
callback(null, items.map((obj) => {
|
||||
return this.mainFiles.filter((mainFile) => {
|
||||
const l = obj.request.length;
|
||||
return l > mainFile.length + 1 && obj.request.substr(l - mainFile.length - 1, l) === "/" + mainFile;
|
||||
}).map((mainFile) => {
|
||||
const l = obj.request.length;
|
||||
return [{
|
||||
context: obj.context,
|
||||
request: obj.request.substr(0, l - mainFile.length)
|
||||
}, {
|
||||
context: obj.context,
|
||||
request: obj.request.substr(0, l - mainFile.length - 1)
|
||||
}];
|
||||
}).reduce((a, b) => a.concat(b), []).concat(obj);
|
||||
}).reduce((a, b) => a.concat(b), []));
|
||||
});
|
||||
|
||||
params.contextModuleFactory.plugin("alternatives", (items, callback) => {
|
||||
if(items.length === 0) return callback(null, items);
|
||||
|
||||
callback(null, items.map((obj) => {
|
||||
for(let i = 0; i < this.modulesDirectories.length; i++) {
|
||||
const dir = this.modulesDirectories[i];
|
||||
const idx = obj.request.indexOf("./" + dir + "/");
|
||||
if(idx === 0) {
|
||||
obj.request = obj.request.slice(dir.length + 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = RequireContextPlugin;
|
||||
22
hGameTest/node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlock.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlock.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
|
||||
const RequireEnsureDependency = require("./RequireEnsureDependency");
|
||||
|
||||
module.exports = class RequireEnsureDependenciesBlock extends AsyncDependenciesBlock {
|
||||
constructor(expr, successExpression, errorExpression, chunkName, chunkNameRange, module, loc) {
|
||||
super(chunkName, module, loc);
|
||||
this.expr = expr;
|
||||
const successBodyRange = successExpression && successExpression.body && successExpression.body.range;
|
||||
if(successBodyRange) {
|
||||
this.range = [successBodyRange[0] + 1, successBodyRange[1] - 1];
|
||||
}
|
||||
this.chunkNameRange = chunkNameRange;
|
||||
const dep = new RequireEnsureDependency(this);
|
||||
dep.loc = loc;
|
||||
this.addDependency(dep);
|
||||
}
|
||||
};
|
||||
102
hGameTest/node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js
generated
vendored
Normal file
102
hGameTest/node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const RequireEnsureDependenciesBlock = require("./RequireEnsureDependenciesBlock");
|
||||
const RequireEnsureItemDependency = require("./RequireEnsureItemDependency");
|
||||
const getFunctionExpression = require("./getFunctionExpression");
|
||||
|
||||
module.exports = class RequireEnsureDependenciesBlockParserPlugin {
|
||||
apply(parser) {
|
||||
parser.plugin("call require.ensure", expr => {
|
||||
let chunkName = null;
|
||||
let chunkNameRange = null;
|
||||
let errorExpressionArg = null;
|
||||
let errorExpression = null;
|
||||
switch(expr.arguments.length) {
|
||||
case 4:
|
||||
{
|
||||
const chunkNameExpr = parser.evaluateExpression(expr.arguments[3]);
|
||||
if(!chunkNameExpr.isString()) return;
|
||||
chunkNameRange = chunkNameExpr.range;
|
||||
chunkName = chunkNameExpr.string;
|
||||
}
|
||||
// falls through
|
||||
case 3:
|
||||
{
|
||||
errorExpressionArg = expr.arguments[2];
|
||||
errorExpression = getFunctionExpression(errorExpressionArg);
|
||||
|
||||
if(!errorExpression && !chunkName) {
|
||||
const chunkNameExpr = parser.evaluateExpression(expr.arguments[2]);
|
||||
if(!chunkNameExpr.isString()) return;
|
||||
chunkNameRange = chunkNameExpr.range;
|
||||
chunkName = chunkNameExpr.string;
|
||||
}
|
||||
}
|
||||
// falls through
|
||||
case 2:
|
||||
{
|
||||
const dependenciesExpr = parser.evaluateExpression(expr.arguments[0]);
|
||||
const dependenciesItems = dependenciesExpr.isArray() ? dependenciesExpr.items : [dependenciesExpr];
|
||||
const successExpressionArg = expr.arguments[1];
|
||||
const successExpression = getFunctionExpression(successExpressionArg);
|
||||
|
||||
if(successExpression) {
|
||||
parser.walkExpressions(successExpression.expressions);
|
||||
}
|
||||
if(errorExpression) {
|
||||
parser.walkExpressions(errorExpression.expressions);
|
||||
}
|
||||
|
||||
const dep = new RequireEnsureDependenciesBlock(expr,
|
||||
successExpression ? successExpression.fn : successExpressionArg,
|
||||
errorExpression ? errorExpression.fn : errorExpressionArg,
|
||||
chunkName, chunkNameRange, parser.state.module, expr.loc);
|
||||
const old = parser.state.current;
|
||||
parser.state.current = dep;
|
||||
try {
|
||||
let failed = false;
|
||||
parser.inScope([], () => {
|
||||
dependenciesItems.forEach(ee => {
|
||||
if(ee.isString()) {
|
||||
const edep = new RequireEnsureItemDependency(ee.string, ee.range);
|
||||
edep.loc = dep.loc;
|
||||
dep.addDependency(edep);
|
||||
} else {
|
||||
failed = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
if(failed) {
|
||||
return;
|
||||
}
|
||||
if(successExpression) {
|
||||
if(successExpression.fn.body.type === "BlockStatement")
|
||||
parser.walkStatement(successExpression.fn.body);
|
||||
else
|
||||
parser.walkExpression(successExpression.fn.body);
|
||||
}
|
||||
old.addBlock(dep);
|
||||
} finally {
|
||||
parser.state.current = old;
|
||||
}
|
||||
if(!successExpression) {
|
||||
parser.walkExpression(successExpressionArg);
|
||||
}
|
||||
if(errorExpression) {
|
||||
if(errorExpression.fn.body.type === "BlockStatement")
|
||||
parser.walkStatement(errorExpression.fn.body);
|
||||
else
|
||||
parser.walkExpression(errorExpression.fn.body);
|
||||
} else if(errorExpressionArg) {
|
||||
parser.walkExpression(errorExpressionArg);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
38
hGameTest/node_modules/webpack/lib/dependencies/RequireEnsureDependency.js
generated
vendored
Normal file
38
hGameTest/node_modules/webpack/lib/dependencies/RequireEnsureDependency.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
const DepBlockHelpers = require("./DepBlockHelpers");
|
||||
|
||||
class RequireEnsureDependency extends NullDependency {
|
||||
constructor(block) {
|
||||
super();
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "require.ensure";
|
||||
}
|
||||
}
|
||||
|
||||
RequireEnsureDependency.Template = class RequireEnsureDependencyTemplate {
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
const depBlock = dep.block;
|
||||
const wrapper = DepBlockHelpers.getLoadDepBlockWrapper(depBlock, outputOptions, requestShortener, "require.ensure");
|
||||
const errorCallbackExists = depBlock.expr.arguments.length === 4 || (!depBlock.chunkName && depBlock.expr.arguments.length === 3);
|
||||
const startBlock = wrapper[0] + "(";
|
||||
const middleBlock = `).bind(null, __webpack_require__)${wrapper[1]}`;
|
||||
const endBlock = `${middleBlock}__webpack_require__.oe${wrapper[2]}`;
|
||||
source.replace(depBlock.expr.range[0], depBlock.expr.arguments[1].range[0] - 1, startBlock);
|
||||
if(errorCallbackExists) {
|
||||
source.replace(depBlock.expr.arguments[1].range[1], depBlock.expr.arguments[2].range[0] - 1, middleBlock);
|
||||
source.replace(depBlock.expr.arguments[2].range[1], depBlock.expr.range[1] - 1, wrapper[2]);
|
||||
} else {
|
||||
source.replace(depBlock.expr.arguments[1].range[1], depBlock.expr.range[1] - 1, endBlock);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = RequireEnsureDependency;
|
||||
21
hGameTest/node_modules/webpack/lib/dependencies/RequireEnsureItemDependency.js
generated
vendored
Normal file
21
hGameTest/node_modules/webpack/lib/dependencies/RequireEnsureItemDependency.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
class RequireEnsureItemDependency extends ModuleDependency {
|
||||
constructor(request) {
|
||||
super(request);
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "require.ensure item";
|
||||
}
|
||||
}
|
||||
|
||||
RequireEnsureItemDependency.Template = NullDependency.Template;
|
||||
|
||||
module.exports = RequireEnsureItemDependency;
|
||||
40
hGameTest/node_modules/webpack/lib/dependencies/RequireEnsurePlugin.js
generated
vendored
Normal file
40
hGameTest/node_modules/webpack/lib/dependencies/RequireEnsurePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const RequireEnsureItemDependency = require("./RequireEnsureItemDependency");
|
||||
const RequireEnsureDependency = require("./RequireEnsureDependency");
|
||||
|
||||
const NullFactory = require("../NullFactory");
|
||||
|
||||
const RequireEnsureDependenciesBlockParserPlugin = require("./RequireEnsureDependenciesBlockParserPlugin");
|
||||
|
||||
const ParserHelpers = require("../ParserHelpers");
|
||||
|
||||
class RequireEnsurePlugin {
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(RequireEnsureItemDependency, normalModuleFactory);
|
||||
compilation.dependencyTemplates.set(RequireEnsureItemDependency, new RequireEnsureItemDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(RequireEnsureDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(RequireEnsureDependency, new RequireEnsureDependency.Template());
|
||||
|
||||
params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
|
||||
|
||||
if(typeof parserOptions.requireEnsure !== "undefined" && !parserOptions.requireEnsure)
|
||||
return;
|
||||
|
||||
parser.apply(new RequireEnsureDependenciesBlockParserPlugin());
|
||||
parser.plugin("evaluate typeof require.ensure", ParserHelpers.evaluateToString("function"));
|
||||
parser.plugin("typeof require.ensure", ParserHelpers.toConstantDependency(JSON.stringify("function")));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = RequireEnsurePlugin;
|
||||
26
hGameTest/node_modules/webpack/lib/dependencies/RequireHeaderDependency.js
generated
vendored
Normal file
26
hGameTest/node_modules/webpack/lib/dependencies/RequireHeaderDependency.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
class RequireHeaderDependency extends NullDependency {
|
||||
constructor(range) {
|
||||
super();
|
||||
if(!Array.isArray(range)) throw new Error("range must be valid");
|
||||
this.range = range;
|
||||
}
|
||||
}
|
||||
|
||||
RequireHeaderDependency.Template = class RequireHeaderDependencyTemplate {
|
||||
apply(dep, source) {
|
||||
source.replace(dep.range[0], dep.range[1] - 1, "__webpack_require__");
|
||||
}
|
||||
|
||||
applyAsTemplateArgument(name, dep, source) {
|
||||
source.replace(dep.range[0], dep.range[1] - 1, "require");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = RequireHeaderDependency;
|
||||
41
hGameTest/node_modules/webpack/lib/dependencies/RequireIncludeDependency.js
generated
vendored
Normal file
41
hGameTest/node_modules/webpack/lib/dependencies/RequireIncludeDependency.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
class RequireIncludeDependency extends ModuleDependency {
|
||||
constructor(request, range) {
|
||||
super(request);
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
getReference() {
|
||||
if(!this.module) return null;
|
||||
return {
|
||||
module: this.module,
|
||||
importedNames: [] // This doesn't use any export
|
||||
};
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "require.include";
|
||||
}
|
||||
}
|
||||
|
||||
RequireIncludeDependency.Template = class RequireIncludeDependencyTemplate {
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
const comment = this.getOptionalComment(outputOptions.pathinfo && dep.module, requestShortener.shorten(dep.request));
|
||||
source.replace(dep.range[0], dep.range[1] - 1, `undefined${comment}`);
|
||||
}
|
||||
|
||||
getOptionalComment(shouldHaveComment, shortenedRequest) {
|
||||
if(shouldHaveComment) {
|
||||
return "";
|
||||
}
|
||||
return `/*! require.include ${shortenedRequest} */`;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = RequireIncludeDependency;
|
||||
21
hGameTest/node_modules/webpack/lib/dependencies/RequireIncludeDependencyParserPlugin.js
generated
vendored
Normal file
21
hGameTest/node_modules/webpack/lib/dependencies/RequireIncludeDependencyParserPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const RequireIncludeDependency = require("./RequireIncludeDependency");
|
||||
|
||||
module.exports = class RequireIncludeDependencyParserPlugin {
|
||||
apply(parser) {
|
||||
parser.plugin("call require.include", expr => {
|
||||
if(expr.arguments.length !== 1) return;
|
||||
const param = parser.evaluateExpression(expr.arguments[0]);
|
||||
if(!param.isString()) return;
|
||||
const dep = new RequireIncludeDependency(param.string, expr.range);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
};
|
||||
33
hGameTest/node_modules/webpack/lib/dependencies/RequireIncludePlugin.js
generated
vendored
Normal file
33
hGameTest/node_modules/webpack/lib/dependencies/RequireIncludePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const RequireIncludeDependency = require("./RequireIncludeDependency");
|
||||
const RequireIncludeDependencyParserPlugin = require("./RequireIncludeDependencyParserPlugin");
|
||||
|
||||
const ParserHelpers = require("../ParserHelpers");
|
||||
|
||||
class RequireIncludePlugin {
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(RequireIncludeDependency, normalModuleFactory);
|
||||
compilation.dependencyTemplates.set(RequireIncludeDependency, new RequireIncludeDependency.Template());
|
||||
|
||||
params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
|
||||
|
||||
if(typeof parserOptions.requireInclude !== "undefined" && !parserOptions.requireInclude)
|
||||
return;
|
||||
|
||||
parser.apply(new RequireIncludeDependencyParserPlugin());
|
||||
parser.plugin("evaluate typeof require.include", ParserHelpers.evaluateToString("function"));
|
||||
parser.plugin("typeof require.include", ParserHelpers.toConstantDependency(JSON.stringify("function")));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = RequireIncludePlugin;
|
||||
24
hGameTest/node_modules/webpack/lib/dependencies/RequireResolveContextDependency.js
generated
vendored
Normal file
24
hGameTest/node_modules/webpack/lib/dependencies/RequireResolveContextDependency.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ContextDependency = require("./ContextDependency");
|
||||
const ContextDependencyTemplateAsId = require("./ContextDependencyTemplateAsId");
|
||||
|
||||
class RequireResolveContextDependency extends ContextDependency {
|
||||
constructor(request, recursive, regExp, range, valueRange) {
|
||||
super(request, recursive, regExp);
|
||||
this.range = range;
|
||||
this.valueRange = valueRange;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "amd require context";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RequireResolveContextDependency.Template = ContextDependencyTemplateAsId;
|
||||
|
||||
module.exports = RequireResolveContextDependency;
|
||||
22
hGameTest/node_modules/webpack/lib/dependencies/RequireResolveDependency.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/dependencies/RequireResolveDependency.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
const ModuleDependencyAsId = require("./ModuleDependencyTemplateAsId");
|
||||
|
||||
class RequireResolveDependency extends ModuleDependency {
|
||||
constructor(request, range) {
|
||||
super(request);
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "require.resolve";
|
||||
}
|
||||
}
|
||||
|
||||
RequireResolveDependency.Template = ModuleDependencyAsId;
|
||||
|
||||
module.exports = RequireResolveDependency;
|
||||
71
hGameTest/node_modules/webpack/lib/dependencies/RequireResolveDependencyParserPlugin.js
generated
vendored
Normal file
71
hGameTest/node_modules/webpack/lib/dependencies/RequireResolveDependencyParserPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const RequireResolveDependency = require("./RequireResolveDependency");
|
||||
const RequireResolveContextDependency = require("./RequireResolveContextDependency");
|
||||
const RequireResolveHeaderDependency = require("./RequireResolveHeaderDependency");
|
||||
const ContextDependencyHelpers = require("./ContextDependencyHelpers");
|
||||
|
||||
class RequireResolveDependencyParserPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(parser) {
|
||||
const options = this.options;
|
||||
parser.plugin("call require.resolve", (expr) => {
|
||||
return parser.applyPluginsBailResult("call require.resolve(Weak)", expr, false);
|
||||
});
|
||||
parser.plugin("call require.resolveWeak", (expr) => {
|
||||
return parser.applyPluginsBailResult("call require.resolve(Weak)", expr, true);
|
||||
});
|
||||
parser.plugin("call require.resolve(Weak)", (expr, weak) => {
|
||||
if(expr.arguments.length !== 1) return;
|
||||
const param = parser.evaluateExpression(expr.arguments[0]);
|
||||
if(param.isConditional()) {
|
||||
param.options.forEach((option) => {
|
||||
const result = parser.applyPluginsBailResult("call require.resolve(Weak):item", expr, option, weak);
|
||||
if(result === undefined) {
|
||||
parser.applyPluginsBailResult("call require.resolve(Weak):context", expr, option, weak);
|
||||
}
|
||||
});
|
||||
const dep = new RequireResolveHeaderDependency(expr.callee.range);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
} else {
|
||||
const result = parser.applyPluginsBailResult("call require.resolve(Weak):item", expr, param, weak);
|
||||
if(result === undefined) {
|
||||
parser.applyPluginsBailResult("call require.resolve(Weak):context", expr, param, weak);
|
||||
}
|
||||
const dep = new RequireResolveHeaderDependency(expr.callee.range);
|
||||
dep.loc = expr.loc;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
parser.plugin("call require.resolve(Weak):item", (expr, param, weak) => {
|
||||
if(param.isString()) {
|
||||
const dep = new RequireResolveDependency(param.string, param.range);
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
dep.weak = weak;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
parser.plugin("call require.resolve(Weak):context", (expr, param, weak) => {
|
||||
const dep = ContextDependencyHelpers.create(RequireResolveContextDependency, param.range, param, expr, options);
|
||||
if(!dep) return;
|
||||
dep.loc = expr.loc;
|
||||
dep.optional = !!parser.scope.inTry;
|
||||
dep.async = weak ? "weak" : false;
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = RequireResolveDependencyParserPlugin;
|
||||
26
hGameTest/node_modules/webpack/lib/dependencies/RequireResolveHeaderDependency.js
generated
vendored
Normal file
26
hGameTest/node_modules/webpack/lib/dependencies/RequireResolveHeaderDependency.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
class RequireResolveHeaderDependency extends NullDependency {
|
||||
constructor(range) {
|
||||
super();
|
||||
if(!Array.isArray(range)) throw new Error("range must be valid");
|
||||
this.range = range;
|
||||
}
|
||||
}
|
||||
|
||||
RequireResolveHeaderDependency.Template = class RequireResolveHeaderDependencyTemplate {
|
||||
apply(dep, source) {
|
||||
source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/");
|
||||
}
|
||||
|
||||
applyAsTemplateArgument(name, dep, source) {
|
||||
source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = RequireResolveHeaderDependency;
|
||||
18
hGameTest/node_modules/webpack/lib/dependencies/SingleEntryDependency.js
generated
vendored
Normal file
18
hGameTest/node_modules/webpack/lib/dependencies/SingleEntryDependency.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
class SingleEntryDependency extends ModuleDependency {
|
||||
constructor(request) {
|
||||
super(request);
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "single entry";
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SingleEntryDependency;
|
||||
44
hGameTest/node_modules/webpack/lib/dependencies/SystemPlugin.js
generated
vendored
Normal file
44
hGameTest/node_modules/webpack/lib/dependencies/SystemPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const ParserHelpers = require("../ParserHelpers");
|
||||
|
||||
class SystemPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
|
||||
|
||||
if(typeof parserOptions.system !== "undefined" && !parserOptions.system)
|
||||
return;
|
||||
|
||||
function setNotSupported(name) {
|
||||
parser.plugin("evaluate typeof " + name, ParserHelpers.evaluateToString("undefined"));
|
||||
parser.plugin("expression " + name,
|
||||
ParserHelpers.expressionIsUnsupported(name + " is not supported by webpack.")
|
||||
);
|
||||
}
|
||||
|
||||
parser.plugin("typeof System.import", ParserHelpers.toConstantDependency(JSON.stringify("function")));
|
||||
parser.plugin("evaluate typeof System.import", ParserHelpers.evaluateToString("function"));
|
||||
parser.plugin("typeof System", ParserHelpers.toConstantDependency(JSON.stringify("object")));
|
||||
parser.plugin("evaluate typeof System", ParserHelpers.evaluateToString("object"));
|
||||
|
||||
setNotSupported("System.set");
|
||||
setNotSupported("System.get");
|
||||
setNotSupported("System.register");
|
||||
parser.plugin("expression System", function() {
|
||||
const systemPolyfillRequire = ParserHelpers.requireFileAsExpression(
|
||||
this.state.module.context, require.resolve("../../buildin/system.js"));
|
||||
return ParserHelpers.addParsedVariableToModule(this, "System", systemPolyfillRequire);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = SystemPlugin;
|
||||
23
hGameTest/node_modules/webpack/lib/dependencies/UnsupportedDependency.js
generated
vendored
Normal file
23
hGameTest/node_modules/webpack/lib/dependencies/UnsupportedDependency.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const NullDependency = require("./NullDependency");
|
||||
const webpackMissingModule = require("./WebpackMissingModule").module;
|
||||
|
||||
class UnsupportedDependency extends NullDependency {
|
||||
constructor(request, range) {
|
||||
super();
|
||||
this.request = request;
|
||||
this.range = range;
|
||||
}
|
||||
}
|
||||
|
||||
UnsupportedDependency.Template = class UnsupportedDependencyTemplate {
|
||||
apply(dep, source, outputOptions, requestShortener) {
|
||||
source.replace(dep.range[0], dep.range[1], webpackMissingModule(dep.request));
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = UnsupportedDependency;
|
||||
18
hGameTest/node_modules/webpack/lib/dependencies/WebpackMissingModule.js
generated
vendored
Normal file
18
hGameTest/node_modules/webpack/lib/dependencies/WebpackMissingModule.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const toErrorCode = err => `var e = new Error(${JSON.stringify(err)}); e.code = 'MODULE_NOT_FOUND';`;
|
||||
|
||||
exports.module = request => `!(function webpackMissingModule() { ${exports.moduleCode(request)} }())`;
|
||||
|
||||
exports.promise = (request) => {
|
||||
const errorCode = toErrorCode(`Cannot find module "${request}"`);
|
||||
return `Promise.reject(function webpackMissingModule() { ${errorCode}; return e; }())`;
|
||||
};
|
||||
|
||||
exports.moduleCode = (request) => {
|
||||
const errorCode = toErrorCode(`Cannot find module "${request}"`);
|
||||
return `${errorCode} throw e;`;
|
||||
};
|
||||
44
hGameTest/node_modules/webpack/lib/dependencies/getFunctionExpression.js
generated
vendored
Normal file
44
hGameTest/node_modules/webpack/lib/dependencies/getFunctionExpression.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
module.exports = function(expr) {
|
||||
// <FunctionExpression>
|
||||
if(expr.type === "FunctionExpression" || expr.type === "ArrowFunctionExpression") {
|
||||
return {
|
||||
fn: expr,
|
||||
expressions: [],
|
||||
needThis: false
|
||||
};
|
||||
}
|
||||
|
||||
// <FunctionExpression>.bind(<Expression>)
|
||||
if(expr.type === "CallExpression" &&
|
||||
expr.callee.type === "MemberExpression" &&
|
||||
expr.callee.object.type === "FunctionExpression" &&
|
||||
expr.callee.property.type === "Identifier" &&
|
||||
expr.callee.property.name === "bind" &&
|
||||
expr.arguments.length === 1) {
|
||||
return {
|
||||
fn: expr.callee.object,
|
||||
expressions: [expr.arguments[0]]
|
||||
};
|
||||
}
|
||||
// (function(_this) {return <FunctionExpression>})(this) (Coffeescript)
|
||||
if(expr.type === "CallExpression" &&
|
||||
expr.callee.type === "FunctionExpression" &&
|
||||
expr.callee.body.type === "BlockStatement" &&
|
||||
expr.arguments.length === 1 &&
|
||||
expr.arguments[0].type === "ThisExpression" &&
|
||||
expr.callee.body.body &&
|
||||
expr.callee.body.body.length === 1 &&
|
||||
expr.callee.body.body[0].type === "ReturnStatement" &&
|
||||
expr.callee.body.body[0].argument &&
|
||||
expr.callee.body.body[0].argument.type === "FunctionExpression") {
|
||||
return {
|
||||
fn: expr.callee.body.body[0].argument,
|
||||
expressions: [],
|
||||
needThis: true
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user