First commit
This commit is contained in:
45
hGameTest/node_modules/webpack/lib/APIPlugin.js
generated
vendored
Normal file
45
hGameTest/node_modules/webpack/lib/APIPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ConstDependency = require("./dependencies/ConstDependency");
|
||||
const ParserHelpers = require("./ParserHelpers");
|
||||
|
||||
const NullFactory = require("./NullFactory");
|
||||
|
||||
const REPLACEMENTS = {
|
||||
__webpack_require__: "__webpack_require__", // eslint-disable-line camelcase
|
||||
__webpack_public_path__: "__webpack_require__.p", // eslint-disable-line camelcase
|
||||
__webpack_modules__: "__webpack_require__.m", // eslint-disable-line camelcase
|
||||
__webpack_chunk_load__: "__webpack_require__.e", // eslint-disable-line camelcase
|
||||
__non_webpack_require__: "require", // eslint-disable-line camelcase
|
||||
__webpack_nonce__: "__webpack_require__.nc", // eslint-disable-line camelcase
|
||||
"require.onError": "__webpack_require__.oe" // eslint-disable-line camelcase
|
||||
};
|
||||
const REPLACEMENT_TYPES = {
|
||||
__webpack_public_path__: "string", // eslint-disable-line camelcase
|
||||
__webpack_require__: "function", // eslint-disable-line camelcase
|
||||
__webpack_modules__: "object", // eslint-disable-line camelcase
|
||||
__webpack_chunk_load__: "function", // eslint-disable-line camelcase
|
||||
__webpack_nonce__: "string" // eslint-disable-line camelcase
|
||||
};
|
||||
|
||||
class APIPlugin {
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
|
||||
|
||||
params.normalModuleFactory.plugin("parser", parser => {
|
||||
Object.keys(REPLACEMENTS).forEach(key => {
|
||||
parser.plugin(`expression ${key}`, ParserHelpers.toConstantDependency(REPLACEMENTS[key]));
|
||||
parser.plugin(`evaluate typeof ${key}`, ParserHelpers.evaluateToString(REPLACEMENT_TYPES[key]));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = APIPlugin;
|
||||
56
hGameTest/node_modules/webpack/lib/AmdMainTemplatePlugin.js
generated
vendored
Normal file
56
hGameTest/node_modules/webpack/lib/AmdMainTemplatePlugin.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 ConcatSource = require("webpack-sources").ConcatSource;
|
||||
const Template = require("./Template");
|
||||
|
||||
class AmdMainTemplatePlugin {
|
||||
constructor(name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
apply(compilation) {
|
||||
const mainTemplate = compilation.mainTemplate;
|
||||
|
||||
compilation.templatesPlugin("render-with-entry", (source, chunk, hash) => {
|
||||
const externals = chunk.getModules().filter((m) => m.external);
|
||||
const externalsDepsArray = JSON.stringify(externals.map((m) =>
|
||||
typeof m.request === "object" ? m.request.amd : m.request
|
||||
));
|
||||
const externalsArguments = externals.map((m) =>
|
||||
Template.toIdentifier(`__WEBPACK_EXTERNAL_MODULE_${m.id}__`)
|
||||
).join(", ");
|
||||
|
||||
if(this.name) {
|
||||
const name = mainTemplate.applyPluginsWaterfall("asset-path", this.name, {
|
||||
hash,
|
||||
chunk
|
||||
});
|
||||
|
||||
return new ConcatSource(
|
||||
`define(${JSON.stringify(name)}, ${externalsDepsArray}, function(${externalsArguments}) { return `, source, "});"
|
||||
);
|
||||
} else if(externalsArguments) {
|
||||
return new ConcatSource(`define(${externalsDepsArray}, function(${externalsArguments}) { return `, source, "});");
|
||||
} else {
|
||||
return new ConcatSource("define(function() { return ", source, "});");
|
||||
}
|
||||
});
|
||||
|
||||
mainTemplate.plugin("global-hash-paths", (paths) => {
|
||||
if(this.name) paths.push(this.name);
|
||||
return paths;
|
||||
});
|
||||
|
||||
mainTemplate.plugin("hash", (hash) => {
|
||||
hash.update("exports amd");
|
||||
hash.update(this.name);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AmdMainTemplatePlugin;
|
||||
43
hGameTest/node_modules/webpack/lib/AsyncDependenciesBlock.js
generated
vendored
Normal file
43
hGameTest/node_modules/webpack/lib/AsyncDependenciesBlock.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const DependenciesBlock = require("./DependenciesBlock");
|
||||
|
||||
module.exports = class AsyncDependenciesBlock extends DependenciesBlock {
|
||||
constructor(name, module, loc) {
|
||||
super();
|
||||
this.chunkName = name;
|
||||
this.chunks = null;
|
||||
this.module = module;
|
||||
this.loc = loc;
|
||||
}
|
||||
get chunk() {
|
||||
throw new Error("`chunk` was been renamed to `chunks` and is now an array");
|
||||
}
|
||||
set chunk(chunk) {
|
||||
throw new Error("`chunk` was been renamed to `chunks` and is now an array");
|
||||
}
|
||||
updateHash(hash) {
|
||||
hash.update(this.chunkName || "");
|
||||
hash.update(this.chunks && this.chunks.map((chunk) => {
|
||||
return chunk.id !== null ? chunk.id : "";
|
||||
}).join(",") || "");
|
||||
super.updateHash(hash);
|
||||
}
|
||||
disconnect() {
|
||||
this.chunks = null;
|
||||
super.disconnect();
|
||||
}
|
||||
unseal() {
|
||||
this.chunks = null;
|
||||
super.unseal();
|
||||
}
|
||||
sortItems() {
|
||||
super.sortItems();
|
||||
if(this.chunks) {
|
||||
this.chunks.sort((a, b) => a.compareTo(b));
|
||||
}
|
||||
}
|
||||
};
|
||||
21
hGameTest/node_modules/webpack/lib/AsyncDependencyToInitialChunkWarning.js
generated
vendored
Normal file
21
hGameTest/node_modules/webpack/lib/AsyncDependencyToInitialChunkWarning.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Sean Larkin @thelarkinn
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const WebpackError = require("./WebpackError");
|
||||
|
||||
module.exports = class AsyncDependencyToInitialChunkWarning extends WebpackError {
|
||||
constructor(chunkName, module, loc) {
|
||||
super();
|
||||
|
||||
this.name = "AsyncDependencyToInitialChunkWarning";
|
||||
this.message = `It's not allowed to load an initial chunk on demand. The chunk name "${chunkName}" is already used by an entrypoint.`;
|
||||
this.module = module;
|
||||
this.origin = module;
|
||||
this.originLoc = loc;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
};
|
||||
36
hGameTest/node_modules/webpack/lib/AutomaticPrefetchPlugin.js
generated
vendored
Normal file
36
hGameTest/node_modules/webpack/lib/AutomaticPrefetchPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const asyncLib = require("async");
|
||||
const PrefetchDependency = require("./dependencies/PrefetchDependency");
|
||||
const NormalModule = require("./NormalModule");
|
||||
|
||||
class AutomaticPrefetchPlugin {
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(PrefetchDependency, normalModuleFactory);
|
||||
});
|
||||
let lastModules = null;
|
||||
compiler.plugin("after-compile", (compilation, callback) => {
|
||||
lastModules = compilation.modules
|
||||
.filter(m => m instanceof NormalModule)
|
||||
.map(m => ({
|
||||
context: m.context,
|
||||
request: m.request
|
||||
}));
|
||||
callback();
|
||||
});
|
||||
compiler.plugin("make", (compilation, callback) => {
|
||||
if(!lastModules) return callback();
|
||||
asyncLib.forEach(lastModules, (m, callback) => {
|
||||
compilation.prefetch(m.context || compiler.context, new PrefetchDependency(m.request), callback);
|
||||
}, callback);
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = AutomaticPrefetchPlugin;
|
||||
75
hGameTest/node_modules/webpack/lib/BannerPlugin.js
generated
vendored
Normal file
75
hGameTest/node_modules/webpack/lib/BannerPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const ConcatSource = require("webpack-sources").ConcatSource;
|
||||
const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
|
||||
|
||||
const wrapComment = (str) => {
|
||||
if(!str.includes("\n")) return `/*! ${str} */`;
|
||||
return `/*!\n * ${str.split("\n").join("\n * ")}\n */`;
|
||||
};
|
||||
|
||||
class BannerPlugin {
|
||||
constructor(options) {
|
||||
if(arguments.length > 1)
|
||||
throw new Error("BannerPlugin only takes one argument (pass an options object)");
|
||||
if(typeof options === "string")
|
||||
options = {
|
||||
banner: options
|
||||
};
|
||||
this.options = options || {};
|
||||
this.banner = this.options.raw ? options.banner : wrapComment(options.banner);
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
const options = this.options;
|
||||
const banner = this.banner;
|
||||
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.plugin("optimize-chunk-assets", (chunks, callback) => {
|
||||
chunks.forEach((chunk) => {
|
||||
if(options.entryOnly && !chunk.isInitial()) return;
|
||||
chunk.files
|
||||
.filter(ModuleFilenameHelpers.matchObject.bind(undefined, options))
|
||||
.forEach((file) => {
|
||||
let basename;
|
||||
let query = "";
|
||||
let filename = file;
|
||||
const hash = compilation.hash;
|
||||
const querySplit = filename.indexOf("?");
|
||||
|
||||
if(querySplit >= 0) {
|
||||
query = filename.substr(querySplit);
|
||||
filename = filename.substr(0, querySplit);
|
||||
}
|
||||
|
||||
const lastSlashIndex = filename.lastIndexOf("/");
|
||||
|
||||
if(lastSlashIndex === -1) {
|
||||
basename = filename;
|
||||
} else {
|
||||
basename = filename.substr(lastSlashIndex + 1);
|
||||
}
|
||||
|
||||
const comment = compilation.getPath(banner, {
|
||||
hash,
|
||||
chunk,
|
||||
filename,
|
||||
basename,
|
||||
query,
|
||||
});
|
||||
|
||||
return compilation.assets[file] = new ConcatSource(comment, "\n", compilation.assets[file]);
|
||||
});
|
||||
});
|
||||
callback();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = BannerPlugin;
|
||||
203
hGameTest/node_modules/webpack/lib/BasicEvaluatedExpression.js
generated
vendored
Normal file
203
hGameTest/node_modules/webpack/lib/BasicEvaluatedExpression.js
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
class BasicEvaluatedExpression {
|
||||
|
||||
constructor() {
|
||||
this.range = null;
|
||||
}
|
||||
|
||||
isNull() {
|
||||
return !!this.null;
|
||||
}
|
||||
|
||||
isString() {
|
||||
return Object.prototype.hasOwnProperty.call(this, "string");
|
||||
}
|
||||
|
||||
isNumber() {
|
||||
return Object.prototype.hasOwnProperty.call(this, "number");
|
||||
}
|
||||
|
||||
isBoolean() {
|
||||
return Object.prototype.hasOwnProperty.call(this, "bool");
|
||||
}
|
||||
|
||||
isRegExp() {
|
||||
return Object.prototype.hasOwnProperty.call(this, "regExp");
|
||||
}
|
||||
|
||||
isConditional() {
|
||||
return Object.prototype.hasOwnProperty.call(this, "options");
|
||||
}
|
||||
|
||||
isArray() {
|
||||
return Object.prototype.hasOwnProperty.call(this, "items");
|
||||
}
|
||||
|
||||
isConstArray() {
|
||||
return Object.prototype.hasOwnProperty.call(this, "array");
|
||||
}
|
||||
|
||||
isIdentifier() {
|
||||
return Object.prototype.hasOwnProperty.call(this, "identifier");
|
||||
}
|
||||
|
||||
isWrapped() {
|
||||
return Object.prototype.hasOwnProperty.call(this, "prefix") || Object.prototype.hasOwnProperty.call(this, "postfix");
|
||||
}
|
||||
|
||||
isTemplateString() {
|
||||
return Object.prototype.hasOwnProperty.call(this, "quasis");
|
||||
}
|
||||
|
||||
isTruthy() {
|
||||
return this.truthy;
|
||||
}
|
||||
|
||||
isFalsy() {
|
||||
return this.falsy;
|
||||
}
|
||||
|
||||
asBool() {
|
||||
if(this.truthy) return true;
|
||||
else if(this.falsy) return false;
|
||||
else if(this.isBoolean()) return this.bool;
|
||||
else if(this.isNull()) return false;
|
||||
else if(this.isString()) return !!this.string;
|
||||
else if(this.isNumber()) return !!this.number;
|
||||
else if(this.isRegExp()) return true;
|
||||
else if(this.isArray()) return true;
|
||||
else if(this.isConstArray()) return true;
|
||||
else if(this.isWrapped()) return this.prefix && this.prefix.asBool() || this.postfix && this.postfix.asBool() ? true : undefined;
|
||||
else if(this.isTemplateString()) {
|
||||
if(this.quasis.length === 1) return this.quasis[0].asBool();
|
||||
for(let i = 0; i < this.quasis.length; i++) {
|
||||
if(this.quasis[i].asBool()) return true;
|
||||
}
|
||||
// can't tell if string will be empty without executing
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
setString(str) {
|
||||
if(str === null)
|
||||
delete this.string;
|
||||
else
|
||||
this.string = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
setNull() {
|
||||
this.null = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
setNumber(num) {
|
||||
if(num === null)
|
||||
delete this.number;
|
||||
else
|
||||
this.number = num;
|
||||
return this;
|
||||
}
|
||||
|
||||
setBoolean(bool) {
|
||||
if(bool === null)
|
||||
delete this.bool;
|
||||
else
|
||||
this.bool = bool;
|
||||
return this;
|
||||
}
|
||||
|
||||
setRegExp(regExp) {
|
||||
if(regExp === null)
|
||||
delete this.regExp;
|
||||
else
|
||||
this.regExp = regExp;
|
||||
return this;
|
||||
}
|
||||
|
||||
setIdentifier(identifier) {
|
||||
if(identifier === null)
|
||||
delete this.identifier;
|
||||
else
|
||||
this.identifier = identifier;
|
||||
return this;
|
||||
}
|
||||
|
||||
setWrapped(prefix, postfix) {
|
||||
this.prefix = prefix;
|
||||
this.postfix = postfix;
|
||||
return this;
|
||||
}
|
||||
|
||||
unsetWrapped() {
|
||||
delete this.prefix;
|
||||
delete this.postfix;
|
||||
return this;
|
||||
}
|
||||
|
||||
setOptions(options) {
|
||||
if(options === null)
|
||||
delete this.options;
|
||||
else
|
||||
this.options = options;
|
||||
return this;
|
||||
}
|
||||
|
||||
setItems(items) {
|
||||
if(items === null)
|
||||
delete this.items;
|
||||
else
|
||||
this.items = items;
|
||||
return this;
|
||||
}
|
||||
|
||||
setArray(array) {
|
||||
if(array === null)
|
||||
delete this.array;
|
||||
else
|
||||
this.array = array;
|
||||
return this;
|
||||
}
|
||||
|
||||
setTemplateString(quasis) {
|
||||
if(quasis === null)
|
||||
delete this.quasis;
|
||||
else
|
||||
this.quasis = quasis;
|
||||
return this;
|
||||
}
|
||||
|
||||
setTruthy() {
|
||||
this.falsy = false;
|
||||
this.truthy = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
setFalsy() {
|
||||
this.falsy = true;
|
||||
this.truthy = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
addOptions(options) {
|
||||
if(!this.options) this.options = [];
|
||||
options.forEach(item => {
|
||||
this.options.push(item);
|
||||
}, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
setRange(range) {
|
||||
this.range = range;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = BasicEvaluatedExpression;
|
||||
95
hGameTest/node_modules/webpack/lib/CachePlugin.js
generated
vendored
Normal file
95
hGameTest/node_modules/webpack/lib/CachePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const asyncLib = require("async");
|
||||
|
||||
class CachePlugin {
|
||||
constructor(cache) {
|
||||
this.cache = cache || {};
|
||||
this.FS_ACCURENCY = 2000;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
if(Array.isArray(compiler.compilers)) {
|
||||
compiler.compilers.forEach((c, idx) => {
|
||||
c.apply(new CachePlugin(this.cache[idx] = this.cache[idx] || {}));
|
||||
});
|
||||
} else {
|
||||
const registerCacheToCompiler = (compiler, cache) => {
|
||||
compiler.plugin("this-compilation", compilation => {
|
||||
// TODO remove notCacheable for webpack 4
|
||||
if(!compilation.notCacheable) {
|
||||
compilation.cache = cache;
|
||||
compilation.plugin("child-compiler", (childCompiler, compilerName, compilerIndex) => {
|
||||
if(cache) {
|
||||
let childCache;
|
||||
if(!cache.children) cache.children = {};
|
||||
if(!cache.children[compilerName]) cache.children[compilerName] = [];
|
||||
if(cache.children[compilerName][compilerIndex])
|
||||
childCache = cache.children[compilerName][compilerIndex];
|
||||
else
|
||||
cache.children[compilerName].push(childCache = {});
|
||||
registerCacheToCompiler(childCompiler, childCache);
|
||||
}
|
||||
});
|
||||
} else if(this.watching) {
|
||||
compilation.warnings.push(
|
||||
new Error(`CachePlugin - Cache cannot be used because of: ${compilation.notCacheable}`)
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
registerCacheToCompiler(compiler, this.cache);
|
||||
compiler.plugin("watch-run", (compiler, callback) => {
|
||||
this.watching = true;
|
||||
callback();
|
||||
});
|
||||
compiler.plugin("run", (compiler, callback) => {
|
||||
if(!compiler._lastCompilationFileDependencies) return callback();
|
||||
const fs = compiler.inputFileSystem;
|
||||
const fileTs = compiler.fileTimestamps = {};
|
||||
asyncLib.forEach(compiler._lastCompilationFileDependencies, (file, callback) => {
|
||||
fs.stat(file, (err, stat) => {
|
||||
if(err) {
|
||||
if(err.code === "ENOENT") return callback();
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if(stat.mtime)
|
||||
this.applyMtime(+stat.mtime);
|
||||
|
||||
fileTs[file] = +stat.mtime || Infinity;
|
||||
callback();
|
||||
});
|
||||
}, err => {
|
||||
if(err) return callback(err);
|
||||
Object.keys(fileTs).forEach(key => {
|
||||
fileTs[key] += this.FS_ACCURENCY;
|
||||
});
|
||||
callback();
|
||||
});
|
||||
});
|
||||
compiler.plugin("after-compile", function(compilation, callback) {
|
||||
compilation.compiler._lastCompilationFileDependencies = compilation.fileDependencies;
|
||||
compilation.compiler._lastCompilationContextDependencies = compilation.contextDependencies;
|
||||
callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
applyMtime(mtime) {
|
||||
if(this.FS_ACCURENCY > 1 && mtime % 2 !== 0)
|
||||
this.FS_ACCURENCY = 1;
|
||||
else if(this.FS_ACCURENCY > 10 && mtime % 20 !== 0)
|
||||
this.FS_ACCURENCY = 10;
|
||||
else if(this.FS_ACCURENCY > 100 && mtime % 200 !== 0)
|
||||
this.FS_ACCURENCY = 100;
|
||||
else if(this.FS_ACCURENCY > 1000 && mtime % 2000 !== 0)
|
||||
this.FS_ACCURENCY = 1000;
|
||||
}
|
||||
}
|
||||
module.exports = CachePlugin;
|
||||
49
hGameTest/node_modules/webpack/lib/CaseSensitiveModulesWarning.js
generated
vendored
Normal file
49
hGameTest/node_modules/webpack/lib/CaseSensitiveModulesWarning.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 WebpackError = require("./WebpackError");
|
||||
|
||||
module.exports = class CaseSensitiveModulesWarning extends WebpackError {
|
||||
constructor(modules) {
|
||||
super();
|
||||
|
||||
this.name = "CaseSensitiveModulesWarning";
|
||||
const sortedModules = this._sort(modules);
|
||||
const modulesList = this._moduleMessages(sortedModules);
|
||||
this.message = "There are multiple modules with names that only differ in casing.\n" +
|
||||
"This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.\n" +
|
||||
`Use equal casing. Compare these module identifiers:\n${modulesList}`;
|
||||
this.origin = this.module = sortedModules[0];
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
|
||||
_sort(modules) {
|
||||
return modules.slice().sort((a, b) => {
|
||||
a = a.identifier();
|
||||
b = b.identifier();
|
||||
/* istanbul ignore next */
|
||||
if(a < b) return -1;
|
||||
/* istanbul ignore next */
|
||||
if(a > b) return 1;
|
||||
/* istanbul ignore next */
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
_moduleMessages(modules) {
|
||||
return modules.map((m) => {
|
||||
let message = `* ${m.identifier()}`;
|
||||
const validReasons = m.reasons.filter((reason) => reason.module);
|
||||
|
||||
if(validReasons.length > 0) {
|
||||
message += `\n Used by ${validReasons.length} module(s), i. e.`;
|
||||
message += `\n ${validReasons[0].module.identifier()}`;
|
||||
}
|
||||
return message;
|
||||
}).join("\n");
|
||||
}
|
||||
};
|
||||
479
hGameTest/node_modules/webpack/lib/Chunk.js
generated
vendored
Normal file
479
hGameTest/node_modules/webpack/lib/Chunk.js
generated
vendored
Normal file
@@ -0,0 +1,479 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const util = require("util");
|
||||
const compareLocations = require("./compareLocations");
|
||||
const SortableSet = require("./util/SortableSet");
|
||||
let debugId = 1000;
|
||||
|
||||
const sortById = (a, b) => {
|
||||
if(a.id < b.id) return -1;
|
||||
if(b.id < a.id) return 1;
|
||||
return 0;
|
||||
};
|
||||
|
||||
const sortByIdentifier = (a, b) => {
|
||||
if(a.identifier() > b.identifier()) return 1;
|
||||
if(a.identifier() < b.identifier()) return -1;
|
||||
return 0;
|
||||
};
|
||||
|
||||
class Chunk {
|
||||
|
||||
constructor(name, module, loc) {
|
||||
this.id = null;
|
||||
this.ids = null;
|
||||
this.debugId = debugId++;
|
||||
this.name = name;
|
||||
this._modules = new SortableSet(undefined, sortByIdentifier);
|
||||
this.entrypoints = [];
|
||||
this.chunks = [];
|
||||
this.parents = [];
|
||||
this.blocks = [];
|
||||
this.origins = [];
|
||||
this.files = [];
|
||||
this.rendered = false;
|
||||
if(module) {
|
||||
this.origins.push({
|
||||
module,
|
||||
loc,
|
||||
name
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
get entry() {
|
||||
throw new Error("Chunk.entry was removed. Use hasRuntime()");
|
||||
}
|
||||
|
||||
set entry(data) {
|
||||
throw new Error("Chunk.entry was removed. Use hasRuntime()");
|
||||
}
|
||||
|
||||
get initial() {
|
||||
throw new Error("Chunk.initial was removed. Use isInitial()");
|
||||
}
|
||||
|
||||
set initial(data) {
|
||||
throw new Error("Chunk.initial was removed. Use isInitial()");
|
||||
}
|
||||
|
||||
hasRuntime() {
|
||||
if(this.entrypoints.length === 0) return false;
|
||||
return this.entrypoints[0].chunks[0] === this;
|
||||
}
|
||||
|
||||
isInitial() {
|
||||
return this.entrypoints.length > 0;
|
||||
}
|
||||
|
||||
hasEntryModule() {
|
||||
return !!this.entryModule;
|
||||
}
|
||||
|
||||
addToCollection(collection, item) {
|
||||
if(item === this) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(collection.indexOf(item) > -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
collection.push(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
addChunk(chunk) {
|
||||
return this.addToCollection(this.chunks, chunk);
|
||||
}
|
||||
|
||||
addParent(parentChunk) {
|
||||
return this.addToCollection(this.parents, parentChunk);
|
||||
}
|
||||
|
||||
addModule(module) {
|
||||
if(!this._modules.has(module)) {
|
||||
this._modules.add(module);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
addBlock(block) {
|
||||
return this.addToCollection(this.blocks, block);
|
||||
}
|
||||
|
||||
removeModule(module) {
|
||||
if(this._modules.delete(module)) {
|
||||
module.removeChunk(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
removeChunk(chunk) {
|
||||
const idx = this.chunks.indexOf(chunk);
|
||||
if(idx >= 0) {
|
||||
this.chunks.splice(idx, 1);
|
||||
chunk.removeParent(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
removeParent(chunk) {
|
||||
const idx = this.parents.indexOf(chunk);
|
||||
if(idx >= 0) {
|
||||
this.parents.splice(idx, 1);
|
||||
chunk.removeChunk(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
addOrigin(module, loc) {
|
||||
this.origins.push({
|
||||
module,
|
||||
loc,
|
||||
name: this.name
|
||||
});
|
||||
}
|
||||
|
||||
setModules(modules) {
|
||||
this._modules = new SortableSet(modules, sortByIdentifier);
|
||||
}
|
||||
|
||||
getNumberOfModules() {
|
||||
return this._modules.size;
|
||||
}
|
||||
|
||||
get modulesIterable() {
|
||||
return this._modules;
|
||||
}
|
||||
|
||||
forEachModule(fn) {
|
||||
this._modules.forEach(fn);
|
||||
}
|
||||
|
||||
mapModules(fn) {
|
||||
return Array.from(this._modules, fn);
|
||||
}
|
||||
|
||||
compareTo(otherChunk) {
|
||||
this._modules.sort();
|
||||
otherChunk._modules.sort();
|
||||
if(this._modules.size > otherChunk._modules.size) return -1;
|
||||
if(this._modules.size < otherChunk._modules.size) return 1;
|
||||
const a = this._modules[Symbol.iterator]();
|
||||
const b = otherChunk._modules[Symbol.iterator]();
|
||||
while(true) { // eslint-disable-line
|
||||
const aItem = a.next();
|
||||
const bItem = b.next();
|
||||
if(aItem.done) return 0;
|
||||
const aModuleIdentifier = aItem.value.identifier();
|
||||
const bModuleIdentifier = bItem.value.identifier();
|
||||
if(aModuleIdentifier > bModuleIdentifier) return -1;
|
||||
if(aModuleIdentifier < bModuleIdentifier) return 1;
|
||||
}
|
||||
}
|
||||
|
||||
containsModule(module) {
|
||||
return this._modules.has(module);
|
||||
}
|
||||
|
||||
getModules() {
|
||||
return Array.from(this._modules);
|
||||
}
|
||||
|
||||
getModulesIdent() {
|
||||
this._modules.sort();
|
||||
let str = "";
|
||||
this._modules.forEach(m => {
|
||||
str += m.identifier() + "#";
|
||||
});
|
||||
return str;
|
||||
}
|
||||
|
||||
remove(reason) {
|
||||
// cleanup modules
|
||||
// Array.from is used here to create a clone, because removeChunk modifies this._modules
|
||||
Array.from(this._modules).forEach(module => {
|
||||
module.removeChunk(this);
|
||||
});
|
||||
|
||||
// cleanup parents
|
||||
this.parents.forEach(parentChunk => {
|
||||
// remove this chunk from its parents
|
||||
const idx = parentChunk.chunks.indexOf(this);
|
||||
if(idx >= 0) {
|
||||
parentChunk.chunks.splice(idx, 1);
|
||||
}
|
||||
|
||||
// cleanup "sub chunks"
|
||||
this.chunks.forEach(chunk => {
|
||||
/**
|
||||
* remove this chunk as "intermediary" and connect
|
||||
* it "sub chunks" and parents directly
|
||||
*/
|
||||
// add parent to each "sub chunk"
|
||||
chunk.addParent(parentChunk);
|
||||
// add "sub chunk" to parent
|
||||
parentChunk.addChunk(chunk);
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* we need to iterate again over the chunks
|
||||
* to remove this from the chunks parents.
|
||||
* This can not be done in the above loop
|
||||
* as it is not garuanteed that `this.parents` contains anything.
|
||||
*/
|
||||
this.chunks.forEach(chunk => {
|
||||
// remove this as parent of every "sub chunk"
|
||||
const idx = chunk.parents.indexOf(this);
|
||||
if(idx >= 0) {
|
||||
chunk.parents.splice(idx, 1);
|
||||
}
|
||||
});
|
||||
|
||||
// cleanup blocks
|
||||
this.blocks.forEach(block => {
|
||||
const idx = block.chunks.indexOf(this);
|
||||
if(idx >= 0) {
|
||||
block.chunks.splice(idx, 1);
|
||||
if(block.chunks.length === 0) {
|
||||
block.chunks = null;
|
||||
block.chunkReason = reason;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
moveModule(module, otherChunk) {
|
||||
module.removeChunk(this);
|
||||
module.addChunk(otherChunk);
|
||||
otherChunk.addModule(module);
|
||||
module.rewriteChunkInReasons(this, [otherChunk]);
|
||||
}
|
||||
|
||||
replaceChunk(oldChunk, newChunk) {
|
||||
const idx = this.chunks.indexOf(oldChunk);
|
||||
if(idx >= 0) {
|
||||
this.chunks.splice(idx, 1);
|
||||
}
|
||||
if(this !== newChunk && newChunk.addParent(this)) {
|
||||
this.addChunk(newChunk);
|
||||
}
|
||||
}
|
||||
|
||||
replaceParentChunk(oldParentChunk, newParentChunk) {
|
||||
const idx = this.parents.indexOf(oldParentChunk);
|
||||
if(idx >= 0) {
|
||||
this.parents.splice(idx, 1);
|
||||
}
|
||||
if(this !== newParentChunk && newParentChunk.addChunk(this)) {
|
||||
this.addParent(newParentChunk);
|
||||
}
|
||||
}
|
||||
|
||||
integrate(otherChunk, reason) {
|
||||
if(!this.canBeIntegrated(otherChunk)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Array.from is used here to create a clone, because moveModule modifies otherChunk._modules
|
||||
const otherChunkModules = Array.from(otherChunk._modules);
|
||||
otherChunkModules.forEach(module => otherChunk.moveModule(module, this));
|
||||
otherChunk._modules.clear();
|
||||
|
||||
otherChunk.parents.forEach(parentChunk => parentChunk.replaceChunk(otherChunk, this));
|
||||
otherChunk.parents.length = 0;
|
||||
|
||||
otherChunk.chunks.forEach(chunk => chunk.replaceParentChunk(otherChunk, this));
|
||||
otherChunk.chunks.length = 0;
|
||||
|
||||
otherChunk.blocks.forEach(b => {
|
||||
b.chunks = b.chunks ? b.chunks.map(c => {
|
||||
return c === otherChunk ? this : c;
|
||||
}) : [this];
|
||||
b.chunkReason = reason;
|
||||
this.addBlock(b);
|
||||
});
|
||||
otherChunk.blocks.length = 0;
|
||||
|
||||
otherChunk.origins.forEach(origin => {
|
||||
this.origins.push(origin);
|
||||
});
|
||||
this.blocks.forEach(b => {
|
||||
b.chunkReason = reason;
|
||||
});
|
||||
this.origins.forEach(origin => {
|
||||
if(!origin.reasons) {
|
||||
origin.reasons = [reason];
|
||||
} else if(origin.reasons[0] !== reason) {
|
||||
origin.reasons.unshift(reason);
|
||||
}
|
||||
});
|
||||
this.chunks = this.chunks.filter(chunk => {
|
||||
return chunk !== otherChunk && chunk !== this;
|
||||
});
|
||||
this.parents = this.parents.filter(parentChunk => {
|
||||
return parentChunk !== otherChunk && parentChunk !== this;
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
split(newChunk) {
|
||||
this.blocks.forEach(block => {
|
||||
newChunk.blocks.push(block);
|
||||
block.chunks.push(newChunk);
|
||||
});
|
||||
this.chunks.forEach(chunk => {
|
||||
newChunk.chunks.push(chunk);
|
||||
chunk.parents.push(newChunk);
|
||||
});
|
||||
this.parents.forEach(parentChunk => {
|
||||
parentChunk.chunks.push(newChunk);
|
||||
newChunk.parents.push(parentChunk);
|
||||
});
|
||||
this.entrypoints.forEach(entrypoint => {
|
||||
entrypoint.insertChunk(newChunk, this);
|
||||
});
|
||||
}
|
||||
|
||||
isEmpty() {
|
||||
return this._modules.size === 0;
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
hash.update(`${this.id} `);
|
||||
hash.update(this.ids ? this.ids.join(",") : "");
|
||||
hash.update(`${this.name || ""} `);
|
||||
this._modules.forEach(m => m.updateHash(hash));
|
||||
}
|
||||
|
||||
canBeIntegrated(otherChunk) {
|
||||
if(otherChunk.isInitial()) {
|
||||
return false;
|
||||
}
|
||||
if(this.isInitial()) {
|
||||
if(otherChunk.parents.length !== 1 || otherChunk.parents[0] !== this) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
addMultiplierAndOverhead(size, options) {
|
||||
const overhead = typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000;
|
||||
const multiplicator = this.isInitial() ? (options.entryChunkMultiplicator || 10) : 1;
|
||||
|
||||
return size * multiplicator + overhead;
|
||||
}
|
||||
|
||||
modulesSize() {
|
||||
let count = 0;
|
||||
for(const module of this._modules) {
|
||||
count += module.size();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
size(options) {
|
||||
return this.addMultiplierAndOverhead(this.modulesSize(), options);
|
||||
}
|
||||
|
||||
integratedSize(otherChunk, options) {
|
||||
// Chunk if it's possible to integrate this chunk
|
||||
if(!this.canBeIntegrated(otherChunk)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let integratedModulesSize = this.modulesSize();
|
||||
// only count modules that do not exist in this chunk!
|
||||
for(const otherModule of otherChunk._modules) {
|
||||
if(!this._modules.has(otherModule)) {
|
||||
integratedModulesSize += otherModule.size();
|
||||
}
|
||||
}
|
||||
|
||||
return this.addMultiplierAndOverhead(integratedModulesSize, options);
|
||||
}
|
||||
|
||||
getChunkMaps(includeInitial, realHash) {
|
||||
const chunksProcessed = [];
|
||||
const chunkHashMap = {};
|
||||
const chunkNameMap = {};
|
||||
(function addChunk(chunk) {
|
||||
if(chunksProcessed.indexOf(chunk) >= 0) return;
|
||||
chunksProcessed.push(chunk);
|
||||
if(!chunk.isInitial() || includeInitial) {
|
||||
chunkHashMap[chunk.id] = realHash ? chunk.hash : chunk.renderedHash;
|
||||
if(chunk.name)
|
||||
chunkNameMap[chunk.id] = chunk.name;
|
||||
}
|
||||
chunk.chunks.forEach(addChunk);
|
||||
}(this));
|
||||
return {
|
||||
hash: chunkHashMap,
|
||||
name: chunkNameMap
|
||||
};
|
||||
}
|
||||
|
||||
sortModules(sortByFn) {
|
||||
this._modules.sortWith(sortByFn || sortById);
|
||||
}
|
||||
|
||||
sortItems() {
|
||||
this.sortModules();
|
||||
this.origins.sort((a, b) => {
|
||||
const aIdent = a.module.identifier();
|
||||
const bIdent = b.module.identifier();
|
||||
if(aIdent < bIdent) return -1;
|
||||
if(aIdent > bIdent) return 1;
|
||||
return compareLocations(a.loc, b.loc);
|
||||
});
|
||||
this.origins.forEach(origin => {
|
||||
if(origin.reasons)
|
||||
origin.reasons.sort();
|
||||
});
|
||||
this.parents.sort(sortById);
|
||||
this.chunks.sort(sortById);
|
||||
}
|
||||
|
||||
toString() {
|
||||
return `Chunk[${Array.from(this._modules).join()}]`;
|
||||
}
|
||||
|
||||
checkConstraints() {
|
||||
const chunk = this;
|
||||
chunk.chunks.forEach((child, idx) => {
|
||||
if(chunk.chunks.indexOf(child) !== idx)
|
||||
throw new Error(`checkConstraints: duplicate child in chunk ${chunk.debugId} ${child.debugId}`);
|
||||
if(child.parents.indexOf(chunk) < 0)
|
||||
throw new Error(`checkConstraints: child missing parent ${chunk.debugId} -> ${child.debugId}`);
|
||||
});
|
||||
chunk.parents.forEach((parentChunk, idx) => {
|
||||
if(chunk.parents.indexOf(parentChunk) !== idx)
|
||||
throw new Error(`checkConstraints: duplicate parent in chunk ${chunk.debugId} ${parentChunk.debugId}`);
|
||||
if(parentChunk.chunks.indexOf(chunk) < 0)
|
||||
throw new Error(`checkConstraints: parent missing child ${parentChunk.debugId} <- ${chunk.debugId}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(Chunk.prototype, "modules", {
|
||||
configurable: false,
|
||||
get: util.deprecate(function() {
|
||||
return Array.from(this._modules);
|
||||
}, "Chunk.modules is deprecated. Use Chunk.getNumberOfModules/mapModules/forEachModule/containsModule instead."),
|
||||
set: util.deprecate(function(value) {
|
||||
this.setModules(value);
|
||||
}, "Chunk.modules is deprecated. Use Chunk.addModule/removeModule instead.")
|
||||
});
|
||||
|
||||
module.exports = Chunk;
|
||||
24
hGameTest/node_modules/webpack/lib/ChunkRenderError.js
generated
vendored
Normal file
24
hGameTest/node_modules/webpack/lib/ChunkRenderError.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 WebpackError = require("./WebpackError");
|
||||
|
||||
class ChunkRenderError extends WebpackError {
|
||||
constructor(chunk, file, error) {
|
||||
super();
|
||||
|
||||
this.name = "ChunkRenderError";
|
||||
this.error = error;
|
||||
this.message = error.message;
|
||||
this.details = error.stack;
|
||||
this.file = file;
|
||||
this.chunk = chunk;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ChunkRenderError;
|
||||
36
hGameTest/node_modules/webpack/lib/ChunkTemplate.js
generated
vendored
Normal file
36
hGameTest/node_modules/webpack/lib/ChunkTemplate.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ConcatSource = require("webpack-sources").ConcatSource;
|
||||
const Template = require("./Template");
|
||||
|
||||
module.exports = class ChunkTemplate extends Template {
|
||||
constructor(outputOptions) {
|
||||
super(outputOptions);
|
||||
}
|
||||
|
||||
render(chunk, moduleTemplate, dependencyTemplates) {
|
||||
const moduleSources = this.renderChunkModules(chunk, moduleTemplate, dependencyTemplates);
|
||||
const core = this.applyPluginsWaterfall("modules", moduleSources, chunk, moduleTemplate, dependencyTemplates);
|
||||
let source = this.applyPluginsWaterfall("render", core, chunk, moduleTemplate, dependencyTemplates);
|
||||
if(chunk.hasEntryModule()) {
|
||||
source = this.applyPluginsWaterfall("render-with-entry", source, chunk);
|
||||
}
|
||||
chunk.rendered = true;
|
||||
return new ConcatSource(source, ";");
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
hash.update("ChunkTemplate");
|
||||
hash.update("2");
|
||||
this.applyPlugins("hash", hash);
|
||||
}
|
||||
|
||||
updateHashForChunk(hash, chunk) {
|
||||
this.updateHash(hash);
|
||||
this.applyPlugins("hash-for-chunk", hash, chunk);
|
||||
}
|
||||
};
|
||||
57
hGameTest/node_modules/webpack/lib/CompatibilityPlugin.js
generated
vendored
Normal file
57
hGameTest/node_modules/webpack/lib/CompatibilityPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ConstDependency = require("./dependencies/ConstDependency");
|
||||
|
||||
const NullFactory = require("./NullFactory");
|
||||
|
||||
const jsonLoaderPath = require.resolve("json-loader");
|
||||
const matchJson = /\.json$/i;
|
||||
|
||||
class CompatibilityPlugin {
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
|
||||
|
||||
params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
|
||||
|
||||
if(typeof parserOptions.browserify !== "undefined" && !parserOptions.browserify)
|
||||
return;
|
||||
|
||||
parser.plugin("call require", (expr) => {
|
||||
// support for browserify style require delegator: "require(o, !0)"
|
||||
if(expr.arguments.length !== 2) return;
|
||||
const second = parser.evaluateExpression(expr.arguments[1]);
|
||||
if(!second.isBoolean()) return;
|
||||
if(second.asBool() !== true) return;
|
||||
const dep = new ConstDependency("require", expr.callee.range);
|
||||
dep.loc = expr.loc;
|
||||
if(parser.state.current.dependencies.length > 1) {
|
||||
const last = parser.state.current.dependencies[parser.state.current.dependencies.length - 1];
|
||||
if(last.critical && last.request === "." && last.userRequest === "." && last.recursive)
|
||||
parser.state.current.dependencies.pop();
|
||||
}
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
});
|
||||
});
|
||||
|
||||
params.normalModuleFactory.plugin("after-resolve", (data, done) => {
|
||||
// if this is a json file and there are no loaders active, we use the json-loader in order to avoid parse errors
|
||||
// @see https://github.com/webpack/webpack/issues/3363
|
||||
if(matchJson.test(data.request) && data.loaders.length === 0) {
|
||||
data.loaders.push({
|
||||
loader: jsonLoaderPath
|
||||
});
|
||||
}
|
||||
done(null, data);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = CompatibilityPlugin;
|
||||
1450
hGameTest/node_modules/webpack/lib/Compilation.js
generated
vendored
Normal file
1450
hGameTest/node_modules/webpack/lib/Compilation.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
519
hGameTest/node_modules/webpack/lib/Compiler.js
generated
vendored
Normal file
519
hGameTest/node_modules/webpack/lib/Compiler.js
generated
vendored
Normal file
@@ -0,0 +1,519 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
const Tapable = require("tapable");
|
||||
const util = require("util");
|
||||
|
||||
const Compilation = require("./Compilation");
|
||||
const Stats = require("./Stats");
|
||||
const NormalModuleFactory = require("./NormalModuleFactory");
|
||||
const ContextModuleFactory = require("./ContextModuleFactory");
|
||||
|
||||
const makePathsRelative = require("./util/identifier").makePathsRelative;
|
||||
|
||||
class Watching {
|
||||
constructor(compiler, watchOptions, handler) {
|
||||
this.startTime = null;
|
||||
this.invalid = false;
|
||||
this.handler = handler;
|
||||
this.callbacks = [];
|
||||
this.closed = false;
|
||||
if(typeof watchOptions === "number") {
|
||||
this.watchOptions = {
|
||||
aggregateTimeout: watchOptions
|
||||
};
|
||||
} else if(watchOptions && typeof watchOptions === "object") {
|
||||
this.watchOptions = Object.assign({}, watchOptions);
|
||||
} else {
|
||||
this.watchOptions = {};
|
||||
}
|
||||
this.watchOptions.aggregateTimeout = this.watchOptions.aggregateTimeout || 200;
|
||||
this.compiler = compiler;
|
||||
this.running = true;
|
||||
this.compiler.readRecords(err => {
|
||||
if(err) return this._done(err);
|
||||
|
||||
this._go();
|
||||
});
|
||||
}
|
||||
|
||||
_go() {
|
||||
this.startTime = Date.now();
|
||||
this.running = true;
|
||||
this.invalid = false;
|
||||
this.compiler.applyPluginsAsync("watch-run", this, err => {
|
||||
if(err) return this._done(err);
|
||||
const onCompiled = (err, compilation) => {
|
||||
if(err) return this._done(err);
|
||||
if(this.invalid) return this._done();
|
||||
|
||||
if(this.compiler.applyPluginsBailResult("should-emit", compilation) === false) {
|
||||
return this._done(null, compilation);
|
||||
}
|
||||
|
||||
this.compiler.emitAssets(compilation, err => {
|
||||
if(err) return this._done(err);
|
||||
if(this.invalid) return this._done();
|
||||
|
||||
this.compiler.emitRecords(err => {
|
||||
if(err) return this._done(err);
|
||||
|
||||
if(compilation.applyPluginsBailResult("need-additional-pass")) {
|
||||
compilation.needAdditionalPass = true;
|
||||
|
||||
const stats = new Stats(compilation);
|
||||
stats.startTime = this.startTime;
|
||||
stats.endTime = Date.now();
|
||||
this.compiler.applyPlugins("done", stats);
|
||||
|
||||
this.compiler.applyPluginsAsync("additional-pass", err => {
|
||||
if(err) return this._done(err);
|
||||
this.compiler.compile(onCompiled);
|
||||
});
|
||||
return;
|
||||
}
|
||||
return this._done(null, compilation);
|
||||
});
|
||||
});
|
||||
};
|
||||
this.compiler.compile(onCompiled);
|
||||
});
|
||||
}
|
||||
|
||||
_getStats(compilation) {
|
||||
const stats = new Stats(compilation);
|
||||
stats.startTime = this.startTime;
|
||||
stats.endTime = Date.now();
|
||||
return stats;
|
||||
}
|
||||
|
||||
_done(err, compilation) {
|
||||
this.running = false;
|
||||
if(this.invalid) return this._go();
|
||||
|
||||
const stats = compilation ? this._getStats(compilation) : null;
|
||||
if(err) {
|
||||
this.compiler.applyPlugins("failed", err);
|
||||
this.handler(err, stats);
|
||||
return;
|
||||
}
|
||||
|
||||
this.compiler.applyPlugins("done", stats);
|
||||
this.handler(null, stats);
|
||||
if(!this.closed) {
|
||||
this.watch(compilation.fileDependencies, compilation.contextDependencies, compilation.missingDependencies);
|
||||
}
|
||||
this.callbacks.forEach(cb => cb());
|
||||
this.callbacks.length = 0;
|
||||
}
|
||||
|
||||
watch(files, dirs, missing) {
|
||||
this.pausedWatcher = null;
|
||||
this.watcher = this.compiler.watchFileSystem.watch(files, dirs, missing, this.startTime, this.watchOptions, (err, filesModified, contextModified, missingModified, fileTimestamps, contextTimestamps) => {
|
||||
this.pausedWatcher = this.watcher;
|
||||
this.watcher = null;
|
||||
if(err) return this.handler(err);
|
||||
|
||||
this.compiler.fileTimestamps = fileTimestamps;
|
||||
this.compiler.contextTimestamps = contextTimestamps;
|
||||
this.invalidate();
|
||||
}, (fileName, changeTime) => {
|
||||
this.compiler.applyPlugins("invalid", fileName, changeTime);
|
||||
});
|
||||
}
|
||||
|
||||
invalidate(callback) {
|
||||
if(callback) {
|
||||
this.callbacks.push(callback);
|
||||
}
|
||||
if(this.watcher) {
|
||||
this.pausedWatcher = this.watcher;
|
||||
this.watcher.pause();
|
||||
this.watcher = null;
|
||||
}
|
||||
if(this.running) {
|
||||
this.invalid = true;
|
||||
return false;
|
||||
} else {
|
||||
this._go();
|
||||
}
|
||||
}
|
||||
|
||||
close(callback) {
|
||||
if(callback === undefined) callback = function() {};
|
||||
|
||||
this.closed = true;
|
||||
if(this.watcher) {
|
||||
this.watcher.close();
|
||||
this.watcher = null;
|
||||
}
|
||||
if(this.pausedWatcher) {
|
||||
this.pausedWatcher.close();
|
||||
this.pausedWatcher = null;
|
||||
}
|
||||
if(this.running) {
|
||||
this.invalid = true;
|
||||
this._done = () => {
|
||||
this.compiler.applyPlugins("watch-close");
|
||||
callback();
|
||||
};
|
||||
} else {
|
||||
this.compiler.applyPlugins("watch-close");
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Compiler extends Tapable {
|
||||
constructor() {
|
||||
super();
|
||||
this.outputPath = "";
|
||||
this.outputFileSystem = null;
|
||||
this.inputFileSystem = null;
|
||||
|
||||
this.recordsInputPath = null;
|
||||
this.recordsOutputPath = null;
|
||||
this.records = {};
|
||||
|
||||
this.fileTimestamps = {};
|
||||
this.contextTimestamps = {};
|
||||
|
||||
this.resolvers = {
|
||||
normal: null,
|
||||
loader: null,
|
||||
context: null
|
||||
};
|
||||
this.parser = {
|
||||
plugin: util.deprecate(
|
||||
(hook, fn) => {
|
||||
this.plugin("compilation", (compilation, data) => {
|
||||
data.normalModuleFactory.plugin("parser", parser => {
|
||||
parser.plugin(hook, fn);
|
||||
});
|
||||
});
|
||||
},
|
||||
"webpack: Using compiler.parser is deprecated.\n" +
|
||||
"Use compiler.plugin(\"compilation\", function(compilation, data) {\n data.normalModuleFactory.plugin(\"parser\", function(parser, options) { parser.plugin(/* ... */); });\n}); instead. "
|
||||
),
|
||||
apply: util.deprecate(
|
||||
() => {
|
||||
const args = arguments;
|
||||
this.plugin("compilation", (compilation, data) => {
|
||||
data.normalModuleFactory.plugin("parser", parser => {
|
||||
parser.apply.apply(parser, args);
|
||||
});
|
||||
});
|
||||
},
|
||||
"webpack: Using compiler.parser is deprecated.\n" +
|
||||
"Use compiler.plugin(\"compilation\", function(compilation, data) {\n data.normalModuleFactory.plugin(\"parser\", function(parser, options) { parser.apply(/* ... */); });\n}); instead. "
|
||||
)
|
||||
};
|
||||
|
||||
this.options = {};
|
||||
}
|
||||
|
||||
watch(watchOptions, handler) {
|
||||
this.fileTimestamps = {};
|
||||
this.contextTimestamps = {};
|
||||
const watching = new Watching(this, watchOptions, handler);
|
||||
return watching;
|
||||
}
|
||||
|
||||
run(callback) {
|
||||
const startTime = Date.now();
|
||||
|
||||
const onCompiled = (err, compilation) => {
|
||||
if(err) return callback(err);
|
||||
|
||||
if(this.applyPluginsBailResult("should-emit", compilation) === false) {
|
||||
const stats = new Stats(compilation);
|
||||
stats.startTime = startTime;
|
||||
stats.endTime = Date.now();
|
||||
this.applyPlugins("done", stats);
|
||||
return callback(null, stats);
|
||||
}
|
||||
|
||||
this.emitAssets(compilation, err => {
|
||||
if(err) return callback(err);
|
||||
|
||||
if(compilation.applyPluginsBailResult("need-additional-pass")) {
|
||||
compilation.needAdditionalPass = true;
|
||||
|
||||
const stats = new Stats(compilation);
|
||||
stats.startTime = startTime;
|
||||
stats.endTime = Date.now();
|
||||
this.applyPlugins("done", stats);
|
||||
|
||||
this.applyPluginsAsync("additional-pass", err => {
|
||||
if(err) return callback(err);
|
||||
this.compile(onCompiled);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.emitRecords(err => {
|
||||
if(err) return callback(err);
|
||||
|
||||
const stats = new Stats(compilation);
|
||||
stats.startTime = startTime;
|
||||
stats.endTime = Date.now();
|
||||
this.applyPlugins("done", stats);
|
||||
return callback(null, stats);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
this.applyPluginsAsync("before-run", this, err => {
|
||||
if(err) return callback(err);
|
||||
|
||||
this.applyPluginsAsync("run", this, err => {
|
||||
if(err) return callback(err);
|
||||
|
||||
this.readRecords(err => {
|
||||
if(err) return callback(err);
|
||||
|
||||
this.compile(onCompiled);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
runAsChild(callback) {
|
||||
this.compile((err, compilation) => {
|
||||
if(err) return callback(err);
|
||||
|
||||
this.parentCompilation.children.push(compilation);
|
||||
Object.keys(compilation.assets).forEach(name => {
|
||||
this.parentCompilation.assets[name] = compilation.assets[name];
|
||||
});
|
||||
|
||||
const entries = Object.keys(compilation.entrypoints).map(name => {
|
||||
return compilation.entrypoints[name].chunks;
|
||||
}).reduce((array, chunks) => {
|
||||
return array.concat(chunks);
|
||||
}, []);
|
||||
|
||||
return callback(null, entries, compilation);
|
||||
});
|
||||
}
|
||||
|
||||
purgeInputFileSystem() {
|
||||
if(this.inputFileSystem && this.inputFileSystem.purge)
|
||||
this.inputFileSystem.purge();
|
||||
}
|
||||
|
||||
emitAssets(compilation, callback) {
|
||||
let outputPath;
|
||||
|
||||
const emitFiles = (err) => {
|
||||
if(err) return callback(err);
|
||||
|
||||
require("async").forEach(Object.keys(compilation.assets), (file, callback) => {
|
||||
|
||||
let targetFile = file;
|
||||
const queryStringIdx = targetFile.indexOf("?");
|
||||
if(queryStringIdx >= 0) {
|
||||
targetFile = targetFile.substr(0, queryStringIdx);
|
||||
}
|
||||
|
||||
const writeOut = (err) => {
|
||||
if(err) return callback(err);
|
||||
const targetPath = this.outputFileSystem.join(outputPath, targetFile);
|
||||
const source = compilation.assets[file];
|
||||
if(source.existsAt === targetPath) {
|
||||
source.emitted = false;
|
||||
return callback();
|
||||
}
|
||||
let content = source.source();
|
||||
|
||||
if(!Buffer.isBuffer(content)) {
|
||||
content = new Buffer(content, "utf8"); // eslint-disable-line
|
||||
}
|
||||
|
||||
source.existsAt = targetPath;
|
||||
source.emitted = true;
|
||||
this.outputFileSystem.writeFile(targetPath, content, callback);
|
||||
};
|
||||
|
||||
if(targetFile.match(/\/|\\/)) {
|
||||
const dir = path.dirname(targetFile);
|
||||
this.outputFileSystem.mkdirp(this.outputFileSystem.join(outputPath, dir), writeOut);
|
||||
} else writeOut();
|
||||
|
||||
}, err => {
|
||||
if(err) return callback(err);
|
||||
|
||||
afterEmit.call(this);
|
||||
});
|
||||
};
|
||||
|
||||
this.applyPluginsAsync("emit", compilation, err => {
|
||||
if(err) return callback(err);
|
||||
outputPath = compilation.getPath(this.outputPath);
|
||||
this.outputFileSystem.mkdirp(outputPath, emitFiles);
|
||||
});
|
||||
|
||||
function afterEmit() {
|
||||
this.applyPluginsAsyncSeries1("after-emit", compilation, err => {
|
||||
if(err) return callback(err);
|
||||
|
||||
return callback();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
emitRecords(callback) {
|
||||
if(!this.recordsOutputPath) return callback();
|
||||
const idx1 = this.recordsOutputPath.lastIndexOf("/");
|
||||
const idx2 = this.recordsOutputPath.lastIndexOf("\\");
|
||||
let recordsOutputPathDirectory = null;
|
||||
if(idx1 > idx2) recordsOutputPathDirectory = this.recordsOutputPath.substr(0, idx1);
|
||||
if(idx1 < idx2) recordsOutputPathDirectory = this.recordsOutputPath.substr(0, idx2);
|
||||
if(!recordsOutputPathDirectory) return writeFile.call(this);
|
||||
this.outputFileSystem.mkdirp(recordsOutputPathDirectory, err => {
|
||||
if(err) return callback(err);
|
||||
writeFile.call(this);
|
||||
});
|
||||
|
||||
function writeFile() {
|
||||
this.outputFileSystem.writeFile(this.recordsOutputPath, JSON.stringify(this.records, undefined, 2), callback);
|
||||
}
|
||||
}
|
||||
|
||||
readRecords(callback) {
|
||||
if(!this.recordsInputPath) {
|
||||
this.records = {};
|
||||
return callback();
|
||||
}
|
||||
this.inputFileSystem.stat(this.recordsInputPath, err => {
|
||||
// It doesn't exist
|
||||
// We can ignore this.
|
||||
if(err) return callback();
|
||||
|
||||
this.inputFileSystem.readFile(this.recordsInputPath, (err, content) => {
|
||||
if(err) return callback(err);
|
||||
|
||||
try {
|
||||
this.records = JSON.parse(content.toString("utf-8"));
|
||||
} catch(e) {
|
||||
e.message = "Cannot parse records: " + e.message;
|
||||
return callback(e);
|
||||
}
|
||||
|
||||
return callback();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
createChildCompiler(compilation, compilerName, compilerIndex, outputOptions, plugins) {
|
||||
const childCompiler = new Compiler();
|
||||
if(Array.isArray(plugins)) {
|
||||
plugins.forEach(plugin => childCompiler.apply(plugin));
|
||||
}
|
||||
for(const name in this._plugins) {
|
||||
if(["make", "compile", "emit", "after-emit", "invalid", "done", "this-compilation"].indexOf(name) < 0)
|
||||
childCompiler._plugins[name] = this._plugins[name].slice();
|
||||
}
|
||||
childCompiler.name = compilerName;
|
||||
childCompiler.outputPath = this.outputPath;
|
||||
childCompiler.inputFileSystem = this.inputFileSystem;
|
||||
childCompiler.outputFileSystem = null;
|
||||
childCompiler.resolvers = this.resolvers;
|
||||
childCompiler.fileTimestamps = this.fileTimestamps;
|
||||
childCompiler.contextTimestamps = this.contextTimestamps;
|
||||
|
||||
const relativeCompilerName = makePathsRelative(this.context, compilerName);
|
||||
if(!this.records[relativeCompilerName]) this.records[relativeCompilerName] = [];
|
||||
if(this.records[relativeCompilerName][compilerIndex])
|
||||
childCompiler.records = this.records[relativeCompilerName][compilerIndex];
|
||||
else
|
||||
this.records[relativeCompilerName].push(childCompiler.records = {});
|
||||
|
||||
childCompiler.options = Object.create(this.options);
|
||||
childCompiler.options.output = Object.create(childCompiler.options.output);
|
||||
for(const name in outputOptions) {
|
||||
childCompiler.options.output[name] = outputOptions[name];
|
||||
}
|
||||
childCompiler.parentCompilation = compilation;
|
||||
|
||||
compilation.applyPlugins("child-compiler", childCompiler, compilerName, compilerIndex);
|
||||
|
||||
return childCompiler;
|
||||
}
|
||||
|
||||
isChild() {
|
||||
return !!this.parentCompilation;
|
||||
}
|
||||
|
||||
createCompilation() {
|
||||
return new Compilation(this);
|
||||
}
|
||||
|
||||
newCompilation(params) {
|
||||
const compilation = this.createCompilation();
|
||||
compilation.fileTimestamps = this.fileTimestamps;
|
||||
compilation.contextTimestamps = this.contextTimestamps;
|
||||
compilation.name = this.name;
|
||||
compilation.records = this.records;
|
||||
compilation.compilationDependencies = params.compilationDependencies;
|
||||
this.applyPlugins("this-compilation", compilation, params);
|
||||
this.applyPlugins("compilation", compilation, params);
|
||||
return compilation;
|
||||
}
|
||||
|
||||
createNormalModuleFactory() {
|
||||
const normalModuleFactory = new NormalModuleFactory(this.options.context, this.resolvers, this.options.module || {});
|
||||
this.applyPlugins("normal-module-factory", normalModuleFactory);
|
||||
return normalModuleFactory;
|
||||
}
|
||||
|
||||
createContextModuleFactory() {
|
||||
const contextModuleFactory = new ContextModuleFactory(this.resolvers, this.inputFileSystem);
|
||||
this.applyPlugins("context-module-factory", contextModuleFactory);
|
||||
return contextModuleFactory;
|
||||
}
|
||||
|
||||
newCompilationParams() {
|
||||
const params = {
|
||||
normalModuleFactory: this.createNormalModuleFactory(),
|
||||
contextModuleFactory: this.createContextModuleFactory(),
|
||||
compilationDependencies: []
|
||||
};
|
||||
return params;
|
||||
}
|
||||
|
||||
compile(callback) {
|
||||
const params = this.newCompilationParams();
|
||||
this.applyPluginsAsync("before-compile", params, err => {
|
||||
if(err) return callback(err);
|
||||
|
||||
this.applyPlugins("compile", params);
|
||||
|
||||
const compilation = this.newCompilation(params);
|
||||
|
||||
this.applyPluginsParallel("make", compilation, err => {
|
||||
if(err) return callback(err);
|
||||
|
||||
compilation.finish();
|
||||
|
||||
compilation.seal(err => {
|
||||
if(err) return callback(err);
|
||||
|
||||
this.applyPluginsAsync("after-compile", compilation, err => {
|
||||
if(err) return callback(err);
|
||||
|
||||
return callback(null, compilation);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Compiler.Watching = Watching;
|
||||
module.exports = Compiler;
|
||||
60
hGameTest/node_modules/webpack/lib/ConstPlugin.js
generated
vendored
Normal file
60
hGameTest/node_modules/webpack/lib/ConstPlugin.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 ConstDependency = require("./dependencies/ConstDependency");
|
||||
const NullFactory = require("./NullFactory");
|
||||
const ParserHelpers = require("./ParserHelpers");
|
||||
|
||||
const getQuery = (request) => {
|
||||
const i = request.indexOf("?");
|
||||
return request.indexOf("?") < 0 ? "" : request.substr(i);
|
||||
};
|
||||
|
||||
class ConstPlugin {
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
|
||||
|
||||
params.normalModuleFactory.plugin("parser", parser => {
|
||||
parser.plugin("statement if", function(statement) {
|
||||
const param = this.evaluateExpression(statement.test);
|
||||
const bool = param.asBool();
|
||||
if(typeof bool === "boolean") {
|
||||
if(statement.test.type !== "Literal") {
|
||||
const dep = new ConstDependency(`${bool}`, param.range);
|
||||
dep.loc = statement.loc;
|
||||
this.state.current.addDependency(dep);
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
});
|
||||
parser.plugin("expression ?:", function(expression) {
|
||||
const param = this.evaluateExpression(expression.test);
|
||||
const bool = param.asBool();
|
||||
if(typeof bool === "boolean") {
|
||||
if(expression.test.type !== "Literal") {
|
||||
const dep = new ConstDependency(` ${bool}`, param.range);
|
||||
dep.loc = expression.loc;
|
||||
this.state.current.addDependency(dep);
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
});
|
||||
parser.plugin("evaluate Identifier __resourceQuery", function(expr) {
|
||||
if(!this.state.module) return;
|
||||
return ParserHelpers.evaluateToString(getQuery(this.state.module.resource))(expr);
|
||||
});
|
||||
parser.plugin("expression __resourceQuery", function() {
|
||||
if(!this.state.module) return;
|
||||
this.state.current.addVariable("__resourceQuery", JSON.stringify(getQuery(this.state.module.resource)));
|
||||
return true;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ConstPlugin;
|
||||
17
hGameTest/node_modules/webpack/lib/ContextExclusionPlugin.js
generated
vendored
Normal file
17
hGameTest/node_modules/webpack/lib/ContextExclusionPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
class ContextExclusionPlugin {
|
||||
constructor(negativeMatcher) {
|
||||
this.negativeMatcher = negativeMatcher;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("context-module-factory", (cmf) => {
|
||||
cmf.plugin("context-module-files", (files) => {
|
||||
return files.filter(filePath => !this.negativeMatcher.test(filePath));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ContextExclusionPlugin;
|
||||
431
hGameTest/node_modules/webpack/lib/ContextModule.js
generated
vendored
Normal file
431
hGameTest/node_modules/webpack/lib/ContextModule.js
generated
vendored
Normal file
@@ -0,0 +1,431 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const path = require("path");
|
||||
const Module = require("./Module");
|
||||
const OriginalSource = require("webpack-sources").OriginalSource;
|
||||
const RawSource = require("webpack-sources").RawSource;
|
||||
const AsyncDependenciesBlock = require("./AsyncDependenciesBlock");
|
||||
const DepBlockHelpers = require("./dependencies/DepBlockHelpers");
|
||||
const Template = require("./Template");
|
||||
|
||||
class ContextModule extends Module {
|
||||
constructor(resolveDependencies, context, recursive, regExp, addon, asyncMode, chunkName) {
|
||||
super();
|
||||
this.resolveDependencies = resolveDependencies;
|
||||
this.context = context;
|
||||
this.recursive = recursive;
|
||||
this.regExp = regExp;
|
||||
this.addon = addon;
|
||||
this.async = asyncMode;
|
||||
this.cacheable = true;
|
||||
this.contextDependencies = [context];
|
||||
this.built = false;
|
||||
this.chunkName = chunkName;
|
||||
}
|
||||
|
||||
prettyRegExp(regexString) {
|
||||
// remove the "/" at the front and the beginning
|
||||
// "/foo/" -> "foo"
|
||||
return regexString.substring(1, regexString.length - 1);
|
||||
}
|
||||
|
||||
contextify(context, request) {
|
||||
return request.split("!").map(subrequest => {
|
||||
let rp = path.relative(context, subrequest);
|
||||
if(path.sep === "\\")
|
||||
rp = rp.replace(/\\/g, "/");
|
||||
if(rp.indexOf("../") !== 0)
|
||||
rp = "./" + rp;
|
||||
return rp;
|
||||
}).join("!");
|
||||
}
|
||||
|
||||
identifier() {
|
||||
let identifier = this.context;
|
||||
if(this.async)
|
||||
identifier += ` ${this.async}`;
|
||||
if(!this.recursive)
|
||||
identifier += " nonrecursive";
|
||||
if(this.addon)
|
||||
identifier += ` ${this.addon}`;
|
||||
if(this.regExp)
|
||||
identifier += ` ${this.regExp}`;
|
||||
|
||||
return identifier;
|
||||
}
|
||||
|
||||
readableIdentifier(requestShortener) {
|
||||
let identifier = requestShortener.shorten(this.context);
|
||||
if(this.async)
|
||||
identifier += ` ${this.async}`;
|
||||
if(!this.recursive)
|
||||
identifier += " nonrecursive";
|
||||
if(this.addon)
|
||||
identifier += ` ${requestShortener.shorten(this.addon)}`;
|
||||
if(this.regExp)
|
||||
identifier += ` ${this.prettyRegExp(this.regExp + "")}`;
|
||||
|
||||
return identifier;
|
||||
}
|
||||
|
||||
libIdent(options) {
|
||||
let identifier = this.contextify(options.context, this.context);
|
||||
if(this.async)
|
||||
identifier += ` ${this.async}`;
|
||||
if(this.recursive)
|
||||
identifier += " recursive";
|
||||
if(this.addon)
|
||||
identifier += ` ${this.contextify(options.context, this.addon)}`;
|
||||
if(this.regExp)
|
||||
identifier += ` ${this.prettyRegExp(this.regExp + "")}`;
|
||||
|
||||
return identifier;
|
||||
}
|
||||
|
||||
needRebuild(fileTimestamps, contextTimestamps) {
|
||||
const ts = contextTimestamps[this.context];
|
||||
if(!ts) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return ts >= this.builtTime;
|
||||
}
|
||||
|
||||
unbuild() {
|
||||
this.built = false;
|
||||
super.unbuild();
|
||||
}
|
||||
|
||||
build(options, compilation, resolver, fs, callback) {
|
||||
this.built = true;
|
||||
this.builtTime = Date.now();
|
||||
this.resolveDependencies(fs, this.context, this.recursive, this.regExp, (err, dependencies) => {
|
||||
if(err) return callback(err);
|
||||
|
||||
// Reset children
|
||||
this.dependencies = [];
|
||||
this.blocks = [];
|
||||
|
||||
// abort if something failed
|
||||
// this will create an empty context
|
||||
if(!dependencies) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
// enhance dependencies with meta info
|
||||
dependencies.forEach(dep => {
|
||||
dep.loc = dep.userRequest;
|
||||
dep.request = this.addon + dep.request;
|
||||
});
|
||||
|
||||
if(!this.async || this.async === "eager") {
|
||||
|
||||
// if we have an sync or eager context
|
||||
// just add all dependencies and continue
|
||||
this.dependencies = dependencies;
|
||||
|
||||
} else if(this.async === "lazy-once") {
|
||||
|
||||
// for the lazy-once mode create a new async dependency block
|
||||
// and add that block to this context
|
||||
if(dependencies.length > 0) {
|
||||
const block = new AsyncDependenciesBlock(this.chunkName, this);
|
||||
dependencies.forEach(dep => {
|
||||
block.addDependency(dep);
|
||||
});
|
||||
this.addBlock(block);
|
||||
}
|
||||
|
||||
} else if(this.async === "weak" || this.async === "async-weak") {
|
||||
|
||||
// we mark all dependencies as weak
|
||||
dependencies.forEach(dep => dep.weak = true);
|
||||
this.dependencies = dependencies;
|
||||
|
||||
} else {
|
||||
// if we are lazy create a new async dependency block per dependency
|
||||
// and add all blocks to this context
|
||||
dependencies.forEach((dep, idx) => {
|
||||
let chunkName = this.chunkName;
|
||||
if(chunkName) {
|
||||
if(!/\[(index|request)\]/.test(chunkName))
|
||||
chunkName += "[index]";
|
||||
chunkName = chunkName.replace(/\[index\]/g, idx);
|
||||
chunkName = chunkName.replace(/\[request\]/g, Template.toPath(dep.userRequest));
|
||||
}
|
||||
const block = new AsyncDependenciesBlock(chunkName, dep.module, dep.loc);
|
||||
block.addDependency(dep);
|
||||
this.addBlock(block);
|
||||
});
|
||||
}
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
getUserRequestMap(dependencies) {
|
||||
// if we filter first we get a new array
|
||||
// therefor we dont need to create a clone of dependencies explicitly
|
||||
// therefore the order of this is !important!
|
||||
return dependencies
|
||||
.filter(dependency => dependency.module)
|
||||
.sort((a, b) => {
|
||||
if(a.userRequest === b.userRequest) {
|
||||
return 0;
|
||||
}
|
||||
return a.userRequest < b.userRequest ? -1 : 1;
|
||||
}).reduce(function(map, dep) {
|
||||
map[dep.userRequest] = dep.module.id;
|
||||
return map;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
getSyncSource(dependencies, id) {
|
||||
const map = this.getUserRequestMap(dependencies);
|
||||
return `var map = ${JSON.stringify(map, null, "\t")};
|
||||
function webpackContext(req) {
|
||||
return __webpack_require__(webpackContextResolve(req));
|
||||
};
|
||||
function webpackContextResolve(req) {
|
||||
var id = map[req];
|
||||
if(!(id + 1)) // check for number or string
|
||||
throw new Error("Cannot find module '" + req + "'.");
|
||||
return id;
|
||||
};
|
||||
webpackContext.keys = function webpackContextKeys() {
|
||||
return Object.keys(map);
|
||||
};
|
||||
webpackContext.resolve = webpackContextResolve;
|
||||
module.exports = webpackContext;
|
||||
webpackContext.id = ${JSON.stringify(id)};`;
|
||||
}
|
||||
|
||||
getWeakSyncSource(dependencies, id) {
|
||||
const map = this.getUserRequestMap(dependencies);
|
||||
return `var map = ${JSON.stringify(map, null, "\t")};
|
||||
function webpackContext(req) {
|
||||
var id = webpackContextResolve(req);
|
||||
if(!__webpack_require__.m[id])
|
||||
throw new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)");
|
||||
return __webpack_require__(id);
|
||||
};
|
||||
function webpackContextResolve(req) {
|
||||
var id = map[req];
|
||||
if(!(id + 1)) // check for number or string
|
||||
throw new Error("Cannot find module '" + req + "'.");
|
||||
return id;
|
||||
};
|
||||
webpackContext.keys = function webpackContextKeys() {
|
||||
return Object.keys(map);
|
||||
};
|
||||
webpackContext.resolve = webpackContextResolve;
|
||||
webpackContext.id = ${JSON.stringify(id)};
|
||||
module.exports = webpackContext;`;
|
||||
}
|
||||
|
||||
getAsyncWeakSource(dependencies, id) {
|
||||
const map = this.getUserRequestMap(dependencies);
|
||||
|
||||
return `var map = ${JSON.stringify(map, null, "\t")};
|
||||
function webpackAsyncContext(req) {
|
||||
return webpackAsyncContextResolve(req).then(function(id) {
|
||||
if(!__webpack_require__.m[id])
|
||||
throw new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)");
|
||||
return __webpack_require__(id);
|
||||
});
|
||||
};
|
||||
function webpackAsyncContextResolve(req) {
|
||||
// Here Promise.resolve().then() is used instead of new Promise() to prevent
|
||||
// uncatched exception popping up in devtools
|
||||
return Promise.resolve().then(function() {
|
||||
var id = map[req];
|
||||
if(!(id + 1)) // check for number or string
|
||||
throw new Error("Cannot find module '" + req + "'.");
|
||||
return id;
|
||||
});
|
||||
};
|
||||
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
|
||||
return Object.keys(map);
|
||||
};
|
||||
webpackAsyncContext.resolve = webpackAsyncContextResolve;
|
||||
webpackAsyncContext.id = ${JSON.stringify(id)};
|
||||
module.exports = webpackAsyncContext;`;
|
||||
}
|
||||
|
||||
getEagerSource(dependencies, id) {
|
||||
const map = this.getUserRequestMap(dependencies);
|
||||
return `var map = ${JSON.stringify(map, null, "\t")};
|
||||
function webpackAsyncContext(req) {
|
||||
return webpackAsyncContextResolve(req).then(__webpack_require__);
|
||||
};
|
||||
function webpackAsyncContextResolve(req) {
|
||||
// Here Promise.resolve().then() is used instead of new Promise() to prevent
|
||||
// uncatched exception popping up in devtools
|
||||
return Promise.resolve().then(function() {
|
||||
var id = map[req];
|
||||
if(!(id + 1)) // check for number or string
|
||||
throw new Error("Cannot find module '" + req + "'.");
|
||||
return id;
|
||||
});
|
||||
};
|
||||
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
|
||||
return Object.keys(map);
|
||||
};
|
||||
webpackAsyncContext.resolve = webpackAsyncContextResolve;
|
||||
webpackAsyncContext.id = ${JSON.stringify(id)};
|
||||
module.exports = webpackAsyncContext;`;
|
||||
}
|
||||
|
||||
getLazyOnceSource(block, dependencies, id, outputOptions, requestShortener) {
|
||||
const promise = DepBlockHelpers.getDepBlockPromise(block, outputOptions, requestShortener, "lazy-once context");
|
||||
const map = this.getUserRequestMap(dependencies);
|
||||
return `var map = ${JSON.stringify(map, null, "\t")};
|
||||
function webpackAsyncContext(req) {
|
||||
return webpackAsyncContextResolve(req).then(__webpack_require__);
|
||||
};
|
||||
function webpackAsyncContextResolve(req) {
|
||||
return ${promise}.then(function() {
|
||||
var id = map[req];
|
||||
if(!(id + 1)) // check for number or string
|
||||
throw new Error("Cannot find module '" + req + "'.");
|
||||
return id;
|
||||
});
|
||||
};
|
||||
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
|
||||
return Object.keys(map);
|
||||
};
|
||||
webpackAsyncContext.resolve = webpackAsyncContextResolve;
|
||||
webpackAsyncContext.id = ${JSON.stringify(id)};
|
||||
module.exports = webpackAsyncContext;`;
|
||||
}
|
||||
|
||||
getLazySource(blocks, id) {
|
||||
let hasMultipleOrNoChunks = false;
|
||||
const map = blocks
|
||||
.filter(block => block.dependencies[0].module)
|
||||
.map((block) => ({
|
||||
dependency: block.dependencies[0],
|
||||
block: block,
|
||||
userRequest: block.dependencies[0].userRequest
|
||||
})).sort((a, b) => {
|
||||
if(a.userRequest === b.userRequest) return 0;
|
||||
return a.userRequest < b.userRequest ? -1 : 1;
|
||||
}).reduce((map, item) => {
|
||||
const chunks = item.block.chunks || [];
|
||||
if(chunks.length !== 1) {
|
||||
hasMultipleOrNoChunks = true;
|
||||
}
|
||||
map[item.userRequest] = [item.dependency.module.id]
|
||||
.concat(chunks.map(chunk => chunk.id));
|
||||
|
||||
return map;
|
||||
}, Object.create(null));
|
||||
|
||||
const requestPrefix = hasMultipleOrNoChunks ?
|
||||
"Promise.all(ids.slice(1).map(__webpack_require__.e))" :
|
||||
"__webpack_require__.e(ids[1])";
|
||||
|
||||
return `var map = ${JSON.stringify(map, null, "\t")};
|
||||
function webpackAsyncContext(req) {
|
||||
var ids = map[req];
|
||||
if(!ids)
|
||||
return Promise.reject(new Error("Cannot find module '" + req + "'."));
|
||||
return ${requestPrefix}.then(function() {
|
||||
return __webpack_require__(ids[0]);
|
||||
});
|
||||
};
|
||||
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
|
||||
return Object.keys(map);
|
||||
};
|
||||
webpackAsyncContext.id = ${JSON.stringify(id)};
|
||||
module.exports = webpackAsyncContext;`;
|
||||
}
|
||||
|
||||
getSourceForEmptyContext(id) {
|
||||
return `function webpackEmptyContext(req) {
|
||||
throw new Error("Cannot find module '" + req + "'.");
|
||||
}
|
||||
webpackEmptyContext.keys = function() { return []; };
|
||||
webpackEmptyContext.resolve = webpackEmptyContext;
|
||||
module.exports = webpackEmptyContext;
|
||||
webpackEmptyContext.id = ${JSON.stringify(id)};`;
|
||||
}
|
||||
|
||||
getSourceForEmptyAsyncContext(id) {
|
||||
return `function webpackEmptyAsyncContext(req) {
|
||||
// Here Promise.resolve().then() is used instead of new Promise() to prevent
|
||||
// uncatched exception popping up in devtools
|
||||
return Promise.resolve().then(function() {
|
||||
throw new Error("Cannot find module '" + req + "'.");
|
||||
});
|
||||
}
|
||||
webpackEmptyAsyncContext.keys = function() { return []; };
|
||||
webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext;
|
||||
module.exports = webpackEmptyAsyncContext;
|
||||
webpackEmptyAsyncContext.id = ${JSON.stringify(id)};`;
|
||||
}
|
||||
|
||||
getSourceString(asyncMode, outputOptions, requestShortener) {
|
||||
if(asyncMode === "lazy") {
|
||||
if(this.blocks && this.blocks.length > 0) {
|
||||
return this.getLazySource(this.blocks, this.id);
|
||||
}
|
||||
return this.getSourceForEmptyAsyncContext(this.id);
|
||||
}
|
||||
if(asyncMode === "eager") {
|
||||
if(this.dependencies && this.dependencies.length > 0) {
|
||||
return this.getEagerSource(this.dependencies, this.id);
|
||||
}
|
||||
return this.getSourceForEmptyAsyncContext(this.id);
|
||||
}
|
||||
if(asyncMode === "lazy-once") {
|
||||
const block = this.blocks[0];
|
||||
if(block) {
|
||||
return this.getLazyOnceSource(block, block.dependencies, this.id, outputOptions, requestShortener);
|
||||
}
|
||||
return this.getSourceForEmptyAsyncContext(this.id);
|
||||
}
|
||||
if(asyncMode === "async-weak") {
|
||||
if(this.dependencies && this.dependencies.length > 0) {
|
||||
return this.getAsyncWeakSource(this.dependencies, this.id);
|
||||
}
|
||||
return this.getSourceForEmptyAsyncContext(this.id);
|
||||
}
|
||||
if(asyncMode === "weak") {
|
||||
if(this.dependencies && this.dependencies.length > 0) {
|
||||
return this.getWeakSyncSource(this.dependencies, this.id);
|
||||
}
|
||||
}
|
||||
if(this.dependencies && this.dependencies.length > 0) {
|
||||
return this.getSyncSource(this.dependencies, this.id);
|
||||
}
|
||||
return this.getSourceForEmptyContext(this.id);
|
||||
}
|
||||
|
||||
getSource(sourceString) {
|
||||
if(this.useSourceMap) {
|
||||
return new OriginalSource(sourceString, this.identifier());
|
||||
}
|
||||
return new RawSource(sourceString);
|
||||
}
|
||||
|
||||
source(dependencyTemplates, outputOptions, requestShortener) {
|
||||
return this.getSource(
|
||||
this.getSourceString(this.async, outputOptions, requestShortener)
|
||||
);
|
||||
}
|
||||
|
||||
size() {
|
||||
// base penalty
|
||||
const initialSize = 160;
|
||||
|
||||
// if we dont have dependencies we stop here.
|
||||
return this.dependencies
|
||||
.reduce((size, dependency) => size + 5 + dependency.userRequest.length, initialSize);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ContextModule;
|
||||
169
hGameTest/node_modules/webpack/lib/ContextModuleFactory.js
generated
vendored
Normal file
169
hGameTest/node_modules/webpack/lib/ContextModuleFactory.js
generated
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const asyncLib = require("async");
|
||||
const path = require("path");
|
||||
|
||||
const Tapable = require("tapable");
|
||||
const ContextModule = require("./ContextModule");
|
||||
const ContextElementDependency = require("./dependencies/ContextElementDependency");
|
||||
|
||||
module.exports = class ContextModuleFactory extends Tapable {
|
||||
constructor(resolvers) {
|
||||
super();
|
||||
this.resolvers = resolvers;
|
||||
}
|
||||
|
||||
create(data, callback) {
|
||||
const context = data.context;
|
||||
const dependencies = data.dependencies;
|
||||
const dependency = dependencies[0];
|
||||
this.applyPluginsAsyncWaterfall("before-resolve", {
|
||||
context: context,
|
||||
request: dependency.request,
|
||||
recursive: dependency.recursive,
|
||||
regExp: dependency.regExp,
|
||||
async: dependency.async,
|
||||
dependencies: dependencies
|
||||
}, (err, result) => {
|
||||
if(err) return callback(err);
|
||||
|
||||
// Ignored
|
||||
if(!result) return callback();
|
||||
|
||||
const context = result.context;
|
||||
const request = result.request;
|
||||
const recursive = result.recursive;
|
||||
const regExp = result.regExp;
|
||||
const asyncContext = result.async;
|
||||
const dependencies = result.dependencies;
|
||||
|
||||
let loaders, resource, loadersPrefix = "";
|
||||
const idx = request.lastIndexOf("!");
|
||||
if(idx >= 0) {
|
||||
loaders = request.substr(0, idx + 1);
|
||||
let i;
|
||||
for(i = 0; i < loaders.length && loaders[i] === "!"; i++) {
|
||||
loadersPrefix += "!";
|
||||
}
|
||||
loaders = loaders.substr(i).replace(/!+$/, "").replace(/!!+/g, "!");
|
||||
if(loaders === "") loaders = [];
|
||||
else loaders = loaders.split("!");
|
||||
resource = request.substr(idx + 1);
|
||||
} else {
|
||||
loaders = [];
|
||||
resource = request;
|
||||
}
|
||||
|
||||
const resolvers = this.resolvers;
|
||||
|
||||
asyncLib.parallel([
|
||||
function(callback) {
|
||||
resolvers.context.resolve({}, context, resource, function(err, result) {
|
||||
if(err) return callback(err);
|
||||
callback(null, result);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
asyncLib.map(loaders, function(loader, callback) {
|
||||
resolvers.loader.resolve({}, context, loader, function(err, result) {
|
||||
if(err) return callback(err);
|
||||
callback(null, result);
|
||||
});
|
||||
}, callback);
|
||||
}
|
||||
], (err, result) => {
|
||||
if(err) return callback(err);
|
||||
|
||||
this.applyPluginsAsyncWaterfall("after-resolve", {
|
||||
loaders: loadersPrefix + result[1].join("!") + (result[1].length > 0 ? "!" : ""),
|
||||
resource: result[0],
|
||||
recursive: recursive,
|
||||
regExp: regExp,
|
||||
async: asyncContext,
|
||||
dependencies: dependencies,
|
||||
resolveDependencies: this.resolveDependencies.bind(this)
|
||||
}, function(err, result) {
|
||||
if(err) return callback(err);
|
||||
|
||||
// Ignored
|
||||
if(!result) return callback();
|
||||
|
||||
return callback(null, new ContextModule(result.resolveDependencies, result.resource, result.recursive, result.regExp, result.loaders, result.async, dependency.chunkName));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
resolveDependencies(fs, resource, recursive, regExp, callback) {
|
||||
const cmf = this;
|
||||
if(!regExp || !resource)
|
||||
return callback(null, []);
|
||||
(function addDirectory(directory, callback) {
|
||||
fs.readdir(directory, (err, files) => {
|
||||
if(err) return callback(err);
|
||||
files = cmf.applyPluginsWaterfall("context-module-files", files);
|
||||
if(!files || files.length === 0) return callback(null, []);
|
||||
asyncLib.map(files.filter(function(p) {
|
||||
return p.indexOf(".") !== 0;
|
||||
}), (seqment, callback) => {
|
||||
|
||||
const subResource = path.join(directory, seqment);
|
||||
|
||||
fs.stat(subResource, (err, stat) => {
|
||||
if(err) {
|
||||
if(err.code === "ENOENT") {
|
||||
// ENOENT is ok here because the file may have been deleted between
|
||||
// the readdir and stat calls.
|
||||
return callback();
|
||||
} else {
|
||||
return callback(err);
|
||||
}
|
||||
}
|
||||
|
||||
if(stat.isDirectory()) {
|
||||
|
||||
if(!recursive) return callback();
|
||||
addDirectory.call(this, subResource, callback);
|
||||
|
||||
} else if(stat.isFile()) {
|
||||
|
||||
const obj = {
|
||||
context: resource,
|
||||
request: "." + subResource.substr(resource.length).replace(/\\/g, "/")
|
||||
};
|
||||
|
||||
this.applyPluginsAsyncWaterfall("alternatives", [obj], (err, alternatives) => {
|
||||
if(err) return callback(err);
|
||||
alternatives = alternatives.filter(function(obj) {
|
||||
return regExp.test(obj.request);
|
||||
}).map(function(obj) {
|
||||
const dep = new ContextElementDependency(obj.request);
|
||||
dep.optional = true;
|
||||
return dep;
|
||||
});
|
||||
callback(null, alternatives);
|
||||
});
|
||||
|
||||
} else callback();
|
||||
|
||||
});
|
||||
|
||||
}, (err, result) => {
|
||||
if(err) return callback(err);
|
||||
|
||||
if(!result) return callback(null, []);
|
||||
|
||||
callback(null, result.filter(function(i) {
|
||||
return !!i;
|
||||
}).reduce(function(a, i) {
|
||||
return a.concat(i);
|
||||
}, []));
|
||||
});
|
||||
});
|
||||
}.call(this, resource, callback));
|
||||
}
|
||||
};
|
||||
111
hGameTest/node_modules/webpack/lib/ContextReplacementPlugin.js
generated
vendored
Normal file
111
hGameTest/node_modules/webpack/lib/ContextReplacementPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
const ContextElementDependency = require("./dependencies/ContextElementDependency");
|
||||
|
||||
class ContextReplacementPlugin {
|
||||
constructor(resourceRegExp, newContentResource, newContentRecursive, newContentRegExp) {
|
||||
this.resourceRegExp = resourceRegExp;
|
||||
|
||||
if(typeof newContentResource === "function") {
|
||||
this.newContentCallback = newContentResource;
|
||||
} else if(typeof newContentResource === "string" && typeof newContentRecursive === "object") {
|
||||
this.newContentResource = newContentResource;
|
||||
this.newContentCreateContextMap = (fs, callback) => {
|
||||
callback(null, newContentRecursive);
|
||||
};
|
||||
} else if(typeof newContentResource === "string" && typeof newContentRecursive === "function") {
|
||||
this.newContentResource = newContentResource;
|
||||
this.newContentCreateContextMap = newContentRecursive;
|
||||
} else {
|
||||
if(typeof newContentResource !== "string") {
|
||||
newContentRegExp = newContentRecursive;
|
||||
newContentRecursive = newContentResource;
|
||||
newContentResource = undefined;
|
||||
}
|
||||
if(typeof newContentRecursive !== "boolean") {
|
||||
newContentRegExp = newContentRecursive;
|
||||
newContentRecursive = undefined;
|
||||
}
|
||||
this.newContentResource = newContentResource;
|
||||
this.newContentRecursive = newContentRecursive;
|
||||
this.newContentRegExp = newContentRegExp;
|
||||
}
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
const resourceRegExp = this.resourceRegExp;
|
||||
const newContentCallback = this.newContentCallback;
|
||||
const newContentResource = this.newContentResource;
|
||||
const newContentRecursive = this.newContentRecursive;
|
||||
const newContentRegExp = this.newContentRegExp;
|
||||
const newContentCreateContextMap = this.newContentCreateContextMap;
|
||||
|
||||
compiler.plugin("context-module-factory", (cmf) => {
|
||||
cmf.plugin("before-resolve", (result, callback) => {
|
||||
if(!result) return callback();
|
||||
if(resourceRegExp.test(result.request)) {
|
||||
if(typeof newContentResource !== "undefined")
|
||||
result.request = newContentResource;
|
||||
if(typeof newContentRecursive !== "undefined")
|
||||
result.recursive = newContentRecursive;
|
||||
if(typeof newContentRegExp !== "undefined")
|
||||
result.regExp = newContentRegExp;
|
||||
if(typeof newContentCallback === "function") {
|
||||
newContentCallback(result);
|
||||
} else {
|
||||
result.dependencies.forEach((d) => {
|
||||
if(d.critical)
|
||||
d.critical = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
return callback(null, result);
|
||||
});
|
||||
cmf.plugin("after-resolve", (result, callback) => {
|
||||
if(!result) return callback();
|
||||
if(resourceRegExp.test(result.resource)) {
|
||||
if(typeof newContentResource !== "undefined")
|
||||
result.resource = path.resolve(result.resource, newContentResource);
|
||||
if(typeof newContentRecursive !== "undefined")
|
||||
result.recursive = newContentRecursive;
|
||||
if(typeof newContentRegExp !== "undefined")
|
||||
result.regExp = newContentRegExp;
|
||||
if(typeof newContentCreateContextMap === "function")
|
||||
result.resolveDependencies = createResolveDependenciesFromContextMap(newContentCreateContextMap);
|
||||
if(typeof newContentCallback === "function") {
|
||||
const origResource = result.resource;
|
||||
newContentCallback(result);
|
||||
if(result.resource !== origResource) {
|
||||
result.resource = path.resolve(origResource, result.resource);
|
||||
}
|
||||
} else {
|
||||
result.dependencies.forEach((d) => {
|
||||
if(d.critical)
|
||||
d.critical = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
return callback(null, result);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const createResolveDependenciesFromContextMap = (createContextMap) => {
|
||||
return function resolveDependenciesFromContextMap(fs, resource, recursive, regExp, callback) {
|
||||
createContextMap(fs, (err, map) => {
|
||||
if(err) return callback(err);
|
||||
const dependencies = Object.keys(map).map((key) => {
|
||||
return new ContextElementDependency(map[key], key);
|
||||
});
|
||||
callback(null, dependencies);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = ContextReplacementPlugin;
|
||||
123
hGameTest/node_modules/webpack/lib/DefinePlugin.js
generated
vendored
Normal file
123
hGameTest/node_modules/webpack/lib/DefinePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ConstDependency = require("./dependencies/ConstDependency");
|
||||
const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
|
||||
const ParserHelpers = require("./ParserHelpers");
|
||||
const NullFactory = require("./NullFactory");
|
||||
|
||||
class DefinePlugin {
|
||||
constructor(definitions) {
|
||||
this.definitions = definitions;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
const definitions = this.definitions;
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
|
||||
|
||||
params.normalModuleFactory.plugin("parser", (parser) => {
|
||||
(function walkDefinitions(definitions, prefix) {
|
||||
Object.keys(definitions).forEach((key) => {
|
||||
const code = definitions[key];
|
||||
if(code && typeof code === "object" && !(code instanceof RegExp)) {
|
||||
walkDefinitions(code, prefix + key + ".");
|
||||
applyObjectDefine(prefix + key, code);
|
||||
return;
|
||||
}
|
||||
applyDefineKey(prefix, key);
|
||||
applyDefine(prefix + key, code);
|
||||
});
|
||||
}(definitions, ""));
|
||||
|
||||
function stringifyObj(obj) {
|
||||
return "Object({" + Object.keys(obj).map((key) => {
|
||||
const code = obj[key];
|
||||
return JSON.stringify(key) + ":" + toCode(code);
|
||||
}).join(",") + "})";
|
||||
}
|
||||
|
||||
function toCode(code) {
|
||||
if(code === null) return "null";
|
||||
else if(code === undefined) return "undefined";
|
||||
else if(code instanceof RegExp && code.toString) return code.toString();
|
||||
else if(typeof code === "function" && code.toString) return "(" + code.toString() + ")";
|
||||
else if(typeof code === "object") return stringifyObj(code);
|
||||
else return code + "";
|
||||
}
|
||||
|
||||
function applyDefineKey(prefix, key) {
|
||||
const splittedKey = key.split(".");
|
||||
splittedKey.slice(1).forEach((_, i) => {
|
||||
const fullKey = prefix + splittedKey.slice(0, i + 1).join(".");
|
||||
parser.plugin("can-rename " + fullKey, ParserHelpers.approve);
|
||||
});
|
||||
}
|
||||
|
||||
function applyDefine(key, code) {
|
||||
const isTypeof = /^typeof\s+/.test(key);
|
||||
if(isTypeof) key = key.replace(/^typeof\s+/, "");
|
||||
let recurse = false;
|
||||
let recurseTypeof = false;
|
||||
code = toCode(code);
|
||||
if(!isTypeof) {
|
||||
parser.plugin("can-rename " + key, ParserHelpers.approve);
|
||||
parser.plugin("evaluate Identifier " + key, (expr) => {
|
||||
/**
|
||||
* this is needed in case there is a recursion in the DefinePlugin
|
||||
* to prevent an endless recursion
|
||||
* e.g.: new DefinePlugin({
|
||||
* "a": "b",
|
||||
* "b": "a"
|
||||
* });
|
||||
*/
|
||||
if(recurse) return;
|
||||
recurse = true;
|
||||
const res = parser.evaluate(code);
|
||||
recurse = false;
|
||||
res.setRange(expr.range);
|
||||
return res;
|
||||
});
|
||||
parser.plugin("expression " + key, ParserHelpers.toConstantDependency(code));
|
||||
}
|
||||
const typeofCode = isTypeof ? code : "typeof (" + code + ")";
|
||||
parser.plugin("evaluate typeof " + key, (expr) => {
|
||||
/**
|
||||
* this is needed in case there is a recursion in the DefinePlugin
|
||||
* to prevent an endless recursion
|
||||
* e.g.: new DefinePlugin({
|
||||
* "typeof a": "tyepof b",
|
||||
* "typeof b": "typeof a"
|
||||
* });
|
||||
*/
|
||||
if(recurseTypeof) return;
|
||||
recurseTypeof = true;
|
||||
const res = parser.evaluate(typeofCode);
|
||||
recurseTypeof = false;
|
||||
res.setRange(expr.range);
|
||||
return res;
|
||||
});
|
||||
parser.plugin("typeof " + key, (expr) => {
|
||||
const res = parser.evaluate(typeofCode);
|
||||
if(!res.isString()) return;
|
||||
return ParserHelpers.toConstantDependency(JSON.stringify(res.string)).bind(parser)(expr);
|
||||
});
|
||||
}
|
||||
|
||||
function applyObjectDefine(key, obj) {
|
||||
const code = stringifyObj(obj);
|
||||
parser.plugin("can-rename " + key, ParserHelpers.approve);
|
||||
parser.plugin("evaluate Identifier " + key, (expr) => new BasicEvaluatedExpression().setTruthy().setRange(expr.range));
|
||||
parser.plugin("evaluate typeof " + key, ParserHelpers.evaluateToString("object"));
|
||||
parser.plugin("expression " + key, ParserHelpers.toConstantDependency(code));
|
||||
parser.plugin("typeof " + key, ParserHelpers.toConstantDependency(JSON.stringify("object")));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = DefinePlugin;
|
||||
98
hGameTest/node_modules/webpack/lib/DelegatedModule.js
generated
vendored
Normal file
98
hGameTest/node_modules/webpack/lib/DelegatedModule.js
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const Module = require("./Module");
|
||||
const OriginalSource = require("webpack-sources").OriginalSource;
|
||||
const RawSource = require("webpack-sources").RawSource;
|
||||
const WebpackMissingModule = require("./dependencies/WebpackMissingModule");
|
||||
const DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
|
||||
const DelegatedExportsDependency = require("./dependencies/DelegatedExportsDependency");
|
||||
|
||||
class DelegatedModule extends Module {
|
||||
constructor(sourceRequest, data, type, userRequest, originalRequest) {
|
||||
super();
|
||||
this.sourceRequest = sourceRequest;
|
||||
this.request = data.id;
|
||||
this.meta = data.meta;
|
||||
this.type = type;
|
||||
this.originalRequest = originalRequest;
|
||||
this.userRequest = userRequest;
|
||||
this.built = false;
|
||||
this.delegated = true;
|
||||
this.delegateData = data;
|
||||
}
|
||||
|
||||
libIdent(options) {
|
||||
return typeof this.originalRequest === "string" ? this.originalRequest : this.originalRequest.libIdent(options);
|
||||
}
|
||||
|
||||
identifier() {
|
||||
return `delegated ${JSON.stringify(this.request)} from ${this.sourceRequest}`;
|
||||
}
|
||||
|
||||
readableIdentifier() {
|
||||
return `delegated ${this.userRequest} from ${this.sourceRequest}`;
|
||||
}
|
||||
|
||||
needRebuild() {
|
||||
return false;
|
||||
}
|
||||
|
||||
build(options, compilation, resolver, fs, callback) {
|
||||
this.built = true;
|
||||
this.builtTime = Date.now();
|
||||
this.cacheable = true;
|
||||
this.dependencies.length = 0;
|
||||
this.addDependency(new DelegatedSourceDependency(this.sourceRequest));
|
||||
this.addDependency(new DelegatedExportsDependency(this, this.delegateData.exports || true));
|
||||
callback();
|
||||
}
|
||||
|
||||
unbuild() {
|
||||
this.built = false;
|
||||
super.unbuild();
|
||||
}
|
||||
|
||||
source() {
|
||||
const sourceModule = this.dependencies[0].module;
|
||||
let str;
|
||||
|
||||
if(!sourceModule) {
|
||||
str = WebpackMissingModule.moduleCode(this.sourceRequest);
|
||||
} else {
|
||||
str = `module.exports = (__webpack_require__(${JSON.stringify(sourceModule.id)}))`;
|
||||
|
||||
switch(this.type) {
|
||||
case "require":
|
||||
str += `(${JSON.stringify(this.request)})`;
|
||||
break;
|
||||
case "object":
|
||||
str += `[${JSON.stringify(this.request)}]`;
|
||||
break;
|
||||
}
|
||||
|
||||
str += ";";
|
||||
}
|
||||
|
||||
if(this.useSourceMap) {
|
||||
return new OriginalSource(str, this.identifier());
|
||||
} else {
|
||||
return new RawSource(str);
|
||||
}
|
||||
}
|
||||
|
||||
size() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
hash.update(this.type);
|
||||
hash.update(JSON.stringify(this.request));
|
||||
super.updateHash(hash);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DelegatedModule;
|
||||
59
hGameTest/node_modules/webpack/lib/DelegatedModuleFactoryPlugin.js
generated
vendored
Normal file
59
hGameTest/node_modules/webpack/lib/DelegatedModuleFactoryPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const DelegatedModule = require("./DelegatedModule");
|
||||
|
||||
// options.source
|
||||
// options.type
|
||||
// options.context
|
||||
// options.scope
|
||||
// options.content
|
||||
class DelegatedModuleFactoryPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
options.type = options.type || "require";
|
||||
options.extensions = options.extensions || ["", ".js"];
|
||||
}
|
||||
|
||||
apply(normalModuleFactory) {
|
||||
const scope = this.options.scope;
|
||||
if(scope) {
|
||||
normalModuleFactory.plugin("factory", factory => (data, callback) => {
|
||||
const dependency = data.dependencies[0];
|
||||
const request = dependency.request;
|
||||
if(request && request.indexOf(scope + "/") === 0) {
|
||||
const innerRequest = "." + request.substr(scope.length);
|
||||
let resolved;
|
||||
if(innerRequest in this.options.content) {
|
||||
resolved = this.options.content[innerRequest];
|
||||
return callback(null, new DelegatedModule(this.options.source, resolved, this.options.type, innerRequest, request));
|
||||
}
|
||||
for(let i = 0; i < this.options.extensions.length; i++) {
|
||||
const extension = this.options.extensions[i];
|
||||
const requestPlusExt = innerRequest + extension;
|
||||
if(requestPlusExt in this.options.content) {
|
||||
resolved = this.options.content[requestPlusExt];
|
||||
return callback(null, new DelegatedModule(this.options.source, resolved, this.options.type, requestPlusExt, request + extension));
|
||||
}
|
||||
}
|
||||
}
|
||||
return factory(data, callback);
|
||||
});
|
||||
} else {
|
||||
normalModuleFactory.plugin("module", module => {
|
||||
if(module.libIdent) {
|
||||
const request = module.libIdent(this.options);
|
||||
if(request && request in this.options.content) {
|
||||
const resolved = this.options.content[request];
|
||||
return new DelegatedModule(this.options.source, resolved, this.options.type, request, module);
|
||||
}
|
||||
}
|
||||
return module;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = DelegatedModuleFactoryPlugin;
|
||||
30
hGameTest/node_modules/webpack/lib/DelegatedPlugin.js
generated
vendored
Normal file
30
hGameTest/node_modules/webpack/lib/DelegatedPlugin.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 DelegatedModuleFactoryPlugin = require("./DelegatedModuleFactoryPlugin");
|
||||
const DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
|
||||
const DelegatedExportsDependency = require("./dependencies/DelegatedExportsDependency");
|
||||
const NullFactory = require("./NullFactory");
|
||||
|
||||
class DelegatedPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
compilation.dependencyFactories.set(DelegatedSourceDependency, params.normalModuleFactory);
|
||||
compilation.dependencyFactories.set(DelegatedExportsDependency, new NullFactory());
|
||||
});
|
||||
|
||||
compiler.plugin("compile", (params) => {
|
||||
params.normalModuleFactory.apply(new DelegatedModuleFactoryPlugin(this.options));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DelegatedPlugin;
|
||||
81
hGameTest/node_modules/webpack/lib/DependenciesBlock.js
generated
vendored
Normal file
81
hGameTest/node_modules/webpack/lib/DependenciesBlock.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const DependenciesBlockVariable = require("./DependenciesBlockVariable");
|
||||
|
||||
function disconnect(i) {
|
||||
i.disconnect();
|
||||
}
|
||||
|
||||
function unseal(i) {
|
||||
i.unseal();
|
||||
}
|
||||
|
||||
class DependenciesBlock {
|
||||
constructor() {
|
||||
this.dependencies = [];
|
||||
this.blocks = [];
|
||||
this.variables = [];
|
||||
}
|
||||
|
||||
addBlock(block) {
|
||||
this.blocks.push(block);
|
||||
block.parent = this;
|
||||
}
|
||||
|
||||
addVariable(name, expression, dependencies) {
|
||||
for(let v of this.variables) {
|
||||
if(v.name === name && v.expression === expression) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.variables.push(new DependenciesBlockVariable(name, expression, dependencies));
|
||||
}
|
||||
|
||||
addDependency(dependency) {
|
||||
this.dependencies.push(dependency);
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
function updateHash(i) {
|
||||
i.updateHash(hash);
|
||||
}
|
||||
|
||||
this.dependencies.forEach(updateHash);
|
||||
this.blocks.forEach(updateHash);
|
||||
this.variables.forEach(updateHash);
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.dependencies.forEach(disconnect);
|
||||
this.blocks.forEach(disconnect);
|
||||
this.variables.forEach(disconnect);
|
||||
}
|
||||
|
||||
unseal() {
|
||||
this.blocks.forEach(unseal);
|
||||
}
|
||||
|
||||
hasDependencies(filter) {
|
||||
if(filter) {
|
||||
if(this.dependencies.some(filter)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if(this.dependencies.length > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return this.blocks.concat(this.variables).some(item => item.hasDependencies(filter));
|
||||
}
|
||||
|
||||
sortItems() {
|
||||
this.blocks.forEach(block => block.sortItems());
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DependenciesBlock;
|
||||
51
hGameTest/node_modules/webpack/lib/DependenciesBlockVariable.js
generated
vendored
Normal file
51
hGameTest/node_modules/webpack/lib/DependenciesBlockVariable.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ReplaceSource = require("webpack-sources").ReplaceSource;
|
||||
const RawSource = require("webpack-sources").RawSource;
|
||||
|
||||
class DependenciesBlockVariable {
|
||||
constructor(name, expression, dependencies) {
|
||||
this.name = name;
|
||||
this.expression = expression;
|
||||
this.dependencies = dependencies || [];
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
hash.update(this.name);
|
||||
hash.update(this.expression);
|
||||
this.dependencies.forEach(d => {
|
||||
d.updateHash(hash);
|
||||
});
|
||||
}
|
||||
|
||||
expressionSource(dependencyTemplates, outputOptions, requestShortener) {
|
||||
const source = new ReplaceSource(new RawSource(this.expression));
|
||||
this.dependencies.forEach(dep => {
|
||||
const template = dependencyTemplates.get(dep.constructor);
|
||||
if(!template) throw new Error(`No template for dependency: ${dep.constructor.name}`);
|
||||
template.apply(dep, source, outputOptions, requestShortener, dependencyTemplates);
|
||||
});
|
||||
return source;
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.dependencies.forEach(d => {
|
||||
d.disconnect();
|
||||
});
|
||||
}
|
||||
|
||||
hasDependencies(filter) {
|
||||
if(filter) {
|
||||
if(this.dependencies.some(filter)) return true;
|
||||
} else {
|
||||
if(this.dependencies.length > 0) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DependenciesBlockVariable;
|
||||
54
hGameTest/node_modules/webpack/lib/Dependency.js
generated
vendored
Normal file
54
hGameTest/node_modules/webpack/lib/Dependency.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 compareLocations = require("./compareLocations");
|
||||
|
||||
class Dependency {
|
||||
constructor() {
|
||||
this.module = null;
|
||||
}
|
||||
|
||||
isEqualResource() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns the referenced module and export
|
||||
getReference() {
|
||||
if(!this.module) return null;
|
||||
return {
|
||||
module: this.module,
|
||||
importedNames: true, // true: full object, false: only sideeffects/no export, array of strings: the exports with this names
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the exported names
|
||||
getExports() {
|
||||
return null;
|
||||
}
|
||||
|
||||
getWarnings() {
|
||||
return null;
|
||||
}
|
||||
|
||||
getErrors() {
|
||||
return null;
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
hash.update((this.module && this.module.id) + "");
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.module = null;
|
||||
}
|
||||
|
||||
// TODO: remove in webpack 3
|
||||
compare(a, b) {
|
||||
return compareLocations(a.loc, b.loc);
|
||||
}
|
||||
}
|
||||
Dependency.compare = (a, b) => compareLocations(a.loc, b.loc);
|
||||
|
||||
module.exports = Dependency;
|
||||
37
hGameTest/node_modules/webpack/lib/DllEntryPlugin.js
generated
vendored
Normal file
37
hGameTest/node_modules/webpack/lib/DllEntryPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const DllEntryDependency = require("./dependencies/DllEntryDependency");
|
||||
const SingleEntryDependency = require("./dependencies/SingleEntryDependency");
|
||||
const DllModuleFactory = require("./DllModuleFactory");
|
||||
|
||||
class DllEntryPlugin {
|
||||
constructor(context, entries, name) {
|
||||
this.context = context;
|
||||
this.entries = entries;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const dllModuleFactory = new DllModuleFactory();
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(DllEntryDependency, dllModuleFactory);
|
||||
|
||||
compilation.dependencyFactories.set(SingleEntryDependency, normalModuleFactory);
|
||||
});
|
||||
compiler.plugin("make", (compilation, callback) => {
|
||||
compilation.addEntry(this.context, new DllEntryDependency(this.entries.map((e, idx) => {
|
||||
const dep = new SingleEntryDependency(e);
|
||||
dep.loc = `${this.name}:${idx}`;
|
||||
return dep;
|
||||
}), this.name), this.name, callback);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DllEntryPlugin;
|
||||
58
hGameTest/node_modules/webpack/lib/DllModule.js
generated
vendored
Normal file
58
hGameTest/node_modules/webpack/lib/DllModule.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 Module = require("./Module");
|
||||
const RawSource = require("webpack-sources").RawSource;
|
||||
|
||||
class DllModule extends Module {
|
||||
constructor(context, dependencies, name, type) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.dependencies = dependencies;
|
||||
this.name = name;
|
||||
this.built = false;
|
||||
this.cacheable = true;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
identifier() {
|
||||
return `dll ${this.name}`;
|
||||
}
|
||||
|
||||
readableIdentifier() {
|
||||
return `dll ${this.name}`;
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.built = false;
|
||||
super.disconnect();
|
||||
}
|
||||
|
||||
build(options, compilation, resolver, fs, callback) {
|
||||
this.built = true;
|
||||
return callback();
|
||||
}
|
||||
|
||||
source() {
|
||||
return new RawSource("module.exports = __webpack_require__;");
|
||||
}
|
||||
|
||||
needRebuild() {
|
||||
return false;
|
||||
}
|
||||
|
||||
size() {
|
||||
return 12;
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
hash.update("dll module");
|
||||
hash.update(this.name || "");
|
||||
super.updateHash(hash);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DllModule;
|
||||
20
hGameTest/node_modules/webpack/lib/DllModuleFactory.js
generated
vendored
Normal file
20
hGameTest/node_modules/webpack/lib/DllModuleFactory.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 Tapable = require("tapable");
|
||||
const DllModule = require("./DllModule");
|
||||
|
||||
class DllModuleFactory extends Tapable {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
create(data, callback) {
|
||||
const dependency = data.dependencies[0];
|
||||
callback(null, new DllModule(data.context, dependency.dependencies, dependency.name, dependency.type));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DllModuleFactory;
|
||||
38
hGameTest/node_modules/webpack/lib/DllPlugin.js
generated
vendored
Normal file
38
hGameTest/node_modules/webpack/lib/DllPlugin.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 DllEntryPlugin = require("./DllEntryPlugin");
|
||||
const LibManifestPlugin = require("./LibManifestPlugin");
|
||||
const FlagInitialModulesAsUsedPlugin = require("./FlagInitialModulesAsUsedPlugin");
|
||||
|
||||
class DllPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("entry-option", (context, entry) => {
|
||||
function itemToPlugin(item, name) {
|
||||
if(Array.isArray(item))
|
||||
return new DllEntryPlugin(context, item, name);
|
||||
else
|
||||
throw new Error("DllPlugin: supply an Array as entry");
|
||||
}
|
||||
if(typeof entry === "object" && !Array.isArray(entry)) {
|
||||
Object.keys(entry).forEach(name => {
|
||||
compiler.apply(itemToPlugin(entry[name], name));
|
||||
});
|
||||
} else {
|
||||
compiler.apply(itemToPlugin(entry, "main"));
|
||||
}
|
||||
return true;
|
||||
});
|
||||
compiler.apply(new LibManifestPlugin(this.options));
|
||||
compiler.apply(new FlagInitialModulesAsUsedPlugin());
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DllPlugin;
|
||||
62
hGameTest/node_modules/webpack/lib/DllReferencePlugin.js
generated
vendored
Normal file
62
hGameTest/node_modules/webpack/lib/DllReferencePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
|
||||
const DelegatedModuleFactoryPlugin = require("./DelegatedModuleFactoryPlugin");
|
||||
const ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin");
|
||||
const DelegatedExportsDependency = require("./dependencies/DelegatedExportsDependency");
|
||||
const NullFactory = require("./NullFactory");
|
||||
|
||||
class DllReferencePlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
compilation.dependencyFactories.set(DelegatedSourceDependency, normalModuleFactory);
|
||||
compilation.dependencyFactories.set(DelegatedExportsDependency, new NullFactory());
|
||||
});
|
||||
|
||||
compiler.plugin("before-compile", (params, callback) => {
|
||||
const manifest = this.options.manifest;
|
||||
if(typeof manifest === "string") {
|
||||
params.compilationDependencies.push(manifest);
|
||||
compiler.inputFileSystem.readFile(manifest, function(err, result) {
|
||||
if(err) return callback(err);
|
||||
params["dll reference " + manifest] = JSON.parse(result.toString("utf-8"));
|
||||
return callback();
|
||||
});
|
||||
} else {
|
||||
return callback();
|
||||
}
|
||||
});
|
||||
|
||||
compiler.plugin("compile", (params) => {
|
||||
let manifest = this.options.manifest;
|
||||
if(typeof manifest === "string") {
|
||||
manifest = params["dll reference " + manifest];
|
||||
}
|
||||
const name = this.options.name || manifest.name;
|
||||
const sourceType = this.options.sourceType || (manifest && manifest.type) || "var";
|
||||
const externals = {};
|
||||
const source = "dll-reference " + name;
|
||||
externals[source] = name;
|
||||
params.normalModuleFactory.apply(new ExternalModuleFactoryPlugin(sourceType, externals));
|
||||
params.normalModuleFactory.apply(new DelegatedModuleFactoryPlugin({
|
||||
source: source,
|
||||
type: this.options.type,
|
||||
scope: this.options.scope,
|
||||
context: this.options.context || compiler.options.context,
|
||||
content: this.options.content || manifest.content,
|
||||
extensions: this.options.extensions
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DllReferencePlugin;
|
||||
59
hGameTest/node_modules/webpack/lib/DynamicEntryPlugin.js
generated
vendored
Normal file
59
hGameTest/node_modules/webpack/lib/DynamicEntryPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Naoyuki Kanezawa @nkzawa
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const MultiEntryDependency = require("./dependencies/MultiEntryDependency");
|
||||
const SingleEntryDependency = require("./dependencies/SingleEntryDependency");
|
||||
const MultiModuleFactory = require("./MultiModuleFactory");
|
||||
const MultiEntryPlugin = require("./MultiEntryPlugin");
|
||||
const SingleEntryPlugin = require("./SingleEntryPlugin");
|
||||
|
||||
class DynamicEntryPlugin {
|
||||
constructor(context, entry) {
|
||||
this.context = context;
|
||||
this.entry = entry;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const multiModuleFactory = new MultiModuleFactory();
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(MultiEntryDependency, multiModuleFactory);
|
||||
compilation.dependencyFactories.set(SingleEntryDependency, normalModuleFactory);
|
||||
});
|
||||
|
||||
compiler.plugin("make", (compilation, callback) => {
|
||||
const addEntry = (entry, name) => {
|
||||
const dep = DynamicEntryPlugin.createDependency(entry, name);
|
||||
return new Promise((resolve, reject) => {
|
||||
compilation.addEntry(this.context, dep, name, (err) => {
|
||||
if(err) return reject(err);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Promise.resolve(this.entry()).then((entry) => {
|
||||
if(typeof entry === "string" || Array.isArray(entry)) {
|
||||
addEntry(entry, "main").then(() => callback(), callback);
|
||||
} else if(typeof entry === "object") {
|
||||
Promise.all(Object.keys(entry).map((name) => {
|
||||
return addEntry(entry[name], name);
|
||||
})).then(() => callback(), callback);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DynamicEntryPlugin;
|
||||
|
||||
DynamicEntryPlugin.createDependency = function(entry, name) {
|
||||
if(Array.isArray(entry))
|
||||
return MultiEntryPlugin.createDependency(entry, name);
|
||||
else
|
||||
return SingleEntryPlugin.createDependency(entry, name);
|
||||
};
|
||||
22
hGameTest/node_modules/webpack/lib/EntryModuleNotFoundError.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/EntryModuleNotFoundError.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 WebpackError = require("./WebpackError");
|
||||
|
||||
class EntryModuleNotFoundError extends WebpackError {
|
||||
constructor(err) {
|
||||
super();
|
||||
|
||||
this.name = "EntryModuleNotFoundError";
|
||||
this.message = "Entry module not found: " + err;
|
||||
this.details = err.details;
|
||||
this.error = err;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EntryModuleNotFoundError;
|
||||
31
hGameTest/node_modules/webpack/lib/EntryOptionPlugin.js
generated
vendored
Normal file
31
hGameTest/node_modules/webpack/lib/EntryOptionPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const SingleEntryPlugin = require("./SingleEntryPlugin");
|
||||
const MultiEntryPlugin = require("./MultiEntryPlugin");
|
||||
const DynamicEntryPlugin = require("./DynamicEntryPlugin");
|
||||
|
||||
function itemToPlugin(context, item, name) {
|
||||
if(Array.isArray(item)) {
|
||||
return new MultiEntryPlugin(context, item, name);
|
||||
}
|
||||
return new SingleEntryPlugin(context, item, name);
|
||||
}
|
||||
|
||||
module.exports = class EntryOptionPlugin {
|
||||
apply(compiler) {
|
||||
compiler.plugin("entry-option", (context, entry) => {
|
||||
if(typeof entry === "string" || Array.isArray(entry)) {
|
||||
compiler.apply(itemToPlugin(context, entry, "main"));
|
||||
} else if(typeof entry === "object") {
|
||||
Object.keys(entry).forEach(name => compiler.apply(itemToPlugin(context, entry[name], name)));
|
||||
} else if(typeof entry === "function") {
|
||||
compiler.apply(new DynamicEntryPlugin(context, entry));
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
};
|
||||
43
hGameTest/node_modules/webpack/lib/Entrypoint.js
generated
vendored
Normal file
43
hGameTest/node_modules/webpack/lib/Entrypoint.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class Entrypoint {
|
||||
constructor(name) {
|
||||
this.name = name;
|
||||
this.chunks = [];
|
||||
}
|
||||
|
||||
unshiftChunk(chunk) {
|
||||
this.chunks.unshift(chunk);
|
||||
chunk.entrypoints.push(this);
|
||||
}
|
||||
|
||||
insertChunk(chunk, before) {
|
||||
const idx = this.chunks.indexOf(before);
|
||||
if(idx >= 0) {
|
||||
this.chunks.splice(idx, 0, chunk);
|
||||
} else {
|
||||
throw new Error("before chunk not found");
|
||||
}
|
||||
chunk.entrypoints.push(this);
|
||||
}
|
||||
|
||||
getFiles() {
|
||||
const files = [];
|
||||
|
||||
for(let chunkIdx = 0; chunkIdx < this.chunks.length; chunkIdx++) {
|
||||
for(let fileIdx = 0; fileIdx < this.chunks[chunkIdx].files.length; fileIdx++) {
|
||||
if(files.indexOf(this.chunks[chunkIdx].files[fileIdx]) === -1) {
|
||||
files.push(this.chunks[chunkIdx].files[fileIdx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Entrypoint;
|
||||
60
hGameTest/node_modules/webpack/lib/EnvironmentPlugin.js
generated
vendored
Normal file
60
hGameTest/node_modules/webpack/lib/EnvironmentPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Authors Simen Brekken @simenbrekken, Einar Löve @einarlove
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const DefinePlugin = require("./DefinePlugin");
|
||||
|
||||
const needsEnvVarFix = ["8", "9"].indexOf(process.versions.node.split(".")[0]) >= 0 &&
|
||||
process.platform === "win32";
|
||||
|
||||
class EnvironmentPlugin {
|
||||
constructor(keys) {
|
||||
if(Array.isArray(keys)) {
|
||||
this.keys = keys;
|
||||
this.defaultValues = {};
|
||||
} else if(keys && typeof keys === "object") {
|
||||
this.keys = Object.keys(keys);
|
||||
this.defaultValues = keys;
|
||||
} else {
|
||||
this.keys = Array.prototype.slice.call(arguments);
|
||||
this.defaultValues = {};
|
||||
}
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
const definitions = this.keys.reduce((defs, key) => {
|
||||
// TODO remove once the fix has made its way into Node 8.
|
||||
// Work around https://github.com/nodejs/node/pull/18463,
|
||||
// affecting Node 8 & 9 by performing an OS-level
|
||||
// operation that always succeeds before reading
|
||||
// environment variables:
|
||||
if(needsEnvVarFix) require("os").cpus();
|
||||
|
||||
const value = process.env[key] !== undefined ? process.env[key] : this.defaultValues[key];
|
||||
|
||||
if(value === undefined) {
|
||||
compiler.plugin("this-compilation", compilation => {
|
||||
const error = new Error(
|
||||
`EnvironmentPlugin - ${key} environment variable is undefined.\n\n` +
|
||||
"You can pass an object with default values to suppress this warning.\n" +
|
||||
"See https://webpack.js.org/plugins/environment-plugin for example."
|
||||
);
|
||||
|
||||
error.name = "EnvVariableNotDefinedError";
|
||||
compilation.warnings.push(error);
|
||||
});
|
||||
}
|
||||
|
||||
defs[`process.env.${key}`] = typeof value === "undefined" ? "undefined" : JSON.stringify(value);
|
||||
|
||||
return defs;
|
||||
}, {});
|
||||
|
||||
compiler.apply(new DefinePlugin(definitions));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EnvironmentPlugin;
|
||||
31
hGameTest/node_modules/webpack/lib/ErrorHelpers.js
generated
vendored
Normal file
31
hGameTest/node_modules/webpack/lib/ErrorHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const loaderFlag = "LOADER_EXECUTION";
|
||||
|
||||
exports.cutOffLoaderExecution = (stack) => {
|
||||
stack = stack.split("\n");
|
||||
for(let i = 0; i < stack.length; i++)
|
||||
if(stack[i].indexOf(loaderFlag) >= 0)
|
||||
stack.length = i;
|
||||
return stack.join("\n");
|
||||
};
|
||||
|
||||
exports.cutOffMessage = (stack, message) => {
|
||||
const nextLine = stack.indexOf("\n");
|
||||
if(nextLine === -1) {
|
||||
return stack === message ? "" : stack;
|
||||
} else {
|
||||
const firstLine = stack.substr(0, nextLine);
|
||||
return firstLine === message ? stack.substr(nextLine + 1) : stack;
|
||||
}
|
||||
};
|
||||
|
||||
exports.cleanUp = (stack, message) => {
|
||||
stack = exports.cutOffLoaderExecution(stack);
|
||||
stack = exports.cutOffMessage(stack, message);
|
||||
return stack;
|
||||
};
|
||||
22
hGameTest/node_modules/webpack/lib/EvalDevToolModulePlugin.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/EvalDevToolModulePlugin.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 EvalDevToolModuleTemplatePlugin = require("./EvalDevToolModuleTemplatePlugin");
|
||||
|
||||
class EvalDevToolModulePlugin {
|
||||
constructor(sourceUrlComment, moduleFilenameTemplate) {
|
||||
this.sourceUrlComment = sourceUrlComment;
|
||||
this.moduleFilenameTemplate = moduleFilenameTemplate;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.moduleTemplate.apply(new EvalDevToolModuleTemplatePlugin(this.sourceUrlComment, this.moduleFilenameTemplate));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EvalDevToolModulePlugin;
|
||||
33
hGameTest/node_modules/webpack/lib/EvalDevToolModuleTemplatePlugin.js
generated
vendored
Normal file
33
hGameTest/node_modules/webpack/lib/EvalDevToolModuleTemplatePlugin.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 RawSource = require("webpack-sources").RawSource;
|
||||
const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
|
||||
|
||||
class EvalDevToolModuleTemplatePlugin {
|
||||
constructor(sourceUrlComment, moduleFilenameTemplate) {
|
||||
this.sourceUrlComment = sourceUrlComment || "\n//# sourceURL=[url]";
|
||||
this.moduleFilenameTemplate = moduleFilenameTemplate || "webpack:///[resourcePath]?[loaders]";
|
||||
}
|
||||
|
||||
apply(moduleTemplate) {
|
||||
moduleTemplate.plugin("module", (source, module) => {
|
||||
const content = source.source();
|
||||
const str = ModuleFilenameHelpers.createFilename(module, this.moduleFilenameTemplate, moduleTemplate.requestShortener);
|
||||
const footer = ["\n",
|
||||
ModuleFilenameHelpers.createFooter(module, moduleTemplate.requestShortener),
|
||||
this.sourceUrlComment.replace(/\[url\]/g, encodeURI(str).replace(/%2F/g, "/").replace(/%20/g, "_").replace(/%5E/g, "^").replace(/%5C/g, "\\").replace(/^\//, ""))
|
||||
].join("\n");
|
||||
return new RawSource(`eval(${JSON.stringify(content + footer)});`);
|
||||
});
|
||||
moduleTemplate.plugin("hash", hash => {
|
||||
hash.update("EvalDevToolModuleTemplatePlugin");
|
||||
hash.update("2");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EvalDevToolModuleTemplatePlugin;
|
||||
75
hGameTest/node_modules/webpack/lib/EvalSourceMapDevToolModuleTemplatePlugin.js
generated
vendored
Normal file
75
hGameTest/node_modules/webpack/lib/EvalSourceMapDevToolModuleTemplatePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const RawSource = require("webpack-sources").RawSource;
|
||||
const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
|
||||
|
||||
class EvalSourceMapDevToolModuleTemplatePlugin {
|
||||
constructor(compilation, options) {
|
||||
this.compilation = compilation;
|
||||
this.sourceMapComment = options.append || "//# sourceURL=[module]\n//# sourceMappingURL=[url]";
|
||||
this.moduleFilenameTemplate = options.moduleFilenameTemplate || "webpack:///[resource-path]?[hash]";
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(moduleTemplate) {
|
||||
const self = this;
|
||||
const options = this.options;
|
||||
moduleTemplate.plugin("module", function(source, module) {
|
||||
if(source.__EvalSourceMapDevToolData)
|
||||
return source.__EvalSourceMapDevToolData;
|
||||
let sourceMap;
|
||||
let content;
|
||||
if(source.sourceAndMap) {
|
||||
const sourceAndMap = source.sourceAndMap(options);
|
||||
sourceMap = sourceAndMap.map;
|
||||
content = sourceAndMap.source;
|
||||
} else {
|
||||
sourceMap = source.map(options);
|
||||
content = source.source();
|
||||
}
|
||||
if(!sourceMap) {
|
||||
return source;
|
||||
}
|
||||
|
||||
// Clone (flat) the sourcemap to ensure that the mutations below do not persist.
|
||||
sourceMap = Object.keys(sourceMap).reduce(function(obj, key) {
|
||||
obj[key] = sourceMap[key];
|
||||
return obj;
|
||||
}, {});
|
||||
const modules = sourceMap.sources.map(function(source) {
|
||||
const module = self.compilation.findModule(source);
|
||||
return module || source;
|
||||
});
|
||||
let moduleFilenames = modules.map(function(module) {
|
||||
return ModuleFilenameHelpers.createFilename(module, self.moduleFilenameTemplate, this.requestShortener);
|
||||
}, this);
|
||||
moduleFilenames = ModuleFilenameHelpers.replaceDuplicates(moduleFilenames, function(filename, i, n) {
|
||||
for(let j = 0; j < n; j++)
|
||||
filename += "*";
|
||||
return filename;
|
||||
});
|
||||
sourceMap.sources = moduleFilenames;
|
||||
if(sourceMap.sourcesContent) {
|
||||
sourceMap.sourcesContent = sourceMap.sourcesContent.map(function(content, i) {
|
||||
return typeof content === "string" ? `${content}\n\n\n${ModuleFilenameHelpers.createFooter(modules[i], this.requestShortener)}` : null;
|
||||
}, this);
|
||||
}
|
||||
sourceMap.sourceRoot = options.sourceRoot || "";
|
||||
sourceMap.file = `${module.id}.js`;
|
||||
|
||||
const footer = self.sourceMapComment.replace(/\[url\]/g, `data:application/json;charset=utf-8;base64,${new Buffer(JSON.stringify(sourceMap), "utf8").toString("base64")}`) + //eslint-disable-line
|
||||
`\n//# sourceURL=webpack-internal:///${module.id}\n`; // workaround for chrome bug
|
||||
source.__EvalSourceMapDevToolData = new RawSource(`eval(${JSON.stringify(content + footer)});`);
|
||||
return source.__EvalSourceMapDevToolData;
|
||||
});
|
||||
moduleTemplate.plugin("hash", function(hash) {
|
||||
hash.update("eval-source-map");
|
||||
hash.update("2");
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = EvalSourceMapDevToolModuleTemplatePlugin;
|
||||
32
hGameTest/node_modules/webpack/lib/EvalSourceMapDevToolPlugin.js
generated
vendored
Normal file
32
hGameTest/node_modules/webpack/lib/EvalSourceMapDevToolPlugin.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 EvalSourceMapDevToolModuleTemplatePlugin = require("./EvalSourceMapDevToolModuleTemplatePlugin");
|
||||
const SourceMapDevToolModuleOptionsPlugin = require("./SourceMapDevToolModuleOptionsPlugin");
|
||||
|
||||
class EvalSourceMapDevToolPlugin {
|
||||
constructor(options) {
|
||||
if(arguments.length > 1)
|
||||
throw new Error("EvalSourceMapDevToolPlugin only takes one argument (pass an options object)");
|
||||
if(typeof options === "string") {
|
||||
options = {
|
||||
append: options
|
||||
};
|
||||
}
|
||||
if(!options) options = {};
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
const options = this.options;
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation);
|
||||
compilation.moduleTemplate.apply(new EvalSourceMapDevToolModuleTemplatePlugin(compilation, options));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EvalSourceMapDevToolPlugin;
|
||||
31
hGameTest/node_modules/webpack/lib/ExportPropertyMainTemplatePlugin.js
generated
vendored
Normal file
31
hGameTest/node_modules/webpack/lib/ExportPropertyMainTemplatePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ConcatSource = require("webpack-sources").ConcatSource;
|
||||
|
||||
function accessorToObjectAccess(accessor) {
|
||||
return accessor.map(a => `[${JSON.stringify(a)}]`).join("");
|
||||
}
|
||||
|
||||
class ExportPropertyMainTemplatePlugin {
|
||||
constructor(property) {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
apply(compilation) {
|
||||
const mainTemplate = compilation.mainTemplate;
|
||||
compilation.templatesPlugin("render-with-entry", (source, chunk, hash) => {
|
||||
const postfix = `${accessorToObjectAccess([].concat(this.property))}`;
|
||||
return new ConcatSource(source, postfix);
|
||||
});
|
||||
mainTemplate.plugin("hash", hash => {
|
||||
hash.update("export property");
|
||||
hash.update(`${this.property}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ExportPropertyMainTemplatePlugin;
|
||||
47
hGameTest/node_modules/webpack/lib/ExtendedAPIPlugin.js
generated
vendored
Normal file
47
hGameTest/node_modules/webpack/lib/ExtendedAPIPlugin.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 ConstDependency = require("./dependencies/ConstDependency");
|
||||
const ParserHelpers = require("./ParserHelpers");
|
||||
const NullFactory = require("./NullFactory");
|
||||
|
||||
const REPLACEMENTS = {
|
||||
__webpack_hash__: "__webpack_require__.h", // eslint-disable-line camelcase
|
||||
__webpack_chunkname__: "__webpack_require__.cn" // eslint-disable-line camelcase
|
||||
};
|
||||
const REPLACEMENT_TYPES = {
|
||||
__webpack_hash__: "string", // eslint-disable-line camelcase
|
||||
__webpack_chunkname__: "string" // eslint-disable-line camelcase
|
||||
};
|
||||
|
||||
class ExtendedAPIPlugin {
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
|
||||
compilation.mainTemplate.plugin("require-extensions", function(source, chunk, hash) {
|
||||
const buf = [source];
|
||||
buf.push("");
|
||||
buf.push("// __webpack_hash__");
|
||||
buf.push(`${this.requireFn}.h = ${JSON.stringify(hash)};`);
|
||||
buf.push("");
|
||||
buf.push("// __webpack_chunkname__");
|
||||
buf.push(`${this.requireFn}.cn = ${JSON.stringify(chunk.name)};`);
|
||||
return this.asString(buf);
|
||||
});
|
||||
compilation.mainTemplate.plugin("global-hash", () => true);
|
||||
|
||||
params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
|
||||
Object.keys(REPLACEMENTS).forEach(key => {
|
||||
parser.plugin(`expression ${key}`, ParserHelpers.toConstantDependency(REPLACEMENTS[key]));
|
||||
parser.plugin(`evaluate typeof ${key}`, ParserHelpers.evaluateToString(REPLACEMENT_TYPES[key]));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ExtendedAPIPlugin;
|
||||
128
hGameTest/node_modules/webpack/lib/ExternalModule.js
generated
vendored
Normal file
128
hGameTest/node_modules/webpack/lib/ExternalModule.js
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const Module = require("./Module");
|
||||
const OriginalSource = require("webpack-sources").OriginalSource;
|
||||
const RawSource = require("webpack-sources").RawSource;
|
||||
const WebpackMissingModule = require("./dependencies/WebpackMissingModule");
|
||||
const Template = require("./Template");
|
||||
|
||||
class ExternalModule extends Module {
|
||||
constructor(request, type, userRequest) {
|
||||
super();
|
||||
this.request = request;
|
||||
this.userRequest = userRequest;
|
||||
this.type = type;
|
||||
this.built = false;
|
||||
this.external = true;
|
||||
}
|
||||
|
||||
libIdent() {
|
||||
return this.userRequest;
|
||||
}
|
||||
|
||||
chunkCondition(chunk) {
|
||||
return chunk.hasEntryModule();
|
||||
}
|
||||
|
||||
identifier() {
|
||||
return "external " + JSON.stringify(this.request);
|
||||
}
|
||||
|
||||
readableIdentifier() {
|
||||
return "external " + JSON.stringify(this.request);
|
||||
}
|
||||
|
||||
needRebuild() {
|
||||
return false;
|
||||
}
|
||||
|
||||
build(options, compilation, resolver, fs, callback) {
|
||||
this.builtTime = Date.now();
|
||||
callback();
|
||||
}
|
||||
|
||||
getSourceForGlobalVariableExternal(variableName, type) {
|
||||
if(!Array.isArray(variableName)) {
|
||||
// make it an array as the look up works the same basically
|
||||
variableName = [variableName];
|
||||
}
|
||||
|
||||
// needed for e.g. window["some"]["thing"]
|
||||
const objectLookup = variableName.map(r => `[${JSON.stringify(r)}]`).join("");
|
||||
return `(function() { module.exports = ${type}${objectLookup}; }());`;
|
||||
}
|
||||
|
||||
getSourceForCommonJsExternal(moduleAndSpecifiers) {
|
||||
if(!Array.isArray(moduleAndSpecifiers)) {
|
||||
return `module.exports = require(${JSON.stringify(moduleAndSpecifiers)});`;
|
||||
}
|
||||
|
||||
const moduleName = moduleAndSpecifiers[0];
|
||||
const objectLookup = moduleAndSpecifiers.slice(1).map(r => `[${JSON.stringify(r)}]`).join("");
|
||||
return `module.exports = require(${moduleName})${objectLookup};`;
|
||||
}
|
||||
|
||||
checkExternalVariable(variableToCheck, request) {
|
||||
return `if(typeof ${variableToCheck} === 'undefined') {${WebpackMissingModule.moduleCode(request)}}\n`;
|
||||
}
|
||||
|
||||
getSourceForAmdOrUmdExternal(id, optional, request) {
|
||||
const externalVariable = Template.toIdentifier(`__WEBPACK_EXTERNAL_MODULE_${id}__`);
|
||||
const missingModuleError = optional ? this.checkExternalVariable(externalVariable, request) : "";
|
||||
return `${missingModuleError}module.exports = ${externalVariable};`;
|
||||
}
|
||||
|
||||
getSourceForDefaultCase(optional, request) {
|
||||
const missingModuleError = optional ? this.checkExternalVariable(request, request) : "";
|
||||
return `${missingModuleError}module.exports = ${request};`;
|
||||
}
|
||||
|
||||
getSourceString() {
|
||||
const request = typeof this.request === "object" ? this.request[this.type] : this.request;
|
||||
switch(this.type) {
|
||||
case "this":
|
||||
case "window":
|
||||
case "global":
|
||||
return this.getSourceForGlobalVariableExternal(request, this.type);
|
||||
case "commonjs":
|
||||
case "commonjs2":
|
||||
return this.getSourceForCommonJsExternal(request);
|
||||
case "amd":
|
||||
case "umd":
|
||||
case "umd2":
|
||||
return this.getSourceForAmdOrUmdExternal(this.id, this.optional, request);
|
||||
default:
|
||||
return this.getSourceForDefaultCase(this.optional, request);
|
||||
}
|
||||
}
|
||||
|
||||
getSource(sourceString) {
|
||||
if(this.useSourceMap) {
|
||||
return new OriginalSource(sourceString, this.identifier());
|
||||
}
|
||||
|
||||
return new RawSource(sourceString);
|
||||
}
|
||||
|
||||
source() {
|
||||
return this.getSource(
|
||||
this.getSourceString()
|
||||
);
|
||||
}
|
||||
|
||||
size() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
hash.update(this.type);
|
||||
hash.update(JSON.stringify(this.request));
|
||||
hash.update(JSON.stringify(Boolean(this.optional)));
|
||||
super.updateHash(hash);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ExternalModule;
|
||||
91
hGameTest/node_modules/webpack/lib/ExternalModuleFactoryPlugin.js
generated
vendored
Normal file
91
hGameTest/node_modules/webpack/lib/ExternalModuleFactoryPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ExternalModule = require("./ExternalModule");
|
||||
|
||||
class ExternalModuleFactoryPlugin {
|
||||
constructor(type, externals) {
|
||||
this.type = type;
|
||||
this.externals = externals;
|
||||
}
|
||||
|
||||
apply(normalModuleFactory) {
|
||||
const globalType = this.type;
|
||||
normalModuleFactory.plugin("factory", factory => (data, callback) => {
|
||||
const context = data.context;
|
||||
const dependency = data.dependencies[0];
|
||||
|
||||
function handleExternal(value, type, callback) {
|
||||
if(typeof type === "function") {
|
||||
callback = type;
|
||||
type = undefined;
|
||||
}
|
||||
if(value === false) return factory(data, callback);
|
||||
if(value === true) value = dependency.request;
|
||||
if(typeof type === "undefined" && /^[a-z0-9]+ /.test(value)) {
|
||||
const idx = value.indexOf(" ");
|
||||
type = value.substr(0, idx);
|
||||
value = value.substr(idx + 1);
|
||||
}
|
||||
callback(null, new ExternalModule(value, type || globalType, dependency.request));
|
||||
return true;
|
||||
}
|
||||
(function handleExternals(externals, callback) {
|
||||
if(typeof externals === "string") {
|
||||
if(externals === dependency.request) {
|
||||
return handleExternal(dependency.request, callback);
|
||||
}
|
||||
} else if(Array.isArray(externals)) {
|
||||
let i = 0;
|
||||
(function next() {
|
||||
let asyncFlag;
|
||||
const handleExternalsAndCallback = function handleExternalsAndCallback(err, module) {
|
||||
if(err) return callback(err);
|
||||
if(!module) {
|
||||
if(asyncFlag) {
|
||||
asyncFlag = false;
|
||||
return;
|
||||
}
|
||||
return next();
|
||||
}
|
||||
callback(null, module);
|
||||
};
|
||||
|
||||
do {
|
||||
asyncFlag = true;
|
||||
if(i >= externals.length) return callback();
|
||||
handleExternals(externals[i++], handleExternalsAndCallback);
|
||||
} while (!asyncFlag); // eslint-disable-line keyword-spacing
|
||||
asyncFlag = false;
|
||||
}());
|
||||
return;
|
||||
} else if(externals instanceof RegExp) {
|
||||
if(externals.test(dependency.request)) {
|
||||
return handleExternal(dependency.request, callback);
|
||||
}
|
||||
} else if(typeof externals === "function") {
|
||||
externals.call(null, context, dependency.request, function(err, value, type) {
|
||||
if(err) return callback(err);
|
||||
if(typeof value !== "undefined") {
|
||||
handleExternal(value, type, callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
return;
|
||||
} else if(typeof externals === "object" && Object.prototype.hasOwnProperty.call(externals, dependency.request)) {
|
||||
return handleExternal(externals[dependency.request], callback);
|
||||
}
|
||||
callback();
|
||||
}(this.externals, function(err, module) {
|
||||
if(err) return callback(err);
|
||||
if(!module) return handleExternal(false, callback);
|
||||
return callback(null, module);
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = ExternalModuleFactoryPlugin;
|
||||
21
hGameTest/node_modules/webpack/lib/ExternalsPlugin.js
generated
vendored
Normal file
21
hGameTest/node_modules/webpack/lib/ExternalsPlugin.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 ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin");
|
||||
|
||||
class ExternalsPlugin {
|
||||
constructor(type, externals) {
|
||||
this.type = type;
|
||||
this.externals = externals;
|
||||
}
|
||||
apply(compiler) {
|
||||
compiler.plugin("compile", (params) => {
|
||||
params.normalModuleFactory.apply(new ExternalModuleFactoryPlugin(this.type, this.externals));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ExternalsPlugin;
|
||||
101
hGameTest/node_modules/webpack/lib/FlagDependencyExportsPlugin.js
generated
vendored
Normal file
101
hGameTest/node_modules/webpack/lib/FlagDependencyExportsPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class FlagDependencyExportsPlugin {
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.plugin("finish-modules", (modules) => {
|
||||
const dependencies = Object.create(null);
|
||||
|
||||
let module;
|
||||
let moduleWithExports;
|
||||
let moduleProvidedExports;
|
||||
const queue = modules.filter((m) => !m.providedExports);
|
||||
for(let i = 0; i < queue.length; i++) {
|
||||
module = queue[i];
|
||||
|
||||
if(module.providedExports !== true) {
|
||||
moduleWithExports = module.meta && module.meta.harmonyModule;
|
||||
moduleProvidedExports = Array.isArray(module.providedExports) ? new Set(module.providedExports) : new Set();
|
||||
processDependenciesBlock(module);
|
||||
if(!moduleWithExports) {
|
||||
module.providedExports = true;
|
||||
notifyDependencies();
|
||||
} else if(module.providedExports !== true) {
|
||||
module.providedExports = Array.from(moduleProvidedExports);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function processDependenciesBlock(depBlock) {
|
||||
depBlock.dependencies.forEach((dep) => processDependency(dep));
|
||||
depBlock.variables.forEach((variable) => {
|
||||
variable.dependencies.forEach((dep) => processDependency(dep));
|
||||
});
|
||||
depBlock.blocks.forEach(processDependenciesBlock);
|
||||
}
|
||||
|
||||
function processDependency(dep) {
|
||||
const exportDesc = dep.getExports && dep.getExports();
|
||||
if(!exportDesc) return;
|
||||
moduleWithExports = true;
|
||||
const exports = exportDesc.exports;
|
||||
const exportDeps = exportDesc.dependencies;
|
||||
if(exportDeps) {
|
||||
exportDeps.forEach((dep) => {
|
||||
const depIdent = dep.identifier();
|
||||
// if this was not yet initialized
|
||||
// initialize it as an array containing the module and stop
|
||||
const array = dependencies[depIdent];
|
||||
if(!array) {
|
||||
dependencies[depIdent] = [module];
|
||||
return;
|
||||
}
|
||||
|
||||
// check if this module is known
|
||||
// if not, add it to the dependencies for this identifier
|
||||
if(array.indexOf(module) < 0)
|
||||
array.push(module);
|
||||
});
|
||||
}
|
||||
let changed = false;
|
||||
if(module.providedExports !== true) {
|
||||
if(exports === true) {
|
||||
module.providedExports = true;
|
||||
changed = true;
|
||||
} else if(Array.isArray(exports)) {
|
||||
changed = addToSet(moduleProvidedExports, exports);
|
||||
}
|
||||
}
|
||||
if(changed) {
|
||||
notifyDependencies();
|
||||
}
|
||||
}
|
||||
|
||||
function notifyDependencies() {
|
||||
const deps = dependencies[module.identifier()];
|
||||
if(deps) {
|
||||
deps.forEach((dep) => queue.push(dep));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function addToSet(a, b) {
|
||||
let changed = false;
|
||||
b.forEach((item) => {
|
||||
if(!a.has(item)) {
|
||||
a.add(item);
|
||||
changed = true;
|
||||
}
|
||||
});
|
||||
return changed;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = FlagDependencyExportsPlugin;
|
||||
81
hGameTest/node_modules/webpack/lib/FlagDependencyUsagePlugin.js
generated
vendored
Normal file
81
hGameTest/node_modules/webpack/lib/FlagDependencyUsagePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class FlagDependencyUsagePlugin {
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", compilation => {
|
||||
compilation.plugin("optimize-modules-advanced", modules => {
|
||||
|
||||
modules.forEach(module => module.used = false);
|
||||
|
||||
const queue = [];
|
||||
compilation.chunks.forEach(chunk => {
|
||||
if(chunk.entryModule) {
|
||||
processModule(chunk.entryModule, true);
|
||||
}
|
||||
});
|
||||
|
||||
while(queue.length) {
|
||||
const queueItem = queue.pop();
|
||||
processDependenciesBlock(queueItem[0], queueItem[1]);
|
||||
}
|
||||
|
||||
function processModule(module, usedExports) {
|
||||
module.used = true;
|
||||
if(module.usedExports === true)
|
||||
return;
|
||||
else if(usedExports === true)
|
||||
module.usedExports = true;
|
||||
else if(Array.isArray(usedExports)) {
|
||||
const old = module.usedExports ? module.usedExports.length : -1;
|
||||
module.usedExports = addToSet(module.usedExports || [], usedExports);
|
||||
if(module.usedExports.length === old)
|
||||
return;
|
||||
} else if(Array.isArray(module.usedExports))
|
||||
return;
|
||||
else
|
||||
module.usedExports = false;
|
||||
|
||||
queue.push([module, module.usedExports]);
|
||||
}
|
||||
|
||||
function processDependenciesBlock(depBlock, usedExports) {
|
||||
depBlock.dependencies.forEach(dep => processDependency(dep));
|
||||
depBlock.variables.forEach(variable => variable.dependencies.forEach(dep => processDependency(dep)));
|
||||
depBlock.blocks.forEach(block => queue.push([block, usedExports]));
|
||||
}
|
||||
|
||||
function processDependency(dep) {
|
||||
const reference = dep.getReference && dep.getReference();
|
||||
if(!reference) return;
|
||||
const module = reference.module;
|
||||
const importedNames = reference.importedNames;
|
||||
const oldUsed = module.used;
|
||||
const oldUsedExports = module.usedExports;
|
||||
if(!oldUsed || (importedNames && (!oldUsedExports || !isSubset(oldUsedExports, importedNames)))) {
|
||||
processModule(module, importedNames);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function addToSet(a, b) {
|
||||
b.forEach(item => {
|
||||
if(a.indexOf(item) < 0)
|
||||
a.push(item);
|
||||
});
|
||||
return a;
|
||||
}
|
||||
|
||||
function isSubset(biggerSet, subset) {
|
||||
if(biggerSet === true) return true;
|
||||
if(subset === true) return false;
|
||||
return subset.every(item => biggerSet.indexOf(item) >= 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = FlagDependencyUsagePlugin;
|
||||
24
hGameTest/node_modules/webpack/lib/FlagInitialModulesAsUsedPlugin.js
generated
vendored
Normal file
24
hGameTest/node_modules/webpack/lib/FlagInitialModulesAsUsedPlugin.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";
|
||||
|
||||
class FlagInitialModulesAsUsedPlugin {
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.plugin("after-optimize-chunks", (chunks) => {
|
||||
chunks.forEach((chunk) => {
|
||||
if(!chunk.isInitial()) {
|
||||
return;
|
||||
}
|
||||
chunk.forEachModule((module) => {
|
||||
module.usedExports = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = FlagInitialModulesAsUsedPlugin;
|
||||
24
hGameTest/node_modules/webpack/lib/FunctionModulePlugin.js
generated
vendored
Normal file
24
hGameTest/node_modules/webpack/lib/FunctionModulePlugin.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 FunctionModuleTemplatePlugin = require("./FunctionModuleTemplatePlugin");
|
||||
const RequestShortener = require("./RequestShortener");
|
||||
|
||||
class FunctionModulePlugin {
|
||||
constructor(options, requestShortener) {
|
||||
this.options = options;
|
||||
this.requestShortener = requestShortener;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.moduleTemplate.requestShortener = this.requestShortener || new RequestShortener(compiler.context);
|
||||
compilation.moduleTemplate.apply(new FunctionModuleTemplatePlugin());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = FunctionModulePlugin;
|
||||
61
hGameTest/node_modules/webpack/lib/FunctionModuleTemplatePlugin.js
generated
vendored
Normal file
61
hGameTest/node_modules/webpack/lib/FunctionModuleTemplatePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ConcatSource = require("webpack-sources").ConcatSource;
|
||||
|
||||
class FunctionModuleTemplatePlugin {
|
||||
apply(moduleTemplate) {
|
||||
moduleTemplate.plugin("render", function(moduleSource, module) {
|
||||
const source = new ConcatSource();
|
||||
const defaultArguments = [module.moduleArgument || "module", module.exportsArgument || "exports"];
|
||||
if((module.arguments && module.arguments.length !== 0) || module.hasDependencies(d => d.requireWebpackRequire !== false)) {
|
||||
defaultArguments.push("__webpack_require__");
|
||||
}
|
||||
source.add("/***/ (function(" + defaultArguments.concat(module.arguments || []).join(", ") + ") {\n\n");
|
||||
if(module.strict) source.add("\"use strict\";\n");
|
||||
source.add(moduleSource);
|
||||
source.add("\n\n/***/ })");
|
||||
return source;
|
||||
});
|
||||
|
||||
moduleTemplate.plugin("package", function(moduleSource, module) {
|
||||
if(this.outputOptions.pathinfo) {
|
||||
const source = new ConcatSource();
|
||||
const req = module.readableIdentifier(this.requestShortener);
|
||||
source.add("/*!****" + req.replace(/./g, "*") + "****!*\\\n");
|
||||
source.add(" !*** " + req.replace(/\*\//g, "*_/") + " ***!\n");
|
||||
source.add(" \\****" + req.replace(/./g, "*") + "****/\n");
|
||||
if(Array.isArray(module.providedExports) && module.providedExports.length === 0)
|
||||
source.add("/*! no exports provided */\n");
|
||||
else if(Array.isArray(module.providedExports))
|
||||
source.add("/*! exports provided: " + module.providedExports.join(", ") + " */\n");
|
||||
else if(module.providedExports)
|
||||
source.add("/*! dynamic exports provided */\n");
|
||||
if(Array.isArray(module.usedExports) && module.usedExports.length === 0)
|
||||
source.add("/*! no exports used */\n");
|
||||
else if(Array.isArray(module.usedExports))
|
||||
source.add("/*! exports used: " + module.usedExports.join(", ") + " */\n");
|
||||
else if(module.usedExports)
|
||||
source.add("/*! all exports used */\n");
|
||||
if(module.optimizationBailout) {
|
||||
module.optimizationBailout.forEach(text => {
|
||||
if(typeof text === "function") text = text(this.requestShortener);
|
||||
source.add(`/*! ${text} */\n`);
|
||||
});
|
||||
}
|
||||
source.add(moduleSource);
|
||||
return source;
|
||||
}
|
||||
return moduleSource;
|
||||
});
|
||||
|
||||
moduleTemplate.plugin("hash", function(hash) {
|
||||
hash.update("FunctionModuleTemplatePlugin");
|
||||
hash.update("2");
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = FunctionModuleTemplatePlugin;
|
||||
42
hGameTest/node_modules/webpack/lib/HashedModuleIdsPlugin.js
generated
vendored
Normal file
42
hGameTest/node_modules/webpack/lib/HashedModuleIdsPlugin.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 createHash = require("crypto").createHash;
|
||||
|
||||
class HashedModuleIdsPlugin {
|
||||
constructor(options) {
|
||||
this.options = Object.assign({
|
||||
hashFunction: "md5",
|
||||
hashDigest: "base64",
|
||||
hashDigestLength: 4
|
||||
}, options);
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
const options = this.options;
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
const usedIds = new Set();
|
||||
compilation.plugin("before-module-ids", (modules) => {
|
||||
modules.forEach((module) => {
|
||||
if(module.id === null && module.libIdent) {
|
||||
const id = module.libIdent({
|
||||
context: this.options.context || compiler.options.context
|
||||
});
|
||||
const hash = createHash(options.hashFunction);
|
||||
hash.update(id);
|
||||
const hashId = hash.digest(options.hashDigest);
|
||||
let len = options.hashDigestLength;
|
||||
while(usedIds.has(hashId.substr(0, len)))
|
||||
len++;
|
||||
module.id = hashId.substr(0, len);
|
||||
usedIds.add(module.id);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HashedModuleIdsPlugin;
|
||||
602
hGameTest/node_modules/webpack/lib/HotModuleReplacement.runtime.js
generated
vendored
Normal file
602
hGameTest/node_modules/webpack/lib/HotModuleReplacement.runtime.js
generated
vendored
Normal file
@@ -0,0 +1,602 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
/*global $hash$ $requestTimeout$ installedModules $require$ hotDownloadManifest hotDownloadUpdateChunk hotDisposeChunk modules */
|
||||
module.exports = function() {
|
||||
|
||||
var hotApplyOnUpdate = true;
|
||||
var hotCurrentHash = $hash$; // eslint-disable-line no-unused-vars
|
||||
var hotRequestTimeout = $requestTimeout$;
|
||||
var hotCurrentModuleData = {};
|
||||
var hotCurrentChildModule; // eslint-disable-line no-unused-vars
|
||||
var hotCurrentParents = []; // eslint-disable-line no-unused-vars
|
||||
var hotCurrentParentsTemp = []; // eslint-disable-line no-unused-vars
|
||||
|
||||
function hotCreateRequire(moduleId) { // eslint-disable-line no-unused-vars
|
||||
var me = installedModules[moduleId];
|
||||
if(!me) return $require$;
|
||||
var fn = function(request) {
|
||||
if(me.hot.active) {
|
||||
if(installedModules[request]) {
|
||||
if(installedModules[request].parents.indexOf(moduleId) < 0)
|
||||
installedModules[request].parents.push(moduleId);
|
||||
} else {
|
||||
hotCurrentParents = [moduleId];
|
||||
hotCurrentChildModule = request;
|
||||
}
|
||||
if(me.children.indexOf(request) < 0)
|
||||
me.children.push(request);
|
||||
} else {
|
||||
console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
|
||||
hotCurrentParents = [];
|
||||
}
|
||||
return $require$(request);
|
||||
};
|
||||
var ObjectFactory = function ObjectFactory(name) {
|
||||
return {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return $require$[name];
|
||||
},
|
||||
set: function(value) {
|
||||
$require$[name] = value;
|
||||
}
|
||||
};
|
||||
};
|
||||
for(var name in $require$) {
|
||||
if(Object.prototype.hasOwnProperty.call($require$, name) && name !== "e") {
|
||||
Object.defineProperty(fn, name, ObjectFactory(name));
|
||||
}
|
||||
}
|
||||
fn.e = function(chunkId) {
|
||||
if(hotStatus === "ready")
|
||||
hotSetStatus("prepare");
|
||||
hotChunksLoading++;
|
||||
return $require$.e(chunkId).then(finishChunkLoading, function(err) {
|
||||
finishChunkLoading();
|
||||
throw err;
|
||||
});
|
||||
|
||||
function finishChunkLoading() {
|
||||
hotChunksLoading--;
|
||||
if(hotStatus === "prepare") {
|
||||
if(!hotWaitingFilesMap[chunkId]) {
|
||||
hotEnsureUpdateChunk(chunkId);
|
||||
}
|
||||
if(hotChunksLoading === 0 && hotWaitingFiles === 0) {
|
||||
hotUpdateDownloaded();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return fn;
|
||||
}
|
||||
|
||||
function hotCreateModule(moduleId) { // eslint-disable-line no-unused-vars
|
||||
var hot = {
|
||||
// private stuff
|
||||
_acceptedDependencies: {},
|
||||
_declinedDependencies: {},
|
||||
_selfAccepted: false,
|
||||
_selfDeclined: false,
|
||||
_disposeHandlers: [],
|
||||
_main: hotCurrentChildModule !== moduleId,
|
||||
|
||||
// Module API
|
||||
active: true,
|
||||
accept: function(dep, callback) {
|
||||
if(typeof dep === "undefined")
|
||||
hot._selfAccepted = true;
|
||||
else if(typeof dep === "function")
|
||||
hot._selfAccepted = dep;
|
||||
else if(typeof dep === "object")
|
||||
for(var i = 0; i < dep.length; i++)
|
||||
hot._acceptedDependencies[dep[i]] = callback || function() {};
|
||||
else
|
||||
hot._acceptedDependencies[dep] = callback || function() {};
|
||||
},
|
||||
decline: function(dep) {
|
||||
if(typeof dep === "undefined")
|
||||
hot._selfDeclined = true;
|
||||
else if(typeof dep === "object")
|
||||
for(var i = 0; i < dep.length; i++)
|
||||
hot._declinedDependencies[dep[i]] = true;
|
||||
else
|
||||
hot._declinedDependencies[dep] = true;
|
||||
},
|
||||
dispose: function(callback) {
|
||||
hot._disposeHandlers.push(callback);
|
||||
},
|
||||
addDisposeHandler: function(callback) {
|
||||
hot._disposeHandlers.push(callback);
|
||||
},
|
||||
removeDisposeHandler: function(callback) {
|
||||
var idx = hot._disposeHandlers.indexOf(callback);
|
||||
if(idx >= 0) hot._disposeHandlers.splice(idx, 1);
|
||||
},
|
||||
|
||||
// Management API
|
||||
check: hotCheck,
|
||||
apply: hotApply,
|
||||
status: function(l) {
|
||||
if(!l) return hotStatus;
|
||||
hotStatusHandlers.push(l);
|
||||
},
|
||||
addStatusHandler: function(l) {
|
||||
hotStatusHandlers.push(l);
|
||||
},
|
||||
removeStatusHandler: function(l) {
|
||||
var idx = hotStatusHandlers.indexOf(l);
|
||||
if(idx >= 0) hotStatusHandlers.splice(idx, 1);
|
||||
},
|
||||
|
||||
//inherit from previous dispose call
|
||||
data: hotCurrentModuleData[moduleId]
|
||||
};
|
||||
hotCurrentChildModule = undefined;
|
||||
return hot;
|
||||
}
|
||||
|
||||
var hotStatusHandlers = [];
|
||||
var hotStatus = "idle";
|
||||
|
||||
function hotSetStatus(newStatus) {
|
||||
hotStatus = newStatus;
|
||||
for(var i = 0; i < hotStatusHandlers.length; i++)
|
||||
hotStatusHandlers[i].call(null, newStatus);
|
||||
}
|
||||
|
||||
// while downloading
|
||||
var hotWaitingFiles = 0;
|
||||
var hotChunksLoading = 0;
|
||||
var hotWaitingFilesMap = {};
|
||||
var hotRequestedFilesMap = {};
|
||||
var hotAvailableFilesMap = {};
|
||||
var hotDeferred;
|
||||
|
||||
// The update info
|
||||
var hotUpdate, hotUpdateNewHash;
|
||||
|
||||
function toModuleId(id) {
|
||||
var isNumber = (+id) + "" === id;
|
||||
return isNumber ? +id : id;
|
||||
}
|
||||
|
||||
function hotCheck(apply) {
|
||||
if(hotStatus !== "idle") throw new Error("check() is only allowed in idle status");
|
||||
hotApplyOnUpdate = apply;
|
||||
hotSetStatus("check");
|
||||
return hotDownloadManifest(hotRequestTimeout).then(function(update) {
|
||||
if(!update) {
|
||||
hotSetStatus("idle");
|
||||
return null;
|
||||
}
|
||||
hotRequestedFilesMap = {};
|
||||
hotWaitingFilesMap = {};
|
||||
hotAvailableFilesMap = update.c;
|
||||
hotUpdateNewHash = update.h;
|
||||
|
||||
hotSetStatus("prepare");
|
||||
var promise = new Promise(function(resolve, reject) {
|
||||
hotDeferred = {
|
||||
resolve: resolve,
|
||||
reject: reject
|
||||
};
|
||||
});
|
||||
hotUpdate = {};
|
||||
/*foreachInstalledChunks*/
|
||||
{ // eslint-disable-line no-lone-blocks
|
||||
/*globals chunkId */
|
||||
hotEnsureUpdateChunk(chunkId);
|
||||
}
|
||||
if(hotStatus === "prepare" && hotChunksLoading === 0 && hotWaitingFiles === 0) {
|
||||
hotUpdateDownloaded();
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
}
|
||||
|
||||
function hotAddUpdateChunk(chunkId, moreModules) { // eslint-disable-line no-unused-vars
|
||||
if(!hotAvailableFilesMap[chunkId] || !hotRequestedFilesMap[chunkId])
|
||||
return;
|
||||
hotRequestedFilesMap[chunkId] = false;
|
||||
for(var moduleId in moreModules) {
|
||||
if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
|
||||
hotUpdate[moduleId] = moreModules[moduleId];
|
||||
}
|
||||
}
|
||||
if(--hotWaitingFiles === 0 && hotChunksLoading === 0) {
|
||||
hotUpdateDownloaded();
|
||||
}
|
||||
}
|
||||
|
||||
function hotEnsureUpdateChunk(chunkId) {
|
||||
if(!hotAvailableFilesMap[chunkId]) {
|
||||
hotWaitingFilesMap[chunkId] = true;
|
||||
} else {
|
||||
hotRequestedFilesMap[chunkId] = true;
|
||||
hotWaitingFiles++;
|
||||
hotDownloadUpdateChunk(chunkId);
|
||||
}
|
||||
}
|
||||
|
||||
function hotUpdateDownloaded() {
|
||||
hotSetStatus("ready");
|
||||
var deferred = hotDeferred;
|
||||
hotDeferred = null;
|
||||
if(!deferred) return;
|
||||
if(hotApplyOnUpdate) {
|
||||
// Wrap deferred object in Promise to mark it as a well-handled Promise to
|
||||
// avoid triggering uncaught exception warning in Chrome.
|
||||
// See https://bugs.chromium.org/p/chromium/issues/detail?id=465666
|
||||
Promise.resolve().then(function() {
|
||||
return hotApply(hotApplyOnUpdate);
|
||||
}).then(
|
||||
function(result) {
|
||||
deferred.resolve(result);
|
||||
},
|
||||
function(err) {
|
||||
deferred.reject(err);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
var outdatedModules = [];
|
||||
for(var id in hotUpdate) {
|
||||
if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
|
||||
outdatedModules.push(toModuleId(id));
|
||||
}
|
||||
}
|
||||
deferred.resolve(outdatedModules);
|
||||
}
|
||||
}
|
||||
|
||||
function hotApply(options) {
|
||||
if(hotStatus !== "ready") throw new Error("apply() is only allowed in ready status");
|
||||
options = options || {};
|
||||
|
||||
var cb;
|
||||
var i;
|
||||
var j;
|
||||
var module;
|
||||
var moduleId;
|
||||
|
||||
function getAffectedStuff(updateModuleId) {
|
||||
var outdatedModules = [updateModuleId];
|
||||
var outdatedDependencies = {};
|
||||
|
||||
var queue = outdatedModules.slice().map(function(id) {
|
||||
return {
|
||||
chain: [id],
|
||||
id: id
|
||||
};
|
||||
});
|
||||
while(queue.length > 0) {
|
||||
var queueItem = queue.pop();
|
||||
var moduleId = queueItem.id;
|
||||
var chain = queueItem.chain;
|
||||
module = installedModules[moduleId];
|
||||
if(!module || module.hot._selfAccepted)
|
||||
continue;
|
||||
if(module.hot._selfDeclined) {
|
||||
return {
|
||||
type: "self-declined",
|
||||
chain: chain,
|
||||
moduleId: moduleId
|
||||
};
|
||||
}
|
||||
if(module.hot._main) {
|
||||
return {
|
||||
type: "unaccepted",
|
||||
chain: chain,
|
||||
moduleId: moduleId
|
||||
};
|
||||
}
|
||||
for(var i = 0; i < module.parents.length; i++) {
|
||||
var parentId = module.parents[i];
|
||||
var parent = installedModules[parentId];
|
||||
if(!parent) continue;
|
||||
if(parent.hot._declinedDependencies[moduleId]) {
|
||||
return {
|
||||
type: "declined",
|
||||
chain: chain.concat([parentId]),
|
||||
moduleId: moduleId,
|
||||
parentId: parentId
|
||||
};
|
||||
}
|
||||
if(outdatedModules.indexOf(parentId) >= 0) continue;
|
||||
if(parent.hot._acceptedDependencies[moduleId]) {
|
||||
if(!outdatedDependencies[parentId])
|
||||
outdatedDependencies[parentId] = [];
|
||||
addAllToSet(outdatedDependencies[parentId], [moduleId]);
|
||||
continue;
|
||||
}
|
||||
delete outdatedDependencies[parentId];
|
||||
outdatedModules.push(parentId);
|
||||
queue.push({
|
||||
chain: chain.concat([parentId]),
|
||||
id: parentId
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
type: "accepted",
|
||||
moduleId: updateModuleId,
|
||||
outdatedModules: outdatedModules,
|
||||
outdatedDependencies: outdatedDependencies
|
||||
};
|
||||
}
|
||||
|
||||
function addAllToSet(a, b) {
|
||||
for(var i = 0; i < b.length; i++) {
|
||||
var item = b[i];
|
||||
if(a.indexOf(item) < 0)
|
||||
a.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
// at begin all updates modules are outdated
|
||||
// the "outdated" status can propagate to parents if they don't accept the children
|
||||
var outdatedDependencies = {};
|
||||
var outdatedModules = [];
|
||||
var appliedUpdate = {};
|
||||
|
||||
var warnUnexpectedRequire = function warnUnexpectedRequire() {
|
||||
console.warn("[HMR] unexpected require(" + result.moduleId + ") to disposed module");
|
||||
};
|
||||
|
||||
for(var id in hotUpdate) {
|
||||
if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
|
||||
moduleId = toModuleId(id);
|
||||
var result;
|
||||
if(hotUpdate[id]) {
|
||||
result = getAffectedStuff(moduleId);
|
||||
} else {
|
||||
result = {
|
||||
type: "disposed",
|
||||
moduleId: id
|
||||
};
|
||||
}
|
||||
var abortError = false;
|
||||
var doApply = false;
|
||||
var doDispose = false;
|
||||
var chainInfo = "";
|
||||
if(result.chain) {
|
||||
chainInfo = "\nUpdate propagation: " + result.chain.join(" -> ");
|
||||
}
|
||||
switch(result.type) {
|
||||
case "self-declined":
|
||||
if(options.onDeclined)
|
||||
options.onDeclined(result);
|
||||
if(!options.ignoreDeclined)
|
||||
abortError = new Error("Aborted because of self decline: " + result.moduleId + chainInfo);
|
||||
break;
|
||||
case "declined":
|
||||
if(options.onDeclined)
|
||||
options.onDeclined(result);
|
||||
if(!options.ignoreDeclined)
|
||||
abortError = new Error("Aborted because of declined dependency: " + result.moduleId + " in " + result.parentId + chainInfo);
|
||||
break;
|
||||
case "unaccepted":
|
||||
if(options.onUnaccepted)
|
||||
options.onUnaccepted(result);
|
||||
if(!options.ignoreUnaccepted)
|
||||
abortError = new Error("Aborted because " + moduleId + " is not accepted" + chainInfo);
|
||||
break;
|
||||
case "accepted":
|
||||
if(options.onAccepted)
|
||||
options.onAccepted(result);
|
||||
doApply = true;
|
||||
break;
|
||||
case "disposed":
|
||||
if(options.onDisposed)
|
||||
options.onDisposed(result);
|
||||
doDispose = true;
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unexception type " + result.type);
|
||||
}
|
||||
if(abortError) {
|
||||
hotSetStatus("abort");
|
||||
return Promise.reject(abortError);
|
||||
}
|
||||
if(doApply) {
|
||||
appliedUpdate[moduleId] = hotUpdate[moduleId];
|
||||
addAllToSet(outdatedModules, result.outdatedModules);
|
||||
for(moduleId in result.outdatedDependencies) {
|
||||
if(Object.prototype.hasOwnProperty.call(result.outdatedDependencies, moduleId)) {
|
||||
if(!outdatedDependencies[moduleId])
|
||||
outdatedDependencies[moduleId] = [];
|
||||
addAllToSet(outdatedDependencies[moduleId], result.outdatedDependencies[moduleId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(doDispose) {
|
||||
addAllToSet(outdatedModules, [result.moduleId]);
|
||||
appliedUpdate[moduleId] = warnUnexpectedRequire;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store self accepted outdated modules to require them later by the module system
|
||||
var outdatedSelfAcceptedModules = [];
|
||||
for(i = 0; i < outdatedModules.length; i++) {
|
||||
moduleId = outdatedModules[i];
|
||||
if(installedModules[moduleId] && installedModules[moduleId].hot._selfAccepted)
|
||||
outdatedSelfAcceptedModules.push({
|
||||
module: moduleId,
|
||||
errorHandler: installedModules[moduleId].hot._selfAccepted
|
||||
});
|
||||
}
|
||||
|
||||
// Now in "dispose" phase
|
||||
hotSetStatus("dispose");
|
||||
Object.keys(hotAvailableFilesMap).forEach(function(chunkId) {
|
||||
if(hotAvailableFilesMap[chunkId] === false) {
|
||||
hotDisposeChunk(chunkId);
|
||||
}
|
||||
});
|
||||
|
||||
var idx;
|
||||
var queue = outdatedModules.slice();
|
||||
while(queue.length > 0) {
|
||||
moduleId = queue.pop();
|
||||
module = installedModules[moduleId];
|
||||
if(!module) continue;
|
||||
|
||||
var data = {};
|
||||
|
||||
// Call dispose handlers
|
||||
var disposeHandlers = module.hot._disposeHandlers;
|
||||
for(j = 0; j < disposeHandlers.length; j++) {
|
||||
cb = disposeHandlers[j];
|
||||
cb(data);
|
||||
}
|
||||
hotCurrentModuleData[moduleId] = data;
|
||||
|
||||
// disable module (this disables requires from this module)
|
||||
module.hot.active = false;
|
||||
|
||||
// remove module from cache
|
||||
delete installedModules[moduleId];
|
||||
|
||||
// when disposing there is no need to call dispose handler
|
||||
delete outdatedDependencies[moduleId];
|
||||
|
||||
// remove "parents" references from all children
|
||||
for(j = 0; j < module.children.length; j++) {
|
||||
var child = installedModules[module.children[j]];
|
||||
if(!child) continue;
|
||||
idx = child.parents.indexOf(moduleId);
|
||||
if(idx >= 0) {
|
||||
child.parents.splice(idx, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// remove outdated dependency from module children
|
||||
var dependency;
|
||||
var moduleOutdatedDependencies;
|
||||
for(moduleId in outdatedDependencies) {
|
||||
if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) {
|
||||
module = installedModules[moduleId];
|
||||
if(module) {
|
||||
moduleOutdatedDependencies = outdatedDependencies[moduleId];
|
||||
for(j = 0; j < moduleOutdatedDependencies.length; j++) {
|
||||
dependency = moduleOutdatedDependencies[j];
|
||||
idx = module.children.indexOf(dependency);
|
||||
if(idx >= 0) module.children.splice(idx, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Not in "apply" phase
|
||||
hotSetStatus("apply");
|
||||
|
||||
hotCurrentHash = hotUpdateNewHash;
|
||||
|
||||
// insert new code
|
||||
for(moduleId in appliedUpdate) {
|
||||
if(Object.prototype.hasOwnProperty.call(appliedUpdate, moduleId)) {
|
||||
modules[moduleId] = appliedUpdate[moduleId];
|
||||
}
|
||||
}
|
||||
|
||||
// call accept handlers
|
||||
var error = null;
|
||||
for(moduleId in outdatedDependencies) {
|
||||
if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) {
|
||||
module = installedModules[moduleId];
|
||||
if(module) {
|
||||
moduleOutdatedDependencies = outdatedDependencies[moduleId];
|
||||
var callbacks = [];
|
||||
for(i = 0; i < moduleOutdatedDependencies.length; i++) {
|
||||
dependency = moduleOutdatedDependencies[i];
|
||||
cb = module.hot._acceptedDependencies[dependency];
|
||||
if(cb) {
|
||||
if(callbacks.indexOf(cb) >= 0) continue;
|
||||
callbacks.push(cb);
|
||||
}
|
||||
}
|
||||
for(i = 0; i < callbacks.length; i++) {
|
||||
cb = callbacks[i];
|
||||
try {
|
||||
cb(moduleOutdatedDependencies);
|
||||
} catch(err) {
|
||||
if(options.onErrored) {
|
||||
options.onErrored({
|
||||
type: "accept-errored",
|
||||
moduleId: moduleId,
|
||||
dependencyId: moduleOutdatedDependencies[i],
|
||||
error: err
|
||||
});
|
||||
}
|
||||
if(!options.ignoreErrored) {
|
||||
if(!error)
|
||||
error = err;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load self accepted modules
|
||||
for(i = 0; i < outdatedSelfAcceptedModules.length; i++) {
|
||||
var item = outdatedSelfAcceptedModules[i];
|
||||
moduleId = item.module;
|
||||
hotCurrentParents = [moduleId];
|
||||
try {
|
||||
$require$(moduleId);
|
||||
} catch(err) {
|
||||
if(typeof item.errorHandler === "function") {
|
||||
try {
|
||||
item.errorHandler(err);
|
||||
} catch(err2) {
|
||||
if(options.onErrored) {
|
||||
options.onErrored({
|
||||
type: "self-accept-error-handler-errored",
|
||||
moduleId: moduleId,
|
||||
error: err2,
|
||||
orginalError: err, // TODO remove in webpack 4
|
||||
originalError: err
|
||||
});
|
||||
}
|
||||
if(!options.ignoreErrored) {
|
||||
if(!error)
|
||||
error = err2;
|
||||
}
|
||||
if(!error)
|
||||
error = err;
|
||||
}
|
||||
} else {
|
||||
if(options.onErrored) {
|
||||
options.onErrored({
|
||||
type: "self-accept-errored",
|
||||
moduleId: moduleId,
|
||||
error: err
|
||||
});
|
||||
}
|
||||
if(!options.ignoreErrored) {
|
||||
if(!error)
|
||||
error = err;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// handle errors in accept handlers and self accepted module load
|
||||
if(error) {
|
||||
hotSetStatus("fail");
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
hotSetStatus("idle");
|
||||
return new Promise(function(resolve) {
|
||||
resolve(outdatedModules);
|
||||
});
|
||||
}
|
||||
};
|
||||
254
hGameTest/node_modules/webpack/lib/HotModuleReplacementPlugin.js
generated
vendored
Normal file
254
hGameTest/node_modules/webpack/lib/HotModuleReplacementPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,254 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
const Template = require("./Template");
|
||||
const ModuleHotAcceptDependency = require("./dependencies/ModuleHotAcceptDependency");
|
||||
const ModuleHotDeclineDependency = require("./dependencies/ModuleHotDeclineDependency");
|
||||
const RawSource = require("webpack-sources").RawSource;
|
||||
const ConstDependency = require("./dependencies/ConstDependency");
|
||||
const NullFactory = require("./NullFactory");
|
||||
const ParserHelpers = require("./ParserHelpers");
|
||||
|
||||
module.exports = class HotModuleReplacementPlugin {
|
||||
constructor(options) {
|
||||
this.options = options || {};
|
||||
this.multiStep = this.options.multiStep;
|
||||
this.fullBuildTimeout = this.options.fullBuildTimeout || 200;
|
||||
this.requestTimeout = this.options.requestTimeout || 10000;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
const multiStep = this.multiStep;
|
||||
const fullBuildTimeout = this.fullBuildTimeout;
|
||||
const requestTimeout = this.requestTimeout;
|
||||
const hotUpdateChunkFilename = compiler.options.output.hotUpdateChunkFilename;
|
||||
const hotUpdateMainFilename = compiler.options.output.hotUpdateMainFilename;
|
||||
compiler.plugin("additional-pass", callback => {
|
||||
if(multiStep)
|
||||
return setTimeout(callback, fullBuildTimeout);
|
||||
return callback();
|
||||
});
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const hotUpdateChunkTemplate = compilation.hotUpdateChunkTemplate;
|
||||
if(!hotUpdateChunkTemplate) return;
|
||||
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(ModuleHotAcceptDependency, normalModuleFactory);
|
||||
compilation.dependencyTemplates.set(ModuleHotAcceptDependency, new ModuleHotAcceptDependency.Template());
|
||||
|
||||
compilation.dependencyFactories.set(ModuleHotDeclineDependency, normalModuleFactory);
|
||||
compilation.dependencyTemplates.set(ModuleHotDeclineDependency, new ModuleHotDeclineDependency.Template());
|
||||
|
||||
compilation.plugin("record", function(compilation, records) {
|
||||
if(records.hash === this.hash) return;
|
||||
records.hash = compilation.hash;
|
||||
records.moduleHashs = {};
|
||||
this.modules.forEach(module => {
|
||||
const identifier = module.identifier();
|
||||
const hash = require("crypto").createHash("md5");
|
||||
module.updateHash(hash);
|
||||
records.moduleHashs[identifier] = hash.digest("hex");
|
||||
});
|
||||
records.chunkHashs = {};
|
||||
this.chunks.forEach(chunk => {
|
||||
records.chunkHashs[chunk.id] = chunk.hash;
|
||||
});
|
||||
records.chunkModuleIds = {};
|
||||
this.chunks.forEach(chunk => {
|
||||
records.chunkModuleIds[chunk.id] = chunk.mapModules(m => m.id);
|
||||
});
|
||||
});
|
||||
let initialPass = false;
|
||||
let recompilation = false;
|
||||
compilation.plugin("after-hash", function() {
|
||||
let records = this.records;
|
||||
if(!records) {
|
||||
initialPass = true;
|
||||
return;
|
||||
}
|
||||
if(!records.hash)
|
||||
initialPass = true;
|
||||
const preHash = records.preHash || "x";
|
||||
const prepreHash = records.prepreHash || "x";
|
||||
if(preHash === this.hash) {
|
||||
recompilation = true;
|
||||
this.modifyHash(prepreHash);
|
||||
return;
|
||||
}
|
||||
records.prepreHash = records.hash || "x";
|
||||
records.preHash = this.hash;
|
||||
this.modifyHash(records.prepreHash);
|
||||
});
|
||||
compilation.plugin("should-generate-chunk-assets", () => {
|
||||
if(multiStep && !recompilation && !initialPass)
|
||||
return false;
|
||||
});
|
||||
compilation.plugin("need-additional-pass", () => {
|
||||
if(multiStep && !recompilation && !initialPass)
|
||||
return true;
|
||||
});
|
||||
compilation.plugin("additional-chunk-assets", function() {
|
||||
const records = this.records;
|
||||
if(records.hash === this.hash) return;
|
||||
if(!records.moduleHashs || !records.chunkHashs || !records.chunkModuleIds) return;
|
||||
this.modules.forEach(module => {
|
||||
const identifier = module.identifier();
|
||||
let hash = require("crypto").createHash("md5");
|
||||
module.updateHash(hash);
|
||||
hash = hash.digest("hex");
|
||||
module.hotUpdate = records.moduleHashs[identifier] !== hash;
|
||||
});
|
||||
const hotUpdateMainContent = {
|
||||
h: this.hash,
|
||||
c: {},
|
||||
};
|
||||
Object.keys(records.chunkHashs).forEach(function(chunkId) {
|
||||
chunkId = isNaN(+chunkId) ? chunkId : +chunkId;
|
||||
const currentChunk = this.chunks.find(chunk => chunk.id === chunkId);
|
||||
if(currentChunk) {
|
||||
const newModules = currentChunk.getModules().filter(module => module.hotUpdate);
|
||||
const allModules = {};
|
||||
currentChunk.forEachModule(module => {
|
||||
allModules[module.id] = true;
|
||||
});
|
||||
const removedModules = records.chunkModuleIds[chunkId].filter(id => !allModules[id]);
|
||||
if(newModules.length > 0 || removedModules.length > 0) {
|
||||
const source = hotUpdateChunkTemplate.render(chunkId, newModules, removedModules, this.hash, this.moduleTemplate, this.dependencyTemplates);
|
||||
const filename = this.getPath(hotUpdateChunkFilename, {
|
||||
hash: records.hash,
|
||||
chunk: currentChunk
|
||||
});
|
||||
this.additionalChunkAssets.push(filename);
|
||||
this.assets[filename] = source;
|
||||
hotUpdateMainContent.c[chunkId] = true;
|
||||
currentChunk.files.push(filename);
|
||||
this.applyPlugins("chunk-asset", currentChunk, filename);
|
||||
}
|
||||
} else {
|
||||
hotUpdateMainContent.c[chunkId] = false;
|
||||
}
|
||||
}, this);
|
||||
const source = new RawSource(JSON.stringify(hotUpdateMainContent));
|
||||
const filename = this.getPath(hotUpdateMainFilename, {
|
||||
hash: records.hash
|
||||
});
|
||||
this.assets[filename] = source;
|
||||
});
|
||||
|
||||
compilation.mainTemplate.plugin("hash", hash => {
|
||||
hash.update("HotMainTemplateDecorator");
|
||||
});
|
||||
|
||||
compilation.mainTemplate.plugin("module-require", (_, chunk, hash, varModuleId) => {
|
||||
return `hotCreateRequire(${varModuleId})`;
|
||||
});
|
||||
|
||||
compilation.mainTemplate.plugin("require-extensions", function(source) {
|
||||
const buf = [source];
|
||||
buf.push("");
|
||||
buf.push("// __webpack_hash__");
|
||||
buf.push(this.requireFn + ".h = function() { return hotCurrentHash; };");
|
||||
return this.asString(buf);
|
||||
});
|
||||
|
||||
compilation.mainTemplate.plugin("bootstrap", function(source, chunk, hash) {
|
||||
source = this.applyPluginsWaterfall("hot-bootstrap", source, chunk, hash);
|
||||
return this.asString([
|
||||
source,
|
||||
"",
|
||||
hotInitCode
|
||||
.replace(/\$require\$/g, this.requireFn)
|
||||
.replace(/\$hash\$/g, JSON.stringify(hash))
|
||||
.replace(/\$requestTimeout\$/g, requestTimeout)
|
||||
.replace(/\/\*foreachInstalledChunks\*\//g, chunk.chunks.length > 0 ? "for(var chunkId in installedChunks)" : `var chunkId = ${JSON.stringify(chunk.id)};`)
|
||||
]);
|
||||
});
|
||||
|
||||
compilation.mainTemplate.plugin("global-hash", () => true);
|
||||
|
||||
compilation.mainTemplate.plugin("current-hash", (_, length) => {
|
||||
if(isFinite(length))
|
||||
return `hotCurrentHash.substr(0, ${length})`;
|
||||
else
|
||||
return "hotCurrentHash";
|
||||
});
|
||||
|
||||
compilation.mainTemplate.plugin("module-obj", function(source, chunk, hash, varModuleId) {
|
||||
return this.asString([
|
||||
`${source},`,
|
||||
`hot: hotCreateModule(${varModuleId}),`,
|
||||
"parents: (hotCurrentParentsTemp = hotCurrentParents, hotCurrentParents = [], hotCurrentParentsTemp),",
|
||||
"children: []"
|
||||
]);
|
||||
});
|
||||
|
||||
params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
|
||||
parser.plugin("expression __webpack_hash__", ParserHelpers.toConstantDependency("__webpack_require__.h()"));
|
||||
parser.plugin("evaluate typeof __webpack_hash__", ParserHelpers.evaluateToString("string"));
|
||||
parser.plugin("evaluate Identifier module.hot", function(expr) {
|
||||
return ParserHelpers.evaluateToIdentifier("module.hot", !!this.state.compilation.hotUpdateChunkTemplate)(expr);
|
||||
});
|
||||
parser.plugin("call module.hot.accept", function(expr) {
|
||||
if(!this.state.compilation.hotUpdateChunkTemplate) return false;
|
||||
if(expr.arguments.length >= 1) {
|
||||
const arg = this.evaluateExpression(expr.arguments[0]);
|
||||
let params = [];
|
||||
let requests = [];
|
||||
if(arg.isString()) {
|
||||
params = [arg];
|
||||
} else if(arg.isArray()) {
|
||||
params = arg.items.filter(param => param.isString());
|
||||
}
|
||||
if(params.length > 0) {
|
||||
params.forEach((param, idx) => {
|
||||
const request = param.string;
|
||||
const dep = new ModuleHotAcceptDependency(request, param.range);
|
||||
dep.optional = true;
|
||||
dep.loc = Object.create(expr.loc);
|
||||
dep.loc.index = idx;
|
||||
this.state.module.addDependency(dep);
|
||||
requests.push(request);
|
||||
});
|
||||
if(expr.arguments.length > 1) {
|
||||
this.applyPluginsBailResult("hot accept callback", expr.arguments[1], requests);
|
||||
parser.walkExpression(expr.arguments[1]); // other args are ignored
|
||||
} else {
|
||||
this.applyPluginsBailResult("hot accept without callback", expr, requests);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
parser.plugin("call module.hot.decline", function(expr) {
|
||||
if(!this.state.compilation.hotUpdateChunkTemplate) return false;
|
||||
if(expr.arguments.length === 1) {
|
||||
const arg = this.evaluateExpression(expr.arguments[0]);
|
||||
let params = [];
|
||||
if(arg.isString()) {
|
||||
params = [arg];
|
||||
} else if(arg.isArray()) {
|
||||
params = arg.items.filter(param => param.isString());
|
||||
}
|
||||
params.forEach((param, idx) => {
|
||||
const dep = new ModuleHotDeclineDependency(param.string, param.range);
|
||||
dep.optional = true;
|
||||
dep.loc = Object.create(expr.loc);
|
||||
dep.loc.index = idx;
|
||||
this.state.module.addDependency(dep);
|
||||
});
|
||||
}
|
||||
});
|
||||
parser.plugin("expression module.hot", ParserHelpers.skipTraversal);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const hotInitCode = Template.getFunctionContent(require("./HotModuleReplacement.runtime.js"));
|
||||
31
hGameTest/node_modules/webpack/lib/HotUpdateChunkTemplate.js
generated
vendored
Normal file
31
hGameTest/node_modules/webpack/lib/HotUpdateChunkTemplate.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const Template = require("./Template");
|
||||
const Chunk = require("./Chunk");
|
||||
|
||||
module.exports = class HotUpdateChunkTemplate extends Template {
|
||||
constructor(outputOptions) {
|
||||
super(outputOptions);
|
||||
}
|
||||
|
||||
render(id, modules, removedModules, hash, moduleTemplate, dependencyTemplates) {
|
||||
const hotUpdateChunk = new Chunk();
|
||||
hotUpdateChunk.id = id;
|
||||
hotUpdateChunk.setModules(modules);
|
||||
hotUpdateChunk.removedModules = removedModules;
|
||||
const modulesSource = this.renderChunkModules(hotUpdateChunk, moduleTemplate, dependencyTemplates);
|
||||
const core = this.applyPluginsWaterfall("modules", modulesSource, modules, removedModules, moduleTemplate, dependencyTemplates);
|
||||
const source = this.applyPluginsWaterfall("render", core, modules, removedModules, hash, id, moduleTemplate, dependencyTemplates);
|
||||
return source;
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
hash.update("HotUpdateChunkTemplate");
|
||||
hash.update("1");
|
||||
this.applyPlugins("hash", hash);
|
||||
}
|
||||
};
|
||||
69
hGameTest/node_modules/webpack/lib/IgnorePlugin.js
generated
vendored
Normal file
69
hGameTest/node_modules/webpack/lib/IgnorePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class IgnorePlugin {
|
||||
constructor(resourceRegExp, contextRegExp) {
|
||||
this.resourceRegExp = resourceRegExp;
|
||||
this.contextRegExp = contextRegExp;
|
||||
|
||||
this.checkIgnore = this.checkIgnore.bind(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Only returns true if a "resourceRegExp" exists
|
||||
* and the resource given matches the regexp.
|
||||
*/
|
||||
checkResource(resource) {
|
||||
if(!this.resourceRegExp) {
|
||||
return false;
|
||||
}
|
||||
return this.resourceRegExp.test(resource);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if contextRegExp does not exist
|
||||
* or if context matches the given regexp.
|
||||
*/
|
||||
checkContext(context) {
|
||||
if(!this.contextRegExp) {
|
||||
return true;
|
||||
}
|
||||
return this.contextRegExp.test(context);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if result should be ignored.
|
||||
* false if it shouldn't.
|
||||
*
|
||||
* Not that if "contextRegExp" is given, both the "resourceRegExp"
|
||||
* and "contextRegExp" have to match.
|
||||
*/
|
||||
checkResult(result) {
|
||||
if(!result) {
|
||||
return true;
|
||||
}
|
||||
return this.checkResource(result.request) && this.checkContext(result.context);
|
||||
}
|
||||
|
||||
checkIgnore(result, callback) {
|
||||
// check if result is ignored
|
||||
if(this.checkResult(result)) {
|
||||
return callback();
|
||||
}
|
||||
return callback(null, result);
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("normal-module-factory", (nmf) => {
|
||||
nmf.plugin("before-resolve", this.checkIgnore);
|
||||
});
|
||||
compiler.plugin("context-module-factory", (cmf) => {
|
||||
cmf.plugin("before-resolve", this.checkIgnore);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = IgnorePlugin;
|
||||
31
hGameTest/node_modules/webpack/lib/JsonpChunkTemplatePlugin.js
generated
vendored
Normal file
31
hGameTest/node_modules/webpack/lib/JsonpChunkTemplatePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ConcatSource = require("webpack-sources").ConcatSource;
|
||||
|
||||
class JsonpChunkTemplatePlugin {
|
||||
apply(chunkTemplate) {
|
||||
chunkTemplate.plugin("render", function(modules, chunk) {
|
||||
const jsonpFunction = this.outputOptions.jsonpFunction;
|
||||
const source = new ConcatSource();
|
||||
source.add(`${jsonpFunction}(${JSON.stringify(chunk.ids)},`);
|
||||
source.add(modules);
|
||||
const entries = [chunk.entryModule].filter(Boolean).map(m => m.id);
|
||||
if(entries.length > 0) {
|
||||
source.add(`,${JSON.stringify(entries)}`);
|
||||
}
|
||||
source.add(")");
|
||||
return source;
|
||||
});
|
||||
chunkTemplate.plugin("hash", function(hash) {
|
||||
hash.update("JsonpChunkTemplatePlugin");
|
||||
hash.update("3");
|
||||
hash.update(`${this.outputOptions.jsonpFunction}`);
|
||||
hash.update(`${this.outputOptions.library}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = JsonpChunkTemplatePlugin;
|
||||
37
hGameTest/node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
generated
vendored
Normal file
37
hGameTest/node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ConcatSource = require("webpack-sources").ConcatSource;
|
||||
|
||||
class JsonpExportMainTemplatePlugin {
|
||||
constructor(name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
apply(compilation) {
|
||||
const mainTemplate = compilation.mainTemplate;
|
||||
|
||||
compilation.templatesPlugin("render-with-entry", (source, chunk, hash) => {
|
||||
const name = mainTemplate.applyPluginsWaterfall("asset-path", this.name || "", {
|
||||
hash: hash,
|
||||
chunk: chunk
|
||||
});
|
||||
return new ConcatSource(`${name}(`, source, ");");
|
||||
});
|
||||
|
||||
mainTemplate.plugin("global-hash-paths", paths => {
|
||||
if(this.name) paths.push(this.name);
|
||||
return paths;
|
||||
});
|
||||
|
||||
mainTemplate.plugin("hash", hash => {
|
||||
hash.update("jsonp export");
|
||||
hash.update(`${this.name}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = JsonpExportMainTemplatePlugin;
|
||||
27
hGameTest/node_modules/webpack/lib/JsonpHotUpdateChunkTemplatePlugin.js
generated
vendored
Normal file
27
hGameTest/node_modules/webpack/lib/JsonpHotUpdateChunkTemplatePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ConcatSource = require("webpack-sources").ConcatSource;
|
||||
|
||||
class JsonpHotUpdateChunkTemplatePlugin {
|
||||
apply(hotUpdateChunkTemplate) {
|
||||
hotUpdateChunkTemplate.plugin("render", function(modulesSource, modules, removedModules, hash, id) {
|
||||
const source = new ConcatSource();
|
||||
source.add(`${this.outputOptions.hotUpdateFunction}(${JSON.stringify(id)},`);
|
||||
source.add(modulesSource);
|
||||
source.add(")");
|
||||
return source;
|
||||
});
|
||||
hotUpdateChunkTemplate.plugin("hash", function(hash) {
|
||||
hash.update("JsonpHotUpdateChunkTemplatePlugin");
|
||||
hash.update("3");
|
||||
hash.update(`${this.outputOptions.hotUpdateFunction}`);
|
||||
hash.update(`${this.outputOptions.library}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = JsonpHotUpdateChunkTemplatePlugin;
|
||||
60
hGameTest/node_modules/webpack/lib/JsonpMainTemplate.runtime.js
generated
vendored
Normal file
60
hGameTest/node_modules/webpack/lib/JsonpMainTemplate.runtime.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
/*globals hotAddUpdateChunk parentHotUpdateCallback document XMLHttpRequest $require$ $hotChunkFilename$ $hotMainFilename$ $crossOriginLoading$ */
|
||||
module.exports = function() {
|
||||
function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars
|
||||
hotAddUpdateChunk(chunkId, moreModules);
|
||||
if(parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
|
||||
} //$semicolon
|
||||
|
||||
function hotDownloadUpdateChunk(chunkId) { // eslint-disable-line no-unused-vars
|
||||
var head = document.getElementsByTagName("head")[0];
|
||||
var script = document.createElement("script");
|
||||
script.type = "text/javascript";
|
||||
script.charset = "utf-8";
|
||||
script.src = $require$.p + $hotChunkFilename$;
|
||||
$crossOriginLoading$;
|
||||
head.appendChild(script);
|
||||
}
|
||||
|
||||
function hotDownloadManifest(requestTimeout) { // eslint-disable-line no-unused-vars
|
||||
requestTimeout = requestTimeout || 10000;
|
||||
return new Promise(function(resolve, reject) {
|
||||
if(typeof XMLHttpRequest === "undefined")
|
||||
return reject(new Error("No browser support"));
|
||||
try {
|
||||
var request = new XMLHttpRequest();
|
||||
var requestPath = $require$.p + $hotMainFilename$;
|
||||
request.open("GET", requestPath, true);
|
||||
request.timeout = requestTimeout;
|
||||
request.send(null);
|
||||
} catch(err) {
|
||||
return reject(err);
|
||||
}
|
||||
request.onreadystatechange = function() {
|
||||
if(request.readyState !== 4) return;
|
||||
if(request.status === 0) {
|
||||
// timeout
|
||||
reject(new Error("Manifest request to " + requestPath + " timed out."));
|
||||
} else if(request.status === 404) {
|
||||
// no update available
|
||||
resolve();
|
||||
} else if(request.status !== 200 && request.status !== 304) {
|
||||
// other failure
|
||||
reject(new Error("Manifest request to " + requestPath + " failed."));
|
||||
} else {
|
||||
// success
|
||||
try {
|
||||
var update = JSON.parse(request.responseText);
|
||||
} catch(e) {
|
||||
reject(e);
|
||||
return;
|
||||
}
|
||||
resolve(update);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
212
hGameTest/node_modules/webpack/lib/JsonpMainTemplatePlugin.js
generated
vendored
Normal file
212
hGameTest/node_modules/webpack/lib/JsonpMainTemplatePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const Template = require("./Template");
|
||||
|
||||
class JsonpMainTemplatePlugin {
|
||||
|
||||
apply(mainTemplate) {
|
||||
mainTemplate.plugin("local-vars", function(source, chunk) {
|
||||
if(chunk.chunks.length > 0) {
|
||||
return this.asString([
|
||||
source,
|
||||
"",
|
||||
"// objects to store loaded and loading chunks",
|
||||
"var installedChunks = {",
|
||||
this.indent(
|
||||
chunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(",\n")
|
||||
),
|
||||
"};"
|
||||
]);
|
||||
}
|
||||
return source;
|
||||
});
|
||||
mainTemplate.plugin("jsonp-script", function(_, chunk, hash) {
|
||||
const chunkFilename = this.outputOptions.chunkFilename;
|
||||
const chunkMaps = chunk.getChunkMaps();
|
||||
const crossOriginLoading = this.outputOptions.crossOriginLoading;
|
||||
const chunkLoadTimeout = this.outputOptions.chunkLoadTimeout;
|
||||
const jsonpScriptType = this.outputOptions.jsonpScriptType;
|
||||
const scriptSrcPath = this.applyPluginsWaterfall("asset-path", JSON.stringify(chunkFilename), {
|
||||
hash: `" + ${this.renderCurrentHashCode(hash)} + "`,
|
||||
hashWithLength: length => `" + ${this.renderCurrentHashCode(hash, length)} + "`,
|
||||
chunk: {
|
||||
id: "\" + chunkId + \"",
|
||||
hash: `" + ${JSON.stringify(chunkMaps.hash)}[chunkId] + "`,
|
||||
hashWithLength(length) {
|
||||
const shortChunkHashMap = Object.create(null);
|
||||
Object.keys(chunkMaps.hash).forEach(chunkId => {
|
||||
if(typeof chunkMaps.hash[chunkId] === "string")
|
||||
shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr(0, length);
|
||||
});
|
||||
return `" + ${JSON.stringify(shortChunkHashMap)}[chunkId] + "`;
|
||||
},
|
||||
name: `" + (${JSON.stringify(chunkMaps.name)}[chunkId]||chunkId) + "`
|
||||
}
|
||||
});
|
||||
return this.asString([
|
||||
"var script = document.createElement('script');",
|
||||
`script.type = ${JSON.stringify(jsonpScriptType)};`,
|
||||
"script.charset = 'utf-8';",
|
||||
"script.async = true;",
|
||||
`script.timeout = ${chunkLoadTimeout};`,
|
||||
crossOriginLoading ? `script.crossOrigin = ${JSON.stringify(crossOriginLoading)};` : "",
|
||||
`if (${this.requireFn}.nc) {`,
|
||||
this.indent(`script.setAttribute("nonce", ${this.requireFn}.nc);`),
|
||||
"}",
|
||||
`script.src = ${this.requireFn}.p + ${scriptSrcPath};`,
|
||||
`var timeout = setTimeout(onScriptComplete, ${chunkLoadTimeout});`,
|
||||
"script.onerror = script.onload = onScriptComplete;",
|
||||
"function onScriptComplete() {",
|
||||
this.indent([
|
||||
"// avoid mem leaks in IE.",
|
||||
"script.onerror = script.onload = null;",
|
||||
"clearTimeout(timeout);",
|
||||
"var chunk = installedChunks[chunkId];",
|
||||
"if(chunk !== 0) {",
|
||||
this.indent([
|
||||
"if(chunk) {",
|
||||
this.indent("chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));"),
|
||||
"}",
|
||||
"installedChunks[chunkId] = undefined;"
|
||||
]),
|
||||
"}"
|
||||
]),
|
||||
"};",
|
||||
]);
|
||||
});
|
||||
mainTemplate.plugin("require-ensure", function(_, chunk, hash) {
|
||||
return this.asString([
|
||||
"var installedChunkData = installedChunks[chunkId];",
|
||||
"if(installedChunkData === 0) {",
|
||||
this.indent([
|
||||
"return new Promise(function(resolve) { resolve(); });"
|
||||
]),
|
||||
"}",
|
||||
"",
|
||||
"// a Promise means \"currently loading\".",
|
||||
"if(installedChunkData) {",
|
||||
this.indent([
|
||||
"return installedChunkData[2];"
|
||||
]),
|
||||
"}",
|
||||
"",
|
||||
"// setup Promise in chunk cache",
|
||||
"var promise = new Promise(function(resolve, reject) {",
|
||||
this.indent([
|
||||
"installedChunkData = installedChunks[chunkId] = [resolve, reject];"
|
||||
]),
|
||||
"});",
|
||||
"installedChunkData[2] = promise;",
|
||||
"",
|
||||
"// start chunk loading",
|
||||
"var head = document.getElementsByTagName('head')[0];",
|
||||
this.applyPluginsWaterfall("jsonp-script", "", chunk, hash),
|
||||
"head.appendChild(script);",
|
||||
"",
|
||||
"return promise;"
|
||||
]);
|
||||
});
|
||||
mainTemplate.plugin("require-extensions", function(source, chunk) {
|
||||
if(chunk.chunks.length === 0) return source;
|
||||
|
||||
return this.asString([
|
||||
source,
|
||||
"",
|
||||
"// on error function for async loading",
|
||||
`${this.requireFn}.oe = function(err) { console.error(err); throw err; };`
|
||||
]);
|
||||
});
|
||||
mainTemplate.plugin("bootstrap", function(source, chunk, hash) {
|
||||
if(chunk.chunks.length > 0) {
|
||||
var jsonpFunction = this.outputOptions.jsonpFunction;
|
||||
return this.asString([
|
||||
source,
|
||||
"",
|
||||
"// install a JSONP callback for chunk loading",
|
||||
`var parentJsonpFunction = window[${JSON.stringify(jsonpFunction)}];`,
|
||||
`window[${JSON.stringify(jsonpFunction)}] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {`,
|
||||
this.indent([
|
||||
"// add \"moreModules\" to the modules object,",
|
||||
"// then flag all \"chunkIds\" as loaded and fire callback",
|
||||
"var moduleId, chunkId, i = 0, resolves = [], result;",
|
||||
"for(;i < chunkIds.length; i++) {",
|
||||
this.indent([
|
||||
"chunkId = chunkIds[i];",
|
||||
"if(installedChunks[chunkId]) {",
|
||||
this.indent("resolves.push(installedChunks[chunkId][0]);"),
|
||||
"}",
|
||||
"installedChunks[chunkId] = 0;"
|
||||
]),
|
||||
"}",
|
||||
"for(moduleId in moreModules) {",
|
||||
this.indent([
|
||||
"if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {",
|
||||
this.indent(this.renderAddModule(hash, chunk, "moduleId", "moreModules[moduleId]")),
|
||||
"}"
|
||||
]),
|
||||
"}",
|
||||
"if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);",
|
||||
"while(resolves.length) {",
|
||||
this.indent("resolves.shift()();"),
|
||||
"}",
|
||||
this.entryPointInChildren(chunk) ? [
|
||||
"if(executeModules) {",
|
||||
this.indent([
|
||||
"for(i=0; i < executeModules.length; i++) {",
|
||||
this.indent(`result = ${this.requireFn}(${this.requireFn}.s = executeModules[i]);`),
|
||||
"}"
|
||||
]),
|
||||
"}",
|
||||
"return result;",
|
||||
] : ""
|
||||
]),
|
||||
"};"
|
||||
]);
|
||||
}
|
||||
return source;
|
||||
});
|
||||
mainTemplate.plugin("hot-bootstrap", function(source, chunk, hash) {
|
||||
const hotUpdateChunkFilename = this.outputOptions.hotUpdateChunkFilename;
|
||||
const hotUpdateMainFilename = this.outputOptions.hotUpdateMainFilename;
|
||||
const crossOriginLoading = this.outputOptions.crossOriginLoading;
|
||||
const hotUpdateFunction = this.outputOptions.hotUpdateFunction;
|
||||
const currentHotUpdateChunkFilename = this.applyPluginsWaterfall("asset-path", JSON.stringify(hotUpdateChunkFilename), {
|
||||
hash: `" + ${this.renderCurrentHashCode(hash)} + "`,
|
||||
hashWithLength: length => `" + ${this.renderCurrentHashCode(hash, length)} + "`,
|
||||
chunk: {
|
||||
id: "\" + chunkId + \""
|
||||
}
|
||||
});
|
||||
const currentHotUpdateMainFilename = this.applyPluginsWaterfall("asset-path", JSON.stringify(hotUpdateMainFilename), {
|
||||
hash: `" + ${this.renderCurrentHashCode(hash)} + "`,
|
||||
hashWithLength: length => `" + ${this.renderCurrentHashCode(hash, length)} + "`
|
||||
});
|
||||
const runtimeSource = Template.getFunctionContent(require("./JsonpMainTemplate.runtime.js"))
|
||||
.replace(/\/\/\$semicolon/g, ";")
|
||||
.replace(/\$require\$/g, this.requireFn)
|
||||
.replace(/\$crossOriginLoading\$/g, crossOriginLoading ? `script.crossOrigin = ${JSON.stringify(crossOriginLoading)}` : "")
|
||||
.replace(/\$hotMainFilename\$/g, currentHotUpdateMainFilename)
|
||||
.replace(/\$hotChunkFilename\$/g, currentHotUpdateChunkFilename)
|
||||
.replace(/\$hash\$/g, JSON.stringify(hash));
|
||||
return `${source}
|
||||
function hotDisposeChunk(chunkId) {
|
||||
delete installedChunks[chunkId];
|
||||
}
|
||||
var parentHotUpdateCallback = window[${JSON.stringify(hotUpdateFunction)}];
|
||||
window[${JSON.stringify(hotUpdateFunction)}] = ${runtimeSource}`;
|
||||
});
|
||||
mainTemplate.plugin("hash", function(hash) {
|
||||
hash.update("jsonp");
|
||||
hash.update("4");
|
||||
hash.update(`${this.outputOptions.filename}`);
|
||||
hash.update(`${this.outputOptions.chunkFilename}`);
|
||||
hash.update(`${this.outputOptions.jsonpFunction}`);
|
||||
hash.update(`${this.outputOptions.hotUpdateFunction}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = JsonpMainTemplatePlugin;
|
||||
21
hGameTest/node_modules/webpack/lib/JsonpTemplatePlugin.js
generated
vendored
Normal file
21
hGameTest/node_modules/webpack/lib/JsonpTemplatePlugin.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 JsonpMainTemplatePlugin = require("./JsonpMainTemplatePlugin");
|
||||
const JsonpChunkTemplatePlugin = require("./JsonpChunkTemplatePlugin");
|
||||
const JsonpHotUpdateChunkTemplatePlugin = require("./JsonpHotUpdateChunkTemplatePlugin");
|
||||
|
||||
class JsonpTemplatePlugin {
|
||||
apply(compiler) {
|
||||
compiler.plugin("this-compilation", (compilation) => {
|
||||
compilation.mainTemplate.apply(new JsonpMainTemplatePlugin());
|
||||
compilation.chunkTemplate.apply(new JsonpChunkTemplatePlugin());
|
||||
compilation.hotUpdateChunkTemplate.apply(new JsonpHotUpdateChunkTemplatePlugin());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = JsonpTemplatePlugin;
|
||||
63
hGameTest/node_modules/webpack/lib/LibManifestPlugin.js
generated
vendored
Normal file
63
hGameTest/node_modules/webpack/lib/LibManifestPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
const asyncLib = require("async");
|
||||
|
||||
class LibManifestPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("emit", (compilation, callback) => {
|
||||
asyncLib.forEach(compilation.chunks, (chunk, callback) => {
|
||||
if(!chunk.isInitial()) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
const targetPath = compilation.getPath(this.options.path, {
|
||||
hash: compilation.hash,
|
||||
chunk
|
||||
});
|
||||
const name = this.options.name && compilation.getPath(this.options.name, {
|
||||
hash: compilation.hash,
|
||||
chunk
|
||||
});
|
||||
const manifest = {
|
||||
name,
|
||||
type: this.options.type,
|
||||
content: chunk.mapModules(module => {
|
||||
if(module.libIdent) {
|
||||
const ident = module.libIdent({
|
||||
context: this.options.context || compiler.options.context
|
||||
});
|
||||
if(ident) {
|
||||
return {
|
||||
ident,
|
||||
data: {
|
||||
id: module.id,
|
||||
meta: module.meta,
|
||||
exports: Array.isArray(module.providedExports) ? module.providedExports : undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}).filter(Boolean).reduce((obj, item) => {
|
||||
obj[item.ident] = item.data;
|
||||
return obj;
|
||||
}, Object.create(null))
|
||||
};
|
||||
const content = new Buffer(JSON.stringify(manifest), "utf8"); //eslint-disable-line
|
||||
compiler.outputFileSystem.mkdirp(path.dirname(targetPath), err => {
|
||||
if(err) return callback(err);
|
||||
compiler.outputFileSystem.writeFile(targetPath, content, callback);
|
||||
});
|
||||
}, callback);
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = LibManifestPlugin;
|
||||
92
hGameTest/node_modules/webpack/lib/LibraryTemplatePlugin.js
generated
vendored
Normal file
92
hGameTest/node_modules/webpack/lib/LibraryTemplatePlugin.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const SetVarMainTemplatePlugin = require("./SetVarMainTemplatePlugin");
|
||||
|
||||
function accessorToObjectAccess(accessor) {
|
||||
return accessor.map((a) => {
|
||||
return `[${JSON.stringify(a)}]`;
|
||||
}).join("");
|
||||
}
|
||||
|
||||
function accessorAccess(base, accessor, joinWith) {
|
||||
accessor = [].concat(accessor);
|
||||
return accessor.map((a, idx) => {
|
||||
a = base ?
|
||||
base + accessorToObjectAccess(accessor.slice(0, idx + 1)) :
|
||||
accessor[0] + accessorToObjectAccess(accessor.slice(1, idx + 1));
|
||||
if(idx === accessor.length - 1) return a;
|
||||
if(idx === 0 && typeof base === "undefined") return `${a} = typeof ${a} === "object" ? ${a} : {}`;
|
||||
return `${a} = ${a} || {}`;
|
||||
}).join(joinWith || "; ");
|
||||
}
|
||||
|
||||
class LibraryTemplatePlugin {
|
||||
|
||||
constructor(name, target, umdNamedDefine, auxiliaryComment, exportProperty) {
|
||||
this.name = name;
|
||||
this.target = target;
|
||||
this.umdNamedDefine = umdNamedDefine;
|
||||
this.auxiliaryComment = auxiliaryComment;
|
||||
this.exportProperty = exportProperty;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("this-compilation", (compilation) => {
|
||||
if(this.exportProperty) {
|
||||
var ExportPropertyMainTemplatePlugin = require("./ExportPropertyMainTemplatePlugin");
|
||||
compilation.apply(new ExportPropertyMainTemplatePlugin(this.exportProperty));
|
||||
}
|
||||
switch(this.target) {
|
||||
case "var":
|
||||
compilation.apply(new SetVarMainTemplatePlugin(`var ${accessorAccess(false, this.name)}`));
|
||||
break;
|
||||
case "assign":
|
||||
compilation.apply(new SetVarMainTemplatePlugin(accessorAccess(undefined, this.name)));
|
||||
break;
|
||||
case "this":
|
||||
case "window":
|
||||
case "global":
|
||||
if(this.name)
|
||||
compilation.apply(new SetVarMainTemplatePlugin(accessorAccess(this.target, this.name)));
|
||||
else
|
||||
compilation.apply(new SetVarMainTemplatePlugin(this.target, true));
|
||||
break;
|
||||
case "commonjs":
|
||||
if(this.name)
|
||||
compilation.apply(new SetVarMainTemplatePlugin(accessorAccess("exports", this.name)));
|
||||
else
|
||||
compilation.apply(new SetVarMainTemplatePlugin("exports", true));
|
||||
break;
|
||||
case "commonjs2":
|
||||
case "commonjs-module":
|
||||
compilation.apply(new SetVarMainTemplatePlugin("module.exports"));
|
||||
break;
|
||||
case "amd":
|
||||
var AmdMainTemplatePlugin = require("./AmdMainTemplatePlugin");
|
||||
compilation.apply(new AmdMainTemplatePlugin(this.name));
|
||||
break;
|
||||
case "umd":
|
||||
case "umd2":
|
||||
var UmdMainTemplatePlugin = require("./UmdMainTemplatePlugin");
|
||||
compilation.apply(new UmdMainTemplatePlugin(this.name, {
|
||||
optionalAmdExternalAsGlobal: this.target === "umd2",
|
||||
namedDefine: this.umdNamedDefine,
|
||||
auxiliaryComment: this.auxiliaryComment
|
||||
}));
|
||||
break;
|
||||
case "jsonp":
|
||||
var JsonpExportMainTemplatePlugin = require("./JsonpExportMainTemplatePlugin");
|
||||
compilation.apply(new JsonpExportMainTemplatePlugin(this.name));
|
||||
break;
|
||||
default:
|
||||
throw new Error(`${this.target} is not a valid Library target`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LibraryTemplatePlugin;
|
||||
36
hGameTest/node_modules/webpack/lib/LoaderOptionsPlugin.js
generated
vendored
Normal file
36
hGameTest/node_modules/webpack/lib/LoaderOptionsPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
|
||||
|
||||
class LoaderOptionsPlugin {
|
||||
constructor(options) {
|
||||
if(typeof options !== "object") options = {};
|
||||
if(!options.test) options.test = {
|
||||
test: () => true
|
||||
};
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
const options = this.options;
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.plugin("normal-module-loader", (context, module) => {
|
||||
const resource = module.resource;
|
||||
if(!resource) return;
|
||||
const i = resource.indexOf("?");
|
||||
if(ModuleFilenameHelpers.matchObject(options, i < 0 ? resource : resource.substr(0, i))) {
|
||||
const filterSet = new Set(["include", "exclude", "test"]);
|
||||
Object.keys(options)
|
||||
.filter((key) => !filterSet.has(key))
|
||||
.forEach((key) => context[key] = options[key]);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LoaderOptionsPlugin;
|
||||
19
hGameTest/node_modules/webpack/lib/LoaderTargetPlugin.js
generated
vendored
Normal file
19
hGameTest/node_modules/webpack/lib/LoaderTargetPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class LoaderTargetPlugin {
|
||||
constructor(target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.plugin("normal-module-loader", (loaderContext) => loaderContext.target = this.target);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LoaderTargetPlugin;
|
||||
233
hGameTest/node_modules/webpack/lib/MainTemplate.js
generated
vendored
Normal file
233
hGameTest/node_modules/webpack/lib/MainTemplate.js
generated
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ConcatSource = require("webpack-sources").ConcatSource;
|
||||
const OriginalSource = require("webpack-sources").OriginalSource;
|
||||
const PrefixSource = require("webpack-sources").PrefixSource;
|
||||
const Template = require("./Template");
|
||||
|
||||
// require function shortcuts:
|
||||
// __webpack_require__.s = the module id of the entry point
|
||||
// __webpack_require__.c = the module cache
|
||||
// __webpack_require__.m = the module functions
|
||||
// __webpack_require__.p = the bundle public path
|
||||
// __webpack_require__.i = the identity function used for harmony imports
|
||||
// __webpack_require__.e = the chunk ensure function
|
||||
// __webpack_require__.d = the exported propery define getter function
|
||||
// __webpack_require__.o = Object.prototype.hasOwnProperty.call
|
||||
// __webpack_require__.n = compatibility get default export
|
||||
// __webpack_require__.h = the webpack hash
|
||||
// __webpack_require__.oe = the uncatched error handler for the webpack runtime
|
||||
// __webpack_require__.nc = the script nonce
|
||||
|
||||
module.exports = class MainTemplate extends Template {
|
||||
constructor(outputOptions) {
|
||||
super(outputOptions);
|
||||
this.plugin("startup", (source, chunk, hash) => {
|
||||
const buf = [];
|
||||
if(chunk.entryModule) {
|
||||
buf.push("// Load entry module and return exports");
|
||||
buf.push(`return ${this.renderRequireFunctionForModule(hash, chunk, JSON.stringify(chunk.entryModule.id))}(${this.requireFn}.s = ${JSON.stringify(chunk.entryModule.id)});`);
|
||||
}
|
||||
return this.asString(buf);
|
||||
});
|
||||
this.plugin("render", (bootstrapSource, chunk, hash, moduleTemplate, dependencyTemplates) => {
|
||||
const source = new ConcatSource();
|
||||
source.add("/******/ (function(modules) { // webpackBootstrap\n");
|
||||
source.add(new PrefixSource("/******/", bootstrapSource));
|
||||
source.add("/******/ })\n");
|
||||
source.add("/************************************************************************/\n");
|
||||
source.add("/******/ (");
|
||||
const modules = this.renderChunkModules(chunk, moduleTemplate, dependencyTemplates, "/******/ ");
|
||||
source.add(this.applyPluginsWaterfall("modules", modules, chunk, hash, moduleTemplate, dependencyTemplates));
|
||||
source.add(")");
|
||||
return source;
|
||||
});
|
||||
this.plugin("local-vars", (source, chunk, hash) => {
|
||||
return this.asString([
|
||||
source,
|
||||
"// The module cache",
|
||||
"var installedModules = {};"
|
||||
]);
|
||||
});
|
||||
this.plugin("require", (source, chunk, hash) => {
|
||||
return this.asString([
|
||||
source,
|
||||
"// Check if module is in cache",
|
||||
"if(installedModules[moduleId]) {",
|
||||
this.indent("return installedModules[moduleId].exports;"),
|
||||
"}",
|
||||
"// Create a new module (and put it into the cache)",
|
||||
"var module = installedModules[moduleId] = {",
|
||||
this.indent(this.applyPluginsWaterfall("module-obj", "", chunk, hash, "moduleId")),
|
||||
"};",
|
||||
"",
|
||||
this.asString(outputOptions.strictModuleExceptionHandling ? [
|
||||
"// Execute the module function",
|
||||
"var threw = true;",
|
||||
"try {",
|
||||
this.indent([
|
||||
`modules[moduleId].call(module.exports, module, module.exports, ${this.renderRequireFunctionForModule(hash, chunk, "moduleId")});`,
|
||||
"threw = false;"
|
||||
]),
|
||||
"} finally {",
|
||||
this.indent([
|
||||
"if(threw) delete installedModules[moduleId];"
|
||||
]),
|
||||
"}"
|
||||
] : [
|
||||
"// Execute the module function",
|
||||
`modules[moduleId].call(module.exports, module, module.exports, ${this.renderRequireFunctionForModule(hash, chunk, "moduleId")});`,
|
||||
]),
|
||||
"",
|
||||
"// Flag the module as loaded",
|
||||
"module.l = true;",
|
||||
"",
|
||||
"// Return the exports of the module",
|
||||
"return module.exports;"
|
||||
]);
|
||||
});
|
||||
this.plugin("module-obj", (source, chunk, hash, varModuleId) => {
|
||||
return this.asString([
|
||||
"i: moduleId,",
|
||||
"l: false,",
|
||||
"exports: {}"
|
||||
]);
|
||||
});
|
||||
this.plugin("require-extensions", (source, chunk, hash) => {
|
||||
const buf = [];
|
||||
const chunkMaps = chunk.getChunkMaps();
|
||||
// Check if there are non initial chunks which need to be imported using require-ensure
|
||||
if(Object.keys(chunkMaps.hash).length) {
|
||||
buf.push("// This file contains only the entry chunk.");
|
||||
buf.push("// The chunk loading function for additional chunks");
|
||||
buf.push(`${this.requireFn}.e = function requireEnsure(chunkId) {`);
|
||||
buf.push(this.indent(this.applyPluginsWaterfall("require-ensure", "throw new Error('Not chunk loading available');", chunk, hash, "chunkId")));
|
||||
buf.push("};");
|
||||
}
|
||||
buf.push("");
|
||||
buf.push("// expose the modules object (__webpack_modules__)");
|
||||
buf.push(`${this.requireFn}.m = modules;`);
|
||||
|
||||
buf.push("");
|
||||
buf.push("// expose the module cache");
|
||||
buf.push(`${this.requireFn}.c = installedModules;`);
|
||||
|
||||
buf.push("");
|
||||
buf.push("// define getter function for harmony exports");
|
||||
buf.push(`${this.requireFn}.d = function(exports, name, getter) {`);
|
||||
buf.push(this.indent([
|
||||
`if(!${this.requireFn}.o(exports, name)) {`,
|
||||
this.indent([
|
||||
"Object.defineProperty(exports, name, {",
|
||||
this.indent([
|
||||
"configurable: false,",
|
||||
"enumerable: true,",
|
||||
"get: getter"
|
||||
]),
|
||||
"});"
|
||||
]),
|
||||
"}"
|
||||
]));
|
||||
buf.push("};");
|
||||
|
||||
buf.push("");
|
||||
buf.push("// getDefaultExport function for compatibility with non-harmony modules");
|
||||
buf.push(this.requireFn + ".n = function(module) {");
|
||||
buf.push(this.indent([
|
||||
"var getter = module && module.__esModule ?",
|
||||
this.indent([
|
||||
"function getDefault() { return module['default']; } :",
|
||||
"function getModuleExports() { return module; };"
|
||||
]),
|
||||
`${this.requireFn}.d(getter, 'a', getter);`,
|
||||
"return getter;"
|
||||
]));
|
||||
buf.push("};");
|
||||
|
||||
buf.push("");
|
||||
buf.push("// Object.prototype.hasOwnProperty.call");
|
||||
buf.push(`${this.requireFn}.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };`);
|
||||
|
||||
const publicPath = this.getPublicPath({
|
||||
hash: hash
|
||||
});
|
||||
buf.push("");
|
||||
buf.push("// __webpack_public_path__");
|
||||
buf.push(`${this.requireFn}.p = ${JSON.stringify(publicPath)};`);
|
||||
return this.asString(buf);
|
||||
});
|
||||
|
||||
this.requireFn = "__webpack_require__";
|
||||
}
|
||||
|
||||
render(hash, chunk, moduleTemplate, dependencyTemplates) {
|
||||
const buf = [];
|
||||
buf.push(this.applyPluginsWaterfall("bootstrap", "", chunk, hash, moduleTemplate, dependencyTemplates));
|
||||
buf.push(this.applyPluginsWaterfall("local-vars", "", chunk, hash));
|
||||
buf.push("");
|
||||
buf.push("// The require function");
|
||||
buf.push(`function ${this.requireFn}(moduleId) {`);
|
||||
buf.push(this.indent(this.applyPluginsWaterfall("require", "", chunk, hash)));
|
||||
buf.push("}");
|
||||
buf.push("");
|
||||
buf.push(this.asString(this.applyPluginsWaterfall("require-extensions", "", chunk, hash)));
|
||||
buf.push("");
|
||||
buf.push(this.asString(this.applyPluginsWaterfall("startup", "", chunk, hash)));
|
||||
let source = this.applyPluginsWaterfall("render", new OriginalSource(this.prefix(buf, " \t") + "\n", `webpack/bootstrap ${hash}`), chunk, hash, moduleTemplate, dependencyTemplates);
|
||||
if(chunk.hasEntryModule()) {
|
||||
source = this.applyPluginsWaterfall("render-with-entry", source, chunk, hash);
|
||||
}
|
||||
if(!source) throw new Error("Compiler error: MainTemplate plugin 'render' should return something");
|
||||
chunk.rendered = true;
|
||||
return new ConcatSource(source, ";");
|
||||
}
|
||||
|
||||
renderRequireFunctionForModule(hash, chunk, varModuleId) {
|
||||
return this.applyPluginsWaterfall("module-require", this.requireFn, chunk, hash, varModuleId);
|
||||
}
|
||||
|
||||
renderAddModule(hash, chunk, varModuleId, varModule) {
|
||||
return this.applyPluginsWaterfall("add-module", `modules[${varModuleId}] = ${varModule};`, chunk, hash, varModuleId, varModule);
|
||||
}
|
||||
|
||||
renderCurrentHashCode(hash, length) {
|
||||
length = length || Infinity;
|
||||
return this.applyPluginsWaterfall("current-hash", JSON.stringify(hash.substr(0, length)), length);
|
||||
}
|
||||
|
||||
entryPointInChildren(chunk) {
|
||||
const checkChildren = (chunk, alreadyCheckedChunks) => {
|
||||
return chunk.chunks.some((child) => {
|
||||
if(alreadyCheckedChunks.indexOf(child) >= 0) return;
|
||||
alreadyCheckedChunks.push(child);
|
||||
return child.hasEntryModule() || checkChildren(child, alreadyCheckedChunks);
|
||||
});
|
||||
};
|
||||
return checkChildren(chunk, []);
|
||||
}
|
||||
|
||||
getPublicPath(options) {
|
||||
return this.applyPluginsWaterfall("asset-path", this.outputOptions.publicPath || "", options);
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
hash.update("maintemplate");
|
||||
hash.update("3");
|
||||
hash.update(this.outputOptions.publicPath + "");
|
||||
this.applyPlugins("hash", hash);
|
||||
}
|
||||
|
||||
updateHashForChunk(hash, chunk) {
|
||||
this.updateHash(hash);
|
||||
this.applyPlugins("hash-for-chunk", hash, chunk);
|
||||
}
|
||||
|
||||
useChunkHash(chunk) {
|
||||
const paths = this.applyPluginsWaterfall("global-hash-paths", []);
|
||||
return !this.applyPluginsBailResult("global-hash", chunk, paths);
|
||||
}
|
||||
};
|
||||
5
hGameTest/node_modules/webpack/lib/MemoryOutputFileSystem.js
generated
vendored
Normal file
5
hGameTest/node_modules/webpack/lib/MemoryOutputFileSystem.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
module.exports = require("memory-fs");
|
||||
250
hGameTest/node_modules/webpack/lib/Module.js
generated
vendored
Normal file
250
hGameTest/node_modules/webpack/lib/Module.js
generated
vendored
Normal file
@@ -0,0 +1,250 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const util = require("util");
|
||||
|
||||
const DependenciesBlock = require("./DependenciesBlock");
|
||||
const ModuleReason = require("./ModuleReason");
|
||||
const SortableSet = require("./util/SortableSet");
|
||||
const Template = require("./Template");
|
||||
|
||||
let debugId = 1000;
|
||||
|
||||
const sortById = (a, b) => {
|
||||
return a.id - b.id;
|
||||
};
|
||||
|
||||
const sortByDebugId = (a, b) => {
|
||||
return a.debugId - b.debugId;
|
||||
};
|
||||
|
||||
class Module extends DependenciesBlock {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.context = null;
|
||||
this.reasons = [];
|
||||
this.debugId = debugId++;
|
||||
this.id = null;
|
||||
this.portableId = null;
|
||||
this.index = null;
|
||||
this.index2 = null;
|
||||
this.depth = null;
|
||||
this.used = null;
|
||||
this.usedExports = null;
|
||||
this.providedExports = null;
|
||||
this._chunks = new SortableSet(undefined, sortById);
|
||||
this._chunksDebugIdent = undefined;
|
||||
this.warnings = [];
|
||||
this.dependenciesWarnings = [];
|
||||
this.errors = [];
|
||||
this.dependenciesErrors = [];
|
||||
this.strict = false;
|
||||
this.meta = {};
|
||||
this.optimizationBailout = [];
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.reasons.length = 0;
|
||||
this.id = null;
|
||||
this.index = null;
|
||||
this.index2 = null;
|
||||
this.depth = null;
|
||||
this.used = null;
|
||||
this.usedExports = null;
|
||||
this.providedExports = null;
|
||||
this._chunks.clear();
|
||||
this._chunksDebugIdent = undefined;
|
||||
this.optimizationBailout.length = 0;
|
||||
super.disconnect();
|
||||
}
|
||||
|
||||
unseal() {
|
||||
this.id = null;
|
||||
this.index = null;
|
||||
this.index2 = null;
|
||||
this.depth = null;
|
||||
this._chunks.clear();
|
||||
this._chunksDebugIdent = undefined;
|
||||
super.unseal();
|
||||
}
|
||||
|
||||
setChunks(chunks) {
|
||||
this._chunks = new SortableSet(chunks, sortById);
|
||||
this._chunksDebugIdent = undefined;
|
||||
}
|
||||
|
||||
addChunk(chunk) {
|
||||
this._chunks.add(chunk);
|
||||
this._chunksDebugIdent = undefined;
|
||||
}
|
||||
|
||||
removeChunk(chunk) {
|
||||
if(this._chunks.delete(chunk)) {
|
||||
this._chunksDebugIdent = undefined;
|
||||
chunk.removeModule(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
isInChunk(chunk) {
|
||||
return this._chunks.has(chunk);
|
||||
}
|
||||
|
||||
getChunkIdsIdent() {
|
||||
if(this._chunksDebugIdent !== undefined) return this._chunksDebugIdent;
|
||||
this._chunks.sortWith(sortByDebugId);
|
||||
const chunks = this._chunks;
|
||||
const list = [];
|
||||
for(const chunk of chunks) {
|
||||
const debugId = chunk.debugId;
|
||||
|
||||
if(typeof debugId !== "number") {
|
||||
return this._chunksDebugIdent = null;
|
||||
}
|
||||
|
||||
list.push(debugId);
|
||||
}
|
||||
|
||||
return this._chunksDebugIdent = list.join(",");
|
||||
}
|
||||
|
||||
forEachChunk(fn) {
|
||||
this._chunks.forEach(fn);
|
||||
}
|
||||
|
||||
mapChunks(fn) {
|
||||
return Array.from(this._chunks, fn);
|
||||
}
|
||||
|
||||
getChunks() {
|
||||
return Array.from(this._chunks);
|
||||
}
|
||||
|
||||
getNumberOfChunks() {
|
||||
return this._chunks.size;
|
||||
}
|
||||
|
||||
hasEqualsChunks(otherModule) {
|
||||
if(this._chunks.size !== otherModule._chunks.size) return false;
|
||||
this._chunks.sortWith(sortByDebugId);
|
||||
otherModule._chunks.sortWith(sortByDebugId);
|
||||
const a = this._chunks[Symbol.iterator]();
|
||||
const b = otherModule._chunks[Symbol.iterator]();
|
||||
while(true) { // eslint-disable-line
|
||||
const aItem = a.next();
|
||||
const bItem = b.next();
|
||||
if(aItem.done) return true;
|
||||
if(aItem.value !== bItem.value) return false;
|
||||
}
|
||||
}
|
||||
|
||||
addReason(module, dependency) {
|
||||
this.reasons.push(new ModuleReason(module, dependency));
|
||||
}
|
||||
|
||||
removeReason(module, dependency) {
|
||||
for(let i = 0; i < this.reasons.length; i++) {
|
||||
let r = this.reasons[i];
|
||||
if(r.module === module && r.dependency === dependency) {
|
||||
this.reasons.splice(i, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
hasReasonForChunk(chunk) {
|
||||
for(let i = 0; i < this.reasons.length; i++) {
|
||||
if(this.reasons[i].hasChunk(chunk))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
rewriteChunkInReasons(oldChunk, newChunks) {
|
||||
for(let i = 0; i < this.reasons.length; i++) {
|
||||
this.reasons[i].rewriteChunks(oldChunk, newChunks);
|
||||
}
|
||||
}
|
||||
|
||||
isUsed(exportName) {
|
||||
if(this.used === null) return exportName;
|
||||
if(!exportName) return !!this.used;
|
||||
if(!this.used) return false;
|
||||
if(!this.usedExports) return false;
|
||||
if(this.usedExports === true) return exportName;
|
||||
let idx = this.usedExports.indexOf(exportName);
|
||||
if(idx < 0) return false;
|
||||
if(this.isProvided(exportName))
|
||||
return Template.numberToIdentifer(idx);
|
||||
return exportName;
|
||||
}
|
||||
|
||||
isProvided(exportName) {
|
||||
if(!Array.isArray(this.providedExports))
|
||||
return null;
|
||||
return this.providedExports.indexOf(exportName) >= 0;
|
||||
}
|
||||
|
||||
toString() {
|
||||
return `Module[${this.id || this.debugId}]`;
|
||||
}
|
||||
|
||||
needRebuild(fileTimestamps, contextTimestamps) {
|
||||
return true;
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
hash.update(this.id + "" + this.used);
|
||||
hash.update(JSON.stringify(this.usedExports));
|
||||
super.updateHash(hash);
|
||||
}
|
||||
|
||||
sortItems(sortChunks) {
|
||||
super.sortItems();
|
||||
if(sortChunks)
|
||||
this._chunks.sort();
|
||||
this.reasons.sort((a, b) => sortById(a.module, b.module));
|
||||
if(Array.isArray(this.usedExports)) {
|
||||
this.usedExports.sort();
|
||||
}
|
||||
}
|
||||
|
||||
unbuild() {
|
||||
this.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(Module.prototype, "entry", {
|
||||
configurable: false,
|
||||
get() {
|
||||
throw new Error("Module.entry was removed. Use Chunk.entryModule");
|
||||
},
|
||||
set() {
|
||||
throw new Error("Module.entry was removed. Use Chunk.entryModule");
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(Module.prototype, "chunks", {
|
||||
configurable: false,
|
||||
get: util.deprecate(function() {
|
||||
return Array.from(this._chunks);
|
||||
}, "Module.chunks: Use Module.forEachChunk/mapChunks/getNumberOfChunks/isInChunk/addChunk/removeChunk instead"),
|
||||
set() {
|
||||
throw new Error("Readonly. Use Module.addChunk/removeChunk to modify chunks.");
|
||||
}
|
||||
});
|
||||
|
||||
Module.prototype.identifier = null;
|
||||
Module.prototype.readableIdentifier = null;
|
||||
Module.prototype.build = null;
|
||||
Module.prototype.source = null;
|
||||
Module.prototype.size = null;
|
||||
Module.prototype.nameForCondition = null;
|
||||
|
||||
module.exports = Module;
|
||||
42
hGameTest/node_modules/webpack/lib/ModuleBuildError.js
generated
vendored
Normal file
42
hGameTest/node_modules/webpack/lib/ModuleBuildError.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 WebpackError = require("./WebpackError");
|
||||
const cutOffLoaderExecution = require("./ErrorHelpers").cutOffLoaderExecution;
|
||||
|
||||
class ModuleBuildError extends WebpackError {
|
||||
constructor(module, err) {
|
||||
super();
|
||||
|
||||
this.name = "ModuleBuildError";
|
||||
this.message = "Module build failed: ";
|
||||
if(err !== null && typeof err === "object") {
|
||||
if(typeof err.stack === "string" && err.stack) {
|
||||
var stack = cutOffLoaderExecution(err.stack);
|
||||
if(!err.hideStack) {
|
||||
this.message += stack;
|
||||
} else {
|
||||
this.details = stack;
|
||||
if(typeof err.message === "string" && err.message) {
|
||||
this.message += err.message;
|
||||
} else {
|
||||
this.message += err;
|
||||
}
|
||||
}
|
||||
} else if(typeof err.message === "string" && err.message) {
|
||||
this.message += err.message;
|
||||
} else {
|
||||
this.message += err;
|
||||
}
|
||||
}
|
||||
this.module = module;
|
||||
this.error = err;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ModuleBuildError;
|
||||
22
hGameTest/node_modules/webpack/lib/ModuleDependencyError.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/ModuleDependencyError.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 WebpackError = require("./WebpackError");
|
||||
const formatLocation = require("./formatLocation");
|
||||
|
||||
module.exports = class ModuleDependencyError extends WebpackError {
|
||||
constructor(module, err, loc) {
|
||||
super();
|
||||
|
||||
this.name = "ModuleDependencyError";
|
||||
this.message = `${formatLocation(loc)} ${err.message}`;
|
||||
this.details = err.stack.split("\n").slice(1).join("\n");
|
||||
this.origin = this.module = module;
|
||||
this.error = err;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
};
|
||||
22
hGameTest/node_modules/webpack/lib/ModuleDependencyWarning.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/ModuleDependencyWarning.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 WebpackError = require("./WebpackError");
|
||||
const formatLocation = require("./formatLocation");
|
||||
|
||||
module.exports = class ModuleDependencyWarning extends WebpackError {
|
||||
constructor(module, err, loc) {
|
||||
super();
|
||||
|
||||
this.name = "ModuleDependencyWarning";
|
||||
this.message = `${formatLocation(loc)} ${err.message}`;
|
||||
this.details = err.stack.split("\n").slice(1).join("\n");
|
||||
this.origin = this.module = module;
|
||||
this.error = err;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
};
|
||||
24
hGameTest/node_modules/webpack/lib/ModuleError.js
generated
vendored
Normal file
24
hGameTest/node_modules/webpack/lib/ModuleError.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 WebpackError = require("./WebpackError");
|
||||
const cleanUp = require("./ErrorHelpers").cleanUp;
|
||||
|
||||
class ModuleError extends WebpackError {
|
||||
constructor(module, err) {
|
||||
super();
|
||||
|
||||
this.name = "ModuleError";
|
||||
this.module = module;
|
||||
this.message = err && typeof err === "object" && err.message ? err.message : err;
|
||||
this.error = err;
|
||||
this.details = err && typeof err === "object" && err.stack ? cleanUp(err.stack, this.message) : undefined;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ModuleError;
|
||||
162
hGameTest/node_modules/webpack/lib/ModuleFilenameHelpers.js
generated
vendored
Normal file
162
hGameTest/node_modules/webpack/lib/ModuleFilenameHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ModuleFilenameHelpers = exports;
|
||||
|
||||
ModuleFilenameHelpers.ALL_LOADERS_RESOURCE = "[all-loaders][resource]";
|
||||
ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE = /\[all-?loaders\]\[resource\]/gi;
|
||||
ModuleFilenameHelpers.LOADERS_RESOURCE = "[loaders][resource]";
|
||||
ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE = /\[loaders\]\[resource\]/gi;
|
||||
ModuleFilenameHelpers.RESOURCE = "[resource]";
|
||||
ModuleFilenameHelpers.REGEXP_RESOURCE = /\[resource\]/gi;
|
||||
ModuleFilenameHelpers.ABSOLUTE_RESOURCE_PATH = "[absolute-resource-path]";
|
||||
ModuleFilenameHelpers.REGEXP_ABSOLUTE_RESOURCE_PATH = /\[abs(olute)?-?resource-?path\]/gi;
|
||||
ModuleFilenameHelpers.RESOURCE_PATH = "[resource-path]";
|
||||
ModuleFilenameHelpers.REGEXP_RESOURCE_PATH = /\[resource-?path\]/gi;
|
||||
ModuleFilenameHelpers.ALL_LOADERS = "[all-loaders]";
|
||||
ModuleFilenameHelpers.REGEXP_ALL_LOADERS = /\[all-?loaders\]/gi;
|
||||
ModuleFilenameHelpers.LOADERS = "[loaders]";
|
||||
ModuleFilenameHelpers.REGEXP_LOADERS = /\[loaders\]/gi;
|
||||
ModuleFilenameHelpers.QUERY = "[query]";
|
||||
ModuleFilenameHelpers.REGEXP_QUERY = /\[query\]/gi;
|
||||
ModuleFilenameHelpers.ID = "[id]";
|
||||
ModuleFilenameHelpers.REGEXP_ID = /\[id\]/gi;
|
||||
ModuleFilenameHelpers.HASH = "[hash]";
|
||||
ModuleFilenameHelpers.REGEXP_HASH = /\[hash\]/gi;
|
||||
|
||||
function getAfter(str, token) {
|
||||
const idx = str.indexOf(token);
|
||||
return idx < 0 ? "" : str.substr(idx);
|
||||
}
|
||||
|
||||
function getBefore(str, token) {
|
||||
const idx = str.lastIndexOf(token);
|
||||
return idx < 0 ? "" : str.substr(0, idx);
|
||||
}
|
||||
|
||||
function getHash(str) {
|
||||
const hash = require("crypto").createHash("md5");
|
||||
hash.update(str);
|
||||
return hash.digest("hex").substr(0, 4);
|
||||
}
|
||||
|
||||
function asRegExp(test) {
|
||||
if(typeof test === "string") test = new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
|
||||
return test;
|
||||
}
|
||||
|
||||
ModuleFilenameHelpers.createFilename = function createFilename(module, moduleFilenameTemplate, requestShortener) {
|
||||
let absoluteResourcePath;
|
||||
let hash;
|
||||
let identifier;
|
||||
let moduleId;
|
||||
let shortIdentifier;
|
||||
if(module === undefined) module = "";
|
||||
if(typeof module === "string") {
|
||||
shortIdentifier = requestShortener.shorten(module);
|
||||
identifier = shortIdentifier;
|
||||
moduleId = "";
|
||||
absoluteResourcePath = module.split("!").pop();
|
||||
hash = getHash(identifier);
|
||||
} else {
|
||||
shortIdentifier = module.readableIdentifier(requestShortener);
|
||||
identifier = requestShortener.shorten(module.identifier());
|
||||
moduleId = module.id;
|
||||
absoluteResourcePath = module.identifier().split("!").pop();
|
||||
hash = getHash(identifier);
|
||||
}
|
||||
const resource = shortIdentifier.split("!").pop();
|
||||
const loaders = getBefore(shortIdentifier, "!");
|
||||
const allLoaders = getBefore(identifier, "!");
|
||||
const query = getAfter(resource, "?");
|
||||
const resourcePath = resource.substr(0, resource.length - query.length);
|
||||
if(typeof moduleFilenameTemplate === "function") {
|
||||
return moduleFilenameTemplate({
|
||||
identifier: identifier,
|
||||
shortIdentifier: shortIdentifier,
|
||||
resource: resource,
|
||||
resourcePath: resourcePath,
|
||||
absoluteResourcePath: absoluteResourcePath,
|
||||
allLoaders: allLoaders,
|
||||
query: query,
|
||||
moduleId: moduleId,
|
||||
hash: hash
|
||||
});
|
||||
}
|
||||
return moduleFilenameTemplate
|
||||
.replace(ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE, identifier)
|
||||
.replace(ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE, shortIdentifier)
|
||||
.replace(ModuleFilenameHelpers.REGEXP_RESOURCE, resource)
|
||||
.replace(ModuleFilenameHelpers.REGEXP_RESOURCE_PATH, resourcePath)
|
||||
.replace(ModuleFilenameHelpers.REGEXP_ABSOLUTE_RESOURCE_PATH, absoluteResourcePath)
|
||||
.replace(ModuleFilenameHelpers.REGEXP_ALL_LOADERS, allLoaders)
|
||||
.replace(ModuleFilenameHelpers.REGEXP_LOADERS, loaders)
|
||||
.replace(ModuleFilenameHelpers.REGEXP_QUERY, query)
|
||||
.replace(ModuleFilenameHelpers.REGEXP_ID, moduleId)
|
||||
.replace(ModuleFilenameHelpers.REGEXP_HASH, hash);
|
||||
};
|
||||
|
||||
ModuleFilenameHelpers.createFooter = function createFooter(module, requestShortener) {
|
||||
if(!module) module = "";
|
||||
if(typeof module === "string") {
|
||||
return [
|
||||
"// WEBPACK FOOTER //",
|
||||
`// ${requestShortener.shorten(module)}`
|
||||
].join("\n");
|
||||
} else {
|
||||
return [
|
||||
"//////////////////",
|
||||
"// WEBPACK FOOTER",
|
||||
`// ${module.readableIdentifier(requestShortener)}`,
|
||||
`// module id = ${module.id}`,
|
||||
`// module chunks = ${module.mapChunks(c => c.id).join(" ")}`
|
||||
].join("\n");
|
||||
}
|
||||
};
|
||||
|
||||
ModuleFilenameHelpers.replaceDuplicates = function replaceDuplicates(array, fn, comparator) {
|
||||
const countMap = Object.create(null);
|
||||
const posMap = Object.create(null);
|
||||
array.forEach((item, idx) => {
|
||||
countMap[item] = (countMap[item] || []);
|
||||
countMap[item].push(idx);
|
||||
posMap[item] = 0;
|
||||
});
|
||||
if(comparator) {
|
||||
Object.keys(countMap).forEach(item => {
|
||||
countMap[item].sort(comparator);
|
||||
});
|
||||
}
|
||||
return array.map((item, i) => {
|
||||
if(countMap[item].length > 1) {
|
||||
if(comparator && countMap[item][0] === i)
|
||||
return item;
|
||||
return fn(item, i, posMap[item]++);
|
||||
} else return item;
|
||||
});
|
||||
};
|
||||
|
||||
ModuleFilenameHelpers.matchPart = function matchPart(str, test) {
|
||||
if(!test) return true;
|
||||
test = asRegExp(test);
|
||||
if(Array.isArray(test)) {
|
||||
return test.map(asRegExp).filter(function(regExp) {
|
||||
return regExp.test(str);
|
||||
}).length > 0;
|
||||
} else {
|
||||
return test.test(str);
|
||||
}
|
||||
};
|
||||
|
||||
ModuleFilenameHelpers.matchObject = function matchObject(obj, str) {
|
||||
if(obj.test)
|
||||
if(!ModuleFilenameHelpers.matchPart(str, obj.test)) return false;
|
||||
if(obj.include)
|
||||
if(!ModuleFilenameHelpers.matchPart(str, obj.include)) return false;
|
||||
if(obj.exclude)
|
||||
if(ModuleFilenameHelpers.matchPart(str, obj.exclude)) return false;
|
||||
return true;
|
||||
};
|
||||
26
hGameTest/node_modules/webpack/lib/ModuleNotFoundError.js
generated
vendored
Normal file
26
hGameTest/node_modules/webpack/lib/ModuleNotFoundError.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 WebpackError = require("./WebpackError");
|
||||
|
||||
class ModuleNotFoundError extends WebpackError {
|
||||
constructor(module, err, dependencies) {
|
||||
super();
|
||||
|
||||
this.name = "ModuleNotFoundError";
|
||||
this.message = "Module not found: " + err;
|
||||
this.details = err.details;
|
||||
this.missing = err.missing;
|
||||
this.module = module;
|
||||
this.origin = module;
|
||||
this.dependencies = dependencies;
|
||||
this.error = err;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ModuleNotFoundError;
|
||||
34
hGameTest/node_modules/webpack/lib/ModuleParseError.js
generated
vendored
Normal file
34
hGameTest/node_modules/webpack/lib/ModuleParseError.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";
|
||||
|
||||
const WebpackError = require("./WebpackError");
|
||||
|
||||
class ModuleParseError extends WebpackError {
|
||||
constructor(module, source, err) {
|
||||
super();
|
||||
|
||||
this.name = "ModuleParseError";
|
||||
this.message = "Module parse failed: " + err.message;
|
||||
this.message += "\nYou may need an appropriate loader to handle this file type.";
|
||||
if(err.loc && typeof err.loc === "object" && typeof err.loc.line === "number") {
|
||||
var lineNumber = err.loc.line;
|
||||
if(/[\0\u0001\u0002\u0003\u0004\u0005\u0006\u0007]/.test(source)) { // binary file
|
||||
this.message += "\n(Source code omitted for this binary file)";
|
||||
} else {
|
||||
source = source.split("\n");
|
||||
this.message += "\n| " + source.slice(Math.max(0, lineNumber - 3), lineNumber + 2).join("\n| ");
|
||||
}
|
||||
} else {
|
||||
this.message += "\n" + err.stack;
|
||||
}
|
||||
this.module = module;
|
||||
this.error = err;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ModuleParseError;
|
||||
50
hGameTest/node_modules/webpack/lib/ModuleReason.js
generated
vendored
Normal file
50
hGameTest/node_modules/webpack/lib/ModuleReason.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 util = require("util");
|
||||
|
||||
class ModuleReason {
|
||||
constructor(module, dependency) {
|
||||
this.module = module;
|
||||
this.dependency = dependency;
|
||||
this._chunks = null;
|
||||
}
|
||||
|
||||
hasChunk(chunk) {
|
||||
if(this._chunks) {
|
||||
if(this._chunks.has(chunk))
|
||||
return true;
|
||||
} else if(this.module._chunks.has(chunk))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
rewriteChunks(oldChunk, newChunks) {
|
||||
if(!this._chunks) {
|
||||
if(!this.module._chunks.has(oldChunk))
|
||||
return;
|
||||
this._chunks = new Set(this.module._chunks);
|
||||
}
|
||||
if(this._chunks.has(oldChunk)) {
|
||||
this._chunks.delete(oldChunk);
|
||||
for(let i = 0; i < newChunks.length; i++) {
|
||||
this._chunks.add(newChunks[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(ModuleReason.prototype, "chunks", {
|
||||
configurable: false,
|
||||
get: util.deprecate(function() {
|
||||
return this._chunks ? Array.from(this._chunks) : null;
|
||||
}, "ModuleReason.chunks: Use ModuleReason.hasChunk/rewriteChunks instead"),
|
||||
set() {
|
||||
throw new Error("Readonly. Use ModuleReason.rewriteChunks to modify chunks.");
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = ModuleReason;
|
||||
23
hGameTest/node_modules/webpack/lib/ModuleTemplate.js
generated
vendored
Normal file
23
hGameTest/node_modules/webpack/lib/ModuleTemplate.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 Template = require("./Template");
|
||||
|
||||
module.exports = class ModuleTemplate extends Template {
|
||||
constructor(outputOptions) {
|
||||
super(outputOptions);
|
||||
}
|
||||
render(module, dependencyTemplates, chunk) {
|
||||
const moduleSource = module.source(dependencyTemplates, this.outputOptions, this.requestShortener);
|
||||
const moduleSourcePostModule = this.applyPluginsWaterfall("module", moduleSource, module, chunk, dependencyTemplates);
|
||||
const moduleSourcePostRender = this.applyPluginsWaterfall("render", moduleSourcePostModule, module, chunk, dependencyTemplates);
|
||||
return this.applyPluginsWaterfall("package", moduleSourcePostRender, module, chunk, dependencyTemplates);
|
||||
}
|
||||
updateHash(hash) {
|
||||
hash.update("1");
|
||||
this.applyPlugins("hash", hash);
|
||||
}
|
||||
};
|
||||
24
hGameTest/node_modules/webpack/lib/ModuleWarning.js
generated
vendored
Normal file
24
hGameTest/node_modules/webpack/lib/ModuleWarning.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 WebpackError = require("./WebpackError");
|
||||
const cleanUp = require("./ErrorHelpers").cleanUp;
|
||||
|
||||
class ModuleWarning extends WebpackError {
|
||||
constructor(module, warning) {
|
||||
super();
|
||||
|
||||
this.name = "ModuleWarning";
|
||||
this.module = module;
|
||||
this.message = warning && typeof warning === "object" && warning.message ? warning.message : warning;
|
||||
this.warning = warning;
|
||||
this.details = warning && typeof warning === "object" && warning.stack ? cleanUp(warning.stack, this.message) : undefined;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ModuleWarning;
|
||||
21
hGameTest/node_modules/webpack/lib/MovedToPluginWarningPlugin.js
generated
vendored
Normal file
21
hGameTest/node_modules/webpack/lib/MovedToPluginWarningPlugin.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";
|
||||
module.exports = class MovedToPluginWarningPlugin {
|
||||
constructor(optionName, pluginName) {
|
||||
this.optionName = optionName;
|
||||
this.pluginName = pluginName;
|
||||
}
|
||||
apply(compiler) {
|
||||
const optionName = this.optionName;
|
||||
const pluginName = this.pluginName;
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.warnings.push(new Error `webpack options:
|
||||
DEPRECATED option ${optionName} will be moved to the ${pluginName}.
|
||||
Use this instead.
|
||||
For more info about the usage of the ${pluginName} see https://webpack.js.org/plugins/`);
|
||||
});
|
||||
}
|
||||
};
|
||||
164
hGameTest/node_modules/webpack/lib/MultiCompiler.js
generated
vendored
Normal file
164
hGameTest/node_modules/webpack/lib/MultiCompiler.js
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const Tapable = require("tapable");
|
||||
const asyncLib = require("async");
|
||||
const MultiWatching = require("./MultiWatching");
|
||||
const MultiStats = require("./MultiStats");
|
||||
|
||||
module.exports = class MultiCompiler extends Tapable {
|
||||
constructor(compilers) {
|
||||
super();
|
||||
if(!Array.isArray(compilers)) {
|
||||
compilers = Object.keys(compilers).map((name) => {
|
||||
compilers[name].name = name;
|
||||
return compilers[name];
|
||||
});
|
||||
}
|
||||
this.compilers = compilers;
|
||||
let doneCompilers = 0;
|
||||
let compilerStats = [];
|
||||
this.compilers.forEach((compiler, idx) => {
|
||||
let compilerDone = false;
|
||||
compiler.plugin("done", stats => {
|
||||
if(!compilerDone) {
|
||||
compilerDone = true;
|
||||
doneCompilers++;
|
||||
}
|
||||
compilerStats[idx] = stats;
|
||||
if(doneCompilers === this.compilers.length) {
|
||||
this.applyPlugins("done", new MultiStats(compilerStats));
|
||||
}
|
||||
});
|
||||
compiler.plugin("invalid", () => {
|
||||
if(compilerDone) {
|
||||
compilerDone = false;
|
||||
doneCompilers--;
|
||||
}
|
||||
this.applyPlugins("invalid");
|
||||
});
|
||||
}, this);
|
||||
}
|
||||
|
||||
get outputPath() {
|
||||
let commonPath = this.compilers[0].outputPath;
|
||||
for(const compiler of this.compilers) {
|
||||
while(compiler.outputPath.indexOf(commonPath) !== 0 && /[/\\]/.test(commonPath)) {
|
||||
commonPath = commonPath.replace(/[/\\][^/\\]*$/, "");
|
||||
}
|
||||
}
|
||||
|
||||
if(!commonPath && this.compilers[0].outputPath[0] === "/") return "/";
|
||||
return commonPath;
|
||||
}
|
||||
|
||||
get inputFileSystem() {
|
||||
throw new Error("Cannot read inputFileSystem of a MultiCompiler");
|
||||
}
|
||||
|
||||
get outputFileSystem() {
|
||||
throw new Error("Cannot read outputFileSystem of a MultiCompiler");
|
||||
}
|
||||
|
||||
set inputFileSystem(value) {
|
||||
this.compilers.forEach(compiler => {
|
||||
compiler.inputFileSystem = value;
|
||||
});
|
||||
}
|
||||
|
||||
set outputFileSystem(value) {
|
||||
this.compilers.forEach(compiler => {
|
||||
compiler.outputFileSystem = value;
|
||||
});
|
||||
}
|
||||
|
||||
runWithDependencies(compilers, fn, callback) {
|
||||
let fulfilledNames = {};
|
||||
let remainingCompilers = compilers;
|
||||
const isDependencyFulfilled = (d) => fulfilledNames[d];
|
||||
const getReadyCompilers = () => {
|
||||
let readyCompilers = [];
|
||||
let list = remainingCompilers;
|
||||
remainingCompilers = [];
|
||||
for(const c of list) {
|
||||
const ready = !c.dependencies || c.dependencies.every(isDependencyFulfilled);
|
||||
if(ready)
|
||||
readyCompilers.push(c);
|
||||
else
|
||||
remainingCompilers.push(c);
|
||||
}
|
||||
return readyCompilers;
|
||||
};
|
||||
const runCompilers = (callback) => {
|
||||
if(remainingCompilers.length === 0) return callback();
|
||||
asyncLib.map(getReadyCompilers(), (compiler, callback) => {
|
||||
fn(compiler, (err) => {
|
||||
if(err) return callback(err);
|
||||
fulfilledNames[compiler.name] = true;
|
||||
runCompilers(callback);
|
||||
});
|
||||
}, callback);
|
||||
};
|
||||
runCompilers(callback);
|
||||
}
|
||||
|
||||
watch(watchOptions, handler) {
|
||||
let watchings = [];
|
||||
let allStats = this.compilers.map(() => null);
|
||||
let compilerStatus = this.compilers.map(() => false);
|
||||
this.runWithDependencies(this.compilers, (compiler, callback) => {
|
||||
const compilerIdx = this.compilers.indexOf(compiler);
|
||||
let firstRun = true;
|
||||
let watching = compiler.watch(Array.isArray(watchOptions) ? watchOptions[compilerIdx] : watchOptions, (err, stats) => {
|
||||
if(err)
|
||||
handler(err);
|
||||
if(stats) {
|
||||
allStats[compilerIdx] = stats;
|
||||
compilerStatus[compilerIdx] = "new";
|
||||
if(compilerStatus.every(Boolean)) {
|
||||
const freshStats = allStats.filter((s, idx) => {
|
||||
return compilerStatus[idx] === "new";
|
||||
});
|
||||
compilerStatus.fill(true);
|
||||
const multiStats = new MultiStats(freshStats);
|
||||
handler(null, multiStats);
|
||||
}
|
||||
}
|
||||
if(firstRun && !err) {
|
||||
firstRun = false;
|
||||
callback();
|
||||
}
|
||||
});
|
||||
watchings.push(watching);
|
||||
}, () => {
|
||||
// ignore
|
||||
});
|
||||
|
||||
return new MultiWatching(watchings, this);
|
||||
}
|
||||
|
||||
run(callback) {
|
||||
const allStats = this.compilers.map(() => null);
|
||||
this.runWithDependencies(this.compilers, ((compiler, callback) => {
|
||||
const compilerIdx = this.compilers.indexOf(compiler);
|
||||
compiler.run((err, stats) => {
|
||||
if(err) return callback(err);
|
||||
allStats[compilerIdx] = stats;
|
||||
callback();
|
||||
});
|
||||
}), (err) => {
|
||||
if(err) return callback(err);
|
||||
callback(null, new MultiStats(allStats));
|
||||
});
|
||||
}
|
||||
|
||||
purgeInputFileSystem() {
|
||||
this.compilers.forEach((compiler) => {
|
||||
if(compiler.inputFileSystem && compiler.inputFileSystem.purge)
|
||||
compiler.inputFileSystem.purge();
|
||||
});
|
||||
}
|
||||
};
|
||||
39
hGameTest/node_modules/webpack/lib/MultiEntryPlugin.js
generated
vendored
Normal file
39
hGameTest/node_modules/webpack/lib/MultiEntryPlugin.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 MultiEntryDependency = require("./dependencies/MultiEntryDependency");
|
||||
const SingleEntryDependency = require("./dependencies/SingleEntryDependency");
|
||||
const MultiModuleFactory = require("./MultiModuleFactory");
|
||||
|
||||
module.exports = class MultiEntryPlugin {
|
||||
constructor(context, entries, name) {
|
||||
this.context = context;
|
||||
this.entries = entries;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
const multiModuleFactory = new MultiModuleFactory();
|
||||
const normalModuleFactory = params.normalModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(MultiEntryDependency, multiModuleFactory);
|
||||
compilation.dependencyFactories.set(SingleEntryDependency, normalModuleFactory);
|
||||
});
|
||||
compiler.plugin("make", (compilation, callback) => {
|
||||
const dep = MultiEntryPlugin.createDependency(this.entries, this.name);
|
||||
compilation.addEntry(this.context, dep, this.name, callback);
|
||||
});
|
||||
}
|
||||
|
||||
static createDependency(entries, name) {
|
||||
return new MultiEntryDependency(entries.map((e, idx) => {
|
||||
const dep = new SingleEntryDependency(e);
|
||||
dep.loc = name + ":" + (100000 + idx);
|
||||
return dep;
|
||||
}), name);
|
||||
}
|
||||
};
|
||||
75
hGameTest/node_modules/webpack/lib/MultiModule.js
generated
vendored
Normal file
75
hGameTest/node_modules/webpack/lib/MultiModule.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const Module = require("./Module");
|
||||
const RawSource = require("webpack-sources").RawSource;
|
||||
|
||||
class MultiModule extends Module {
|
||||
|
||||
constructor(context, dependencies, name) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.dependencies = dependencies;
|
||||
this.name = name;
|
||||
this.built = false;
|
||||
this.cacheable = true;
|
||||
}
|
||||
|
||||
identifier() {
|
||||
return `multi ${this.dependencies.map((d) => d.request).join(" ")}`;
|
||||
}
|
||||
|
||||
readableIdentifier(requestShortener) {
|
||||
return `multi ${this.dependencies.map((d) => requestShortener.shorten(d.request)).join(" ")}`;
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.built = false;
|
||||
super.disconnect();
|
||||
}
|
||||
|
||||
build(options, compilation, resolver, fs, callback) {
|
||||
this.built = true;
|
||||
return callback();
|
||||
}
|
||||
|
||||
needRebuild() {
|
||||
return false;
|
||||
}
|
||||
|
||||
size() {
|
||||
return 16 + this.dependencies.length * 12;
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
hash.update("multi module");
|
||||
hash.update(this.name || "");
|
||||
super.updateHash(hash);
|
||||
}
|
||||
|
||||
source(dependencyTemplates, outputOptions) {
|
||||
const str = [];
|
||||
this.dependencies.forEach(function(dep, idx) {
|
||||
if(dep.module) {
|
||||
if(idx === this.dependencies.length - 1)
|
||||
str.push("module.exports = ");
|
||||
str.push("__webpack_require__(");
|
||||
if(outputOptions.pathinfo)
|
||||
str.push(`/*! ${dep.request} */`);
|
||||
str.push(`${JSON.stringify(dep.module.id)}`);
|
||||
str.push(")");
|
||||
} else {
|
||||
str.push("(function webpackMissingModule() { throw new Error(");
|
||||
str.push(JSON.stringify(`Cannot find module "${dep.request}"`));
|
||||
str.push("); }())");
|
||||
}
|
||||
str.push(";\n");
|
||||
}, this);
|
||||
return new RawSource(str.join(""));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MultiModule;
|
||||
19
hGameTest/node_modules/webpack/lib/MultiModuleFactory.js
generated
vendored
Normal file
19
hGameTest/node_modules/webpack/lib/MultiModuleFactory.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const Tapable = require("tapable");
|
||||
const MultiModule = require("./MultiModule");
|
||||
|
||||
module.exports = class MultiModuleFactory extends Tapable {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
create(data, callback) {
|
||||
const dependency = data.dependencies[0];
|
||||
callback(null, new MultiModule(data.context, dependency.dependencies, dependency.name));
|
||||
}
|
||||
};
|
||||
79
hGameTest/node_modules/webpack/lib/MultiStats.js
generated
vendored
Normal file
79
hGameTest/node_modules/webpack/lib/MultiStats.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const Stats = require("./Stats");
|
||||
|
||||
const optionOrFallback = (optionValue, fallbackValue) => optionValue !== undefined ? optionValue : fallbackValue;
|
||||
|
||||
class MultiStats {
|
||||
constructor(stats) {
|
||||
this.stats = stats;
|
||||
this.hash = stats.map(stat => stat.hash).join("");
|
||||
}
|
||||
|
||||
hasErrors() {
|
||||
return this.stats.map((stat) => stat.hasErrors()).reduce((a, b) => a || b, false);
|
||||
}
|
||||
|
||||
hasWarnings() {
|
||||
return this.stats.map((stat) => stat.hasWarnings()).reduce((a, b) => a || b, false);
|
||||
}
|
||||
|
||||
toJson(options, forToString) {
|
||||
if(typeof options === "boolean" || typeof options === "string") {
|
||||
options = Stats.presetToOptions(options);
|
||||
} else if(!options) {
|
||||
options = {};
|
||||
}
|
||||
const jsons = this.stats.map((stat, idx) => {
|
||||
const childOptions = Stats.getChildOptions(options, idx);
|
||||
const obj = stat.toJson(childOptions, forToString);
|
||||
obj.name = stat.compilation && stat.compilation.name;
|
||||
return obj;
|
||||
});
|
||||
const showVersion = typeof options.version === "undefined" ? jsons.every(j => j.version) : options.version !== false;
|
||||
const showHash = typeof options.hash === "undefined" ? jsons.every(j => j.hash) : options.hash !== false;
|
||||
jsons.forEach(j => {
|
||||
if(showVersion)
|
||||
delete j.version;
|
||||
});
|
||||
const obj = {
|
||||
errors: jsons.reduce((arr, j) => {
|
||||
return arr.concat(j.errors.map(msg => {
|
||||
return `(${j.name}) ${msg}`;
|
||||
}));
|
||||
}, []),
|
||||
warnings: jsons.reduce((arr, j) => {
|
||||
return arr.concat(j.warnings.map(msg => {
|
||||
return `(${j.name}) ${msg}`;
|
||||
}));
|
||||
}, [])
|
||||
};
|
||||
if(showVersion)
|
||||
obj.version = require("../package.json").version;
|
||||
if(showHash)
|
||||
obj.hash = this.hash;
|
||||
if(options.children !== false)
|
||||
obj.children = jsons;
|
||||
return obj;
|
||||
}
|
||||
|
||||
toString(options) {
|
||||
if(typeof options === "boolean" || typeof options === "string") {
|
||||
options = Stats.presetToOptions(options);
|
||||
} else if(!options) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
const useColors = optionOrFallback(options.colors, false);
|
||||
|
||||
const obj = this.toJson(options, true);
|
||||
|
||||
return Stats.jsonToString(obj, useColors);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MultiStats;
|
||||
32
hGameTest/node_modules/webpack/lib/MultiWatching.js
generated
vendored
Normal file
32
hGameTest/node_modules/webpack/lib/MultiWatching.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 asyncLib = require("async");
|
||||
|
||||
class MultiWatching {
|
||||
constructor(watchings, compiler) {
|
||||
this.watchings = watchings;
|
||||
this.compiler = compiler;
|
||||
}
|
||||
|
||||
invalidate() {
|
||||
this.watchings.forEach((watching) => watching.invalidate());
|
||||
}
|
||||
|
||||
close(callback) {
|
||||
if(callback === undefined) callback = () => { /*do nothing*/ };
|
||||
|
||||
asyncLib.forEach(this.watchings, (watching, finishedCallback) => {
|
||||
watching.close(finishedCallback);
|
||||
}, err => {
|
||||
this.compiler.applyPlugins("watch-close");
|
||||
callback(err);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MultiWatching;
|
||||
30
hGameTest/node_modules/webpack/lib/NamedChunksPlugin.js
generated
vendored
Normal file
30
hGameTest/node_modules/webpack/lib/NamedChunksPlugin.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";
|
||||
|
||||
class NamedChunksPlugin {
|
||||
|
||||
static defaultNameResolver(chunk) {
|
||||
return chunk.name || null;
|
||||
}
|
||||
|
||||
constructor(nameResolver) {
|
||||
this.nameResolver = nameResolver || NamedChunksPlugin.defaultNameResolver;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.plugin("before-chunk-ids", (chunks) => {
|
||||
chunks.forEach((chunk) => {
|
||||
if(chunk.id === null) {
|
||||
chunk.id = this.nameResolver(chunk);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NamedChunksPlugin;
|
||||
27
hGameTest/node_modules/webpack/lib/NamedModulesPlugin.js
generated
vendored
Normal file
27
hGameTest/node_modules/webpack/lib/NamedModulesPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class NamedModulesPlugin {
|
||||
constructor(options) {
|
||||
this.options = options || {};
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.plugin("before-module-ids", (modules) => {
|
||||
modules.forEach((module) => {
|
||||
if(module.id === null && module.libIdent) {
|
||||
module.id = module.libIdent({
|
||||
context: this.options.context || compiler.options.context
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NamedModulesPlugin;
|
||||
15
hGameTest/node_modules/webpack/lib/NewWatchingPlugin.js
generated
vendored
Normal file
15
hGameTest/node_modules/webpack/lib/NewWatchingPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class NewWatchingPlugin {
|
||||
apply(compiler) {
|
||||
compiler.plugin("compilation", function(compilation) {
|
||||
compilation.warnings.push(new Error("The 'NewWatchingPlugin' is no longer necessary (now default)"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NewWatchingPlugin;
|
||||
22
hGameTest/node_modules/webpack/lib/NoEmitOnErrorsPlugin.js
generated
vendored
Normal file
22
hGameTest/node_modules/webpack/lib/NoEmitOnErrorsPlugin.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";
|
||||
|
||||
class NoEmitOnErrorsPlugin {
|
||||
apply(compiler) {
|
||||
compiler.plugin("should-emit", (compilation) => {
|
||||
if(compilation.getStats().hasErrors())
|
||||
return false;
|
||||
});
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.plugin("should-record", () => {
|
||||
if(compilation.getStats().hasErrors())
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NoEmitOnErrorsPlugin;
|
||||
29
hGameTest/node_modules/webpack/lib/NoErrorsPlugin.js
generated
vendored
Normal file
29
hGameTest/node_modules/webpack/lib/NoErrorsPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
let deprecationReported = false;
|
||||
|
||||
class NoErrorsPlugin {
|
||||
apply(compiler) {
|
||||
compiler.plugin("should-emit", (compilation) => {
|
||||
if(!deprecationReported) {
|
||||
compilation.warnings.push("webpack: Using NoErrorsPlugin is deprecated.\n" +
|
||||
"Use NoEmitOnErrorsPlugin instead.\n");
|
||||
deprecationReported = true;
|
||||
}
|
||||
if(compilation.errors.length > 0)
|
||||
return false;
|
||||
});
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.plugin("should-record", () => {
|
||||
if(compilation.errors.length > 0)
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NoErrorsPlugin;
|
||||
97
hGameTest/node_modules/webpack/lib/NodeStuffPlugin.js
generated
vendored
Normal file
97
hGameTest/node_modules/webpack/lib/NodeStuffPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
const ParserHelpers = require("./ParserHelpers");
|
||||
const ConstDependency = require("./dependencies/ConstDependency");
|
||||
|
||||
const NullFactory = require("./NullFactory");
|
||||
|
||||
class NodeStuffPlugin {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
const options = this.options;
|
||||
compiler.plugin("compilation", (compilation, params) => {
|
||||
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
|
||||
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
|
||||
|
||||
params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
|
||||
|
||||
if(parserOptions.node === false)
|
||||
return;
|
||||
|
||||
let localOptions = options;
|
||||
if(parserOptions.node)
|
||||
localOptions = Object.assign({}, localOptions, parserOptions.node);
|
||||
|
||||
function setConstant(expressionName, value) {
|
||||
parser.plugin(`expression ${expressionName}`, function() {
|
||||
this.state.current.addVariable(expressionName, JSON.stringify(value));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
function setModuleConstant(expressionName, fn) {
|
||||
parser.plugin(`expression ${expressionName}`, function() {
|
||||
this.state.current.addVariable(expressionName, JSON.stringify(fn(this.state.module)));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
const context = compiler.context;
|
||||
if(localOptions.__filename === "mock") {
|
||||
setConstant("__filename", "/index.js");
|
||||
} else if(localOptions.__filename) {
|
||||
setModuleConstant("__filename", module => path.relative(context, module.resource));
|
||||
}
|
||||
parser.plugin("evaluate Identifier __filename", function(expr) {
|
||||
if(!this.state.module) return;
|
||||
const resource = this.state.module.resource;
|
||||
const i = resource.indexOf("?");
|
||||
return ParserHelpers.evaluateToString(i < 0 ? resource : resource.substr(0, i))(expr);
|
||||
});
|
||||
if(localOptions.__dirname === "mock") {
|
||||
setConstant("__dirname", "/");
|
||||
} else if(localOptions.__dirname) {
|
||||
setModuleConstant("__dirname", module => path.relative(context, module.context));
|
||||
}
|
||||
parser.plugin("evaluate Identifier __dirname", function(expr) {
|
||||
if(!this.state.module) return;
|
||||
return ParserHelpers.evaluateToString(this.state.module.context)(expr);
|
||||
});
|
||||
parser.plugin("expression require.main", ParserHelpers.toConstantDependency("__webpack_require__.c[__webpack_require__.s]"));
|
||||
parser.plugin(
|
||||
"expression require.extensions",
|
||||
ParserHelpers.expressionIsUnsupported("require.extensions is not supported by webpack. Use a loader instead.")
|
||||
);
|
||||
parser.plugin("expression module.loaded", ParserHelpers.toConstantDependency("module.l"));
|
||||
parser.plugin("expression module.id", ParserHelpers.toConstantDependency("module.i"));
|
||||
parser.plugin("expression module.exports", function() {
|
||||
const module = this.state.module;
|
||||
const isHarmony = module.meta && module.meta.harmonyModule;
|
||||
if(!isHarmony)
|
||||
return true;
|
||||
});
|
||||
parser.plugin("evaluate Identifier module.hot", ParserHelpers.evaluateToIdentifier("module.hot", false));
|
||||
parser.plugin("expression module", function() {
|
||||
const module = this.state.module;
|
||||
const isHarmony = module.meta && module.meta.harmonyModule;
|
||||
let moduleJsPath = path.join(__dirname, "..", "buildin", isHarmony ? "harmony-module.js" : "module.js");
|
||||
if(module.context) {
|
||||
moduleJsPath = path.relative(this.state.module.context, moduleJsPath);
|
||||
if(!/^[A-Z]:/i.test(moduleJsPath)) {
|
||||
moduleJsPath = `./${moduleJsPath.replace(/\\/g, "/")}`;
|
||||
}
|
||||
}
|
||||
return ParserHelpers.addParsedVariableToModule(this, "module", `require(${JSON.stringify(moduleJsPath)})(module)`);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = NodeStuffPlugin;
|
||||
556
hGameTest/node_modules/webpack/lib/NormalModule.js
generated
vendored
Normal file
556
hGameTest/node_modules/webpack/lib/NormalModule.js
generated
vendored
Normal file
@@ -0,0 +1,556 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
const NativeModule = require("module");
|
||||
const crypto = require("crypto");
|
||||
|
||||
const SourceMapSource = require("webpack-sources").SourceMapSource;
|
||||
const OriginalSource = require("webpack-sources").OriginalSource;
|
||||
const RawSource = require("webpack-sources").RawSource;
|
||||
const ReplaceSource = require("webpack-sources").ReplaceSource;
|
||||
const CachedSource = require("webpack-sources").CachedSource;
|
||||
const LineToLineMappedSource = require("webpack-sources").LineToLineMappedSource;
|
||||
|
||||
const WebpackError = require("./WebpackError");
|
||||
const Module = require("./Module");
|
||||
const ModuleParseError = require("./ModuleParseError");
|
||||
const ModuleBuildError = require("./ModuleBuildError");
|
||||
const ModuleError = require("./ModuleError");
|
||||
const ModuleWarning = require("./ModuleWarning");
|
||||
|
||||
const runLoaders = require("loader-runner").runLoaders;
|
||||
const getContext = require("loader-runner").getContext;
|
||||
|
||||
function asString(buf) {
|
||||
if(Buffer.isBuffer(buf)) {
|
||||
return buf.toString("utf-8");
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
function contextify(context, request) {
|
||||
return request.split("!").map(function(r) {
|
||||
const splitPath = r.split("?");
|
||||
splitPath[0] = path.relative(context, splitPath[0]);
|
||||
if(path.sep === "\\")
|
||||
splitPath[0] = splitPath[0].replace(/\\/g, "/");
|
||||
if(splitPath[0].indexOf("../") !== 0)
|
||||
splitPath[0] = "./" + splitPath[0];
|
||||
return splitPath.join("?");
|
||||
}).join("!");
|
||||
}
|
||||
|
||||
class NonErrorEmittedError extends WebpackError {
|
||||
constructor(error) {
|
||||
super();
|
||||
|
||||
this.name = "NonErrorEmittedError";
|
||||
this.message = "(Emitted value instead of an instance of Error) " + error;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
|
||||
const dependencyTemplatesHashMap = new WeakMap();
|
||||
|
||||
class NormalModule extends Module {
|
||||
|
||||
constructor(request, userRequest, rawRequest, loaders, resource, parser) {
|
||||
super();
|
||||
this.request = request;
|
||||
this.userRequest = userRequest;
|
||||
this.rawRequest = rawRequest;
|
||||
this.parser = parser;
|
||||
this.resource = resource;
|
||||
this.context = getContext(resource);
|
||||
this.loaders = loaders;
|
||||
this.fileDependencies = [];
|
||||
this.contextDependencies = [];
|
||||
this.warnings = [];
|
||||
this.errors = [];
|
||||
this.error = null;
|
||||
this._source = null;
|
||||
this.assets = {};
|
||||
this.built = false;
|
||||
this._cachedSource = null;
|
||||
}
|
||||
|
||||
identifier() {
|
||||
return this.request;
|
||||
}
|
||||
|
||||
readableIdentifier(requestShortener) {
|
||||
return requestShortener.shorten(this.userRequest);
|
||||
}
|
||||
|
||||
libIdent(options) {
|
||||
return contextify(options.context, this.userRequest);
|
||||
}
|
||||
|
||||
nameForCondition() {
|
||||
const idx = this.resource.indexOf("?");
|
||||
if(idx >= 0) return this.resource.substr(0, idx);
|
||||
return this.resource;
|
||||
}
|
||||
|
||||
createSourceForAsset(name, content, sourceMap) {
|
||||
if(!sourceMap) {
|
||||
return new RawSource(content);
|
||||
}
|
||||
|
||||
if(typeof sourceMap === "string") {
|
||||
return new OriginalSource(content, sourceMap);
|
||||
}
|
||||
|
||||
return new SourceMapSource(content, name, sourceMap);
|
||||
}
|
||||
|
||||
createLoaderContext(resolver, options, compilation, fs) {
|
||||
const loaderContext = {
|
||||
version: 2,
|
||||
emitWarning: (warning) => {
|
||||
if(!(warning instanceof Error))
|
||||
warning = new NonErrorEmittedError(warning);
|
||||
this.warnings.push(new ModuleWarning(this, warning));
|
||||
},
|
||||
emitError: (error) => {
|
||||
if(!(error instanceof Error))
|
||||
error = new NonErrorEmittedError(error);
|
||||
this.errors.push(new ModuleError(this, error));
|
||||
},
|
||||
exec: (code, filename) => {
|
||||
const module = new NativeModule(filename, this);
|
||||
module.paths = NativeModule._nodeModulePaths(this.context);
|
||||
module.filename = filename;
|
||||
module._compile(code, filename);
|
||||
return module.exports;
|
||||
},
|
||||
resolve(context, request, callback) {
|
||||
resolver.resolve({}, context, request, callback);
|
||||
},
|
||||
resolveSync(context, request) {
|
||||
return resolver.resolveSync({}, context, request);
|
||||
},
|
||||
emitFile: (name, content, sourceMap) => {
|
||||
this.assets[name] = this.createSourceForAsset(name, content, sourceMap);
|
||||
},
|
||||
options: options,
|
||||
webpack: true,
|
||||
sourceMap: !!this.useSourceMap,
|
||||
_module: this,
|
||||
_compilation: compilation,
|
||||
_compiler: compilation.compiler,
|
||||
fs: fs,
|
||||
};
|
||||
|
||||
compilation.applyPlugins("normal-module-loader", loaderContext, this);
|
||||
if(options.loader)
|
||||
Object.assign(loaderContext, options.loader);
|
||||
|
||||
return loaderContext;
|
||||
}
|
||||
|
||||
createSource(source, resourceBuffer, sourceMap) {
|
||||
// if there is no identifier return raw source
|
||||
if(!this.identifier) {
|
||||
return new RawSource(source);
|
||||
}
|
||||
|
||||
// from here on we assume we have an identifier
|
||||
const identifier = this.identifier();
|
||||
|
||||
if(this.lineToLine && resourceBuffer) {
|
||||
return new LineToLineMappedSource(
|
||||
source, identifier, asString(resourceBuffer));
|
||||
}
|
||||
|
||||
if(this.useSourceMap && sourceMap) {
|
||||
return new SourceMapSource(source, identifier, sourceMap);
|
||||
}
|
||||
|
||||
return new OriginalSource(source, identifier);
|
||||
}
|
||||
|
||||
doBuild(options, compilation, resolver, fs, callback) {
|
||||
this.cacheable = false;
|
||||
const loaderContext = this.createLoaderContext(resolver, options, compilation, fs);
|
||||
|
||||
runLoaders({
|
||||
resource: this.resource,
|
||||
loaders: this.loaders,
|
||||
context: loaderContext,
|
||||
readResource: fs.readFile.bind(fs)
|
||||
}, (err, result) => {
|
||||
if(result) {
|
||||
this.cacheable = result.cacheable;
|
||||
this.fileDependencies = result.fileDependencies;
|
||||
this.contextDependencies = result.contextDependencies;
|
||||
}
|
||||
|
||||
if(err) {
|
||||
const error = new ModuleBuildError(this, err);
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
const resourceBuffer = result.resourceBuffer;
|
||||
const source = result.result[0];
|
||||
const sourceMap = result.result[1];
|
||||
|
||||
if(!Buffer.isBuffer(source) && typeof source !== "string") {
|
||||
const error = new ModuleBuildError(this, new Error("Final loader didn't return a Buffer or String"));
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
this._source = this.createSource(asString(source), resourceBuffer, sourceMap);
|
||||
return callback();
|
||||
});
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.built = false;
|
||||
super.disconnect();
|
||||
}
|
||||
|
||||
markModuleAsErrored(error) {
|
||||
this.meta = null;
|
||||
this.error = error;
|
||||
this.errors.push(this.error);
|
||||
this._source = new RawSource("throw new Error(" + JSON.stringify(this.error.message) + ");");
|
||||
}
|
||||
|
||||
applyNoParseRule(rule, content) {
|
||||
// must start with "rule" if rule is a string
|
||||
if(typeof rule === "string") {
|
||||
return content.indexOf(rule) === 0;
|
||||
}
|
||||
|
||||
if(typeof rule === "function") {
|
||||
return rule(content);
|
||||
}
|
||||
// we assume rule is a regexp
|
||||
return rule.test(content);
|
||||
}
|
||||
|
||||
// check if module should not be parsed
|
||||
// returns "true" if the module should !not! be parsed
|
||||
// returns "false" if the module !must! be parsed
|
||||
shouldPreventParsing(noParseRule, request) {
|
||||
// if no noParseRule exists, return false
|
||||
// the module !must! be parsed.
|
||||
if(!noParseRule) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// we only have one rule to check
|
||||
if(!Array.isArray(noParseRule)) {
|
||||
// returns "true" if the module is !not! to be parsed
|
||||
return this.applyNoParseRule(noParseRule, request);
|
||||
}
|
||||
|
||||
for(let i = 0; i < noParseRule.length; i++) {
|
||||
const rule = noParseRule[i];
|
||||
// early exit on first truthy match
|
||||
// this module is !not! to be parsed
|
||||
if(this.applyNoParseRule(rule, request)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// no match found, so this module !should! be parsed
|
||||
return false;
|
||||
}
|
||||
|
||||
build(options, compilation, resolver, fs, callback) {
|
||||
this.buildTimestamp = Date.now();
|
||||
this.built = true;
|
||||
this._source = null;
|
||||
this.error = null;
|
||||
this.errors.length = 0;
|
||||
this.warnings.length = 0;
|
||||
this.meta = {};
|
||||
|
||||
return this.doBuild(options, compilation, resolver, fs, (err) => {
|
||||
this.dependencies.length = 0;
|
||||
this.variables.length = 0;
|
||||
this.blocks.length = 0;
|
||||
this._cachedSource = null;
|
||||
|
||||
// if we have an error mark module as failed and exit
|
||||
if(err) {
|
||||
this.markModuleAsErrored(err);
|
||||
return callback();
|
||||
}
|
||||
|
||||
// check if this module should !not! be parsed.
|
||||
// if so, exit here;
|
||||
const noParseRule = options.module && options.module.noParse;
|
||||
if(this.shouldPreventParsing(noParseRule, this.request)) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
try {
|
||||
this.parser.parse(this._source.source(), {
|
||||
current: this,
|
||||
module: this,
|
||||
compilation: compilation,
|
||||
options: options
|
||||
});
|
||||
} catch(e) {
|
||||
const source = this._source.source();
|
||||
const error = new ModuleParseError(this, source, e);
|
||||
this.markModuleAsErrored(error);
|
||||
return callback();
|
||||
}
|
||||
return callback();
|
||||
});
|
||||
}
|
||||
|
||||
getHashDigest(dependencyTemplates) {
|
||||
let dtHash = dependencyTemplatesHashMap.get("hash");
|
||||
const hash = crypto.createHash("md5");
|
||||
this.updateHash(hash);
|
||||
hash.update(`${dtHash}`);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
|
||||
sourceDependency(dependency, dependencyTemplates, source, outputOptions, requestShortener) {
|
||||
const template = dependencyTemplates.get(dependency.constructor);
|
||||
if(!template) throw new Error("No template for dependency: " + dependency.constructor.name);
|
||||
template.apply(dependency, source, outputOptions, requestShortener, dependencyTemplates);
|
||||
}
|
||||
|
||||
sourceVariables(variable, availableVars, dependencyTemplates, outputOptions, requestShortener) {
|
||||
const name = variable.name;
|
||||
const expr = variable.expressionSource(dependencyTemplates, outputOptions, requestShortener);
|
||||
|
||||
if(availableVars.some(v => v.name === name && v.expression.source() === expr.source())) {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
name: name,
|
||||
expression: expr
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* creates the start part of a IIFE around the module to inject a variable name
|
||||
* (function(...){ <- this part
|
||||
* }.call(...))
|
||||
*/
|
||||
variableInjectionFunctionWrapperStartCode(varNames) {
|
||||
const args = varNames.join(", ");
|
||||
return `/* WEBPACK VAR INJECTION */(function(${args}) {`;
|
||||
}
|
||||
|
||||
contextArgument(block) {
|
||||
if(this === block) {
|
||||
return this.exportsArgument || "exports";
|
||||
}
|
||||
return "this";
|
||||
}
|
||||
|
||||
/*
|
||||
* creates the end part of a IIFE around the module to inject a variable name
|
||||
* (function(...){
|
||||
* }.call(...)) <- this part
|
||||
*/
|
||||
variableInjectionFunctionWrapperEndCode(varExpressions, block) {
|
||||
const firstParam = this.contextArgument(block);
|
||||
const furtherParams = varExpressions.map(e => e.source()).join(", ");
|
||||
return `}.call(${firstParam}, ${furtherParams}))`;
|
||||
}
|
||||
|
||||
splitVariablesInUniqueNamedChunks(vars) {
|
||||
const startState = [
|
||||
[]
|
||||
];
|
||||
return vars.reduce((chunks, variable) => {
|
||||
const current = chunks[chunks.length - 1];
|
||||
// check if variable with same name exists already
|
||||
// if so create a new chunk of variables.
|
||||
const variableNameAlreadyExists = current.some(v => v.name === variable.name);
|
||||
|
||||
if(variableNameAlreadyExists) {
|
||||
// start new chunk with current variable
|
||||
chunks.push([variable]);
|
||||
} else {
|
||||
// else add it to current chunk
|
||||
current.push(variable);
|
||||
}
|
||||
return chunks;
|
||||
}, startState);
|
||||
}
|
||||
|
||||
sourceBlock(block, availableVars, dependencyTemplates, source, outputOptions, requestShortener) {
|
||||
block.dependencies.forEach((dependency) => this.sourceDependency(
|
||||
dependency, dependencyTemplates, source, outputOptions, requestShortener));
|
||||
|
||||
/**
|
||||
* Get the variables of all blocks that we need to inject.
|
||||
* These will contain the variable name and its expression.
|
||||
* The name will be added as a paramter in a IIFE the expression as its value.
|
||||
*/
|
||||
const vars = block.variables.reduce((result, value) => {
|
||||
const variable = this.sourceVariables(
|
||||
value, availableVars, dependencyTemplates, outputOptions, requestShortener);
|
||||
|
||||
if(variable) {
|
||||
result.push(variable);
|
||||
}
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* if we actually have variables
|
||||
* this is important as how #splitVariablesInUniqueNamedChunks works
|
||||
* it will always return an array in an array which would lead to a IIFE wrapper around
|
||||
* a module if we do this with an empty vars array.
|
||||
*/
|
||||
if(vars.length > 0) {
|
||||
/**
|
||||
* Split all variables up into chunks of unique names.
|
||||
* e.g. imagine you have the following variable names that need to be injected:
|
||||
* [foo, bar, baz, foo, some, more]
|
||||
* we can not inject "foo" twice, therefore we just make two IIFEs like so:
|
||||
* (function(foo, bar, baz){
|
||||
* (function(foo, some, more){
|
||||
* ...
|
||||
* }(...));
|
||||
* }(...));
|
||||
*
|
||||
* "splitVariablesInUniqueNamedChunks" splits the variables shown above up to this:
|
||||
* [[foo, bar, baz], [foo, some, more]]
|
||||
*/
|
||||
const injectionVariableChunks = this.splitVariablesInUniqueNamedChunks(vars);
|
||||
|
||||
// create all the beginnings of IIFEs
|
||||
const functionWrapperStarts = injectionVariableChunks.map((variableChunk) => {
|
||||
return this.variableInjectionFunctionWrapperStartCode(
|
||||
variableChunk.map(variable => variable.name)
|
||||
);
|
||||
});
|
||||
|
||||
// and all the ends
|
||||
const functionWrapperEnds = injectionVariableChunks.map((variableChunk) => {
|
||||
return this.variableInjectionFunctionWrapperEndCode(
|
||||
variableChunk.map(variable => variable.expression), block
|
||||
);
|
||||
});
|
||||
|
||||
// join them to one big string
|
||||
const varStartCode = functionWrapperStarts.join("");
|
||||
|
||||
// reverse the ends first before joining them, as the last added must be the inner most
|
||||
const varEndCode = functionWrapperEnds.reverse().join("");
|
||||
|
||||
// if we have anything, add it to the source
|
||||
if(varStartCode && varEndCode) {
|
||||
const start = block.range ? block.range[0] : -10;
|
||||
const end = block.range ? block.range[1] : (this._source.size() + 1);
|
||||
source.insert(start + 0.5, varStartCode);
|
||||
source.insert(end + 0.5, "\n/* WEBPACK VAR INJECTION */" + varEndCode);
|
||||
}
|
||||
}
|
||||
|
||||
block.blocks.forEach((block) =>
|
||||
this.sourceBlock(
|
||||
block,
|
||||
availableVars.concat(vars),
|
||||
dependencyTemplates,
|
||||
source,
|
||||
outputOptions,
|
||||
requestShortener
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
source(dependencyTemplates, outputOptions, requestShortener) {
|
||||
const hashDigest = this.getHashDigest(dependencyTemplates);
|
||||
if(this._cachedSource && this._cachedSource.hash === hashDigest) {
|
||||
return this._cachedSource.source;
|
||||
}
|
||||
|
||||
if(!this._source) {
|
||||
return new RawSource("throw new Error('No source available');");
|
||||
}
|
||||
|
||||
const source = new ReplaceSource(this._source);
|
||||
this._cachedSource = {
|
||||
source: source,
|
||||
hash: hashDigest
|
||||
};
|
||||
|
||||
this.sourceBlock(this, [], dependencyTemplates, source, outputOptions, requestShortener);
|
||||
return new CachedSource(source);
|
||||
}
|
||||
|
||||
originalSource() {
|
||||
return this._source;
|
||||
}
|
||||
|
||||
getHighestTimestamp(keys, timestampsByKey) {
|
||||
let highestTimestamp = 0;
|
||||
for(let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
const timestamp = timestampsByKey[key];
|
||||
// if there is no timestamp yet, early return with Infinity
|
||||
if(!timestamp) return Infinity;
|
||||
highestTimestamp = Math.max(highestTimestamp, timestamp);
|
||||
}
|
||||
return highestTimestamp;
|
||||
}
|
||||
|
||||
needRebuild(fileTimestamps, contextTimestamps) {
|
||||
const highestFileDepTimestamp = this.getHighestTimestamp(
|
||||
this.fileDependencies, fileTimestamps);
|
||||
// if the hightest is Infinity, we need a rebuild
|
||||
// exit early here.
|
||||
if(highestFileDepTimestamp === Infinity) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const highestContextDepTimestamp = this.getHighestTimestamp(
|
||||
this.contextDependencies, contextTimestamps);
|
||||
|
||||
// Again if the hightest is Infinity, we need a rebuild
|
||||
// exit early here.
|
||||
if(highestContextDepTimestamp === Infinity) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// else take the highest of file and context timestamps and compare
|
||||
// to last build timestamp
|
||||
return Math.max(highestContextDepTimestamp, highestFileDepTimestamp) >= this.buildTimestamp;
|
||||
}
|
||||
|
||||
size() {
|
||||
return this._source ? this._source.size() : -1;
|
||||
}
|
||||
|
||||
updateHashWithSource(hash) {
|
||||
if(!this._source) {
|
||||
hash.update("null");
|
||||
return;
|
||||
}
|
||||
hash.update("source");
|
||||
this._source.updateHash(hash);
|
||||
}
|
||||
|
||||
updateHashWithMeta(hash) {
|
||||
hash.update("meta");
|
||||
hash.update(JSON.stringify(this.meta));
|
||||
}
|
||||
|
||||
updateHash(hash) {
|
||||
this.updateHashWithSource(hash);
|
||||
this.updateHashWithMeta(hash);
|
||||
super.updateHash(hash);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = NormalModule;
|
||||
294
hGameTest/node_modules/webpack/lib/NormalModuleFactory.js
generated
vendored
Normal file
294
hGameTest/node_modules/webpack/lib/NormalModuleFactory.js
generated
vendored
Normal file
@@ -0,0 +1,294 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const asyncLib = require("async");
|
||||
const Tapable = require("tapable");
|
||||
const NormalModule = require("./NormalModule");
|
||||
const RawModule = require("./RawModule");
|
||||
const Parser = require("./Parser");
|
||||
const RuleSet = require("./RuleSet");
|
||||
|
||||
function loaderToIdent(data) {
|
||||
if(!data.options)
|
||||
return data.loader;
|
||||
if(typeof data.options === "string")
|
||||
return data.loader + "?" + data.options;
|
||||
if(typeof data.options !== "object")
|
||||
throw new Error("loader options must be string or object");
|
||||
if(data.ident)
|
||||
return data.loader + "??" + data.ident;
|
||||
return data.loader + "?" + JSON.stringify(data.options);
|
||||
}
|
||||
|
||||
function identToLoaderRequest(resultString) {
|
||||
const idx = resultString.indexOf("?");
|
||||
let options;
|
||||
|
||||
if(idx >= 0) {
|
||||
options = resultString.substr(idx + 1);
|
||||
resultString = resultString.substr(0, idx);
|
||||
|
||||
return {
|
||||
loader: resultString,
|
||||
options
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
loader: resultString
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class NormalModuleFactory extends Tapable {
|
||||
constructor(context, resolvers, options) {
|
||||
super();
|
||||
this.resolvers = resolvers;
|
||||
this.ruleSet = new RuleSet(options.rules || options.loaders);
|
||||
this.cachePredicate = typeof options.unsafeCache === "function" ? options.unsafeCache : Boolean.bind(null, options.unsafeCache);
|
||||
this.context = context || "";
|
||||
this.parserCache = {};
|
||||
this.plugin("factory", () => (result, callback) => {
|
||||
let resolver = this.applyPluginsWaterfall0("resolver", null);
|
||||
|
||||
// Ignored
|
||||
if(!resolver) return callback();
|
||||
|
||||
resolver(result, (err, data) => {
|
||||
if(err) return callback(err);
|
||||
|
||||
// Ignored
|
||||
if(!data) return callback();
|
||||
|
||||
// direct module
|
||||
if(typeof data.source === "function")
|
||||
return callback(null, data);
|
||||
|
||||
this.applyPluginsAsyncWaterfall("after-resolve", data, (err, result) => {
|
||||
if(err) return callback(err);
|
||||
|
||||
// Ignored
|
||||
if(!result) return callback();
|
||||
|
||||
let createdModule = this.applyPluginsBailResult("create-module", result);
|
||||
if(!createdModule) {
|
||||
|
||||
if(!result.request) {
|
||||
return callback(new Error("Empty dependency (no request)"));
|
||||
}
|
||||
|
||||
createdModule = new NormalModule(
|
||||
result.request,
|
||||
result.userRequest,
|
||||
result.rawRequest,
|
||||
result.loaders,
|
||||
result.resource,
|
||||
result.parser
|
||||
);
|
||||
}
|
||||
|
||||
createdModule = this.applyPluginsWaterfall0("module", createdModule);
|
||||
|
||||
return callback(null, createdModule);
|
||||
});
|
||||
});
|
||||
});
|
||||
this.plugin("resolver", () => (data, callback) => {
|
||||
const contextInfo = data.contextInfo;
|
||||
const context = data.context;
|
||||
const request = data.request;
|
||||
|
||||
const noAutoLoaders = /^-?!/.test(request);
|
||||
const noPrePostAutoLoaders = /^!!/.test(request);
|
||||
const noPostAutoLoaders = /^-!/.test(request);
|
||||
let elements = request.replace(/^-?!+/, "").replace(/!!+/g, "!").split("!");
|
||||
let resource = elements.pop();
|
||||
elements = elements.map(identToLoaderRequest);
|
||||
|
||||
asyncLib.parallel([
|
||||
callback => this.resolveRequestArray(contextInfo, context, elements, this.resolvers.loader, callback),
|
||||
callback => {
|
||||
if(resource === "" || resource[0] === "?")
|
||||
return callback(null, {
|
||||
resource
|
||||
});
|
||||
|
||||
this.resolvers.normal.resolve(contextInfo, context, resource, (err, resource, resourceResolveData) => {
|
||||
if(err) return callback(err);
|
||||
callback(null, {
|
||||
resourceResolveData,
|
||||
resource
|
||||
});
|
||||
});
|
||||
}
|
||||
], (err, results) => {
|
||||
if(err) return callback(err);
|
||||
let loaders = results[0];
|
||||
const resourceResolveData = results[1].resourceResolveData;
|
||||
resource = results[1].resource;
|
||||
|
||||
// translate option idents
|
||||
try {
|
||||
loaders.forEach(item => {
|
||||
if(typeof item.options === "string" && /^\?/.test(item.options)) {
|
||||
const ident = item.options.substr(1);
|
||||
item.options = this.ruleSet.findOptionsByIdent(ident);
|
||||
item.ident = ident;
|
||||
}
|
||||
});
|
||||
} catch(e) {
|
||||
return callback(e);
|
||||
}
|
||||
|
||||
if(resource === false) {
|
||||
// ignored
|
||||
return callback(null,
|
||||
new RawModule(
|
||||
"/* (ignored) */",
|
||||
`ignored ${context} ${request}`,
|
||||
`${request} (ignored)`
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const userRequest = loaders.map(loaderToIdent).concat([resource]).join("!");
|
||||
|
||||
let resourcePath = resource;
|
||||
let resourceQuery = "";
|
||||
const queryIndex = resourcePath.indexOf("?");
|
||||
if(queryIndex >= 0) {
|
||||
resourceQuery = resourcePath.substr(queryIndex);
|
||||
resourcePath = resourcePath.substr(0, queryIndex);
|
||||
}
|
||||
|
||||
const result = this.ruleSet.exec({
|
||||
resource: resourcePath,
|
||||
resourceQuery,
|
||||
issuer: contextInfo.issuer,
|
||||
compiler: contextInfo.compiler
|
||||
});
|
||||
const settings = {};
|
||||
const useLoadersPost = [];
|
||||
const useLoaders = [];
|
||||
const useLoadersPre = [];
|
||||
result.forEach(r => {
|
||||
if(r.type === "use") {
|
||||
if(r.enforce === "post" && !noPostAutoLoaders && !noPrePostAutoLoaders)
|
||||
useLoadersPost.push(r.value);
|
||||
else if(r.enforce === "pre" && !noPrePostAutoLoaders)
|
||||
useLoadersPre.push(r.value);
|
||||
else if(!r.enforce && !noAutoLoaders && !noPrePostAutoLoaders)
|
||||
useLoaders.push(r.value);
|
||||
} else {
|
||||
settings[r.type] = r.value;
|
||||
}
|
||||
});
|
||||
asyncLib.parallel([
|
||||
this.resolveRequestArray.bind(this, contextInfo, this.context, useLoadersPost, this.resolvers.loader),
|
||||
this.resolveRequestArray.bind(this, contextInfo, this.context, useLoaders, this.resolvers.loader),
|
||||
this.resolveRequestArray.bind(this, contextInfo, this.context, useLoadersPre, this.resolvers.loader)
|
||||
], (err, results) => {
|
||||
if(err) return callback(err);
|
||||
loaders = results[0].concat(loaders, results[1], results[2]);
|
||||
process.nextTick(() => {
|
||||
callback(null, {
|
||||
context: context,
|
||||
request: loaders.map(loaderToIdent).concat([resource]).join("!"),
|
||||
dependencies: data.dependencies,
|
||||
userRequest,
|
||||
rawRequest: request,
|
||||
loaders,
|
||||
resource,
|
||||
resourceResolveData,
|
||||
parser: this.getParser(settings.parser)
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
create(data, callback) {
|
||||
const dependencies = data.dependencies;
|
||||
const cacheEntry = dependencies[0].__NormalModuleFactoryCache;
|
||||
if(cacheEntry) return callback(null, cacheEntry);
|
||||
const context = data.context || this.context;
|
||||
const request = dependencies[0].request;
|
||||
const contextInfo = data.contextInfo || {};
|
||||
this.applyPluginsAsyncWaterfall("before-resolve", {
|
||||
contextInfo,
|
||||
context,
|
||||
request,
|
||||
dependencies
|
||||
}, (err, result) => {
|
||||
if(err) return callback(err);
|
||||
|
||||
// Ignored
|
||||
if(!result) return callback();
|
||||
|
||||
const factory = this.applyPluginsWaterfall0("factory", null);
|
||||
|
||||
// Ignored
|
||||
if(!factory) return callback();
|
||||
|
||||
factory(result, (err, module) => {
|
||||
if(err) return callback(err);
|
||||
|
||||
if(module && this.cachePredicate(module)) {
|
||||
dependencies.forEach(d => d.__NormalModuleFactoryCache = module);
|
||||
}
|
||||
|
||||
callback(null, module);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
resolveRequestArray(contextInfo, context, array, resolver, callback) {
|
||||
if(array.length === 0) return callback(null, []);
|
||||
asyncLib.map(array, (item, callback) => {
|
||||
resolver.resolve(contextInfo, context, item.loader, (err, result) => {
|
||||
if(err && /^[^/]*$/.test(item.loader) && !/-loader$/.test(item.loader)) {
|
||||
return resolver.resolve(contextInfo, context, item.loader + "-loader", err2 => {
|
||||
if(!err2) {
|
||||
err.message = err.message + "\n" +
|
||||
"BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.\n" +
|
||||
` You need to specify '${item.loader}-loader' instead of '${item.loader}',\n` +
|
||||
" see https://webpack.js.org/guides/migrating/#automatic-loader-module-name-extension-removed";
|
||||
}
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
if(err) return callback(err);
|
||||
|
||||
const optionsOnly = item.options ? {
|
||||
options: item.options
|
||||
} : undefined;
|
||||
return callback(null, Object.assign({}, item, identToLoaderRequest(result), optionsOnly));
|
||||
});
|
||||
}, callback);
|
||||
}
|
||||
|
||||
getParser(parserOptions) {
|
||||
let ident = "null";
|
||||
if(parserOptions) {
|
||||
if(parserOptions.ident)
|
||||
ident = parserOptions.ident;
|
||||
else
|
||||
ident = JSON.stringify(parserOptions);
|
||||
}
|
||||
const parser = this.parserCache[ident];
|
||||
if(parser)
|
||||
return parser;
|
||||
return this.parserCache[ident] = this.createParser(parserOptions);
|
||||
}
|
||||
|
||||
createParser(parserOptions) {
|
||||
const parser = new Parser();
|
||||
this.applyPlugins2("parser", parser, parserOptions || {});
|
||||
return parser;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NormalModuleFactory;
|
||||
45
hGameTest/node_modules/webpack/lib/NormalModuleReplacementPlugin.js
generated
vendored
Normal file
45
hGameTest/node_modules/webpack/lib/NormalModuleReplacementPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
|
||||
class NormalModuleReplacementPlugin {
|
||||
constructor(resourceRegExp, newResource) {
|
||||
this.resourceRegExp = resourceRegExp;
|
||||
this.newResource = newResource;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
const resourceRegExp = this.resourceRegExp;
|
||||
const newResource = this.newResource;
|
||||
compiler.plugin("normal-module-factory", (nmf) => {
|
||||
nmf.plugin("before-resolve", (result, callback) => {
|
||||
if(!result) return callback();
|
||||
if(resourceRegExp.test(result.request)) {
|
||||
if(typeof newResource === "function") {
|
||||
newResource(result);
|
||||
} else {
|
||||
result.request = newResource;
|
||||
}
|
||||
}
|
||||
return callback(null, result);
|
||||
});
|
||||
nmf.plugin("after-resolve", (result, callback) => {
|
||||
if(!result) return callback();
|
||||
if(resourceRegExp.test(result.resource)) {
|
||||
if(typeof newResource === "function") {
|
||||
newResource(result);
|
||||
} else {
|
||||
result.resource = path.resolve(path.dirname(result.resource), newResource);
|
||||
}
|
||||
}
|
||||
return callback(null, result);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NormalModuleReplacementPlugin;
|
||||
12
hGameTest/node_modules/webpack/lib/NullFactory.js
generated
vendored
Normal file
12
hGameTest/node_modules/webpack/lib/NullFactory.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class NullFactory {
|
||||
create(data, callback) {
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
module.exports = NullFactory;
|
||||
10
hGameTest/node_modules/webpack/lib/OptionsApply.js
generated
vendored
Normal file
10
hGameTest/node_modules/webpack/lib/OptionsApply.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
class OptionsApply {
|
||||
process(options, compiler) {}
|
||||
}
|
||||
module.exports = OptionsApply;
|
||||
73
hGameTest/node_modules/webpack/lib/OptionsDefaulter.js
generated
vendored
Normal file
73
hGameTest/node_modules/webpack/lib/OptionsDefaulter.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
function getProperty(obj, name) {
|
||||
name = name.split(".");
|
||||
for(let i = 0; i < name.length - 1; i++) {
|
||||
obj = obj[name[i]];
|
||||
if(typeof obj !== "object" || !obj) return;
|
||||
}
|
||||
return obj[name.pop()];
|
||||
}
|
||||
|
||||
function setProperty(obj, name, value) {
|
||||
name = name.split(".");
|
||||
for(let i = 0; i < name.length - 1; i++) {
|
||||
if(typeof obj[name[i]] !== "object" && typeof obj[name[i]] !== "undefined") return;
|
||||
if(!obj[name[i]]) obj[name[i]] = {};
|
||||
obj = obj[name[i]];
|
||||
}
|
||||
obj[name.pop()] = value;
|
||||
}
|
||||
|
||||
class OptionsDefaulter {
|
||||
constructor() {
|
||||
this.defaults = {};
|
||||
this.config = {};
|
||||
}
|
||||
|
||||
process(options) {
|
||||
// TODO: change this for webpack 4: options = Object.assign({}, options);
|
||||
for(let name in this.defaults) {
|
||||
switch(this.config[name]) {
|
||||
case undefined:
|
||||
if(getProperty(options, name) === undefined)
|
||||
setProperty(options, name, this.defaults[name]);
|
||||
break;
|
||||
case "call":
|
||||
setProperty(options, name, this.defaults[name].call(this, getProperty(options, name), options), options);
|
||||
break;
|
||||
case "make":
|
||||
if(getProperty(options, name) === undefined)
|
||||
setProperty(options, name, this.defaults[name].call(this, options), options);
|
||||
break;
|
||||
case "append":
|
||||
{
|
||||
let oldValue = getProperty(options, name);
|
||||
if(!Array.isArray(oldValue)) oldValue = [];
|
||||
oldValue.push.apply(oldValue, this.defaults[name]);
|
||||
setProperty(options, name, oldValue);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new Error("OptionsDefaulter cannot process " + this.config[name]);
|
||||
}
|
||||
}
|
||||
// TODO: change this for webpack 4: return options;
|
||||
}
|
||||
|
||||
set(name, config, def) {
|
||||
if(arguments.length === 3) {
|
||||
this.defaults[name] = def;
|
||||
this.config[name] = config;
|
||||
} else {
|
||||
this.defaults[name] = config;
|
||||
delete this.config[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = OptionsDefaulter;
|
||||
1541
hGameTest/node_modules/webpack/lib/Parser.js
generated
vendored
Normal file
1541
hGameTest/node_modules/webpack/lib/Parser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user