summaryrefslogtreecommitdiffstats
path: root/node_modules/webpack/lib/dependencies
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/webpack/lib/dependencies')
-rw-r--r--node_modules/webpack/lib/dependencies/AMDDefineDependency.js137
-rw-r--r--node_modules/webpack/lib/dependencies/AMDDefineDependencyParserPlugin.js336
-rw-r--r--node_modules/webpack/lib/dependencies/AMDPlugin.js249
-rw-r--r--node_modules/webpack/lib/dependencies/AMDRequireArrayDependency.js49
-rw-r--r--node_modules/webpack/lib/dependencies/AMDRequireContextDependency.js20
-rw-r--r--node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlock.js47
-rw-r--r--node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js274
-rw-r--r--node_modules/webpack/lib/dependencies/AMDRequireDependency.js135
-rw-r--r--node_modules/webpack/lib/dependencies/AMDRequireItemDependency.js22
-rw-r--r--node_modules/webpack/lib/dependencies/CommonJsPlugin.js158
-rw-r--r--node_modules/webpack/lib/dependencies/CommonJsRequireContextDependency.js23
-rw-r--r--node_modules/webpack/lib/dependencies/CommonJsRequireDependency.js22
-rw-r--r--node_modules/webpack/lib/dependencies/CommonJsRequireDependencyParserPlugin.js138
-rw-r--r--node_modules/webpack/lib/dependencies/ConstDependency.js33
-rw-r--r--node_modules/webpack/lib/dependencies/ContextDependency.js68
-rw-r--r--node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js232
-rw-r--r--node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsId.js43
-rw-r--r--node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsRequireCall.js39
-rw-r--r--node_modules/webpack/lib/dependencies/ContextElementDependency.js21
-rw-r--r--node_modules/webpack/lib/dependencies/CriticalDependencyWarning.js20
-rw-r--r--node_modules/webpack/lib/dependencies/DelegatedExportsDependency.js33
-rw-r--r--node_modules/webpack/lib/dependencies/DelegatedSourceDependency.js18
-rw-r--r--node_modules/webpack/lib/dependencies/DependencyReference.js64
-rw-r--r--node_modules/webpack/lib/dependencies/DllEntryDependency.js20
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyAcceptDependency.js48
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyAcceptImportDependency.js23
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyCompatibilityDependency.js31
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyDetectionParserPlugin.js96
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyExportDependencyParserPlugin.js154
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyExportExpressionDependency.js58
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyExportHeaderDependency.js30
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency.js659
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyExportSpecifierDependency.js54
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyImportDependency.js109
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyImportDependencyParserPlugin.js222
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyImportSideEffectDependency.js31
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js163
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyInitDependency.js60
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyModulesPlugin.js143
-rw-r--r--node_modules/webpack/lib/dependencies/HarmonyTopLevelThisParserPlugin.js26
-rw-r--r--node_modules/webpack/lib/dependencies/ImportContextDependency.js23
-rw-r--r--node_modules/webpack/lib/dependencies/ImportDependenciesBlock.js18
-rw-r--r--node_modules/webpack/lib/dependencies/ImportDependency.js34
-rw-r--r--node_modules/webpack/lib/dependencies/ImportEagerDependency.js32
-rw-r--r--node_modules/webpack/lib/dependencies/ImportParserPlugin.js248
-rw-r--r--node_modules/webpack/lib/dependencies/ImportPlugin.js79
-rw-r--r--node_modules/webpack/lib/dependencies/ImportWeakDependency.js34
-rw-r--r--node_modules/webpack/lib/dependencies/JsonExportsDependency.js26
-rw-r--r--node_modules/webpack/lib/dependencies/LoaderDependency.js21
-rw-r--r--node_modules/webpack/lib/dependencies/LoaderPlugin.js115
-rw-r--r--node_modules/webpack/lib/dependencies/LocalModule.js23
-rw-r--r--node_modules/webpack/lib/dependencies/LocalModuleDependency.js28
-rw-r--r--node_modules/webpack/lib/dependencies/LocalModulesHelpers.js52
-rw-r--r--node_modules/webpack/lib/dependencies/ModuleDependency.js23
-rw-r--r--node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsId.js17
-rw-r--r--node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsRequireId.js17
-rw-r--r--node_modules/webpack/lib/dependencies/ModuleHotAcceptDependency.js23
-rw-r--r--node_modules/webpack/lib/dependencies/ModuleHotDeclineDependency.js23
-rw-r--r--node_modules/webpack/lib/dependencies/MultiEntryDependency.js25
-rw-r--r--node_modules/webpack/lib/dependencies/NullDependency.js20
-rw-r--r--node_modules/webpack/lib/dependencies/PrefetchDependency.js18
-rw-r--r--node_modules/webpack/lib/dependencies/RequireContextDependency.js22
-rw-r--r--node_modules/webpack/lib/dependencies/RequireContextDependencyParserPlugin.js56
-rw-r--r--node_modules/webpack/lib/dependencies/RequireContextPlugin.js143
-rw-r--r--node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlock.js33
-rw-r--r--node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js116
-rw-r--r--node_modules/webpack/lib/dependencies/RequireEnsureDependency.js58
-rw-r--r--node_modules/webpack/lib/dependencies/RequireEnsureItemDependency.js21
-rw-r--r--node_modules/webpack/lib/dependencies/RequireEnsurePlugin.js74
-rw-r--r--node_modules/webpack/lib/dependencies/RequireHeaderDependency.js26
-rw-r--r--node_modules/webpack/lib/dependencies/RequireIncludeDependency.js39
-rw-r--r--node_modules/webpack/lib/dependencies/RequireIncludeDependencyParserPlugin.js23
-rw-r--r--node_modules/webpack/lib/dependencies/RequireIncludePlugin.js61
-rw-r--r--node_modules/webpack/lib/dependencies/RequireResolveContextDependency.js23
-rw-r--r--node_modules/webpack/lib/dependencies/RequireResolveDependency.js22
-rw-r--r--node_modules/webpack/lib/dependencies/RequireResolveDependencyParserPlugin.js86
-rw-r--r--node_modules/webpack/lib/dependencies/RequireResolveHeaderDependency.js26
-rw-r--r--node_modules/webpack/lib/dependencies/SingleEntryDependency.js21
-rw-r--r--node_modules/webpack/lib/dependencies/SystemPlugin.js122
-rw-r--r--node_modules/webpack/lib/dependencies/UnsupportedDependency.js27
-rw-r--r--node_modules/webpack/lib/dependencies/WebAssemblyExportImportedDependency.js31
-rw-r--r--node_modules/webpack/lib/dependencies/WebAssemblyImportDependency.js54
-rw-r--r--node_modules/webpack/lib/dependencies/WebpackMissingModule.js20
-rw-r--r--node_modules/webpack/lib/dependencies/getFunctionExpression.js52
84 files changed, 0 insertions, 6163 deletions
diff --git a/node_modules/webpack/lib/dependencies/AMDDefineDependency.js b/node_modules/webpack/lib/dependencies/AMDDefineDependency.js
deleted file mode 100644
index fcec365..0000000
--- a/node_modules/webpack/lib/dependencies/AMDDefineDependency.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const NullDependency = require("./NullDependency");
-
-class AMDDefineDependency extends NullDependency {
- constructor(range, arrayRange, functionRange, objectRange, namedModule) {
- super();
- this.range = range;
- this.arrayRange = arrayRange;
- this.functionRange = functionRange;
- this.objectRange = objectRange;
- this.namedModule = namedModule;
- this.localModule = null;
- }
-
- get type() {
- return "amd define";
- }
-}
-
-AMDDefineDependency.Template = class AMDDefineDependencyTemplate {
- get definitions() {
- return {
- f: [
- "var __WEBPACK_AMD_DEFINE_RESULT__;",
- `!(__WEBPACK_AMD_DEFINE_RESULT__ = (#).call(exports, __webpack_require__, exports, module),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`
- ],
- o: ["", "!(module.exports = #)"],
- of: [
- "var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;",
- `!(__WEBPACK_AMD_DEFINE_FACTORY__ = (#),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
- __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`
- ],
- af: [
- "var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;",
- `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_RESULT__ = (#).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`
- ],
- ao: ["", "!(#, module.exports = #)"],
- aof: [
- "var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;",
- `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_FACTORY__ = (#),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`
- ],
- lf: [
- "var XXX, XXXmodule;",
- "!(XXXmodule = { id: YYY, exports: {}, loaded: false }, XXX = #.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule), XXXmodule.loaded = true, XXX === undefined && (XXX = XXXmodule.exports))"
- ],
- lo: ["var XXX;", "!(XXX = #)"],
- lof: [
- "var XXX, XXXfactory, XXXmodule;",
- "!(XXXfactory = (#), (XXXmodule = { id: YYY, exports: {}, loaded: false }), XXX = (typeof XXXfactory === 'function' ? (XXXfactory.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule)) : XXXfactory), (XXXmodule.loaded = true), XXX === undefined && (XXX = XXXmodule.exports))"
- ],
- laf: [
- "var __WEBPACK_AMD_DEFINE_ARRAY__, XXX;",
- "!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, XXX = ((#).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)))"
- ],
- lao: ["var XXX;", "!(#, XXX = #)"],
- laof: [
- "var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_FACTORY__, XXX;",
- `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_FACTORY__ = (#),
- XXX = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__))`
- ]
- };
- }
-
- apply(dependency, source) {
- const branch = this.branch(dependency);
- const defAndText = this.definitions[branch];
- const definitions = defAndText[0];
- const text = defAndText[1];
- this.replace(dependency, source, definitions, text);
- }
-
- localModuleVar(dependency) {
- return (
- dependency.localModule &&
- dependency.localModule.used &&
- dependency.localModule.variableName()
- );
- }
-
- branch(dependency) {
- const localModuleVar = this.localModuleVar(dependency) ? "l" : "";
- const arrayRange = dependency.arrayRange ? "a" : "";
- const objectRange = dependency.objectRange ? "o" : "";
- const functionRange = dependency.functionRange ? "f" : "";
- return localModuleVar + arrayRange + objectRange + functionRange;
- }
-
- replace(dependency, source, definition, text) {
- const localModuleVar = this.localModuleVar(dependency);
- if (localModuleVar) {
- text = text.replace(/XXX/g, localModuleVar.replace(/\$/g, "$$$$"));
- definition = definition.replace(
- /XXX/g,
- localModuleVar.replace(/\$/g, "$$$$")
- );
- }
-
- if (dependency.namedModule) {
- text = text.replace(/YYY/g, JSON.stringify(dependency.namedModule));
- }
-
- const texts = text.split("#");
-
- if (definition) source.insert(0, definition);
-
- let current = dependency.range[0];
- if (dependency.arrayRange) {
- source.replace(current, dependency.arrayRange[0] - 1, texts.shift());
- current = dependency.arrayRange[1];
- }
-
- if (dependency.objectRange) {
- source.replace(current, dependency.objectRange[0] - 1, texts.shift());
- current = dependency.objectRange[1];
- } else if (dependency.functionRange) {
- source.replace(current, dependency.functionRange[0] - 1, texts.shift());
- current = dependency.functionRange[1];
- }
- source.replace(current, dependency.range[1] - 1, texts.shift());
- if (texts.length > 0) throw new Error("Implementation error");
- }
-};
-
-module.exports = AMDDefineDependency;
diff --git a/node_modules/webpack/lib/dependencies/AMDDefineDependencyParserPlugin.js b/node_modules/webpack/lib/dependencies/AMDDefineDependencyParserPlugin.js
deleted file mode 100644
index 99a1528..0000000
--- a/node_modules/webpack/lib/dependencies/AMDDefineDependencyParserPlugin.js
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const AMDRequireItemDependency = require("./AMDRequireItemDependency");
-const AMDRequireContextDependency = require("./AMDRequireContextDependency");
-const ConstDependency = require("./ConstDependency");
-const AMDDefineDependency = require("./AMDDefineDependency");
-const AMDRequireArrayDependency = require("./AMDRequireArrayDependency");
-const LocalModuleDependency = require("./LocalModuleDependency");
-const ContextDependencyHelpers = require("./ContextDependencyHelpers");
-const LocalModulesHelpers = require("./LocalModulesHelpers");
-
-const isBoundFunctionExpression = expr => {
- if (expr.type !== "CallExpression") return false;
- if (expr.callee.type !== "MemberExpression") return false;
- if (expr.callee.computed) return false;
- if (expr.callee.object.type !== "FunctionExpression") return false;
- if (expr.callee.property.type !== "Identifier") return false;
- if (expr.callee.property.name !== "bind") return false;
- return true;
-};
-
-const isUnboundFunctionExpression = expr => {
- if (expr.type === "FunctionExpression") return true;
- if (expr.type === "ArrowFunctionExpression") return true;
- return false;
-};
-
-const isCallable = expr => {
- if (isUnboundFunctionExpression(expr)) return true;
- if (isBoundFunctionExpression(expr)) return true;
- return false;
-};
-
-class AMDDefineDependencyParserPlugin {
- constructor(options) {
- this.options = options;
- }
-
- apply(parser) {
- parser.hooks.call
- .for("define")
- .tap(
- "AMDDefineDependencyParserPlugin",
- this.processCallDefine.bind(this, parser)
- );
- }
-
- processArray(parser, expr, param, identifiers, namedModule) {
- if (param.isArray()) {
- param.items.forEach((param, idx) => {
- if (
- param.isString() &&
- ["require", "module", "exports"].includes(param.string)
- )
- identifiers[idx] = param.string;
- const result = this.processItem(parser, expr, param, namedModule);
- if (result === undefined) {
- this.processContext(parser, expr, param);
- }
- });
- return true;
- } else if (param.isConstArray()) {
- const deps = [];
- param.array.forEach((request, idx) => {
- let dep;
- let localModule;
- if (request === "require") {
- identifiers[idx] = request;
- dep = "__webpack_require__";
- } else if (["exports", "module"].includes(request)) {
- identifiers[idx] = request;
- dep = request;
- } else if (
- (localModule = LocalModulesHelpers.getLocalModule(
- parser.state,
- request
- ))
- ) {
- dep = new LocalModuleDependency(localModule, undefined, false);
- dep.loc = expr.loc;
- parser.state.current.addDependency(dep);
- } else {
- dep = this.newRequireItemDependency(request);
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- parser.state.current.addDependency(dep);
- }
- deps.push(dep);
- });
- const dep = this.newRequireArrayDependency(deps, param.range);
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- parser.state.current.addDependency(dep);
- return true;
- }
- }
- processItem(parser, expr, param, namedModule) {
- if (param.isConditional()) {
- param.options.forEach(param => {
- const result = this.processItem(parser, expr, param);
- if (result === undefined) {
- this.processContext(parser, expr, param);
- }
- });
- return true;
- } else if (param.isString()) {
- let dep, localModule;
- if (param.string === "require") {
- dep = new ConstDependency("__webpack_require__", param.range);
- } else if (["require", "exports", "module"].includes(param.string)) {
- dep = new ConstDependency(param.string, param.range);
- } else if (
- (localModule = LocalModulesHelpers.getLocalModule(
- parser.state,
- param.string,
- namedModule
- ))
- ) {
- dep = new LocalModuleDependency(localModule, param.range, false);
- } else {
- dep = this.newRequireItemDependency(param.string, param.range);
- }
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- parser.state.current.addDependency(dep);
- return true;
- }
- }
- processContext(parser, expr, param) {
- const dep = ContextDependencyHelpers.create(
- AMDRequireContextDependency,
- param.range,
- param,
- expr,
- this.options,
- {},
- parser
- );
- if (!dep) return;
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- parser.state.current.addDependency(dep);
- return true;
- }
-
- processCallDefine(parser, expr) {
- let array, fn, obj, namedModule;
- switch (expr.arguments.length) {
- case 1:
- if (isCallable(expr.arguments[0])) {
- // define(f() {…})
- fn = expr.arguments[0];
- } else if (expr.arguments[0].type === "ObjectExpression") {
- // define({…})
- obj = expr.arguments[0];
- } else {
- // define(expr)
- // unclear if function or object
- obj = fn = expr.arguments[0];
- }
- break;
- case 2:
- if (expr.arguments[0].type === "Literal") {
- namedModule = expr.arguments[0].value;
- // define("…", …)
- if (isCallable(expr.arguments[1])) {
- // define("…", f() {…})
- fn = expr.arguments[1];
- } else if (expr.arguments[1].type === "ObjectExpression") {
- // define("…", {…})
- obj = expr.arguments[1];
- } else {
- // define("…", expr)
- // unclear if function or object
- obj = fn = expr.arguments[1];
- }
- } else {
- array = expr.arguments[0];
- if (isCallable(expr.arguments[1])) {
- // define([…], f() {})
- fn = expr.arguments[1];
- } else if (expr.arguments[1].type === "ObjectExpression") {
- // define([…], {…})
- obj = expr.arguments[1];
- } else {
- // define([…], expr)
- // unclear if function or object
- obj = fn = expr.arguments[1];
- }
- }
- break;
- case 3:
- // define("…", […], f() {…})
- namedModule = expr.arguments[0].value;
- array = expr.arguments[1];
- if (isCallable(expr.arguments[2])) {
- // define("…", […], f() {})
- fn = expr.arguments[2];
- } else if (expr.arguments[2].type === "ObjectExpression") {
- // define("…", […], {…})
- obj = expr.arguments[2];
- } else {
- // define("…", […], expr)
- // unclear if function or object
- obj = fn = expr.arguments[2];
- }
- break;
- default:
- return;
- }
- let fnParams = null;
- let fnParamsOffset = 0;
- if (fn) {
- if (isUnboundFunctionExpression(fn)) {
- fnParams = fn.params;
- } else if (isBoundFunctionExpression(fn)) {
- fnParams = fn.callee.object.params;
- fnParamsOffset = fn.arguments.length - 1;
- if (fnParamsOffset < 0) {
- fnParamsOffset = 0;
- }
- }
- }
- let fnRenames = parser.scope.renames.createChild();
- if (array) {
- const identifiers = {};
- const param = parser.evaluateExpression(array);
- const result = this.processArray(
- parser,
- expr,
- param,
- identifiers,
- namedModule
- );
- if (!result) return;
- if (fnParams) {
- fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => {
- if (identifiers[idx]) {
- fnRenames.set(param.name, identifiers[idx]);
- return false;
- }
- return true;
- });
- }
- } else {
- const identifiers = ["require", "exports", "module"];
- if (fnParams) {
- fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => {
- if (identifiers[idx]) {
- fnRenames.set(param.name, identifiers[idx]);
- return false;
- }
- return true;
- });
- }
- }
- let inTry;
- if (fn && isUnboundFunctionExpression(fn)) {
- inTry = parser.scope.inTry;
- parser.inScope(fnParams, () => {
- parser.scope.renames = fnRenames;
- parser.scope.inTry = inTry;
- if (fn.body.type === "BlockStatement") {
- parser.walkStatement(fn.body);
- } else {
- parser.walkExpression(fn.body);
- }
- });
- } else if (fn && isBoundFunctionExpression(fn)) {
- inTry = parser.scope.inTry;
- parser.inScope(
- fn.callee.object.params.filter(
- i => !["require", "module", "exports"].includes(i.name)
- ),
- () => {
- parser.scope.renames = fnRenames;
- parser.scope.inTry = inTry;
- if (fn.callee.object.body.type === "BlockStatement") {
- parser.walkStatement(fn.callee.object.body);
- } else {
- parser.walkExpression(fn.callee.object.body);
- }
- }
- );
- if (fn.arguments) {
- parser.walkExpressions(fn.arguments);
- }
- } else if (fn || obj) {
- parser.walkExpression(fn || obj);
- }
-
- const dep = this.newDefineDependency(
- expr.range,
- array ? array.range : null,
- fn ? fn.range : null,
- obj ? obj.range : null,
- namedModule ? namedModule : null
- );
- dep.loc = expr.loc;
- if (namedModule) {
- dep.localModule = LocalModulesHelpers.addLocalModule(
- parser.state,
- namedModule
- );
- }
- parser.state.current.addDependency(dep);
- return true;
- }
-
- newDefineDependency(
- range,
- arrayRange,
- functionRange,
- objectRange,
- namedModule
- ) {
- return new AMDDefineDependency(
- range,
- arrayRange,
- functionRange,
- objectRange,
- namedModule
- );
- }
- newRequireArrayDependency(depsArray, range) {
- return new AMDRequireArrayDependency(depsArray, range);
- }
- newRequireItemDependency(request, range) {
- return new AMDRequireItemDependency(request, range);
- }
-}
-module.exports = AMDDefineDependencyParserPlugin;
diff --git a/node_modules/webpack/lib/dependencies/AMDPlugin.js b/node_modules/webpack/lib/dependencies/AMDPlugin.js
deleted file mode 100644
index d113491..0000000
--- a/node_modules/webpack/lib/dependencies/AMDPlugin.js
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const path = require("path");
-const AMDRequireDependency = require("./AMDRequireDependency");
-const AMDRequireItemDependency = require("./AMDRequireItemDependency");
-const AMDRequireArrayDependency = require("./AMDRequireArrayDependency");
-const AMDRequireContextDependency = require("./AMDRequireContextDependency");
-const AMDDefineDependency = require("./AMDDefineDependency");
-const UnsupportedDependency = require("./UnsupportedDependency");
-const LocalModuleDependency = require("./LocalModuleDependency");
-
-const NullFactory = require("../NullFactory");
-
-const AMDRequireDependenciesBlockParserPlugin = require("./AMDRequireDependenciesBlockParserPlugin");
-const AMDDefineDependencyParserPlugin = require("./AMDDefineDependencyParserPlugin");
-
-const AliasPlugin = require("enhanced-resolve/lib/AliasPlugin");
-
-const ParserHelpers = require("../ParserHelpers");
-
-class AMDPlugin {
- constructor(options, amdOptions) {
- this.amdOptions = amdOptions;
- this.options = options;
- }
-
- apply(compiler) {
- const options = this.options;
- const amdOptions = this.amdOptions;
- compiler.hooks.compilation.tap(
- "AMDPlugin",
- (compilation, { contextModuleFactory, normalModuleFactory }) => {
- compilation.dependencyFactories.set(
- AMDRequireDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- AMDRequireDependency,
- new AMDRequireDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- AMDRequireItemDependency,
- normalModuleFactory
- );
- compilation.dependencyTemplates.set(
- AMDRequireItemDependency,
- new AMDRequireItemDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- AMDRequireArrayDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- AMDRequireArrayDependency,
- new AMDRequireArrayDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- AMDRequireContextDependency,
- contextModuleFactory
- );
- compilation.dependencyTemplates.set(
- AMDRequireContextDependency,
- new AMDRequireContextDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- AMDDefineDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- AMDDefineDependency,
- new AMDDefineDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- UnsupportedDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- UnsupportedDependency,
- new UnsupportedDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- LocalModuleDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- LocalModuleDependency,
- new LocalModuleDependency.Template()
- );
-
- const handler = (parser, parserOptions) => {
- if (parserOptions.amd !== undefined && !parserOptions.amd) return;
-
- const setExpressionToModule = (outerExpr, module) => {
- parser.hooks.expression.for(outerExpr).tap("AMDPlugin", expr => {
- const dep = new AMDRequireItemDependency(module, expr.range);
- dep.userRequest = outerExpr;
- dep.loc = expr.loc;
- parser.state.current.addDependency(dep);
- return true;
- });
- };
-
- new AMDRequireDependenciesBlockParserPlugin(options).apply(parser);
- new AMDDefineDependencyParserPlugin(options).apply(parser);
-
- setExpressionToModule("require.amd", "!!webpack amd options");
- setExpressionToModule("define.amd", "!!webpack amd options");
- setExpressionToModule("define", "!!webpack amd define");
-
- parser.hooks.expression
- .for("__webpack_amd_options__")
- .tap("AMDPlugin", () =>
- parser.state.current.addVariable(
- "__webpack_amd_options__",
- JSON.stringify(amdOptions)
- )
- );
- parser.hooks.evaluateTypeof
- .for("define.amd")
- .tap(
- "AMDPlugin",
- ParserHelpers.evaluateToString(typeof amdOptions)
- );
- parser.hooks.evaluateTypeof
- .for("require.amd")
- .tap(
- "AMDPlugin",
- ParserHelpers.evaluateToString(typeof amdOptions)
- );
- parser.hooks.evaluateIdentifier
- .for("define.amd")
- .tap(
- "AMDPlugin",
- ParserHelpers.evaluateToIdentifier("define.amd", true)
- );
- parser.hooks.evaluateIdentifier
- .for("require.amd")
- .tap(
- "AMDPlugin",
- ParserHelpers.evaluateToIdentifier("require.amd", true)
- );
- parser.hooks.typeof
- .for("define")
- .tap(
- "AMDPlugin",
- ParserHelpers.toConstantDependency(
- parser,
- JSON.stringify("function")
- )
- );
- parser.hooks.evaluateTypeof
- .for("define")
- .tap("AMDPlugin", ParserHelpers.evaluateToString("function"));
- parser.hooks.canRename
- .for("define")
- .tap("AMDPlugin", ParserHelpers.approve);
- parser.hooks.rename.for("define").tap("AMDPlugin", expr => {
- const dep = new AMDRequireItemDependency(
- "!!webpack amd define",
- expr.range
- );
- dep.userRequest = "define";
- dep.loc = expr.loc;
- parser.state.current.addDependency(dep);
- return false;
- });
- parser.hooks.typeof
- .for("require")
- .tap(
- "AMDPlugin",
- ParserHelpers.toConstantDependency(
- parser,
- JSON.stringify("function")
- )
- );
- parser.hooks.evaluateTypeof
- .for("require")
- .tap("AMDPlugin", ParserHelpers.evaluateToString("function"));
- };
-
- normalModuleFactory.hooks.parser
- .for("javascript/auto")
- .tap("AMDPlugin", handler);
- normalModuleFactory.hooks.parser
- .for("javascript/dynamic")
- .tap("AMDPlugin", handler);
- }
- );
- compiler.hooks.afterResolvers.tap("AMDPlugin", () => {
- compiler.resolverFactory.hooks.resolver
- .for("normal")
- .tap("AMDPlugin", resolver => {
- new AliasPlugin(
- "described-resolve",
- {
- name: "amdefine",
- alias: path.join(
- __dirname,
- "..",
- "..",
- "buildin",
- "amd-define.js"
- )
- },
- "resolve"
- ).apply(resolver);
- new AliasPlugin(
- "described-resolve",
- {
- name: "webpack amd options",
- alias: path.join(
- __dirname,
- "..",
- "..",
- "buildin",
- "amd-options.js"
- )
- },
- "resolve"
- ).apply(resolver);
- new AliasPlugin(
- "described-resolve",
- {
- name: "webpack amd define",
- alias: path.join(
- __dirname,
- "..",
- "..",
- "buildin",
- "amd-define.js"
- )
- },
- "resolve"
- ).apply(resolver);
- });
- });
- }
-}
-module.exports = AMDPlugin;
diff --git a/node_modules/webpack/lib/dependencies/AMDRequireArrayDependency.js b/node_modules/webpack/lib/dependencies/AMDRequireArrayDependency.js
deleted file mode 100644
index ddb9c29..0000000
--- a/node_modules/webpack/lib/dependencies/AMDRequireArrayDependency.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const Dependency = require("../Dependency");
-
-class AMDRequireArrayDependency extends Dependency {
- constructor(depsArray, range) {
- super();
- this.depsArray = depsArray;
- this.range = range;
- }
-
- get type() {
- return "amd require array";
- }
-}
-
-AMDRequireArrayDependency.Template = class AMDRequireArrayDependencyTemplate {
- apply(dep, source, runtime) {
- const content = this.getContent(dep, runtime);
- source.replace(dep.range[0], dep.range[1] - 1, content);
- }
-
- getContent(dep, runtime) {
- const requires = dep.depsArray.map(dependency => {
- return this.contentForDependency(dependency, runtime);
- });
- return `[${requires.join(", ")}]`;
- }
-
- contentForDependency(dep, runtime) {
- if (typeof dep === "string") {
- return dep;
- }
-
- if (dep.localModule) {
- return dep.localModule.variableName();
- } else {
- return runtime.moduleExports({
- module: dep.module,
- request: dep.request
- });
- }
- }
-};
-
-module.exports = AMDRequireArrayDependency;
diff --git a/node_modules/webpack/lib/dependencies/AMDRequireContextDependency.js b/node_modules/webpack/lib/dependencies/AMDRequireContextDependency.js
deleted file mode 100644
index b2e60b5..0000000
--- a/node_modules/webpack/lib/dependencies/AMDRequireContextDependency.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const ContextDependency = require("./ContextDependency");
-class AMDRequireContextDependency extends ContextDependency {
- constructor(options, range, valueRange) {
- super(options);
- this.range = range;
- this.valueRange = valueRange;
- }
-
- get type() {
- return "amd require context";
- }
-}
-AMDRequireContextDependency.Template = require("./ContextDependencyTemplateAsRequireCall");
-module.exports = AMDRequireContextDependency;
diff --git a/node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlock.js b/node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlock.js
deleted file mode 100644
index bd7e7b8..0000000
--- a/node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlock.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
-const AMDRequireDependency = require("./AMDRequireDependency");
-
-module.exports = class AMDRequireDependenciesBlock extends AsyncDependenciesBlock {
- constructor(
- expr,
- arrayRange,
- functionRange,
- errorCallbackRange,
- module,
- loc,
- request
- ) {
- super(null, module, loc, request);
- this.expr = expr;
- this.outerRange = expr.range;
- this.arrayRange = arrayRange;
- this.functionBindThis = false;
- this.functionRange = functionRange;
- this.errorCallbackBindThis = false;
- this.errorCallbackRange = errorCallbackRange;
- this.bindThis = true;
- if (arrayRange && functionRange && errorCallbackRange) {
- this.range = [arrayRange[0], errorCallbackRange[1]];
- } else if (arrayRange && functionRange) {
- this.range = [arrayRange[0], functionRange[1]];
- } else if (arrayRange) {
- this.range = arrayRange;
- } else if (functionRange) {
- this.range = functionRange;
- } else {
- this.range = expr.range;
- }
- const dep = this.newRequireDependency();
- dep.loc = loc;
- this.addDependency(dep);
- }
-
- newRequireDependency() {
- return new AMDRequireDependency(this);
- }
-};
diff --git a/node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js b/node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js
deleted file mode 100644
index ea52d81..0000000
--- a/node_modules/webpack/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const AMDRequireItemDependency = require("./AMDRequireItemDependency");
-const AMDRequireArrayDependency = require("./AMDRequireArrayDependency");
-const AMDRequireContextDependency = require("./AMDRequireContextDependency");
-const AMDRequireDependenciesBlock = require("./AMDRequireDependenciesBlock");
-const UnsupportedDependency = require("./UnsupportedDependency");
-const LocalModuleDependency = require("./LocalModuleDependency");
-const ContextDependencyHelpers = require("./ContextDependencyHelpers");
-const LocalModulesHelpers = require("./LocalModulesHelpers");
-const ConstDependency = require("./ConstDependency");
-const getFunctionExpression = require("./getFunctionExpression");
-const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
-
-class AMDRequireDependenciesBlockParserPlugin {
- constructor(options) {
- this.options = options;
- }
-
- processFunctionArgument(parser, expression) {
- let bindThis = true;
- const fnData = getFunctionExpression(expression);
- if (fnData) {
- parser.inScope(
- fnData.fn.params.filter(i => {
- return !["require", "module", "exports"].includes(i.name);
- }),
- () => {
- if (fnData.fn.body.type === "BlockStatement") {
- parser.walkStatement(fnData.fn.body);
- } else {
- parser.walkExpression(fnData.fn.body);
- }
- }
- );
- parser.walkExpressions(fnData.expressions);
- if (fnData.needThis === false) {
- bindThis = false;
- }
- } else {
- parser.walkExpression(expression);
- }
- return bindThis;
- }
-
- apply(parser) {
- parser.hooks.call
- .for("require")
- .tap(
- "AMDRequireDependenciesBlockParserPlugin",
- this.processCallRequire.bind(this, parser)
- );
- }
-
- processArray(parser, expr, param) {
- if (param.isArray()) {
- for (const p of param.items) {
- const result = this.processItem(parser, expr, p);
- if (result === undefined) {
- this.processContext(parser, expr, p);
- }
- }
- return true;
- } else if (param.isConstArray()) {
- const deps = [];
- for (const request of param.array) {
- let dep, localModule;
- if (request === "require") {
- dep = "__webpack_require__";
- } else if (["exports", "module"].includes(request)) {
- dep = request;
- } else if (
- (localModule = LocalModulesHelpers.getLocalModule(
- parser.state,
- request
- ))
- ) {
- dep = new LocalModuleDependency(localModule, undefined, false);
- dep.loc = expr.loc;
- parser.state.current.addDependency(dep);
- } else {
- dep = this.newRequireItemDependency(request);
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- parser.state.current.addDependency(dep);
- }
- deps.push(dep);
- }
- const dep = this.newRequireArrayDependency(deps, param.range);
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- parser.state.current.addDependency(dep);
- return true;
- }
- }
- processItem(parser, expr, param) {
- if (param.isConditional()) {
- for (const p of param.options) {
- const result = this.processItem(parser, expr, p);
- if (result === undefined) {
- this.processContext(parser, expr, p);
- }
- }
- return true;
- } else if (param.isString()) {
- let dep, localModule;
- if (param.string === "require") {
- dep = new ConstDependency("__webpack_require__", param.string);
- } else if (param.string === "module") {
- dep = new ConstDependency(
- parser.state.module.buildInfo.moduleArgument,
- param.range
- );
- } else if (param.string === "exports") {
- dep = new ConstDependency(
- parser.state.module.buildInfo.exportsArgument,
- param.range
- );
- } else if (
- (localModule = LocalModulesHelpers.getLocalModule(
- parser.state,
- param.string
- ))
- ) {
- dep = new LocalModuleDependency(localModule, param.range, false);
- } else {
- dep = this.newRequireItemDependency(param.string, param.range);
- }
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- parser.state.current.addDependency(dep);
- return true;
- }
- }
- processContext(parser, expr, param) {
- const dep = ContextDependencyHelpers.create(
- AMDRequireContextDependency,
- param.range,
- param,
- expr,
- this.options,
- {},
- parser
- );
- if (!dep) return;
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- parser.state.current.addDependency(dep);
- return true;
- }
-
- processArrayForRequestString(param) {
- if (param.isArray()) {
- const result = param.items.map(item =>
- this.processItemForRequestString(item)
- );
- if (result.every(Boolean)) return result.join(" ");
- } else if (param.isConstArray()) {
- return param.array.join(" ");
- }
- }
-
- processItemForRequestString(param) {
- if (param.isConditional()) {
- const result = param.options.map(item =>
- this.processItemForRequestString(item)
- );
- if (result.every(Boolean)) return result.join("|");
- } else if (param.isString()) {
- return param.string;
- }
- }
-
- processCallRequire(parser, expr) {
- let param;
- let dep;
- let result;
-
- const old = parser.state.current;
-
- if (expr.arguments.length >= 1) {
- param = parser.evaluateExpression(expr.arguments[0]);
- dep = this.newRequireDependenciesBlock(
- expr,
- param.range,
- expr.arguments.length > 1 ? expr.arguments[1].range : null,
- expr.arguments.length > 2 ? expr.arguments[2].range : null,
- parser.state.module,
- expr.loc,
- this.processArrayForRequestString(param)
- );
- parser.state.current = dep;
- }
-
- if (expr.arguments.length === 1) {
- parser.inScope([], () => {
- result = this.processArray(parser, expr, param);
- });
- parser.state.current = old;
- if (!result) return;
- parser.state.current.addBlock(dep);
- return true;
- }
-
- if (expr.arguments.length === 2 || expr.arguments.length === 3) {
- try {
- parser.inScope([], () => {
- result = this.processArray(parser, expr, param);
- });
- if (!result) {
- dep = new UnsupportedDependency("unsupported", expr.range);
- old.addDependency(dep);
- if (parser.state.module) {
- parser.state.module.errors.push(
- new UnsupportedFeatureWarning(
- parser.state.module,
- "Cannot statically analyse 'require(…, …)' in line " +
- expr.loc.start.line,
- expr.loc
- )
- );
- }
- dep = null;
- return true;
- }
- dep.functionBindThis = this.processFunctionArgument(
- parser,
- expr.arguments[1]
- );
- if (expr.arguments.length === 3) {
- dep.errorCallbackBindThis = this.processFunctionArgument(
- parser,
- expr.arguments[2]
- );
- }
- } finally {
- parser.state.current = old;
- if (dep) parser.state.current.addBlock(dep);
- }
- return true;
- }
- }
-
- newRequireDependenciesBlock(
- expr,
- arrayRange,
- functionRange,
- errorCallbackRange,
- module,
- loc,
- request
- ) {
- return new AMDRequireDependenciesBlock(
- expr,
- arrayRange,
- functionRange,
- errorCallbackRange,
- module,
- loc,
- request
- );
- }
- newRequireItemDependency(request, range) {
- return new AMDRequireItemDependency(request, range);
- }
- newRequireArrayDependency(depsArray, range) {
- return new AMDRequireArrayDependency(depsArray, range);
- }
-}
-module.exports = AMDRequireDependenciesBlockParserPlugin;
diff --git a/node_modules/webpack/lib/dependencies/AMDRequireDependency.js b/node_modules/webpack/lib/dependencies/AMDRequireDependency.js
deleted file mode 100644
index fd514e2..0000000
--- a/node_modules/webpack/lib/dependencies/AMDRequireDependency.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const NullDependency = require("./NullDependency");
-
-class AMDRequireDependency extends NullDependency {
- constructor(block) {
- super();
- this.block = block;
- }
-}
-
-AMDRequireDependency.Template = class AMDRequireDependencyTemplate {
- apply(dep, source, runtime) {
- const depBlock = dep.block;
- const promise = runtime.blockPromise({
- block: depBlock,
- message: "AMD require"
- });
-
- // has array range but no function range
- if (depBlock.arrayRange && !depBlock.functionRange) {
- const startBlock = `${promise}.then(function() {`;
- const endBlock = `;}).catch(${runtime.onError()})`;
- source.replace(
- depBlock.outerRange[0],
- depBlock.arrayRange[0] - 1,
- startBlock
- );
- source.replace(
- depBlock.arrayRange[1],
- depBlock.outerRange[1] - 1,
- endBlock
- );
- return;
- }
-
- // has function range but no array range
- if (depBlock.functionRange && !depBlock.arrayRange) {
- const startBlock = `${promise}.then((`;
- const endBlock = `).bind(exports, __webpack_require__, exports, module)).catch(${runtime.onError()})`;
- source.replace(
- depBlock.outerRange[0],
- depBlock.functionRange[0] - 1,
- startBlock
- );
- source.replace(
- depBlock.functionRange[1],
- depBlock.outerRange[1] - 1,
- endBlock
- );
- return;
- }
-
- // has array range, function range, and errorCallbackRange
- if (
- depBlock.arrayRange &&
- depBlock.functionRange &&
- depBlock.errorCallbackRange
- ) {
- const startBlock = `${promise}.then(function() { `;
- const errorRangeBlock = `}${
- depBlock.functionBindThis ? ".bind(this)" : ""
- }).catch(`;
- const endBlock = `${
- depBlock.errorCallbackBindThis ? ".bind(this)" : ""
- })`;
-
- source.replace(
- depBlock.outerRange[0],
- depBlock.arrayRange[0] - 1,
- startBlock
- );
- source.insert(
- depBlock.arrayRange[0] + 0.9,
- "var __WEBPACK_AMD_REQUIRE_ARRAY__ = "
- );
- source.replace(
- depBlock.arrayRange[1],
- depBlock.functionRange[0] - 1,
- "; ("
- );
- source.insert(
- depBlock.functionRange[1],
- ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);"
- );
- source.replace(
- depBlock.functionRange[1],
- depBlock.errorCallbackRange[0] - 1,
- errorRangeBlock
- );
- source.replace(
- depBlock.errorCallbackRange[1],
- depBlock.outerRange[1] - 1,
- endBlock
- );
- return;
- }
-
- // has array range, function range, but no errorCallbackRange
- if (depBlock.arrayRange && depBlock.functionRange) {
- const startBlock = `${promise}.then(function() { `;
- const endBlock = `}${
- depBlock.functionBindThis ? ".bind(this)" : ""
- }).catch(${runtime.onError()})`;
- source.replace(
- depBlock.outerRange[0],
- depBlock.arrayRange[0] - 1,
- startBlock
- );
- source.insert(
- depBlock.arrayRange[0] + 0.9,
- "var __WEBPACK_AMD_REQUIRE_ARRAY__ = "
- );
- source.replace(
- depBlock.arrayRange[1],
- depBlock.functionRange[0] - 1,
- "; ("
- );
- source.insert(
- depBlock.functionRange[1],
- ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);"
- );
- source.replace(
- depBlock.functionRange[1],
- depBlock.outerRange[1] - 1,
- endBlock
- );
- }
- }
-};
-
-module.exports = AMDRequireDependency;
diff --git a/node_modules/webpack/lib/dependencies/AMDRequireItemDependency.js b/node_modules/webpack/lib/dependencies/AMDRequireItemDependency.js
deleted file mode 100644
index d033a90..0000000
--- a/node_modules/webpack/lib/dependencies/AMDRequireItemDependency.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-const ModuleDependencyTemplateAsRequireId = require("./ModuleDependencyTemplateAsRequireId");
-
-class AMDRequireItemDependency extends ModuleDependency {
- constructor(request, range) {
- super(request);
- this.range = range;
- }
-
- get type() {
- return "amd require";
- }
-}
-
-AMDRequireItemDependency.Template = ModuleDependencyTemplateAsRequireId;
-
-module.exports = AMDRequireItemDependency;
diff --git a/node_modules/webpack/lib/dependencies/CommonJsPlugin.js b/node_modules/webpack/lib/dependencies/CommonJsPlugin.js
deleted file mode 100644
index 6d441a8..0000000
--- a/node_modules/webpack/lib/dependencies/CommonJsPlugin.js
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ConstDependency = require("./ConstDependency");
-const CommonJsRequireDependency = require("./CommonJsRequireDependency");
-const CommonJsRequireContextDependency = require("./CommonJsRequireContextDependency");
-const RequireResolveDependency = require("./RequireResolveDependency");
-const RequireResolveContextDependency = require("./RequireResolveContextDependency");
-const RequireResolveHeaderDependency = require("./RequireResolveHeaderDependency");
-const RequireHeaderDependency = require("./RequireHeaderDependency");
-
-const NullFactory = require("../NullFactory");
-
-const RequireResolveDependencyParserPlugin = require("./RequireResolveDependencyParserPlugin");
-const CommonJsRequireDependencyParserPlugin = require("./CommonJsRequireDependencyParserPlugin");
-
-const ParserHelpers = require("../ParserHelpers");
-
-class CommonJsPlugin {
- constructor(options) {
- this.options = options;
- }
-
- apply(compiler) {
- const options = this.options;
- compiler.hooks.compilation.tap(
- "CommonJsPlugin",
- (compilation, { contextModuleFactory, normalModuleFactory }) => {
- compilation.dependencyFactories.set(
- CommonJsRequireDependency,
- normalModuleFactory
- );
- compilation.dependencyTemplates.set(
- CommonJsRequireDependency,
- new CommonJsRequireDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- CommonJsRequireContextDependency,
- contextModuleFactory
- );
- compilation.dependencyTemplates.set(
- CommonJsRequireContextDependency,
- new CommonJsRequireContextDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- RequireResolveDependency,
- normalModuleFactory
- );
- compilation.dependencyTemplates.set(
- RequireResolveDependency,
- new RequireResolveDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- RequireResolveContextDependency,
- contextModuleFactory
- );
- compilation.dependencyTemplates.set(
- RequireResolveContextDependency,
- new RequireResolveContextDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- RequireResolveHeaderDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- RequireResolveHeaderDependency,
- new RequireResolveHeaderDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- RequireHeaderDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- RequireHeaderDependency,
- new RequireHeaderDependency.Template()
- );
-
- const handler = (parser, parserOptions) => {
- if (parserOptions.commonjs !== undefined && !parserOptions.commonjs)
- return;
-
- const requireExpressions = [
- "require",
- "require.resolve",
- "require.resolveWeak"
- ];
- for (let expression of requireExpressions) {
- parser.hooks.typeof
- .for(expression)
- .tap(
- "CommonJsPlugin",
- ParserHelpers.toConstantDependency(
- parser,
- JSON.stringify("function")
- )
- );
- parser.hooks.evaluateTypeof
- .for(expression)
- .tap(
- "CommonJsPlugin",
- ParserHelpers.evaluateToString("function")
- );
- parser.hooks.evaluateIdentifier
- .for(expression)
- .tap(
- "CommonJsPlugin",
- ParserHelpers.evaluateToIdentifier(expression, true)
- );
- }
-
- parser.hooks.evaluateTypeof
- .for("module")
- .tap("CommonJsPlugin", ParserHelpers.evaluateToString("object"));
- parser.hooks.assign.for("require").tap("CommonJsPlugin", expr => {
- // to not leak to global "require", we need to define a local require here.
- const dep = new ConstDependency("var require;", 0);
- dep.loc = expr.loc;
- parser.state.current.addDependency(dep);
- parser.scope.definitions.add("require");
- return true;
- });
- parser.hooks.canRename
- .for("require")
- .tap("CommonJsPlugin", () => true);
- parser.hooks.rename.for("require").tap("CommonJsPlugin", expr => {
- // define the require variable. It's still undefined, but not "not defined".
- const dep = new ConstDependency("var require;", 0);
- dep.loc = expr.loc;
- parser.state.current.addDependency(dep);
- return false;
- });
- parser.hooks.typeof.for("module").tap("CommonJsPlugin", () => true);
- parser.hooks.evaluateTypeof
- .for("exports")
- .tap("CommonJsPlugin", ParserHelpers.evaluateToString("object"));
-
- new CommonJsRequireDependencyParserPlugin(options).apply(parser);
- new RequireResolveDependencyParserPlugin(options).apply(parser);
- };
-
- normalModuleFactory.hooks.parser
- .for("javascript/auto")
- .tap("CommonJsPlugin", handler);
- normalModuleFactory.hooks.parser
- .for("javascript/dynamic")
- .tap("CommonJsPlugin", handler);
- }
- );
- }
-}
-module.exports = CommonJsPlugin;
diff --git a/node_modules/webpack/lib/dependencies/CommonJsRequireContextDependency.js b/node_modules/webpack/lib/dependencies/CommonJsRequireContextDependency.js
deleted file mode 100644
index 723a849..0000000
--- a/node_modules/webpack/lib/dependencies/CommonJsRequireContextDependency.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ContextDependency = require("./ContextDependency");
-const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");
-
-class CommonJsRequireContextDependency extends ContextDependency {
- constructor(options, range, valueRange) {
- super(options);
- this.range = range;
- this.valueRange = valueRange;
- }
-
- get type() {
- return "cjs require context";
- }
-}
-
-CommonJsRequireContextDependency.Template = ContextDependencyTemplateAsRequireCall;
-
-module.exports = CommonJsRequireContextDependency;
diff --git a/node_modules/webpack/lib/dependencies/CommonJsRequireDependency.js b/node_modules/webpack/lib/dependencies/CommonJsRequireDependency.js
deleted file mode 100644
index 29a30f3..0000000
--- a/node_modules/webpack/lib/dependencies/CommonJsRequireDependency.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-const ModuleDependencyTemplateAsId = require("./ModuleDependencyTemplateAsId");
-
-class CommonJsRequireDependency extends ModuleDependency {
- constructor(request, range) {
- super(request);
- this.range = range;
- }
-
- get type() {
- return "cjs require";
- }
-}
-
-CommonJsRequireDependency.Template = ModuleDependencyTemplateAsId;
-
-module.exports = CommonJsRequireDependency;
diff --git a/node_modules/webpack/lib/dependencies/CommonJsRequireDependencyParserPlugin.js b/node_modules/webpack/lib/dependencies/CommonJsRequireDependencyParserPlugin.js
deleted file mode 100644
index b0faa1a..0000000
--- a/node_modules/webpack/lib/dependencies/CommonJsRequireDependencyParserPlugin.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const CommonJsRequireDependency = require("./CommonJsRequireDependency");
-const CommonJsRequireContextDependency = require("./CommonJsRequireContextDependency");
-const RequireHeaderDependency = require("./RequireHeaderDependency");
-const LocalModuleDependency = require("./LocalModuleDependency");
-const ContextDependencyHelpers = require("./ContextDependencyHelpers");
-const LocalModulesHelpers = require("./LocalModulesHelpers");
-const ParserHelpers = require("../ParserHelpers");
-
-class CommonJsRequireDependencyParserPlugin {
- constructor(options) {
- this.options = options;
- }
-
- apply(parser) {
- const options = this.options;
-
- const processItem = (expr, param) => {
- if (param.isString()) {
- const dep = new CommonJsRequireDependency(param.string, param.range);
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- parser.state.current.addDependency(dep);
- return true;
- }
- };
- const processContext = (expr, param) => {
- const dep = ContextDependencyHelpers.create(
- CommonJsRequireContextDependency,
- expr.range,
- param,
- expr,
- options,
- {},
- parser
- );
- if (!dep) return;
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- parser.state.current.addDependency(dep);
- return true;
- };
-
- parser.hooks.expression
- .for("require.cache")
- .tap(
- "CommonJsRequireDependencyParserPlugin",
- ParserHelpers.toConstantDependencyWithWebpackRequire(
- parser,
- "__webpack_require__.c"
- )
- );
- parser.hooks.expression
- .for("require")
- .tap("CommonJsRequireDependencyParserPlugin", expr => {
- const dep = new CommonJsRequireContextDependency(
- {
- request: options.unknownContextRequest,
- recursive: options.unknownContextRecursive,
- regExp: options.unknownContextRegExp,
- mode: "sync"
- },
- expr.range
- );
- dep.critical =
- options.unknownContextCritical &&
- "require function is used in a way in which dependencies cannot be statically extracted";
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- parser.state.current.addDependency(dep);
- return true;
- });
-
- const createHandler = callNew => expr => {
- if (expr.arguments.length !== 1) return;
- let localModule;
- const param = parser.evaluateExpression(expr.arguments[0]);
- if (param.isConditional()) {
- let isExpression = false;
- const prevLength = parser.state.current.dependencies.length;
- const dep = new RequireHeaderDependency(expr.callee.range);
- dep.loc = expr.loc;
- parser.state.current.addDependency(dep);
- for (const p of param.options) {
- const result = processItem(expr, p);
- if (result === undefined) {
- isExpression = true;
- }
- }
- if (isExpression) {
- parser.state.current.dependencies.length = prevLength;
- } else {
- return true;
- }
- }
- if (
- param.isString() &&
- (localModule = LocalModulesHelpers.getLocalModule(
- parser.state,
- param.string
- ))
- ) {
- const dep = new LocalModuleDependency(localModule, expr.range, callNew);
- dep.loc = expr.loc;
- parser.state.current.addDependency(dep);
- return true;
- } else {
- const result = processItem(expr, param);
- if (result === undefined) {
- processContext(expr, param);
- } else {
- const dep = new RequireHeaderDependency(expr.callee.range);
- dep.loc = expr.loc;
- parser.state.current.addDependency(dep);
- }
- return true;
- }
- };
- parser.hooks.call
- .for("require")
- .tap("CommonJsRequireDependencyParserPlugin", createHandler(false));
- parser.hooks.new
- .for("require")
- .tap("CommonJsRequireDependencyParserPlugin", createHandler(true));
- parser.hooks.call
- .for("module.require")
- .tap("CommonJsRequireDependencyParserPlugin", createHandler(false));
- parser.hooks.new
- .for("module.require")
- .tap("CommonJsRequireDependencyParserPlugin", createHandler(true));
- }
-}
-module.exports = CommonJsRequireDependencyParserPlugin;
diff --git a/node_modules/webpack/lib/dependencies/ConstDependency.js b/node_modules/webpack/lib/dependencies/ConstDependency.js
deleted file mode 100644
index 22edb8e..0000000
--- a/node_modules/webpack/lib/dependencies/ConstDependency.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const NullDependency = require("./NullDependency");
-
-class ConstDependency extends NullDependency {
- constructor(expression, range, requireWebpackRequire) {
- super();
- this.expression = expression;
- this.range = range;
- this.requireWebpackRequire = requireWebpackRequire;
- }
-
- updateHash(hash) {
- hash.update(this.range + "");
- hash.update(this.expression + "");
- }
-}
-
-ConstDependency.Template = class ConstDependencyTemplate {
- apply(dep, source) {
- if (typeof dep.range === "number") {
- source.insert(dep.range, dep.expression);
- return;
- }
-
- source.replace(dep.range[0], dep.range[1] - 1, dep.expression);
- }
-};
-
-module.exports = ConstDependency;
diff --git a/node_modules/webpack/lib/dependencies/ContextDependency.js b/node_modules/webpack/lib/dependencies/ContextDependency.js
deleted file mode 100644
index 10c2fea..0000000
--- a/node_modules/webpack/lib/dependencies/ContextDependency.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const Dependency = require("../Dependency");
-const CriticalDependencyWarning = require("./CriticalDependencyWarning");
-
-const regExpToString = r => (r ? r + "" : "");
-
-class ContextDependency extends Dependency {
- // options: { request, recursive, regExp, include, exclude, mode, chunkName, groupOptions }
- constructor(options) {
- super();
- this.options = options;
- this.userRequest = this.options.request;
- /** @type {false | string} */
- this.critical = false;
- this.hadGlobalOrStickyRegExp = false;
- if (this.options.regExp.global || this.options.regExp.sticky) {
- this.options.regExp = null;
- this.hadGlobalOrStickyRegExp = true;
- }
- }
-
- getResourceIdentifier() {
- return (
- `context${this.options.request} ${this.options.recursive} ` +
- `${regExpToString(this.options.regExp)} ${regExpToString(
- this.options.include
- )} ${regExpToString(this.options.exclude)} ` +
- `${this.options.mode} ${this.options.chunkName} ` +
- `${JSON.stringify(this.options.groupOptions)}`
- );
- }
-
- getWarnings() {
- let warnings = super.getWarnings() || [];
- if (this.critical) {
- warnings.push(new CriticalDependencyWarning(this.critical));
- }
- if (this.hadGlobalOrStickyRegExp) {
- warnings.push(
- new CriticalDependencyWarning(
- "Contexts can't use RegExps with the 'g' or 'y' flags."
- )
- );
- }
- return warnings;
- }
-}
-
-// TODO remove in webpack 5
-Object.defineProperty(ContextDependency.prototype, "async", {
- configurable: false,
- get() {
- throw new Error(
- "ContextDependency.async was removed. Use ContextDependency.options.mode instead."
- );
- },
- set() {
- throw new Error(
- "ContextDependency.async was removed. Pass options.mode to constructor instead"
- );
- }
-});
-
-module.exports = ContextDependency;
diff --git a/node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js b/node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
deleted file mode 100644
index 377425b..0000000
--- a/node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const ContextDependencyHelpers = exports;
-
-/**
- * Escapes regular expression metacharacters
- * @param {string} str String to quote
- * @returns {string} Escaped string
- */
-const quotemeta = str => {
- return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
-};
-
-const splitContextFromPrefix = prefix => {
- const idx = prefix.lastIndexOf("/");
- let context = ".";
- if (idx >= 0) {
- context = prefix.substr(0, idx);
- prefix = `.${prefix.substr(idx)}`;
- }
- return {
- context,
- prefix
- };
-};
-
-const splitQueryFromPostfix = postfix => {
- const idx = postfix.indexOf("?");
- let query = "";
- if (idx >= 0) {
- query = postfix.substr(idx);
- postfix = postfix.substr(0, idx);
- }
- return {
- postfix,
- query
- };
-};
-
-ContextDependencyHelpers.create = (
- Dep,
- range,
- param,
- expr,
- options,
- contextOptions,
- // when parser is not passed in, expressions won't be walked
- parser = null
-) => {
- if (param.isTemplateString()) {
- let prefixRaw = param.quasis[0].string;
- let postfixRaw =
- param.quasis.length > 1
- ? param.quasis[param.quasis.length - 1].string
- : "";
-
- const valueRange = param.range;
- const { context, prefix } = splitContextFromPrefix(prefixRaw);
- const { postfix, query } = splitQueryFromPostfix(postfixRaw);
-
- // When there are more than two quasis, the generated RegExp can be more precise
- // We join the quasis with the expression regexp
- const innerQuasis = param.quasis.slice(1, param.quasis.length - 1);
- const innerRegExp =
- options.wrappedContextRegExp.source +
- innerQuasis
- .map(q => quotemeta(q.string) + options.wrappedContextRegExp.source)
- .join("");
-
- // Example: `./context/pre${e}inner${e}inner2${e}post?query`
- // context: "./context"
- // prefix: "./pre"
- // innerQuasis: [BEE("inner"), BEE("inner2")]
- // (BEE = BasicEvaluatedExpression)
- // postfix: "post"
- // query: "?query"
- // regExp: /^\.\/pre.*inner.*inner2.*post$/
- const regExp = new RegExp(
- `^${quotemeta(prefix)}${innerRegExp}${quotemeta(postfix)}$`
- );
- const dep = new Dep(
- Object.assign(
- {
- request: context + query,
- recursive: options.wrappedContextRecursive,
- regExp,
- mode: "sync"
- },
- contextOptions
- ),
- range,
- valueRange
- );
- dep.loc = expr.loc;
- const replaces = [];
-
- param.parts.forEach((part, i) => {
- if (i % 2 === 0) {
- // Quasis or merged quasi
- let range = part.range;
- let value = part.string;
- if (param.templateStringKind === "cooked") {
- value = JSON.stringify(value);
- value = value.slice(1, value.length - 1);
- }
- if (i === 0) {
- // prefix
- value = prefix;
- range = [param.range[0], part.range[1]];
- value =
- (param.templateStringKind === "cooked" ? "`" : "String.raw`") +
- value;
- } else if (i === param.parts.length - 1) {
- // postfix
- value = postfix;
- range = [part.range[0], param.range[1]];
- value = value + "`";
- } else if (
- part.expression &&
- part.expression.type === "TemplateElement" &&
- part.expression.value.raw === value
- ) {
- // Shortcut when it's a single quasi and doesn't need to be replaced
- return;
- }
- replaces.push({
- range,
- value
- });
- } else {
- // Expression
- if (parser) {
- parser.walkExpression(part.expression);
- }
- }
- });
-
- dep.replaces = replaces;
- dep.critical =
- options.wrappedContextCritical &&
- "a part of the request of a dependency is an expression";
- return dep;
- } else if (
- param.isWrapped() &&
- ((param.prefix && param.prefix.isString()) ||
- (param.postfix && param.postfix.isString()))
- ) {
- let prefixRaw =
- param.prefix && param.prefix.isString() ? param.prefix.string : "";
- let postfixRaw =
- param.postfix && param.postfix.isString() ? param.postfix.string : "";
- const prefixRange =
- param.prefix && param.prefix.isString() ? param.prefix.range : null;
- const postfixRange =
- param.postfix && param.postfix.isString() ? param.postfix.range : null;
- const valueRange = param.range;
- const { context, prefix } = splitContextFromPrefix(prefixRaw);
- const { postfix, query } = splitQueryFromPostfix(postfixRaw);
- const regExp = new RegExp(
- `^${quotemeta(prefix)}${options.wrappedContextRegExp.source}${quotemeta(
- postfix
- )}$`
- );
- const dep = new Dep(
- Object.assign(
- {
- request: context + query,
- recursive: options.wrappedContextRecursive,
- regExp,
- mode: "sync"
- },
- contextOptions
- ),
- range,
- valueRange
- );
- dep.loc = expr.loc;
- const replaces = [];
- if (prefixRange) {
- replaces.push({
- range: prefixRange,
- value: JSON.stringify(prefix)
- });
- }
- if (postfixRange) {
- replaces.push({
- range: postfixRange,
- value: JSON.stringify(postfix)
- });
- }
- dep.replaces = replaces;
- dep.critical =
- options.wrappedContextCritical &&
- "a part of the request of a dependency is an expression";
-
- if (parser && param.wrappedInnerExpressions) {
- for (const part of param.wrappedInnerExpressions) {
- if (part.expression) parser.walkExpression(part.expression);
- }
- }
-
- return dep;
- } else {
- const dep = new Dep(
- Object.assign(
- {
- request: options.exprContextRequest,
- recursive: options.exprContextRecursive,
- regExp: options.exprContextRegExp,
- mode: "sync"
- },
- contextOptions
- ),
- range,
- param.range
- );
- dep.loc = expr.loc;
- dep.critical =
- options.exprContextCritical &&
- "the request of a dependency is an expression";
-
- if (parser) {
- parser.walkExpression(param.expression);
- }
-
- return dep;
- }
-};
diff --git a/node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsId.js b/node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsId.js
deleted file mode 100644
index 1ee83ff..0000000
--- a/node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsId.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-class ContextDependencyTemplateAsId {
- apply(dep, source, runtime) {
- const moduleExports = runtime.moduleExports({
- module: dep.module,
- request: dep.request
- });
-
- if (dep.module) {
- if (dep.valueRange) {
- if (Array.isArray(dep.replaces)) {
- for (let i = 0; i < dep.replaces.length; i++) {
- const rep = dep.replaces[i];
- source.replace(rep.range[0], rep.range[1] - 1, rep.value);
- }
- }
- source.replace(dep.valueRange[1], dep.range[1] - 1, ")");
- // TODO webpack 5 remove `prepend` it's no longer used
- source.replace(
- dep.range[0],
- dep.valueRange[0] - 1,
- `${moduleExports}.resolve(${
- typeof dep.prepend === "string" ? JSON.stringify(dep.prepend) : ""
- }`
- );
- } else {
- source.replace(
- dep.range[0],
- dep.range[1] - 1,
- `${moduleExports}.resolve`
- );
- }
- } else {
- source.replace(dep.range[0], dep.range[1] - 1, moduleExports);
- }
- }
-}
-module.exports = ContextDependencyTemplateAsId;
diff --git a/node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsRequireCall.js b/node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsRequireCall.js
deleted file mode 100644
index 6d833ac..0000000
--- a/node_modules/webpack/lib/dependencies/ContextDependencyTemplateAsRequireCall.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-class ContextDependencyTemplateAsRequireCall {
- apply(dep, source, runtime) {
- const moduleExports = runtime.moduleExports({
- module: dep.module,
- request: dep.request
- });
-
- if (dep.module) {
- if (dep.valueRange) {
- if (Array.isArray(dep.replaces)) {
- for (let i = 0; i < dep.replaces.length; i++) {
- const rep = dep.replaces[i];
- source.replace(rep.range[0], rep.range[1] - 1, rep.value);
- }
- }
- source.replace(dep.valueRange[1], dep.range[1] - 1, ")");
- // TODO webpack 5 remove `prepend` it's no longer used
- source.replace(
- dep.range[0],
- dep.valueRange[0] - 1,
- `${moduleExports}(${
- typeof dep.prepend === "string" ? JSON.stringify(dep.prepend) : ""
- }`
- );
- } else {
- source.replace(dep.range[0], dep.range[1] - 1, moduleExports);
- }
- } else {
- source.replace(dep.range[0], dep.range[1] - 1, moduleExports);
- }
- }
-}
-module.exports = ContextDependencyTemplateAsRequireCall;
diff --git a/node_modules/webpack/lib/dependencies/ContextElementDependency.js b/node_modules/webpack/lib/dependencies/ContextElementDependency.js
deleted file mode 100644
index 2587704..0000000
--- a/node_modules/webpack/lib/dependencies/ContextElementDependency.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-
-class ContextElementDependency extends ModuleDependency {
- constructor(request, userRequest) {
- super(request);
- if (userRequest) {
- this.userRequest = userRequest;
- }
- }
-
- get type() {
- return "context element";
- }
-}
-
-module.exports = ContextElementDependency;
diff --git a/node_modules/webpack/lib/dependencies/CriticalDependencyWarning.js b/node_modules/webpack/lib/dependencies/CriticalDependencyWarning.js
deleted file mode 100644
index 43bd568..0000000
--- a/node_modules/webpack/lib/dependencies/CriticalDependencyWarning.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const WebpackError = require("../WebpackError");
-
-class CriticalDependencyWarning extends WebpackError {
- constructor(message) {
- super();
-
- this.name = "CriticalDependencyWarning";
- this.message = "Critical dependency: " + message;
-
- Error.captureStackTrace(this, this.constructor);
- }
-}
-
-module.exports = CriticalDependencyWarning;
diff --git a/node_modules/webpack/lib/dependencies/DelegatedExportsDependency.js b/node_modules/webpack/lib/dependencies/DelegatedExportsDependency.js
deleted file mode 100644
index fcacedb..0000000
--- a/node_modules/webpack/lib/dependencies/DelegatedExportsDependency.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const DependencyReference = require("./DependencyReference");
-const NullDependency = require("./NullDependency");
-
-class DelegatedExportsDependency extends NullDependency {
- constructor(originModule, exports) {
- super();
- this.originModule = originModule;
- this.exports = exports;
- }
-
- get type() {
- return "delegated exports";
- }
-
- getReference() {
- return new DependencyReference(this.originModule, true, false);
- }
-
- getExports() {
- return {
- exports: this.exports,
- dependencies: undefined
- };
- }
-}
-
-module.exports = DelegatedExportsDependency;
diff --git a/node_modules/webpack/lib/dependencies/DelegatedSourceDependency.js b/node_modules/webpack/lib/dependencies/DelegatedSourceDependency.js
deleted file mode 100644
index 7b0b9de..0000000
--- a/node_modules/webpack/lib/dependencies/DelegatedSourceDependency.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-
-class DelegatedSourceDependency extends ModuleDependency {
- constructor(request) {
- super(request);
- }
-
- get type() {
- return "delegated source";
- }
-}
-
-module.exports = DelegatedSourceDependency;
diff --git a/node_modules/webpack/lib/dependencies/DependencyReference.js b/node_modules/webpack/lib/dependencies/DependencyReference.js
deleted file mode 100644
index a8f6afa..0000000
--- a/node_modules/webpack/lib/dependencies/DependencyReference.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Florent Cailhol @ooflorent
-*/
-"use strict";
-
-/** @typedef {import("../Module")} Module */
-
-class DependencyReference {
- // TODO webpack 5: module must be dynamic, you must pass a function returning a module
- // This is needed to remove the hack in ConcatenatedModule
- // The problem is that the `module` in Dependency could be replaced i. e. because of Scope Hoisting
- /**
- *
- * @param {Module} module the referenced module
- * @param {string[] | boolean} importedNames imported named from the module
- * @param {boolean=} weak if this is a weak reference
- * @param {number} order the order information or NaN if don't care
- */
- constructor(module, importedNames, weak = false, order = NaN) {
- // TODO webpack 5: make it a getter
- this.module = module;
- // true: full object
- // false: only sideeffects/no export
- // array of strings: the exports with this names
- this.importedNames = importedNames;
- this.weak = !!weak;
- this.order = order;
- }
-
- /**
- * @param {DependencyReference[]} array an array (will be modified)
- * @returns {DependencyReference[]} the array again
- */
- static sort(array) {
- /** @type {WeakMap<DependencyReference, number>} */
- const originalOrder = new WeakMap();
- let i = 0;
- for (const ref of array) {
- originalOrder.set(ref, i++);
- }
- return array.sort((a, b) => {
- const aOrder = a.order;
- const bOrder = b.order;
- if (isNaN(aOrder)) {
- if (!isNaN(bOrder)) {
- return 1;
- }
- } else {
- if (isNaN(bOrder)) {
- return -1;
- }
- if (aOrder !== bOrder) {
- return aOrder - bOrder;
- }
- }
- const aOrg = originalOrder.get(a);
- const bOrg = originalOrder.get(b);
- return aOrg - bOrg;
- });
- }
-}
-
-module.exports = DependencyReference;
diff --git a/node_modules/webpack/lib/dependencies/DllEntryDependency.js b/node_modules/webpack/lib/dependencies/DllEntryDependency.js
deleted file mode 100644
index 47c6acc..0000000
--- a/node_modules/webpack/lib/dependencies/DllEntryDependency.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const Dependency = require("../Dependency");
-
-class DllEntryDependency extends Dependency {
- constructor(dependencies, name) {
- super();
- this.dependencies = dependencies;
- this.name = name;
- }
-
- get type() {
- return "dll entry";
- }
-}
-
-module.exports = DllEntryDependency;
diff --git a/node_modules/webpack/lib/dependencies/HarmonyAcceptDependency.js b/node_modules/webpack/lib/dependencies/HarmonyAcceptDependency.js
deleted file mode 100644
index edb7b01..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyAcceptDependency.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const NullDependency = require("./NullDependency");
-const HarmonyImportDependency = require("./HarmonyImportDependency");
-
-class HarmonyAcceptDependency extends NullDependency {
- constructor(range, dependencies, hasCallback) {
- super();
- this.range = range;
- this.dependencies = dependencies;
- this.hasCallback = hasCallback;
- }
-
- get type() {
- return "accepted harmony modules";
- }
-}
-
-HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate {
- apply(dep, source, runtime) {
- const content = dep.dependencies
- .filter(dependency =>
- HarmonyImportDependency.Template.isImportEmitted(dependency, source)
- )
- .map(dependency => dependency.getImportStatement(true, runtime))
- .join("");
-
- if (dep.hasCallback) {
- source.insert(
- dep.range[0],
- `function(__WEBPACK_OUTDATED_DEPENDENCIES__) { ${content}(`
- );
- source.insert(
- dep.range[1],
- ")(__WEBPACK_OUTDATED_DEPENDENCIES__); }.bind(this)"
- );
- return;
- }
-
- source.insert(dep.range[1] - 0.5, `, function() { ${content} }`);
- }
-};
-
-module.exports = HarmonyAcceptDependency;
diff --git a/node_modules/webpack/lib/dependencies/HarmonyAcceptImportDependency.js b/node_modules/webpack/lib/dependencies/HarmonyAcceptImportDependency.js
deleted file mode 100644
index 62bd00c..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyAcceptImportDependency.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const HarmonyImportDependency = require("./HarmonyImportDependency");
-
-class HarmonyAcceptImportDependency extends HarmonyImportDependency {
- constructor(request, originModule, parserScope) {
- super(request, originModule, NaN, parserScope);
- this.weak = true;
- }
-
- get type() {
- return "harmony accept";
- }
-}
-
-HarmonyAcceptImportDependency.Template = class HarmonyAcceptImportDependencyTemplate extends HarmonyImportDependency.Template {
- apply(dep, source, runtime) {}
-};
-
-module.exports = HarmonyAcceptImportDependency;
diff --git a/node_modules/webpack/lib/dependencies/HarmonyCompatibilityDependency.js b/node_modules/webpack/lib/dependencies/HarmonyCompatibilityDependency.js
deleted file mode 100644
index d6febb5..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyCompatibilityDependency.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const NullDependency = require("./NullDependency");
-
-class HarmonyCompatibilityDependency extends NullDependency {
- constructor(originModule) {
- super();
- this.originModule = originModule;
- }
-
- get type() {
- return "harmony export header";
- }
-}
-
-HarmonyCompatibilityDependency.Template = class HarmonyExportDependencyTemplate {
- apply(dep, source, runtime) {
- const usedExports = dep.originModule.usedExports;
- if (usedExports !== false && !Array.isArray(usedExports)) {
- const content = runtime.defineEsModuleFlagStatement({
- exportsArgument: dep.originModule.exportsArgument
- });
- source.insert(-10, content);
- }
- }
-};
-
-module.exports = HarmonyCompatibilityDependency;
diff --git a/node_modules/webpack/lib/dependencies/HarmonyDetectionParserPlugin.js b/node_modules/webpack/lib/dependencies/HarmonyDetectionParserPlugin.js
deleted file mode 100644
index 1a0872f..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyDetectionParserPlugin.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const HarmonyCompatibilityDependency = require("./HarmonyCompatibilityDependency");
-const HarmonyInitDependency = require("./HarmonyInitDependency");
-
-module.exports = class HarmonyDetectionParserPlugin {
- apply(parser) {
- parser.hooks.program.tap("HarmonyDetectionParserPlugin", ast => {
- const isStrictHarmony = parser.state.module.type === "javascript/esm";
- const isHarmony =
- isStrictHarmony ||
- ast.body.some(
- statement =>
- statement.type === "ImportDeclaration" ||
- statement.type === "ExportDefaultDeclaration" ||
- statement.type === "ExportNamedDeclaration" ||
- statement.type === "ExportAllDeclaration"
- );
- if (isHarmony) {
- const module = parser.state.module;
- const compatDep = new HarmonyCompatibilityDependency(module);
- compatDep.loc = {
- start: {
- line: -1,
- column: 0
- },
- end: {
- line: -1,
- column: 0
- },
- index: -3
- };
- module.addDependency(compatDep);
- const initDep = new HarmonyInitDependency(module);
- initDep.loc = {
- start: {
- line: -1,
- column: 0
- },
- end: {
- line: -1,
- column: 0
- },
- index: -2
- };
- module.addDependency(initDep);
- parser.state.harmonyParserScope = parser.state.harmonyParserScope || {};
- parser.scope.isStrict = true;
- module.buildMeta.exportsType = "namespace";
- module.buildInfo.strict = true;
- module.buildInfo.exportsArgument = "__webpack_exports__";
- if (isStrictHarmony) {
- module.buildMeta.strictHarmonyModule = true;
- module.buildInfo.moduleArgument = "__webpack_module__";
- }
- }
- });
-
- const skipInHarmony = () => {
- const module = parser.state.module;
- if (module && module.buildMeta && module.buildMeta.exportsType) {
- return true;
- }
- };
-
- const nullInHarmony = () => {
- const module = parser.state.module;
- if (module && module.buildMeta && module.buildMeta.exportsType) {
- return null;
- }
- };
-
- const nonHarmonyIdentifiers = ["define", "exports"];
- for (const identifer of nonHarmonyIdentifiers) {
- parser.hooks.evaluateTypeof
- .for(identifer)
- .tap("HarmonyDetectionParserPlugin", nullInHarmony);
- parser.hooks.typeof
- .for(identifer)
- .tap("HarmonyDetectionParserPlugin", skipInHarmony);
- parser.hooks.evaluate
- .for(identifer)
- .tap("HarmonyDetectionParserPlugin", nullInHarmony);
- parser.hooks.expression
- .for(identifer)
- .tap("HarmonyDetectionParserPlugin", skipInHarmony);
- parser.hooks.call
- .for(identifer)
- .tap("HarmonyDetectionParserPlugin", skipInHarmony);
- }
- }
-};
diff --git a/node_modules/webpack/lib/dependencies/HarmonyExportDependencyParserPlugin.js b/node_modules/webpack/lib/dependencies/HarmonyExportDependencyParserPlugin.js
deleted file mode 100644
index 6ab0c0f..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyExportDependencyParserPlugin.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const HarmonyExportExpressionDependency = require("./HarmonyExportExpressionDependency");
-const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency");
-const HarmonyExportHeaderDependency = require("./HarmonyExportHeaderDependency");
-const HarmonyExportSpecifierDependency = require("./HarmonyExportSpecifierDependency");
-const HarmonyExportImportedSpecifierDependency = require("./HarmonyExportImportedSpecifierDependency");
-const ConstDependency = require("./ConstDependency");
-
-module.exports = class HarmonyExportDependencyParserPlugin {
- constructor(moduleOptions) {
- this.strictExportPresence = moduleOptions.strictExportPresence;
- }
-
- apply(parser) {
- parser.hooks.export.tap(
- "HarmonyExportDependencyParserPlugin",
- statement => {
- const dep = new HarmonyExportHeaderDependency(
- statement.declaration && statement.declaration.range,
- statement.range
- );
- dep.loc = Object.create(statement.loc);
- dep.loc.index = -1;
- parser.state.current.addDependency(dep);
- return true;
- }
- );
- parser.hooks.exportImport.tap(
- "HarmonyExportDependencyParserPlugin",
- (statement, source) => {
- parser.state.lastHarmonyImportOrder =
- (parser.state.lastHarmonyImportOrder || 0) + 1;
- const clearDep = new ConstDependency("", statement.range);
- clearDep.loc = Object.create(statement.loc);
- clearDep.loc.index = -1;
- parser.state.current.addDependency(clearDep);
- const sideEffectDep = new HarmonyImportSideEffectDependency(
- source,
- parser.state.module,
- parser.state.lastHarmonyImportOrder,
- parser.state.harmonyParserScope
- );
- sideEffectDep.loc = Object.create(statement.loc);
- sideEffectDep.loc.index = -1;
- parser.state.current.addDependency(sideEffectDep);
- return true;
- }
- );
- parser.hooks.exportExpression.tap(
- "HarmonyExportDependencyParserPlugin",
- (statement, expr) => {
- const comments = parser.getComments([
- statement.range[0],
- expr.range[0]
- ]);
- const dep = new HarmonyExportExpressionDependency(
- parser.state.module,
- expr.range,
- statement.range,
- comments
- .map(c => {
- switch (c.type) {
- case "Block":
- return `/*${c.value}*/`;
- case "Line":
- return `//${c.value}\n`;
- }
- return "";
- })
- .join("")
- );
- dep.loc = Object.create(statement.loc);
- dep.loc.index = -1;
- parser.state.current.addDependency(dep);
- return true;
- }
- );
- parser.hooks.exportDeclaration.tap(
- "HarmonyExportDependencyParserPlugin",
- statement => {}
- );
- parser.hooks.exportSpecifier.tap(
- "HarmonyExportDependencyParserPlugin",
- (statement, id, name, idx) => {
- const rename = parser.scope.renames.get(id);
- let dep;
- const harmonyNamedExports = (parser.state.harmonyNamedExports =
- parser.state.harmonyNamedExports || new Set());
- harmonyNamedExports.add(name);
- if (rename === "imported var") {
- const settings = parser.state.harmonySpecifier.get(id);
- dep = new HarmonyExportImportedSpecifierDependency(
- settings.source,
- parser.state.module,
- settings.sourceOrder,
- parser.state.harmonyParserScope,
- settings.id,
- name,
- harmonyNamedExports,
- null,
- this.strictExportPresence
- );
- } else {
- dep = new HarmonyExportSpecifierDependency(
- parser.state.module,
- id,
- name
- );
- }
- dep.loc = Object.create(statement.loc);
- dep.loc.index = idx;
- parser.state.current.addDependency(dep);
- return true;
- }
- );
- parser.hooks.exportImportSpecifier.tap(
- "HarmonyExportDependencyParserPlugin",
- (statement, source, id, name, idx) => {
- const harmonyNamedExports = (parser.state.harmonyNamedExports =
- parser.state.harmonyNamedExports || new Set());
- let harmonyStarExports = null;
- if (name) {
- harmonyNamedExports.add(name);
- } else {
- harmonyStarExports = parser.state.harmonyStarExports =
- parser.state.harmonyStarExports || [];
- }
- const dep = new HarmonyExportImportedSpecifierDependency(
- source,
- parser.state.module,
- parser.state.lastHarmonyImportOrder,
- parser.state.harmonyParserScope,
- id,
- name,
- harmonyNamedExports,
- harmonyStarExports && harmonyStarExports.slice(),
- this.strictExportPresence
- );
- if (harmonyStarExports) {
- harmonyStarExports.push(dep);
- }
- dep.loc = Object.create(statement.loc);
- dep.loc.index = idx;
- parser.state.current.addDependency(dep);
- return true;
- }
- );
- }
-};
diff --git a/node_modules/webpack/lib/dependencies/HarmonyExportExpressionDependency.js b/node_modules/webpack/lib/dependencies/HarmonyExportExpressionDependency.js
deleted file mode 100644
index dfb499a..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyExportExpressionDependency.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const NullDependency = require("./NullDependency");
-
-class HarmonyExportExpressionDependency extends NullDependency {
- constructor(originModule, range, rangeStatement, prefix) {
- super();
- this.originModule = originModule;
- this.range = range;
- this.rangeStatement = rangeStatement;
- this.prefix = prefix;
- }
-
- get type() {
- return "harmony export expression";
- }
-
- getExports() {
- return {
- exports: ["default"],
- dependencies: undefined
- };
- }
-}
-
-HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTemplate {
- apply(dep, source) {
- const used = dep.originModule.isUsed("default");
- const content = this.getContent(dep.originModule, used);
-
- if (dep.range) {
- source.replace(
- dep.rangeStatement[0],
- dep.range[0] - 1,
- content + "(" + dep.prefix
- );
- source.replace(dep.range[1], dep.rangeStatement[1] - 1, ");");
- return;
- }
-
- source.replace(dep.rangeStatement[0], dep.rangeStatement[1] - 1, content);
- }
-
- getContent(module, used) {
- const exportsName = module.exportsArgument;
- if (used) {
- return `/* harmony default export */ ${exportsName}[${JSON.stringify(
- used
- )}] = `;
- }
- return "/* unused harmony default export */ var _unused_webpack_default_export = ";
- }
-};
-
-module.exports = HarmonyExportExpressionDependency;
diff --git a/node_modules/webpack/lib/dependencies/HarmonyExportHeaderDependency.js b/node_modules/webpack/lib/dependencies/HarmonyExportHeaderDependency.js
deleted file mode 100644
index a0e9918..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyExportHeaderDependency.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const NullDependency = require("./NullDependency");
-
-class HarmonyExportHeaderDependency extends NullDependency {
- constructor(range, rangeStatement) {
- super();
- this.range = range;
- this.rangeStatement = rangeStatement;
- }
-
- get type() {
- return "harmony export header";
- }
-}
-
-HarmonyExportHeaderDependency.Template = class HarmonyExportDependencyTemplate {
- apply(dep, source) {
- const content = "";
- const replaceUntil = dep.range
- ? dep.range[0] - 1
- : dep.rangeStatement[1] - 1;
- source.replace(dep.rangeStatement[0], replaceUntil, content);
- }
-};
-
-module.exports = HarmonyExportHeaderDependency;
diff --git a/node_modules/webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/node_modules/webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency.js
deleted file mode 100644
index bca61a0..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency.js
+++ /dev/null
@@ -1,659 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const DependencyReference = require("./DependencyReference");
-const HarmonyImportDependency = require("./HarmonyImportDependency");
-const Template = require("../Template");
-const HarmonyLinkingError = require("../HarmonyLinkingError");
-
-/** @typedef {import("../Module")} Module */
-
-/** @typedef {"missing"|"unused"|"empty-star"|"reexport-non-harmony-default"|"reexport-named-default"|"reexport-namespace-object"|"reexport-non-harmony-default-strict"|"reexport-fake-namespace-object"|"rexport-non-harmony-undefined"|"safe-reexport"|"checked-reexport"|"dynamic-reexport"} ExportModeType */
-
-/** @type {Map<string, string>} */
-const EMPTY_MAP = new Map();
-
-class ExportMode {
- /**
- * @param {ExportModeType} type type of the mode
- */
- constructor(type) {
- /** @type {ExportModeType} */
- this.type = type;
- /** @type {string|null} */
- this.name = null;
- /** @type {Map<string, string>} */
- this.map = EMPTY_MAP;
- /** @type {Set<string>|null} */
- this.ignored = null;
- /** @type {Module|null} */
- this.module = null;
- /** @type {string|null} */
- this.userRequest = null;
- }
-}
-
-const EMPTY_STAR_MODE = new ExportMode("empty-star");
-
-class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
- constructor(
- request,
- originModule,
- sourceOrder,
- parserScope,
- id,
- name,
- activeExports,
- otherStarExports,
- strictExportPresence
- ) {
- super(request, originModule, sourceOrder, parserScope);
- this.id = id;
- this.redirectedId = undefined;
- this.name = name;
- this.activeExports = activeExports;
- this.otherStarExports = otherStarExports;
- this.strictExportPresence = strictExportPresence;
- }
-
- get type() {
- return "harmony export imported specifier";
- }
-
- get _id() {
- return this.redirectedId || this.id;
- }
-
- getMode(ignoreUnused) {
- const name = this.name;
- const id = this._id;
- const used = this.originModule.isUsed(name);
- const importedModule = this._module;
-
- if (!importedModule) {
- const mode = new ExportMode("missing");
- mode.userRequest = this.userRequest;
- return mode;
- }
-
- if (
- !ignoreUnused &&
- (name ? !used : this.originModule.usedExports === false)
- ) {
- const mode = new ExportMode("unused");
- mode.name = name || "*";
- return mode;
- }
-
- const strictHarmonyModule = this.originModule.buildMeta.strictHarmonyModule;
- if (name && id === "default" && importedModule.buildMeta) {
- if (!importedModule.buildMeta.exportsType) {
- const mode = new ExportMode(
- strictHarmonyModule
- ? "reexport-non-harmony-default-strict"
- : "reexport-non-harmony-default"
- );
- mode.name = name;
- mode.module = importedModule;
- return mode;
- } else if (importedModule.buildMeta.exportsType === "named") {
- const mode = new ExportMode("reexport-named-default");
- mode.name = name;
- mode.module = importedModule;
- return mode;
- }
- }
-
- const isNotAHarmonyModule =
- importedModule.buildMeta && !importedModule.buildMeta.exportsType;
- if (name) {
- let mode;
- if (id) {
- // export { name as name }
- if (isNotAHarmonyModule && strictHarmonyModule) {
- mode = new ExportMode("rexport-non-harmony-undefined");
- mode.name = name;
- } else {
- mode = new ExportMode("safe-reexport");
- mode.map = new Map([[name, id]]);
- }
- } else {
- // export { * as name }
- if (isNotAHarmonyModule && strictHarmonyModule) {
- mode = new ExportMode("reexport-fake-namespace-object");
- mode.name = name;
- } else {
- mode = new ExportMode("reexport-namespace-object");
- mode.name = name;
- }
- }
- mode.module = importedModule;
- return mode;
- }
-
- const hasUsedExports = Array.isArray(this.originModule.usedExports);
- const hasProvidedExports = Array.isArray(
- importedModule.buildMeta.providedExports
- );
- const activeFromOtherStarExports = this._discoverActiveExportsFromOtherStartExports();
-
- // export *
- if (hasUsedExports) {
- // reexport * with known used exports
- if (hasProvidedExports) {
- const map = new Map(
- this.originModule.usedExports
- .filter(id => {
- if (id === "default") return false;
- if (this.activeExports.has(id)) return false;
- if (activeFromOtherStarExports.has(id)) return false;
- if (!importedModule.buildMeta.providedExports.includes(id))
- return false;
- return true;
- })
- .map(item => [item, item])
- );
-
- if (map.size === 0) {
- return EMPTY_STAR_MODE;
- }
-
- const mode = new ExportMode("safe-reexport");
- mode.module = importedModule;
- mode.map = map;
- return mode;
- }
-
- const map = new Map(
- this.originModule.usedExports
- .filter(id => {
- if (id === "default") return false;
- if (this.activeExports.has(id)) return false;
- if (activeFromOtherStarExports.has(id)) return false;
-
- return true;
- })
- .map(item => [item, item])
- );
-
- if (map.size === 0) {
- return EMPTY_STAR_MODE;
- }
-
- const mode = new ExportMode("checked-reexport");
- mode.module = importedModule;
- mode.map = map;
- return mode;
- }
-
- if (hasProvidedExports) {
- const map = new Map(
- importedModule.buildMeta.providedExports
- .filter(id => {
- if (id === "default") return false;
- if (this.activeExports.has(id)) return false;
- if (activeFromOtherStarExports.has(id)) return false;
-
- return true;
- })
- .map(item => [item, item])
- );
-
- if (map.size === 0) {
- return EMPTY_STAR_MODE;
- }
-
- const mode = new ExportMode("safe-reexport");
- mode.module = importedModule;
- mode.map = map;
- return mode;
- }
-
- const mode = new ExportMode("dynamic-reexport");
- mode.module = importedModule;
- mode.ignored = new Set([
- "default",
- ...this.activeExports,
- ...activeFromOtherStarExports
- ]);
- return mode;
- }
-
- getReference() {
- const mode = this.getMode(false);
-
- switch (mode.type) {
- case "missing":
- case "unused":
- case "empty-star":
- return null;
-
- case "reexport-non-harmony-default":
- case "reexport-named-default":
- return new DependencyReference(
- mode.module,
- ["default"],
- false,
- this.sourceOrder
- );
-
- case "reexport-namespace-object":
- case "reexport-non-harmony-default-strict":
- case "reexport-fake-namespace-object":
- case "rexport-non-harmony-undefined":
- return new DependencyReference(
- mode.module,
- true,
- false,
- this.sourceOrder
- );
-
- case "safe-reexport":
- case "checked-reexport":
- return new DependencyReference(
- mode.module,
- Array.from(mode.map.values()),
- false,
- this.sourceOrder
- );
-
- case "dynamic-reexport":
- return new DependencyReference(
- mode.module,
- true,
- false,
- this.sourceOrder
- );
-
- default:
- throw new Error(`Unknown mode ${mode.type}`);
- }
- }
-
- _discoverActiveExportsFromOtherStartExports() {
- if (!this.otherStarExports) return new Set();
- const result = new Set();
- // try to learn impossible exports from other star exports with provided exports
- for (const otherStarExport of this.otherStarExports) {
- const otherImportedModule = otherStarExport._module;
- if (
- otherImportedModule &&
- Array.isArray(otherImportedModule.buildMeta.providedExports)
- ) {
- for (const exportName of otherImportedModule.buildMeta
- .providedExports) {
- result.add(exportName);
- }
- }
- }
- return result;
- }
-
- getExports() {
- if (this.name) {
- return {
- exports: [this.name],
- dependencies: undefined
- };
- }
-
- const importedModule = this._module;
-
- if (!importedModule) {
- // no imported module available
- return {
- exports: null,
- dependencies: undefined
- };
- }
-
- if (Array.isArray(importedModule.buildMeta.providedExports)) {
- const activeFromOtherStarExports = this._discoverActiveExportsFromOtherStartExports();
- return {
- exports: importedModule.buildMeta.providedExports.filter(
- id =>
- id !== "default" &&
- !activeFromOtherStarExports.has(id) &&
- !this.activeExports.has(id)
- ),
- dependencies: [importedModule]
- };
- }
-
- if (importedModule.buildMeta.providedExports) {
- return {
- exports: true,
- dependencies: undefined
- };
- }
-
- return {
- exports: null,
- dependencies: [importedModule]
- };
- }
-
- getWarnings() {
- if (
- this.strictExportPresence ||
- this.originModule.buildMeta.strictHarmonyModule
- ) {
- return [];
- }
- return this._getErrors();
- }
-
- getErrors() {
- if (
- this.strictExportPresence ||
- this.originModule.buildMeta.strictHarmonyModule
- ) {
- return this._getErrors();
- }
- return [];
- }
-
- _getErrors() {
- const importedModule = this._module;
- if (!importedModule) {
- return;
- }
-
- if (!importedModule.buildMeta || !importedModule.buildMeta.exportsType) {
- // It's not an harmony module
- if (
- this.originModule.buildMeta.strictHarmonyModule &&
- this._id &&
- this._id !== "default"
- ) {
- // In strict harmony modules we only support the default export
- return [
- new HarmonyLinkingError(
- `Can't reexport the named export '${this._id}' from non EcmaScript module (only default export is available)`
- )
- ];
- }
- return;
- }
-
- if (!this._id) {
- return;
- }
-
- if (importedModule.isProvided(this._id) !== false) {
- // It's provided or we are not sure
- return;
- }
-
- // We are sure that it's not provided
- const idIsNotNameMessage =
- this._id !== this.name ? ` (reexported as '${this.name}')` : "";
- const errorMessage = `"export '${this._id}'${idIsNotNameMessage} was not found in '${this.userRequest}'`;
- return [new HarmonyLinkingError(errorMessage)];
- }
-
- updateHash(hash) {
- super.updateHash(hash);
- const hashValue = this.getHashValue(this._module);
- hash.update(hashValue);
- }
-
- getHashValue(importedModule) {
- if (!importedModule) {
- return "";
- }
-
- const stringifiedUsedExport = JSON.stringify(importedModule.usedExports);
- const stringifiedProvidedExport = JSON.stringify(
- importedModule.buildMeta.providedExports
- );
- return (
- importedModule.used + stringifiedUsedExport + stringifiedProvidedExport
- );
- }
-
- disconnect() {
- super.disconnect();
- this.redirectedId = undefined;
- }
-}
-
-module.exports = HarmonyExportImportedSpecifierDependency;
-
-HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedSpecifierDependencyTemplate extends HarmonyImportDependency.Template {
- harmonyInit(dep, source, runtime, dependencyTemplates) {
- super.harmonyInit(dep, source, runtime, dependencyTemplates);
- const content = this.getContent(dep);
- source.insert(-1, content);
- }
-
- getHarmonyInitOrder(dep) {
- if (dep.name) {
- const used = dep.originModule.isUsed(dep.name);
- if (!used) return NaN;
- } else {
- const importedModule = dep._module;
-
- const activeFromOtherStarExports = dep._discoverActiveExportsFromOtherStartExports();
-
- if (Array.isArray(dep.originModule.usedExports)) {
- // we know which exports are used
-
- const unused = dep.originModule.usedExports.every(id => {
- if (id === "default") return true;
- if (dep.activeExports.has(id)) return true;
- if (importedModule.isProvided(id) === false) return true;
- if (activeFromOtherStarExports.has(id)) return true;
- return false;
- });
- if (unused) return NaN;
- } else if (
- dep.originModule.usedExports &&
- importedModule &&
- Array.isArray(importedModule.buildMeta.providedExports)
- ) {
- // not sure which exports are used, but we know which are provided
-
- const unused = importedModule.buildMeta.providedExports.every(id => {
- if (id === "default") return true;
- if (dep.activeExports.has(id)) return true;
- if (activeFromOtherStarExports.has(id)) return true;
- return false;
- });
- if (unused) return NaN;
- }
- }
- return super.getHarmonyInitOrder(dep);
- }
-
- getContent(dep) {
- const mode = dep.getMode(false);
- const module = dep.originModule;
- const importedModule = dep._module;
- const importVar = dep.getImportVar();
-
- switch (mode.type) {
- case "missing":
- return `throw new Error(${JSON.stringify(
- `Cannot find module '${mode.userRequest}'`
- )});\n`;
-
- case "unused":
- return `${Template.toNormalComment(
- `unused harmony reexport ${mode.name}`
- )}\n`;
-
- case "reexport-non-harmony-default":
- return (
- "/* harmony reexport (default from non-harmony) */ " +
- this.getReexportStatement(
- module,
- module.isUsed(mode.name),
- importVar,
- null
- )
- );
-
- case "reexport-named-default":
- return (
- "/* harmony reexport (default from named exports) */ " +
- this.getReexportStatement(
- module,
- module.isUsed(mode.name),
- importVar,
- ""
- )
- );
-
- case "reexport-fake-namespace-object":
- return (
- "/* harmony reexport (fake namespace object from non-harmony) */ " +
- this.getReexportFakeNamespaceObjectStatement(
- module,
- module.isUsed(mode.name),
- importVar
- )
- );
-
- case "rexport-non-harmony-undefined":
- return (
- "/* harmony reexport (non default export from non-harmony) */ " +
- this.getReexportStatement(
- module,
- module.isUsed(mode.name),
- "undefined",
- ""
- )
- );
-
- case "reexport-non-harmony-default-strict":
- return (
- "/* harmony reexport (default from non-harmony) */ " +
- this.getReexportStatement(
- module,
- module.isUsed(mode.name),
- importVar,
- ""
- )
- );
-
- case "reexport-namespace-object":
- return (
- "/* harmony reexport (module object) */ " +
- this.getReexportStatement(
- module,
- module.isUsed(mode.name),
- importVar,
- ""
- )
- );
-
- case "empty-star":
- return "/* empty/unused harmony star reexport */";
-
- case "safe-reexport":
- return Array.from(mode.map.entries())
- .map(item => {
- return (
- "/* harmony reexport (safe) */ " +
- this.getReexportStatement(
- module,
- module.isUsed(item[0]),
- importVar,
- importedModule.isUsed(item[1])
- ) +
- "\n"
- );
- })
- .join("");
-
- case "checked-reexport":
- return Array.from(mode.map.entries())
- .map(item => {
- return (
- "/* harmony reexport (checked) */ " +
- this.getConditionalReexportStatement(
- module,
- item[0],
- importVar,
- item[1]
- ) +
- "\n"
- );
- })
- .join("");
-
- case "dynamic-reexport": {
- const ignoredExports = mode.ignored;
- let content =
- "/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in " +
- importVar +
- ") ";
-
- // Filter out exports which are defined by other exports
- // and filter out default export because it cannot be reexported with *
- if (ignoredExports.size > 0) {
- content +=
- "if(" +
- JSON.stringify(Array.from(ignoredExports)) +
- ".indexOf(__WEBPACK_IMPORT_KEY__) < 0) ";
- } else {
- content += "if(__WEBPACK_IMPORT_KEY__ !== 'default') ";
- }
- const exportsName = dep.originModule.exportsArgument;
- return (
- content +
- `(function(key) { __webpack_require__.d(${exportsName}, key, function() { return ${importVar}[key]; }) }(__WEBPACK_IMPORT_KEY__));\n`
- );
- }
-
- default:
- throw new Error(`Unknown mode ${mode.type}`);
- }
- }
-
- getReexportStatement(module, key, name, valueKey) {
- const exportsName = module.exportsArgument;
- const returnValue = this.getReturnValue(name, valueKey);
- return `__webpack_require__.d(${exportsName}, ${JSON.stringify(
- key
- )}, function() { return ${returnValue}; });\n`;
- }
-
- getReexportFakeNamespaceObjectStatement(module, key, name) {
- const exportsName = module.exportsArgument;
- return `__webpack_require__.d(${exportsName}, ${JSON.stringify(
- key
- )}, function() { return __webpack_require__.t(${name}); });\n`;
- }
-
- getConditionalReexportStatement(module, key, name, valueKey) {
- if (valueKey === false) {
- return "/* unused export */\n";
- }
- const exportsName = module.exportsArgument;
- const returnValue = this.getReturnValue(name, valueKey);
- return `if(__webpack_require__.o(${name}, ${JSON.stringify(
- valueKey
- )})) __webpack_require__.d(${exportsName}, ${JSON.stringify(
- key
- )}, function() { return ${returnValue}; });\n`;
- }
-
- getReturnValue(name, valueKey) {
- if (valueKey === null) {
- return `${name}_default.a`;
- }
- if (valueKey === "") {
- return name;
- }
- if (valueKey === false) {
- return "/* unused export */ undefined";
- }
-
- return `${name}[${JSON.stringify(valueKey)}]`;
- }
-};
diff --git a/node_modules/webpack/lib/dependencies/HarmonyExportSpecifierDependency.js b/node_modules/webpack/lib/dependencies/HarmonyExportSpecifierDependency.js
deleted file mode 100644
index 1bf6a3f..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyExportSpecifierDependency.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const NullDependency = require("./NullDependency");
-
-class HarmonyExportSpecifierDependency extends NullDependency {
- constructor(originModule, id, name) {
- super();
- this.originModule = originModule;
- this.id = id;
- this.name = name;
- }
-
- get type() {
- return "harmony export specifier";
- }
-
- getExports() {
- return {
- exports: [this.name],
- dependencies: undefined
- };
- }
-}
-
-HarmonyExportSpecifierDependency.Template = class HarmonyExportSpecifierDependencyTemplate {
- apply(dep, source) {}
-
- getHarmonyInitOrder(dep) {
- return 0;
- }
-
- harmonyInit(dep, source, runtime) {
- const content = this.getContent(dep);
- source.insert(-1, content);
- }
-
- getContent(dep) {
- const used = dep.originModule.isUsed(dep.name);
- if (!used) {
- return `/* unused harmony export ${dep.name || "namespace"} */\n`;
- }
-
- const exportsName = dep.originModule.exportsArgument;
-
- return `/* harmony export (binding) */ __webpack_require__.d(${exportsName}, ${JSON.stringify(
- used
- )}, function() { return ${dep.id}; });\n`;
- }
-};
-
-module.exports = HarmonyExportSpecifierDependency;
diff --git a/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js b/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js
deleted file mode 100644
index 97fd9bf..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const DependencyReference = require("./DependencyReference");
-const ModuleDependency = require("./ModuleDependency");
-const Template = require("../Template");
-
-class HarmonyImportDependency extends ModuleDependency {
- constructor(request, originModule, sourceOrder, parserScope) {
- super(request);
- this.redirectedModule = undefined;
- this.originModule = originModule;
- this.sourceOrder = sourceOrder;
- this.parserScope = parserScope;
- }
-
- get _module() {
- return this.redirectedModule || this.module;
- }
-
- getReference() {
- if (!this._module) return null;
- return new DependencyReference(
- this._module,
- false,
- this.weak,
- this.sourceOrder
- );
- }
-
- getImportVar() {
- let importVarMap = this.parserScope.importVarMap;
- if (!importVarMap) this.parserScope.importVarMap = importVarMap = new Map();
- let importVar = importVarMap.get(this._module);
- if (importVar) return importVar;
- importVar = `${Template.toIdentifier(
- `${this.userRequest}`
- )}__WEBPACK_IMPORTED_MODULE_${importVarMap.size}__`;
- importVarMap.set(this._module, importVar);
- return importVar;
- }
-
- getImportStatement(update, runtime) {
- return runtime.importStatement({
- update,
- module: this._module,
- importVar: this.getImportVar(),
- request: this.request,
- originModule: this.originModule
- });
- }
-
- updateHash(hash) {
- super.updateHash(hash);
- const importedModule = this._module;
- hash.update(
- (importedModule &&
- (!importedModule.buildMeta || importedModule.buildMeta.exportsType)) +
- ""
- );
- hash.update((importedModule && importedModule.id) + "");
- }
-
- disconnect() {
- super.disconnect();
- this.redirectedModule = undefined;
- }
-}
-
-module.exports = HarmonyImportDependency;
-
-const importEmittedMap = new WeakMap();
-
-HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate {
- apply(dep, source, runtime) {
- // no-op
- }
-
- getHarmonyInitOrder(dep) {
- return dep.sourceOrder;
- }
-
- static isImportEmitted(dep, source) {
- let sourceInfo = importEmittedMap.get(source);
- if (!sourceInfo) return false;
- const key = dep._module || dep.request;
- return key && sourceInfo.emittedImports.get(key);
- }
-
- harmonyInit(dep, source, runtime, dependencyTemplates) {
- let sourceInfo = importEmittedMap.get(source);
- if (!sourceInfo) {
- importEmittedMap.set(
- source,
- (sourceInfo = {
- emittedImports: new Map()
- })
- );
- }
- const key = dep._module || dep.request;
- if (key && sourceInfo.emittedImports.get(key)) return;
- sourceInfo.emittedImports.set(key, true);
- const content = dep.getImportStatement(false, runtime);
- source.insert(-1, content);
- }
-};
diff --git a/node_modules/webpack/lib/dependencies/HarmonyImportDependencyParserPlugin.js b/node_modules/webpack/lib/dependencies/HarmonyImportDependencyParserPlugin.js
deleted file mode 100644
index 7f9fcde..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyImportDependencyParserPlugin.js
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const { SyncBailHook } = require("tapable");
-const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency");
-const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDependency");
-const HarmonyAcceptImportDependency = require("./HarmonyAcceptImportDependency");
-const HarmonyAcceptDependency = require("./HarmonyAcceptDependency");
-const ConstDependency = require("./ConstDependency");
-
-module.exports = class HarmonyImportDependencyParserPlugin {
- constructor(moduleOptions) {
- this.strictExportPresence = moduleOptions.strictExportPresence;
- this.strictThisContextOnImports = moduleOptions.strictThisContextOnImports;
- }
-
- apply(parser) {
- parser.hooks.import.tap(
- "HarmonyImportDependencyParserPlugin",
- (statement, source) => {
- parser.state.lastHarmonyImportOrder =
- (parser.state.lastHarmonyImportOrder || 0) + 1;
- const clearDep = new ConstDependency("", statement.range);
- clearDep.loc = statement.loc;
- parser.state.module.addDependency(clearDep);
- const sideEffectDep = new HarmonyImportSideEffectDependency(
- source,
- parser.state.module,
- parser.state.lastHarmonyImportOrder,
- parser.state.harmonyParserScope
- );
- sideEffectDep.loc = statement.loc;
- parser.state.module.addDependency(sideEffectDep);
- return true;
- }
- );
- parser.hooks.importSpecifier.tap(
- "HarmonyImportDependencyParserPlugin",
- (statement, source, id, name) => {
- parser.scope.definitions.delete(name);
- parser.scope.renames.set(name, "imported var");
- if (!parser.state.harmonySpecifier) {
- parser.state.harmonySpecifier = new Map();
- }
- parser.state.harmonySpecifier.set(name, {
- source,
- id,
- sourceOrder: parser.state.lastHarmonyImportOrder
- });
- return true;
- }
- );
- parser.hooks.expression
- .for("imported var")
- .tap("HarmonyImportDependencyParserPlugin", expr => {
- const name = expr.name;
- const settings = parser.state.harmonySpecifier.get(name);
- const dep = new HarmonyImportSpecifierDependency(
- settings.source,
- parser.state.module,
- settings.sourceOrder,
- parser.state.harmonyParserScope,
- settings.id,
- name,
- expr.range,
- this.strictExportPresence
- );
- dep.shorthand = parser.scope.inShorthand;
- dep.directImport = true;
- dep.loc = expr.loc;
- parser.state.module.addDependency(dep);
- return true;
- });
- parser.hooks.expressionAnyMember
- .for("imported var")
- .tap("HarmonyImportDependencyParserPlugin", expr => {
- const name = expr.object.name;
- const settings = parser.state.harmonySpecifier.get(name);
- if (settings.id !== null) return false;
- const dep = new HarmonyImportSpecifierDependency(
- settings.source,
- parser.state.module,
- settings.sourceOrder,
- parser.state.harmonyParserScope,
- expr.property.name || expr.property.value,
- name,
- expr.range,
- this.strictExportPresence
- );
- dep.shorthand = parser.scope.inShorthand;
- dep.directImport = false;
- dep.loc = expr.loc;
- parser.state.module.addDependency(dep);
- return true;
- });
- if (this.strictThisContextOnImports) {
- // only in case when we strictly follow the spec we need a special case here
- parser.hooks.callAnyMember
- .for("imported var")
- .tap("HarmonyImportDependencyParserPlugin", expr => {
- if (expr.callee.type !== "MemberExpression") return;
- if (expr.callee.object.type !== "Identifier") return;
- const name = expr.callee.object.name;
- const settings = parser.state.harmonySpecifier.get(name);
- if (settings.id !== null) return false;
- const dep = new HarmonyImportSpecifierDependency(
- settings.source,
- parser.state.module,
- settings.sourceOrder,
- parser.state.harmonyParserScope,
- expr.callee.property.name || expr.callee.property.value,
- name,
- expr.callee.range,
- this.strictExportPresence
- );
- dep.shorthand = parser.scope.inShorthand;
- dep.directImport = false;
- dep.namespaceObjectAsContext = true;
- dep.loc = expr.callee.loc;
- parser.state.module.addDependency(dep);
- if (expr.arguments) parser.walkExpressions(expr.arguments);
- return true;
- });
- }
- parser.hooks.call
- .for("imported var")
- .tap("HarmonyImportDependencyParserPlugin", expr => {
- const args = expr.arguments;
- const fullExpr = expr;
- expr = expr.callee;
- if (expr.type !== "Identifier") return;
- const name = expr.name;
- const settings = parser.state.harmonySpecifier.get(name);
- const dep = new HarmonyImportSpecifierDependency(
- settings.source,
- parser.state.module,
- settings.sourceOrder,
- parser.state.harmonyParserScope,
- settings.id,
- name,
- expr.range,
- this.strictExportPresence
- );
- dep.directImport = true;
- dep.callArgs = args;
- dep.call = fullExpr;
- dep.loc = expr.loc;
- parser.state.module.addDependency(dep);
- if (args) parser.walkExpressions(args);
- return true;
- });
- // TODO webpack 5: refactor this, no custom hooks
- if (!parser.hooks.hotAcceptCallback) {
- parser.hooks.hotAcceptCallback = new SyncBailHook([
- "expression",
- "requests"
- ]);
- }
- if (!parser.hooks.hotAcceptWithoutCallback) {
- parser.hooks.hotAcceptWithoutCallback = new SyncBailHook([
- "expression",
- "requests"
- ]);
- }
- parser.hooks.hotAcceptCallback.tap(
- "HarmonyImportDependencyParserPlugin",
- (expr, requests) => {
- const harmonyParserScope = parser.state.harmonyParserScope;
- if (!harmonyParserScope) {
- // This is not a harmony module, skip it
- return;
- }
- const dependencies = requests.map(request => {
- const dep = new HarmonyAcceptImportDependency(
- request,
- parser.state.module,
- harmonyParserScope
- );
- dep.loc = expr.loc;
- parser.state.module.addDependency(dep);
- return dep;
- });
- if (dependencies.length > 0) {
- const dep = new HarmonyAcceptDependency(
- expr.range,
- dependencies,
- true
- );
- dep.loc = expr.loc;
- parser.state.module.addDependency(dep);
- }
- }
- );
- parser.hooks.hotAcceptWithoutCallback.tap(
- "HarmonyImportDependencyParserPlugin",
- (expr, requests) => {
- const dependencies = requests.map(request => {
- const dep = new HarmonyAcceptImportDependency(
- request,
- parser.state.module,
- parser.state.harmonyParserScope
- );
- dep.loc = expr.loc;
- parser.state.module.addDependency(dep);
- return dep;
- });
- if (dependencies.length > 0) {
- const dep = new HarmonyAcceptDependency(
- expr.range,
- dependencies,
- false
- );
- dep.loc = expr.loc;
- parser.state.module.addDependency(dep);
- }
- }
- );
- }
-};
diff --git a/node_modules/webpack/lib/dependencies/HarmonyImportSideEffectDependency.js b/node_modules/webpack/lib/dependencies/HarmonyImportSideEffectDependency.js
deleted file mode 100644
index a41c1b9..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyImportSideEffectDependency.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const HarmonyImportDependency = require("./HarmonyImportDependency");
-
-class HarmonyImportSideEffectDependency extends HarmonyImportDependency {
- constructor(request, originModule, sourceOrder, parserScope) {
- super(request, originModule, sourceOrder, parserScope);
- }
-
- getReference() {
- if (this._module && this._module.factoryMeta.sideEffectFree) return null;
-
- return super.getReference();
- }
-
- get type() {
- return "harmony side effect evaluation";
- }
-}
-
-HarmonyImportSideEffectDependency.Template = class HarmonyImportSideEffectDependencyTemplate extends HarmonyImportDependency.Template {
- getHarmonyInitOrder(dep) {
- if (dep._module && dep._module.factoryMeta.sideEffectFree) return NaN;
- return super.getHarmonyInitOrder(dep);
- }
-};
-
-module.exports = HarmonyImportSideEffectDependency;
diff --git a/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js b/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js
deleted file mode 100644
index d07fbf1..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const DependencyReference = require("./DependencyReference");
-const HarmonyImportDependency = require("./HarmonyImportDependency");
-const HarmonyLinkingError = require("../HarmonyLinkingError");
-
-class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
- constructor(
- request,
- originModule,
- sourceOrder,
- parserScope,
- id,
- name,
- range,
- strictExportPresence
- ) {
- super(request, originModule, sourceOrder, parserScope);
- this.id = id === null ? null : `${id}`;
- this.redirectedId = undefined;
- this.name = name;
- this.range = range;
- this.strictExportPresence = strictExportPresence;
- this.namespaceObjectAsContext = false;
- this.callArgs = undefined;
- this.call = undefined;
- this.directImport = undefined;
- this.shorthand = undefined;
- }
-
- get type() {
- return "harmony import specifier";
- }
-
- get _id() {
- return this.redirectedId || this.id;
- }
-
- getReference() {
- if (!this._module) return null;
- return new DependencyReference(
- this._module,
- this._id && !this.namespaceObjectAsContext ? [this._id] : true,
- false,
- this.sourceOrder
- );
- }
-
- getWarnings() {
- if (
- this.strictExportPresence ||
- this.originModule.buildMeta.strictHarmonyModule
- ) {
- return [];
- }
- return this._getErrors();
- }
-
- getErrors() {
- if (
- this.strictExportPresence ||
- this.originModule.buildMeta.strictHarmonyModule
- ) {
- return this._getErrors();
- }
- return [];
- }
-
- _getErrors() {
- const importedModule = this._module;
- if (!importedModule) {
- return;
- }
-
- if (!importedModule.buildMeta || !importedModule.buildMeta.exportsType) {
- // It's not an harmony module
- if (
- this.originModule.buildMeta.strictHarmonyModule &&
- this._id &&
- this._id !== "default"
- ) {
- // In strict harmony modules we only support the default export
- return [
- new HarmonyLinkingError(
- `Can't import the named export '${this._id}' from non EcmaScript module (only default export is available)`
- )
- ];
- }
- return;
- }
-
- if (!this._id) {
- return;
- }
-
- if (importedModule.isProvided(this._id) !== false) {
- // It's provided or we are not sure
- return;
- }
-
- // We are sure that it's not provided
- const idIsNotNameMessage =
- this._id !== this.name ? ` (imported as '${this.name}')` : "";
- const errorMessage = `"export '${this._id}'${idIsNotNameMessage} was not found in '${this.userRequest}'`;
- return [new HarmonyLinkingError(errorMessage)];
- }
-
- // implement this method to allow the occurrence order plugin to count correctly
- getNumberOfIdOccurrences() {
- return 0;
- }
-
- updateHash(hash) {
- super.updateHash(hash);
- const importedModule = this._module;
- hash.update((importedModule && this._id) + "");
- hash.update(
- (importedModule && this._id && importedModule.isUsed(this._id)) + ""
- );
- hash.update(
- (importedModule &&
- (!importedModule.buildMeta || importedModule.buildMeta.exportsType)) +
- ""
- );
- hash.update(
- (importedModule &&
- importedModule.used + JSON.stringify(importedModule.usedExports)) + ""
- );
- }
-
- disconnect() {
- super.disconnect();
- this.redirectedId = undefined;
- }
-}
-
-HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependencyTemplate extends HarmonyImportDependency.Template {
- apply(dep, source, runtime) {
- super.apply(dep, source, runtime);
- const content = this.getContent(dep, runtime);
- source.replace(dep.range[0], dep.range[1] - 1, content);
- }
-
- getContent(dep, runtime) {
- const exportExpr = runtime.exportFromImport({
- module: dep._module,
- request: dep.request,
- exportName: dep._id,
- originModule: dep.originModule,
- asiSafe: dep.shorthand,
- isCall: dep.call,
- callContext: !dep.directImport,
- importVar: dep.getImportVar()
- });
- return dep.shorthand ? `${dep.name}: ${exportExpr}` : exportExpr;
- }
-};
-
-module.exports = HarmonyImportSpecifierDependency;
diff --git a/node_modules/webpack/lib/dependencies/HarmonyInitDependency.js b/node_modules/webpack/lib/dependencies/HarmonyInitDependency.js
deleted file mode 100644
index 73239c8..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyInitDependency.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const NullDependency = require("./NullDependency");
-
-class HarmonyInitDependency extends NullDependency {
- constructor(originModule) {
- super();
- this.originModule = originModule;
- }
-
- get type() {
- return "harmony init";
- }
-}
-
-module.exports = HarmonyInitDependency;
-
-HarmonyInitDependency.Template = class HarmonyInitDependencyTemplate {
- apply(dep, source, runtime, dependencyTemplates) {
- const module = dep.originModule;
- const list = [];
- for (const dependency of module.dependencies) {
- const template = dependencyTemplates.get(dependency.constructor);
- if (
- template &&
- typeof template.harmonyInit === "function" &&
- typeof template.getHarmonyInitOrder === "function"
- ) {
- const order = template.getHarmonyInitOrder(dependency);
- if (!isNaN(order)) {
- list.push({
- order,
- listOrder: list.length,
- dependency,
- template
- });
- }
- }
- }
-
- list.sort((a, b) => {
- const x = a.order - b.order;
- if (x) return x;
- return a.listOrder - b.listOrder;
- });
-
- for (const item of list) {
- item.template.harmonyInit(
- item.dependency,
- source,
- runtime,
- dependencyTemplates
- );
- }
- }
-};
diff --git a/node_modules/webpack/lib/dependencies/HarmonyModulesPlugin.js b/node_modules/webpack/lib/dependencies/HarmonyModulesPlugin.js
deleted file mode 100644
index 43a8d4c..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyModulesPlugin.js
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const HarmonyCompatibilityDependency = require("./HarmonyCompatibilityDependency");
-const HarmonyInitDependency = require("./HarmonyInitDependency");
-const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDependency");
-const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency");
-const HarmonyExportHeaderDependency = require("./HarmonyExportHeaderDependency");
-const HarmonyExportExpressionDependency = require("./HarmonyExportExpressionDependency");
-const HarmonyExportSpecifierDependency = require("./HarmonyExportSpecifierDependency");
-const HarmonyExportImportedSpecifierDependency = require("./HarmonyExportImportedSpecifierDependency");
-const HarmonyAcceptDependency = require("./HarmonyAcceptDependency");
-const HarmonyAcceptImportDependency = require("./HarmonyAcceptImportDependency");
-
-const NullFactory = require("../NullFactory");
-
-const HarmonyDetectionParserPlugin = require("./HarmonyDetectionParserPlugin");
-const HarmonyImportDependencyParserPlugin = require("./HarmonyImportDependencyParserPlugin");
-const HarmonyExportDependencyParserPlugin = require("./HarmonyExportDependencyParserPlugin");
-const HarmonyTopLevelThisParserPlugin = require("./HarmonyTopLevelThisParserPlugin");
-
-class HarmonyModulesPlugin {
- constructor(options) {
- this.options = options;
- }
-
- apply(compiler) {
- compiler.hooks.compilation.tap(
- "HarmonyModulesPlugin",
- (compilation, { normalModuleFactory }) => {
- compilation.dependencyFactories.set(
- HarmonyCompatibilityDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- HarmonyCompatibilityDependency,
- new HarmonyCompatibilityDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- HarmonyInitDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- HarmonyInitDependency,
- new HarmonyInitDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- HarmonyImportSideEffectDependency,
- normalModuleFactory
- );
- compilation.dependencyTemplates.set(
- HarmonyImportSideEffectDependency,
- new HarmonyImportSideEffectDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- HarmonyImportSpecifierDependency,
- normalModuleFactory
- );
- compilation.dependencyTemplates.set(
- HarmonyImportSpecifierDependency,
- new HarmonyImportSpecifierDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- HarmonyExportHeaderDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- HarmonyExportHeaderDependency,
- new HarmonyExportHeaderDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- HarmonyExportExpressionDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- HarmonyExportExpressionDependency,
- new HarmonyExportExpressionDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- HarmonyExportSpecifierDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- HarmonyExportSpecifierDependency,
- new HarmonyExportSpecifierDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- HarmonyExportImportedSpecifierDependency,
- normalModuleFactory
- );
- compilation.dependencyTemplates.set(
- HarmonyExportImportedSpecifierDependency,
- new HarmonyExportImportedSpecifierDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- HarmonyAcceptDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- HarmonyAcceptDependency,
- new HarmonyAcceptDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- HarmonyAcceptImportDependency,
- normalModuleFactory
- );
- compilation.dependencyTemplates.set(
- HarmonyAcceptImportDependency,
- new HarmonyAcceptImportDependency.Template()
- );
-
- const handler = (parser, parserOptions) => {
- if (parserOptions.harmony !== undefined && !parserOptions.harmony)
- return;
-
- new HarmonyDetectionParserPlugin().apply(parser);
- new HarmonyImportDependencyParserPlugin(this.options).apply(parser);
- new HarmonyExportDependencyParserPlugin(this.options).apply(parser);
- new HarmonyTopLevelThisParserPlugin().apply(parser);
- };
-
- normalModuleFactory.hooks.parser
- .for("javascript/auto")
- .tap("HarmonyModulesPlugin", handler);
- normalModuleFactory.hooks.parser
- .for("javascript/esm")
- .tap("HarmonyModulesPlugin", handler);
- }
- );
- }
-}
-module.exports = HarmonyModulesPlugin;
diff --git a/node_modules/webpack/lib/dependencies/HarmonyTopLevelThisParserPlugin.js b/node_modules/webpack/lib/dependencies/HarmonyTopLevelThisParserPlugin.js
deleted file mode 100644
index f036009..0000000
--- a/node_modules/webpack/lib/dependencies/HarmonyTopLevelThisParserPlugin.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Florent Cailhol @ooflorent
-*/
-"use strict";
-
-const ConstDependency = require("./ConstDependency");
-
-class HarmonyTopLevelThisParserPlugin {
- apply(parser) {
- parser.hooks.expression
- .for("this")
- .tap("HarmonyTopLevelThisParserPlugin", node => {
- if (!parser.scope.topLevelScope) return;
- const module = parser.state.module;
- const isHarmony = !!(module.buildMeta && module.buildMeta.exportsType);
- if (isHarmony) {
- const dep = new ConstDependency("undefined", node.range, false);
- dep.loc = node.loc;
- parser.state.current.addDependency(dep);
- }
- });
- }
-}
-
-module.exports = HarmonyTopLevelThisParserPlugin;
diff --git a/node_modules/webpack/lib/dependencies/ImportContextDependency.js b/node_modules/webpack/lib/dependencies/ImportContextDependency.js
deleted file mode 100644
index f25a28a..0000000
--- a/node_modules/webpack/lib/dependencies/ImportContextDependency.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ContextDependency = require("./ContextDependency");
-const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");
-
-class ImportContextDependency extends ContextDependency {
- constructor(options, range, valueRange) {
- super(options);
- this.range = range;
- this.valueRange = valueRange;
- }
-
- get type() {
- return `import() context ${this.options.mode}`;
- }
-}
-
-ImportContextDependency.Template = ContextDependencyTemplateAsRequireCall;
-
-module.exports = ImportContextDependency;
diff --git a/node_modules/webpack/lib/dependencies/ImportDependenciesBlock.js b/node_modules/webpack/lib/dependencies/ImportDependenciesBlock.js
deleted file mode 100644
index 61e6bb2..0000000
--- a/node_modules/webpack/lib/dependencies/ImportDependenciesBlock.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
-const ImportDependency = require("./ImportDependency");
-
-module.exports = class ImportDependenciesBlock extends AsyncDependenciesBlock {
- // TODO webpack 5 reorganize arguments
- constructor(request, range, groupOptions, module, loc, originModule) {
- super(groupOptions, module, loc, request);
- this.range = range;
- const dep = new ImportDependency(request, originModule, this);
- dep.loc = loc;
- this.addDependency(dep);
- }
-};
diff --git a/node_modules/webpack/lib/dependencies/ImportDependency.js b/node_modules/webpack/lib/dependencies/ImportDependency.js
deleted file mode 100644
index 520bed2..0000000
--- a/node_modules/webpack/lib/dependencies/ImportDependency.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-
-class ImportDependency extends ModuleDependency {
- constructor(request, originModule, block) {
- super(request);
- this.originModule = originModule;
- this.block = block;
- }
-
- get type() {
- return "import()";
- }
-}
-
-ImportDependency.Template = class ImportDependencyTemplate {
- apply(dep, source, runtime) {
- const content = runtime.moduleNamespacePromise({
- block: dep.block,
- module: dep.module,
- request: dep.request,
- strict: dep.originModule.buildMeta.strictHarmonyModule,
- message: "import()"
- });
-
- source.replace(dep.block.range[0], dep.block.range[1] - 1, content);
- }
-};
-
-module.exports = ImportDependency;
diff --git a/node_modules/webpack/lib/dependencies/ImportEagerDependency.js b/node_modules/webpack/lib/dependencies/ImportEagerDependency.js
deleted file mode 100644
index 0671d5d..0000000
--- a/node_modules/webpack/lib/dependencies/ImportEagerDependency.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-
-class ImportEagerDependency extends ModuleDependency {
- constructor(request, originModule, range) {
- super(request);
- this.originModule = originModule;
- this.range = range;
- }
-
- get type() {
- return "import() eager";
- }
-}
-
-ImportEagerDependency.Template = class ImportEagerDependencyTemplate {
- apply(dep, source, runtime) {
- const content = runtime.moduleNamespacePromise({
- module: dep.module,
- request: dep.request,
- strict: dep.originModule.buildMeta.strictHarmonyModule,
- message: "import() eager"
- });
- source.replace(dep.range[0], dep.range[1] - 1, content);
- }
-};
-
-module.exports = ImportEagerDependency;
diff --git a/node_modules/webpack/lib/dependencies/ImportParserPlugin.js b/node_modules/webpack/lib/dependencies/ImportParserPlugin.js
deleted file mode 100644
index cb751a8..0000000
--- a/node_modules/webpack/lib/dependencies/ImportParserPlugin.js
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const ImportContextDependency = require("./ImportContextDependency");
-const ImportWeakDependency = require("./ImportWeakDependency");
-const ImportDependenciesBlock = require("./ImportDependenciesBlock");
-const ImportEagerDependency = require("./ImportEagerDependency");
-const ContextDependencyHelpers = require("./ContextDependencyHelpers");
-const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
-const CommentCompilationWarning = require("../CommentCompilationWarning");
-
-class ImportParserPlugin {
- constructor(options) {
- this.options = options;
- }
-
- apply(parser) {
- parser.hooks.importCall.tap("ImportParserPlugin", expr => {
- if (expr.arguments.length !== 1) {
- throw new Error(
- "Incorrect number of arguments provided to 'import(module: string) -> Promise'."
- );
- }
-
- const param = parser.evaluateExpression(expr.arguments[0]);
-
- let chunkName = null;
- let mode = "lazy";
- let include = null;
- let exclude = null;
- const groupOptions = {};
-
- const {
- options: importOptions,
- errors: commentErrors
- } = parser.parseCommentOptions(expr.range);
-
- if (commentErrors) {
- for (const e of commentErrors) {
- const { comment } = e;
- parser.state.module.warnings.push(
- new CommentCompilationWarning(
- `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`,
- parser.state.module,
- comment.loc
- )
- );
- }
- }
-
- if (importOptions) {
- if (importOptions.webpackIgnore !== undefined) {
- if (typeof importOptions.webpackIgnore !== "boolean") {
- parser.state.module.warnings.push(
- new UnsupportedFeatureWarning(
- parser.state.module,
- `\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`,
- expr.loc
- )
- );
- } else {
- // Do not instrument `import()` if `webpackIgnore` is `true`
- if (importOptions.webpackIgnore) {
- return false;
- }
- }
- }
- if (importOptions.webpackChunkName !== undefined) {
- if (typeof importOptions.webpackChunkName !== "string") {
- parser.state.module.warnings.push(
- new UnsupportedFeatureWarning(
- parser.state.module,
- `\`webpackChunkName\` expected a string, but received: ${importOptions.webpackChunkName}.`,
- expr.loc
- )
- );
- } else {
- chunkName = importOptions.webpackChunkName;
- }
- }
- if (importOptions.webpackMode !== undefined) {
- if (typeof importOptions.webpackMode !== "string") {
- parser.state.module.warnings.push(
- new UnsupportedFeatureWarning(
- parser.state.module,
- `\`webpackMode\` expected a string, but received: ${importOptions.webpackMode}.`,
- expr.loc
- )
- );
- } else {
- mode = importOptions.webpackMode;
- }
- }
- if (importOptions.webpackPrefetch !== undefined) {
- if (importOptions.webpackPrefetch === true) {
- groupOptions.prefetchOrder = 0;
- } else if (typeof importOptions.webpackPrefetch === "number") {
- groupOptions.prefetchOrder = importOptions.webpackPrefetch;
- } else {
- parser.state.module.warnings.push(
- new UnsupportedFeatureWarning(
- parser.state.module,
- `\`webpackPrefetch\` expected true or a number, but received: ${importOptions.webpackPrefetch}.`,
- expr.loc
- )
- );
- }
- }
- if (importOptions.webpackPreload !== undefined) {
- if (importOptions.webpackPreload === true) {
- groupOptions.preloadOrder = 0;
- } else if (typeof importOptions.webpackPreload === "number") {
- groupOptions.preloadOrder = importOptions.webpackPreload;
- } else {
- parser.state.module.warnings.push(
- new UnsupportedFeatureWarning(
- parser.state.module,
- `\`webpackPreload\` expected true or a number, but received: ${importOptions.webpackPreload}.`,
- expr.loc
- )
- );
- }
- }
- if (importOptions.webpackInclude !== undefined) {
- if (
- !importOptions.webpackInclude ||
- importOptions.webpackInclude.constructor.name !== "RegExp"
- ) {
- parser.state.module.warnings.push(
- new UnsupportedFeatureWarning(
- parser.state.module,
- `\`webpackInclude\` expected a regular expression, but received: ${importOptions.webpackInclude}.`,
- expr.loc
- )
- );
- } else {
- include = new RegExp(importOptions.webpackInclude);
- }
- }
- if (importOptions.webpackExclude !== undefined) {
- if (
- !importOptions.webpackExclude ||
- importOptions.webpackExclude.constructor.name !== "RegExp"
- ) {
- parser.state.module.warnings.push(
- new UnsupportedFeatureWarning(
- parser.state.module,
- `\`webpackExclude\` expected a regular expression, but received: ${importOptions.webpackExclude}.`,
- expr.loc
- )
- );
- } else {
- exclude = new RegExp(importOptions.webpackExclude);
- }
- }
- }
-
- if (param.isString()) {
- if (mode !== "lazy" && mode !== "eager" && mode !== "weak") {
- parser.state.module.warnings.push(
- new UnsupportedFeatureWarning(
- parser.state.module,
- `\`webpackMode\` expected 'lazy', 'eager' or 'weak', but received: ${mode}.`,
- expr.loc
- )
- );
- }
-
- if (mode === "eager") {
- const dep = new ImportEagerDependency(
- param.string,
- parser.state.module,
- expr.range
- );
- parser.state.current.addDependency(dep);
- } else if (mode === "weak") {
- const dep = new ImportWeakDependency(
- param.string,
- parser.state.module,
- expr.range
- );
- parser.state.current.addDependency(dep);
- } else {
- const depBlock = new ImportDependenciesBlock(
- param.string,
- expr.range,
- Object.assign(groupOptions, {
- name: chunkName
- }),
- parser.state.module,
- expr.loc,
- parser.state.module
- );
- parser.state.current.addBlock(depBlock);
- }
- return true;
- } else {
- if (
- mode !== "lazy" &&
- mode !== "lazy-once" &&
- mode !== "eager" &&
- mode !== "weak"
- ) {
- parser.state.module.warnings.push(
- new UnsupportedFeatureWarning(
- parser.state.module,
- `\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${mode}.`,
- expr.loc
- )
- );
- mode = "lazy";
- }
-
- if (mode === "weak") {
- mode = "async-weak";
- }
- const dep = ContextDependencyHelpers.create(
- ImportContextDependency,
- expr.range,
- param,
- expr,
- this.options,
- {
- chunkName,
- groupOptions,
- include,
- exclude,
- mode,
- namespaceObject: parser.state.module.buildMeta.strictHarmonyModule
- ? "strict"
- : true
- },
- parser
- );
- if (!dep) return;
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- parser.state.current.addDependency(dep);
- return true;
- }
- });
- }
-}
-
-module.exports = ImportParserPlugin;
diff --git a/node_modules/webpack/lib/dependencies/ImportPlugin.js b/node_modules/webpack/lib/dependencies/ImportPlugin.js
deleted file mode 100644
index 1647192..0000000
--- a/node_modules/webpack/lib/dependencies/ImportPlugin.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const ImportDependency = require("./ImportDependency");
-const ImportEagerDependency = require("./ImportEagerDependency");
-const ImportWeakDependency = require("./ImportWeakDependency");
-const ImportContextDependency = require("./ImportContextDependency");
-const ImportParserPlugin = require("./ImportParserPlugin");
-
-class ImportPlugin {
- constructor(options) {
- this.options = options;
- }
-
- apply(compiler) {
- const options = this.options;
- compiler.hooks.compilation.tap(
- "ImportPlugin",
- (compilation, { contextModuleFactory, normalModuleFactory }) => {
- compilation.dependencyFactories.set(
- ImportDependency,
- normalModuleFactory
- );
- compilation.dependencyTemplates.set(
- ImportDependency,
- new ImportDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- ImportEagerDependency,
- normalModuleFactory
- );
- compilation.dependencyTemplates.set(
- ImportEagerDependency,
- new ImportEagerDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- ImportWeakDependency,
- normalModuleFactory
- );
- compilation.dependencyTemplates.set(
- ImportWeakDependency,
- new ImportWeakDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- ImportContextDependency,
- contextModuleFactory
- );
- compilation.dependencyTemplates.set(
- ImportContextDependency,
- new ImportContextDependency.Template()
- );
-
- const handler = (parser, parserOptions) => {
- if (parserOptions.import !== undefined && !parserOptions.import)
- return;
-
- new ImportParserPlugin(options).apply(parser);
- };
-
- normalModuleFactory.hooks.parser
- .for("javascript/auto")
- .tap("ImportPlugin", handler);
- normalModuleFactory.hooks.parser
- .for("javascript/dynamic")
- .tap("ImportPlugin", handler);
- normalModuleFactory.hooks.parser
- .for("javascript/esm")
- .tap("ImportPlugin", handler);
- }
- );
- }
-}
-module.exports = ImportPlugin;
diff --git a/node_modules/webpack/lib/dependencies/ImportWeakDependency.js b/node_modules/webpack/lib/dependencies/ImportWeakDependency.js
deleted file mode 100644
index d484000..0000000
--- a/node_modules/webpack/lib/dependencies/ImportWeakDependency.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-
-class ImportWeakDependency extends ModuleDependency {
- constructor(request, originModule, range) {
- super(request);
- this.originModule = originModule;
- this.range = range;
- this.weak = true;
- }
-
- get type() {
- return "import() weak";
- }
-}
-
-ImportWeakDependency.Template = class ImportDependencyTemplate {
- apply(dep, source, runtime) {
- const content = runtime.moduleNamespacePromise({
- module: dep.module,
- request: dep.request,
- strict: dep.originModule.buildMeta.strictHarmonyModule,
- message: "import() weak",
- weak: true
- });
- source.replace(dep.range[0], dep.range[1] - 1, content);
- }
-};
-
-module.exports = ImportWeakDependency;
diff --git a/node_modules/webpack/lib/dependencies/JsonExportsDependency.js b/node_modules/webpack/lib/dependencies/JsonExportsDependency.js
deleted file mode 100644
index 9e17bfb..0000000
--- a/node_modules/webpack/lib/dependencies/JsonExportsDependency.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const NullDependency = require("./NullDependency");
-
-class JsonExportsDependency extends NullDependency {
- constructor(exports) {
- super();
- this.exports = exports;
- }
-
- get type() {
- return "json exports";
- }
-
- getExports() {
- return {
- exports: this.exports,
- dependencies: undefined
- };
- }
-}
-
-module.exports = JsonExportsDependency;
diff --git a/node_modules/webpack/lib/dependencies/LoaderDependency.js b/node_modules/webpack/lib/dependencies/LoaderDependency.js
deleted file mode 100644
index 9d0876b..0000000
--- a/node_modules/webpack/lib/dependencies/LoaderDependency.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-
-class LoaderDependency extends ModuleDependency {
- /**
- * @param {string} request request string
- */
- constructor(request) {
- super(request);
- }
-
- get type() {
- return "loader";
- }
-}
-
-module.exports = LoaderDependency;
diff --git a/node_modules/webpack/lib/dependencies/LoaderPlugin.js b/node_modules/webpack/lib/dependencies/LoaderPlugin.js
deleted file mode 100644
index e46f593..0000000
--- a/node_modules/webpack/lib/dependencies/LoaderPlugin.js
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const LoaderDependency = require("./LoaderDependency");
-const NormalModule = require("../NormalModule");
-
-/** @typedef {import("../Module")} Module */
-
-/**
- * @callback LoadModuleCallback
- * @param {Error=} err error object
- * @param {string=} source source code
- * @param {object=} map source map
- * @param {Module=} module loaded module if successful
- */
-
-class LoaderPlugin {
- apply(compiler) {
- compiler.hooks.compilation.tap(
- "LoaderPlugin",
- (compilation, { normalModuleFactory }) => {
- compilation.dependencyFactories.set(
- LoaderDependency,
- normalModuleFactory
- );
- }
- );
-
- compiler.hooks.compilation.tap("LoaderPlugin", compilation => {
- compilation.hooks.normalModuleLoader.tap(
- "LoaderPlugin",
- (loaderContext, module) => {
- /**
- * @param {string} request the request string to load the module from
- * @param {LoadModuleCallback} callback callback returning the loaded module or error
- * @returns {void}
- */
- loaderContext.loadModule = (request, callback) => {
- const dep = new LoaderDependency(request);
- dep.loc = {
- name: request
- };
- const factory = compilation.dependencyFactories.get(
- dep.constructor
- );
- if (factory === undefined) {
- return callback(
- new Error(
- `No module factory available for dependency type: ${dep.constructor.name}`
- )
- );
- }
- compilation.semaphore.release();
- compilation.addModuleDependencies(
- module,
- [
- {
- factory,
- dependencies: [dep]
- }
- ],
- true,
- "lm",
- true,
- err => {
- compilation.semaphore.acquire(() => {
- if (err) {
- return callback(err);
- }
- if (!dep.module) {
- return callback(new Error("Cannot load the module"));
- }
- // TODO consider removing this in webpack 5
- if (dep.module instanceof NormalModule && dep.module.error) {
- return callback(dep.module.error);
- }
- if (!dep.module._source) {
- throw new Error(
- "The module created for a LoaderDependency must have a property _source"
- );
- }
- let source, map;
- const moduleSource = dep.module._source;
- if (moduleSource.sourceAndMap) {
- const sourceAndMap = moduleSource.sourceAndMap();
- map = sourceAndMap.map;
- source = sourceAndMap.source;
- } else {
- map = moduleSource.map();
- source = moduleSource.source();
- }
- if (dep.module.buildInfo.fileDependencies) {
- for (const d of dep.module.buildInfo.fileDependencies) {
- loaderContext.addDependency(d);
- }
- }
- if (dep.module.buildInfo.contextDependencies) {
- for (const d of dep.module.buildInfo.contextDependencies) {
- loaderContext.addContextDependency(d);
- }
- }
- return callback(null, source, map, dep.module);
- });
- }
- );
- };
- }
- );
- });
- }
-}
-module.exports = LoaderPlugin;
diff --git a/node_modules/webpack/lib/dependencies/LocalModule.js b/node_modules/webpack/lib/dependencies/LocalModule.js
deleted file mode 100644
index 06e5385..0000000
--- a/node_modules/webpack/lib/dependencies/LocalModule.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-class LocalModule {
- constructor(module, name, idx) {
- this.module = module;
- this.name = name;
- this.idx = idx;
- this.used = false;
- }
-
- flagUsed() {
- this.used = true;
- }
-
- variableName() {
- return "__WEBPACK_LOCAL_MODULE_" + this.idx + "__";
- }
-}
-module.exports = LocalModule;
diff --git a/node_modules/webpack/lib/dependencies/LocalModuleDependency.js b/node_modules/webpack/lib/dependencies/LocalModuleDependency.js
deleted file mode 100644
index 5d1e56b..0000000
--- a/node_modules/webpack/lib/dependencies/LocalModuleDependency.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const NullDependency = require("./NullDependency");
-
-class LocalModuleDependency extends NullDependency {
- constructor(localModule, range, callNew) {
- super();
- localModule.flagUsed();
- this.localModule = localModule;
- this.range = range;
- this.callNew = callNew;
- }
-}
-
-LocalModuleDependency.Template = class LocalModuleDependencyTemplate {
- apply(dep, source) {
- if (!dep.range) return;
- const moduleInstance = dep.callNew
- ? `new (function () { return ${dep.localModule.variableName()}; })()`
- : dep.localModule.variableName();
- source.replace(dep.range[0], dep.range[1] - 1, moduleInstance);
- }
-};
-
-module.exports = LocalModuleDependency;
diff --git a/node_modules/webpack/lib/dependencies/LocalModulesHelpers.js b/node_modules/webpack/lib/dependencies/LocalModulesHelpers.js
deleted file mode 100644
index 0566227..0000000
--- a/node_modules/webpack/lib/dependencies/LocalModulesHelpers.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const LocalModule = require("./LocalModule");
-const LocalModulesHelpers = exports;
-
-const lookup = (parent, mod) => {
- if (mod.charAt(0) !== ".") return mod;
-
- var path = parent.split("/");
- var segs = mod.split("/");
- path.pop();
-
- for (let i = 0; i < segs.length; i++) {
- const seg = segs[i];
- if (seg === "..") {
- path.pop();
- } else if (seg !== ".") {
- path.push(seg);
- }
- }
-
- return path.join("/");
-};
-
-LocalModulesHelpers.addLocalModule = (state, name) => {
- if (!state.localModules) {
- state.localModules = [];
- }
- const m = new LocalModule(state.module, name, state.localModules.length);
- state.localModules.push(m);
- return m;
-};
-
-LocalModulesHelpers.getLocalModule = (state, name, namedModule) => {
- if (!state.localModules) return null;
- if (namedModule) {
- // resolve dependency name relative to the defining named module
- name = lookup(namedModule, name);
- }
- for (let i = 0; i < state.localModules.length; i++) {
- if (state.localModules[i].name === name) {
- return state.localModules[i];
- }
- }
- return null;
-};
-
-module.exports = LocalModulesHelpers;
diff --git a/node_modules/webpack/lib/dependencies/ModuleDependency.js b/node_modules/webpack/lib/dependencies/ModuleDependency.js
deleted file mode 100644
index f325e7a..0000000
--- a/node_modules/webpack/lib/dependencies/ModuleDependency.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const Dependency = require("../Dependency");
-
-class ModuleDependency extends Dependency {
- /**
- * @param {string} request request path which needs resolving
- */
- constructor(request) {
- super();
- this.request = request;
- this.userRequest = request;
- }
-
- getResourceIdentifier() {
- return `module${this.request}`;
- }
-}
-
-module.exports = ModuleDependency;
diff --git a/node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsId.js b/node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsId.js
deleted file mode 100644
index 82bc6b5..0000000
--- a/node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsId.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-class ModuleDependencyTemplateAsId {
- apply(dep, source, runtime) {
- if (!dep.range) return;
- const content = runtime.moduleId({
- module: dep.module,
- request: dep.request
- });
- source.replace(dep.range[0], dep.range[1] - 1, content);
- }
-}
-module.exports = ModuleDependencyTemplateAsId;
diff --git a/node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsRequireId.js b/node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsRequireId.js
deleted file mode 100644
index db74b89..0000000
--- a/node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsRequireId.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-class ModuleDependencyTemplateAsRequireId {
- apply(dep, source, runtime) {
- if (!dep.range) return;
- const content = runtime.moduleExports({
- module: dep.module,
- request: dep.request
- });
- source.replace(dep.range[0], dep.range[1] - 1, content);
- }
-}
-module.exports = ModuleDependencyTemplateAsRequireId;
diff --git a/node_modules/webpack/lib/dependencies/ModuleHotAcceptDependency.js b/node_modules/webpack/lib/dependencies/ModuleHotAcceptDependency.js
deleted file mode 100644
index 403f7f1..0000000
--- a/node_modules/webpack/lib/dependencies/ModuleHotAcceptDependency.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-const ModuleDependencyTemplateAsId = require("./ModuleDependencyTemplateAsId");
-
-class ModuleHotAcceptDependency extends ModuleDependency {
- constructor(request, range) {
- super(request);
- this.range = range;
- this.weak = true;
- }
-
- get type() {
- return "module.hot.accept";
- }
-}
-
-ModuleHotAcceptDependency.Template = ModuleDependencyTemplateAsId;
-
-module.exports = ModuleHotAcceptDependency;
diff --git a/node_modules/webpack/lib/dependencies/ModuleHotDeclineDependency.js b/node_modules/webpack/lib/dependencies/ModuleHotDeclineDependency.js
deleted file mode 100644
index 49bf0af..0000000
--- a/node_modules/webpack/lib/dependencies/ModuleHotDeclineDependency.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-const ModuleDependencyTemplateAsId = require("./ModuleDependencyTemplateAsId");
-
-class ModuleHotDeclineDependency extends ModuleDependency {
- constructor(request, range) {
- super(request);
- this.range = range;
- this.weak = true;
- }
-
- get type() {
- return "module.hot.decline";
- }
-}
-
-ModuleHotDeclineDependency.Template = ModuleDependencyTemplateAsId;
-
-module.exports = ModuleHotDeclineDependency;
diff --git a/node_modules/webpack/lib/dependencies/MultiEntryDependency.js b/node_modules/webpack/lib/dependencies/MultiEntryDependency.js
deleted file mode 100644
index 712d3ff..0000000
--- a/node_modules/webpack/lib/dependencies/MultiEntryDependency.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-/** @typedef {import("./SingleEntryDependency")} SingleEntryDependency */
-const Dependency = require("../Dependency");
-
-class MultiEntryDependency extends Dependency {
- /**
- * @param {SingleEntryDependency[]} dependencies an array of SingleEntryDependencies
- * @param {string} name entry name
- */
- constructor(dependencies, name) {
- super();
- this.dependencies = dependencies;
- this.name = name;
- }
-
- get type() {
- return "multi entry";
- }
-}
-
-module.exports = MultiEntryDependency;
diff --git a/node_modules/webpack/lib/dependencies/NullDependency.js b/node_modules/webpack/lib/dependencies/NullDependency.js
deleted file mode 100644
index 585f5fc..0000000
--- a/node_modules/webpack/lib/dependencies/NullDependency.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const Dependency = require("../Dependency");
-
-class NullDependency extends Dependency {
- get type() {
- return "null";
- }
-
- updateHash() {}
-}
-
-NullDependency.Template = class NullDependencyTemplate {
- apply() {}
-};
-
-module.exports = NullDependency;
diff --git a/node_modules/webpack/lib/dependencies/PrefetchDependency.js b/node_modules/webpack/lib/dependencies/PrefetchDependency.js
deleted file mode 100644
index 7107d83..0000000
--- a/node_modules/webpack/lib/dependencies/PrefetchDependency.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-
-class PrefetchDependency extends ModuleDependency {
- constructor(request) {
- super(request);
- }
-
- get type() {
- return "prefetch";
- }
-}
-
-module.exports = PrefetchDependency;
diff --git a/node_modules/webpack/lib/dependencies/RequireContextDependency.js b/node_modules/webpack/lib/dependencies/RequireContextDependency.js
deleted file mode 100644
index fd2e728..0000000
--- a/node_modules/webpack/lib/dependencies/RequireContextDependency.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ContextDependency = require("./ContextDependency");
-const ModuleDependencyTemplateAsRequireId = require("./ModuleDependencyTemplateAsRequireId");
-
-class RequireContextDependency extends ContextDependency {
- constructor(options, range) {
- super(options);
- this.range = range;
- }
-
- get type() {
- return "require.context";
- }
-}
-
-RequireContextDependency.Template = ModuleDependencyTemplateAsRequireId;
-
-module.exports = RequireContextDependency;
diff --git a/node_modules/webpack/lib/dependencies/RequireContextDependencyParserPlugin.js b/node_modules/webpack/lib/dependencies/RequireContextDependencyParserPlugin.js
deleted file mode 100644
index 1071fc0..0000000
--- a/node_modules/webpack/lib/dependencies/RequireContextDependencyParserPlugin.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const RequireContextDependency = require("./RequireContextDependency");
-
-module.exports = class RequireContextDependencyParserPlugin {
- apply(parser) {
- parser.hooks.call
- .for("require.context")
- .tap("RequireContextDependencyParserPlugin", expr => {
- let regExp = /^\.\/.*$/;
- let recursive = true;
- let mode = "sync";
- switch (expr.arguments.length) {
- case 4: {
- const modeExpr = parser.evaluateExpression(expr.arguments[3]);
- if (!modeExpr.isString()) return;
- mode = modeExpr.string;
- }
- // falls through
- case 3: {
- const regExpExpr = parser.evaluateExpression(expr.arguments[2]);
- if (!regExpExpr.isRegExp()) return;
- regExp = regExpExpr.regExp;
- }
- // falls through
- case 2: {
- const recursiveExpr = parser.evaluateExpression(expr.arguments[1]);
- if (!recursiveExpr.isBoolean()) return;
- recursive = recursiveExpr.bool;
- }
- // falls through
- case 1: {
- const requestExpr = parser.evaluateExpression(expr.arguments[0]);
- if (!requestExpr.isString()) return;
- const dep = new RequireContextDependency(
- {
- request: requestExpr.string,
- recursive,
- regExp,
- mode
- },
- expr.range
- );
- dep.loc = expr.loc;
- dep.optional = parser.scope.inTry;
- parser.state.current.addDependency(dep);
- return true;
- }
- }
- });
- }
-};
diff --git a/node_modules/webpack/lib/dependencies/RequireContextPlugin.js b/node_modules/webpack/lib/dependencies/RequireContextPlugin.js
deleted file mode 100644
index 4e44e87..0000000
--- a/node_modules/webpack/lib/dependencies/RequireContextPlugin.js
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const RequireContextDependency = require("./RequireContextDependency");
-const ContextElementDependency = require("./ContextElementDependency");
-
-const RequireContextDependencyParserPlugin = require("./RequireContextDependencyParserPlugin");
-
-class RequireContextPlugin {
- constructor(modulesDirectories, extensions, mainFiles) {
- if (!Array.isArray(modulesDirectories)) {
- throw new Error("modulesDirectories must be an array");
- }
- if (!Array.isArray(extensions)) {
- throw new Error("extensions must be an array");
- }
- this.modulesDirectories = modulesDirectories;
- this.extensions = extensions;
- this.mainFiles = mainFiles;
- }
-
- apply(compiler) {
- compiler.hooks.compilation.tap(
- "RequireContextPlugin",
- (compilation, { contextModuleFactory, normalModuleFactory }) => {
- compilation.dependencyFactories.set(
- RequireContextDependency,
- contextModuleFactory
- );
- compilation.dependencyTemplates.set(
- RequireContextDependency,
- new RequireContextDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- ContextElementDependency,
- normalModuleFactory
- );
-
- const handler = (parser, parserOptions) => {
- if (
- parserOptions.requireContext !== undefined &&
- !parserOptions.requireContext
- )
- return;
-
- new RequireContextDependencyParserPlugin().apply(parser);
- };
-
- normalModuleFactory.hooks.parser
- .for("javascript/auto")
- .tap("RequireContextPlugin", handler);
- normalModuleFactory.hooks.parser
- .for("javascript/dynamic")
- .tap("RequireContextPlugin", handler);
-
- contextModuleFactory.hooks.alternatives.tap(
- "RequireContextPlugin",
- items => {
- if (items.length === 0) return items;
- return items
- .map(obj => {
- return this.extensions
- .filter(ext => {
- const l = obj.request.length;
- return (
- l > ext.length &&
- obj.request.substr(l - ext.length, l) === ext
- );
- })
- .map(ext => {
- const l = obj.request.length;
- return {
- context: obj.context,
- request: obj.request.substr(0, l - ext.length)
- };
- })
- .concat(obj);
- })
- .reduce((a, b) => a.concat(b), []);
- }
- );
-
- contextModuleFactory.hooks.alternatives.tap(
- "RequireContextPlugin",
- items => {
- if (items.length === 0) return items;
- return items
- .map(obj => {
- return this.mainFiles
- .filter(mainFile => {
- const l = obj.request.length;
- return (
- l > mainFile.length + 1 &&
- obj.request.substr(l - mainFile.length - 1, l) ===
- "/" + mainFile
- );
- })
- .map(mainFile => {
- const l = obj.request.length;
- return [
- {
- context: obj.context,
- request: obj.request.substr(0, l - mainFile.length)
- },
- {
- context: obj.context,
- request: obj.request.substr(0, l - mainFile.length - 1)
- }
- ];
- })
- .reduce((a, b) => a.concat(b), [])
- .concat(obj);
- })
- .reduce((a, b) => a.concat(b), []);
- }
- );
-
- contextModuleFactory.hooks.alternatives.tap(
- "RequireContextPlugin",
- items => {
- if (items.length === 0) return items;
- return items.map(obj => {
- for (let i = 0; i < this.modulesDirectories.length; i++) {
- const dir = this.modulesDirectories[i];
- const idx = obj.request.indexOf("./" + dir + "/");
- if (idx === 0) {
- obj.request = obj.request.slice(dir.length + 3);
- break;
- }
- }
- return obj;
- });
- }
- );
- }
- );
- }
-}
-module.exports = RequireContextPlugin;
diff --git a/node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlock.js b/node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlock.js
deleted file mode 100644
index 2a5dde7..0000000
--- a/node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlock.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
-const RequireEnsureDependency = require("./RequireEnsureDependency");
-
-module.exports = class RequireEnsureDependenciesBlock extends AsyncDependenciesBlock {
- constructor(
- expr,
- successExpression,
- errorExpression,
- chunkName,
- chunkNameRange,
- module,
- loc
- ) {
- super(chunkName, module, loc, null);
- this.expr = expr;
- const successBodyRange =
- successExpression &&
- successExpression.body &&
- successExpression.body.range;
- if (successBodyRange) {
- this.range = [successBodyRange[0] + 1, successBodyRange[1] - 1];
- }
- this.chunkNameRange = chunkNameRange;
- const dep = new RequireEnsureDependency(this);
- dep.loc = loc;
- this.addDependency(dep);
- }
-};
diff --git a/node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js b/node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js
deleted file mode 100644
index 213eaac..0000000
--- a/node_modules/webpack/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const RequireEnsureDependenciesBlock = require("./RequireEnsureDependenciesBlock");
-const RequireEnsureItemDependency = require("./RequireEnsureItemDependency");
-const getFunctionExpression = require("./getFunctionExpression");
-
-module.exports = class RequireEnsureDependenciesBlockParserPlugin {
- apply(parser) {
- parser.hooks.call
- .for("require.ensure")
- .tap("RequireEnsureDependenciesBlockParserPlugin", expr => {
- let chunkName = null;
- let chunkNameRange = null;
- let errorExpressionArg = null;
- let errorExpression = null;
- switch (expr.arguments.length) {
- case 4: {
- const chunkNameExpr = parser.evaluateExpression(expr.arguments[3]);
- if (!chunkNameExpr.isString()) return;
- chunkNameRange = chunkNameExpr.range;
- chunkName = chunkNameExpr.string;
- }
- // falls through
- case 3: {
- errorExpressionArg = expr.arguments[2];
- errorExpression = getFunctionExpression(errorExpressionArg);
-
- if (!errorExpression && !chunkName) {
- const chunkNameExpr = parser.evaluateExpression(
- expr.arguments[2]
- );
- if (!chunkNameExpr.isString()) return;
- chunkNameRange = chunkNameExpr.range;
- chunkName = chunkNameExpr.string;
- }
- }
- // falls through
- case 2: {
- const dependenciesExpr = parser.evaluateExpression(
- expr.arguments[0]
- );
- const dependenciesItems = dependenciesExpr.isArray()
- ? dependenciesExpr.items
- : [dependenciesExpr];
- const successExpressionArg = expr.arguments[1];
- const successExpression = getFunctionExpression(
- successExpressionArg
- );
-
- if (successExpression) {
- parser.walkExpressions(successExpression.expressions);
- }
- if (errorExpression) {
- parser.walkExpressions(errorExpression.expressions);
- }
-
- const dep = new RequireEnsureDependenciesBlock(
- expr,
- successExpression ? successExpression.fn : successExpressionArg,
- errorExpression ? errorExpression.fn : errorExpressionArg,
- chunkName,
- chunkNameRange,
- parser.state.module,
- expr.loc
- );
- const old = parser.state.current;
- parser.state.current = dep;
- try {
- let failed = false;
- parser.inScope([], () => {
- for (const ee of dependenciesItems) {
- if (ee.isString()) {
- const edep = new RequireEnsureItemDependency(ee.string);
- edep.loc = dep.loc;
- dep.addDependency(edep);
- } else {
- failed = true;
- }
- }
- });
- if (failed) {
- return;
- }
- if (successExpression) {
- if (successExpression.fn.body.type === "BlockStatement") {
- parser.walkStatement(successExpression.fn.body);
- } else {
- parser.walkExpression(successExpression.fn.body);
- }
- }
- old.addBlock(dep);
- } finally {
- parser.state.current = old;
- }
- if (!successExpression) {
- parser.walkExpression(successExpressionArg);
- }
- if (errorExpression) {
- if (errorExpression.fn.body.type === "BlockStatement") {
- parser.walkStatement(errorExpression.fn.body);
- } else {
- parser.walkExpression(errorExpression.fn.body);
- }
- } else if (errorExpressionArg) {
- parser.walkExpression(errorExpressionArg);
- }
- return true;
- }
- }
- });
- }
-};
diff --git a/node_modules/webpack/lib/dependencies/RequireEnsureDependency.js b/node_modules/webpack/lib/dependencies/RequireEnsureDependency.js
deleted file mode 100644
index 8401305..0000000
--- a/node_modules/webpack/lib/dependencies/RequireEnsureDependency.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const NullDependency = require("./NullDependency");
-
-class RequireEnsureDependency extends NullDependency {
- constructor(block) {
- super();
- this.block = block;
- }
-
- get type() {
- return "require.ensure";
- }
-}
-
-RequireEnsureDependency.Template = class RequireEnsureDependencyTemplate {
- apply(dep, source, runtime) {
- const depBlock = dep.block;
- const promise = runtime.blockPromise({
- block: depBlock,
- message: "require.ensure"
- });
- const errorCallbackExists =
- depBlock.expr.arguments.length === 4 ||
- (!depBlock.chunkName && depBlock.expr.arguments.length === 3);
- const startBlock = `${promise}.then((`;
- const middleBlock = ").bind(null, __webpack_require__)).catch(";
- const endBlock = `).bind(null, __webpack_require__)).catch(${runtime.onError()})`;
- source.replace(
- depBlock.expr.range[0],
- depBlock.expr.arguments[1].range[0] - 1,
- startBlock
- );
- if (errorCallbackExists) {
- source.replace(
- depBlock.expr.arguments[1].range[1],
- depBlock.expr.arguments[2].range[0] - 1,
- middleBlock
- );
- source.replace(
- depBlock.expr.arguments[2].range[1],
- depBlock.expr.range[1] - 1,
- ")"
- );
- } else {
- source.replace(
- depBlock.expr.arguments[1].range[1],
- depBlock.expr.range[1] - 1,
- endBlock
- );
- }
- }
-};
-
-module.exports = RequireEnsureDependency;
diff --git a/node_modules/webpack/lib/dependencies/RequireEnsureItemDependency.js b/node_modules/webpack/lib/dependencies/RequireEnsureItemDependency.js
deleted file mode 100644
index b4b620b..0000000
--- a/node_modules/webpack/lib/dependencies/RequireEnsureItemDependency.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-const NullDependency = require("./NullDependency");
-
-class RequireEnsureItemDependency extends ModuleDependency {
- constructor(request) {
- super(request);
- }
-
- get type() {
- return "require.ensure item";
- }
-}
-
-RequireEnsureItemDependency.Template = NullDependency.Template;
-
-module.exports = RequireEnsureItemDependency;
diff --git a/node_modules/webpack/lib/dependencies/RequireEnsurePlugin.js b/node_modules/webpack/lib/dependencies/RequireEnsurePlugin.js
deleted file mode 100644
index c818e91..0000000
--- a/node_modules/webpack/lib/dependencies/RequireEnsurePlugin.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const RequireEnsureItemDependency = require("./RequireEnsureItemDependency");
-const RequireEnsureDependency = require("./RequireEnsureDependency");
-
-const NullFactory = require("../NullFactory");
-
-const RequireEnsureDependenciesBlockParserPlugin = require("./RequireEnsureDependenciesBlockParserPlugin");
-
-const ParserHelpers = require("../ParserHelpers");
-
-class RequireEnsurePlugin {
- apply(compiler) {
- compiler.hooks.compilation.tap(
- "RequireEnsurePlugin",
- (compilation, { normalModuleFactory }) => {
- compilation.dependencyFactories.set(
- RequireEnsureItemDependency,
- normalModuleFactory
- );
- compilation.dependencyTemplates.set(
- RequireEnsureItemDependency,
- new RequireEnsureItemDependency.Template()
- );
-
- compilation.dependencyFactories.set(
- RequireEnsureDependency,
- new NullFactory()
- );
- compilation.dependencyTemplates.set(
- RequireEnsureDependency,
- new RequireEnsureDependency.Template()
- );
-
- const handler = (parser, parserOptions) => {
- if (
- parserOptions.requireEnsure !== undefined &&
- !parserOptions.requireEnsure
- )
- return;
-
- new RequireEnsureDependenciesBlockParserPlugin().apply(parser);
- parser.hooks.evaluateTypeof
- .for("require.ensure")
- .tap(
- "RequireEnsurePlugin",
- ParserHelpers.evaluateToString("function")
- );
- parser.hooks.typeof
- .for("require.ensure")
- .tap(
- "RequireEnsurePlugin",
- ParserHelpers.toConstantDependency(
- parser,
- JSON.stringify("function")
- )
- );
- };
-
- normalModuleFactory.hooks.parser
- .for("javascript/auto")
- .tap("RequireEnsurePlugin", handler);
- normalModuleFactory.hooks.parser
- .for("javascript/dynamic")
- .tap("RequireEnsurePlugin", handler);
- }
- );
- }
-}
-module.exports = RequireEnsurePlugin;
diff --git a/node_modules/webpack/lib/dependencies/RequireHeaderDependency.js b/node_modules/webpack/lib/dependencies/RequireHeaderDependency.js
deleted file mode 100644
index 6dddd06..0000000
--- a/node_modules/webpack/lib/dependencies/RequireHeaderDependency.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const NullDependency = require("./NullDependency");
-
-class RequireHeaderDependency extends NullDependency {
- constructor(range) {
- super();
- if (!Array.isArray(range)) throw new Error("range must be valid");
- this.range = range;
- }
-}
-
-RequireHeaderDependency.Template = class RequireHeaderDependencyTemplate {
- apply(dep, source) {
- source.replace(dep.range[0], dep.range[1] - 1, "__webpack_require__");
- }
-
- applyAsTemplateArgument(name, dep, source) {
- source.replace(dep.range[0], dep.range[1] - 1, "require");
- }
-};
-
-module.exports = RequireHeaderDependency;
diff --git a/node_modules/webpack/lib/dependencies/RequireIncludeDependency.js b/node_modules/webpack/lib/dependencies/RequireIncludeDependency.js
deleted file mode 100644
index 9eca576..0000000
--- a/node_modules/webpack/lib/dependencies/RequireIncludeDependency.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const DependencyReference = require("./DependencyReference");
-const ModuleDependency = require("./ModuleDependency");
-const Template = require("../Template");
-
-class RequireIncludeDependency extends ModuleDependency {
- constructor(request, range) {
- super(request);
- this.range = range;
- }
-
- getReference() {
- if (!this.module) return null;
- // This doesn't use any export
- return new DependencyReference(this.module, [], false);
- }
-
- get type() {
- return "require.include";
- }
-}
-
-RequireIncludeDependency.Template = class RequireIncludeDependencyTemplate {
- apply(dep, source, runtime) {
- const comment = runtime.outputOptions.pathinfo
- ? Template.toComment(
- `require.include ${runtime.requestShortener.shorten(dep.request)}`
- )
- : "";
- source.replace(dep.range[0], dep.range[1] - 1, `undefined${comment}`);
- }
-};
-
-module.exports = RequireIncludeDependency;
diff --git a/node_modules/webpack/lib/dependencies/RequireIncludeDependencyParserPlugin.js b/node_modules/webpack/lib/dependencies/RequireIncludeDependencyParserPlugin.js
deleted file mode 100644
index 117e204..0000000
--- a/node_modules/webpack/lib/dependencies/RequireIncludeDependencyParserPlugin.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const RequireIncludeDependency = require("./RequireIncludeDependency");
-
-module.exports = class RequireIncludeDependencyParserPlugin {
- apply(parser) {
- parser.hooks.call
- .for("require.include")
- .tap("RequireIncludeDependencyParserPlugin", expr => {
- if (expr.arguments.length !== 1) return;
- const param = parser.evaluateExpression(expr.arguments[0]);
- if (!param.isString()) return;
- const dep = new RequireIncludeDependency(param.string, expr.range);
- dep.loc = expr.loc;
- parser.state.current.addDependency(dep);
- return true;
- });
- }
-};
diff --git a/node_modules/webpack/lib/dependencies/RequireIncludePlugin.js b/node_modules/webpack/lib/dependencies/RequireIncludePlugin.js
deleted file mode 100644
index e7d535b..0000000
--- a/node_modules/webpack/lib/dependencies/RequireIncludePlugin.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const RequireIncludeDependency = require("./RequireIncludeDependency");
-const RequireIncludeDependencyParserPlugin = require("./RequireIncludeDependencyParserPlugin");
-
-const ParserHelpers = require("../ParserHelpers");
-
-class RequireIncludePlugin {
- apply(compiler) {
- compiler.hooks.compilation.tap(
- "RequireIncludePlugin",
- (compilation, { normalModuleFactory }) => {
- compilation.dependencyFactories.set(
- RequireIncludeDependency,
- normalModuleFactory
- );
- compilation.dependencyTemplates.set(
- RequireIncludeDependency,
- new RequireIncludeDependency.Template()
- );
-
- const handler = (parser, parserOptions) => {
- if (
- parserOptions.requireInclude !== undefined &&
- !parserOptions.requireInclude
- )
- return;
-
- new RequireIncludeDependencyParserPlugin().apply(parser);
- parser.hooks.evaluateTypeof
- .for("require.include")
- .tap(
- "RequireIncludePlugin",
- ParserHelpers.evaluateToString("function")
- );
- parser.hooks.typeof
- .for("require.include")
- .tap(
- "RequireIncludePlugin",
- ParserHelpers.toConstantDependency(
- parser,
- JSON.stringify("function")
- )
- );
- };
-
- normalModuleFactory.hooks.parser
- .for("javascript/auto")
- .tap("RequireIncludePlugin", handler);
- normalModuleFactory.hooks.parser
- .for("javascript/dynamic")
- .tap("RequireIncludePlugin", handler);
- }
- );
- }
-}
-module.exports = RequireIncludePlugin;
diff --git a/node_modules/webpack/lib/dependencies/RequireResolveContextDependency.js b/node_modules/webpack/lib/dependencies/RequireResolveContextDependency.js
deleted file mode 100644
index cc40451..0000000
--- a/node_modules/webpack/lib/dependencies/RequireResolveContextDependency.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ContextDependency = require("./ContextDependency");
-const ContextDependencyTemplateAsId = require("./ContextDependencyTemplateAsId");
-
-class RequireResolveContextDependency extends ContextDependency {
- constructor(options, range, valueRange) {
- super(options);
- this.range = range;
- this.valueRange = valueRange;
- }
-
- get type() {
- return "amd require context";
- }
-}
-
-RequireResolveContextDependency.Template = ContextDependencyTemplateAsId;
-
-module.exports = RequireResolveContextDependency;
diff --git a/node_modules/webpack/lib/dependencies/RequireResolveDependency.js b/node_modules/webpack/lib/dependencies/RequireResolveDependency.js
deleted file mode 100644
index 3933baa..0000000
--- a/node_modules/webpack/lib/dependencies/RequireResolveDependency.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-const ModuleDependencyAsId = require("./ModuleDependencyTemplateAsId");
-
-class RequireResolveDependency extends ModuleDependency {
- constructor(request, range) {
- super(request);
- this.range = range;
- }
-
- get type() {
- return "require.resolve";
- }
-}
-
-RequireResolveDependency.Template = ModuleDependencyAsId;
-
-module.exports = RequireResolveDependency;
diff --git a/node_modules/webpack/lib/dependencies/RequireResolveDependencyParserPlugin.js b/node_modules/webpack/lib/dependencies/RequireResolveDependencyParserPlugin.js
deleted file mode 100644
index 0d356cf..0000000
--- a/node_modules/webpack/lib/dependencies/RequireResolveDependencyParserPlugin.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const RequireResolveDependency = require("./RequireResolveDependency");
-const RequireResolveContextDependency = require("./RequireResolveContextDependency");
-const RequireResolveHeaderDependency = require("./RequireResolveHeaderDependency");
-const ContextDependencyHelpers = require("./ContextDependencyHelpers");
-
-class RequireResolveDependencyParserPlugin {
- constructor(options) {
- this.options = options;
- }
-
- apply(parser) {
- const options = this.options;
-
- const process = (expr, weak) => {
- if (expr.arguments.length !== 1) return;
- const param = parser.evaluateExpression(expr.arguments[0]);
- if (param.isConditional()) {
- for (const option of param.options) {
- const result = processItem(expr, option, weak);
- if (result === undefined) {
- processContext(expr, option, weak);
- }
- }
- const dep = new RequireResolveHeaderDependency(expr.callee.range);
- dep.loc = expr.loc;
- parser.state.current.addDependency(dep);
- return true;
- } else {
- const result = processItem(expr, param, weak);
- if (result === undefined) {
- processContext(expr, param, weak);
- }
- const dep = new RequireResolveHeaderDependency(expr.callee.range);
- dep.loc = expr.loc;
- parser.state.current.addDependency(dep);
- return true;
- }
- };
- const processItem = (expr, param, weak) => {
- if (param.isString()) {
- const dep = new RequireResolveDependency(param.string, param.range);
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- dep.weak = weak;
- parser.state.current.addDependency(dep);
- return true;
- }
- };
- const processContext = (expr, param, weak) => {
- const dep = ContextDependencyHelpers.create(
- RequireResolveContextDependency,
- param.range,
- param,
- expr,
- options,
- {
- mode: weak ? "weak" : "sync"
- },
- parser
- );
- if (!dep) return;
- dep.loc = expr.loc;
- dep.optional = !!parser.scope.inTry;
- parser.state.current.addDependency(dep);
- return true;
- };
-
- parser.hooks.call
- .for("require.resolve")
- .tap("RequireResolveDependencyParserPlugin", expr => {
- return process(expr, false);
- });
- parser.hooks.call
- .for("require.resolveWeak")
- .tap("RequireResolveDependencyParserPlugin", expr => {
- return process(expr, true);
- });
- }
-}
-module.exports = RequireResolveDependencyParserPlugin;
diff --git a/node_modules/webpack/lib/dependencies/RequireResolveHeaderDependency.js b/node_modules/webpack/lib/dependencies/RequireResolveHeaderDependency.js
deleted file mode 100644
index 05fe86d..0000000
--- a/node_modules/webpack/lib/dependencies/RequireResolveHeaderDependency.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const NullDependency = require("./NullDependency");
-
-class RequireResolveHeaderDependency extends NullDependency {
- constructor(range) {
- super();
- if (!Array.isArray(range)) throw new Error("range must be valid");
- this.range = range;
- }
-}
-
-RequireResolveHeaderDependency.Template = class RequireResolveHeaderDependencyTemplate {
- apply(dep, source) {
- source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/");
- }
-
- applyAsTemplateArgument(name, dep, source) {
- source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/");
- }
-};
-
-module.exports = RequireResolveHeaderDependency;
diff --git a/node_modules/webpack/lib/dependencies/SingleEntryDependency.js b/node_modules/webpack/lib/dependencies/SingleEntryDependency.js
deleted file mode 100644
index 75a8c08..0000000
--- a/node_modules/webpack/lib/dependencies/SingleEntryDependency.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const ModuleDependency = require("./ModuleDependency");
-
-class SingleEntryDependency extends ModuleDependency {
- /**
- * @param {string} request request path for entry
- */
- constructor(request) {
- super(request);
- }
-
- get type() {
- return "single entry";
- }
-}
-
-module.exports = SingleEntryDependency;
diff --git a/node_modules/webpack/lib/dependencies/SystemPlugin.js b/node_modules/webpack/lib/dependencies/SystemPlugin.js
deleted file mode 100644
index 0e3419b..0000000
--- a/node_modules/webpack/lib/dependencies/SystemPlugin.js
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const ParserHelpers = require("../ParserHelpers");
-const WebpackError = require("../WebpackError");
-
-class SystemPlugin {
- constructor(options) {
- this.options = options;
- }
-
- apply(compiler) {
- compiler.hooks.compilation.tap(
- "SystemPlugin",
- (compilation, { normalModuleFactory }) => {
- const handler = (parser, parserOptions) => {
- if (parserOptions.system !== undefined && !parserOptions.system)
- return;
-
- const shouldWarn = parserOptions.system === undefined;
-
- const setNotSupported = name => {
- parser.hooks.evaluateTypeof
- .for(name)
- .tap("SystemPlugin", ParserHelpers.evaluateToString("undefined"));
- parser.hooks.expression
- .for(name)
- .tap(
- "SystemPlugin",
- ParserHelpers.expressionIsUnsupported(
- parser,
- name + " is not supported by webpack."
- )
- );
- };
-
- parser.hooks.typeof
- .for("System.import")
- .tap(
- "SystemPlugin",
- ParserHelpers.toConstantDependency(
- parser,
- JSON.stringify("function")
- )
- );
- parser.hooks.evaluateTypeof
- .for("System.import")
- .tap("SystemPlugin", ParserHelpers.evaluateToString("function"));
- parser.hooks.typeof
- .for("System")
- .tap(
- "SystemPlugin",
- ParserHelpers.toConstantDependency(
- parser,
- JSON.stringify("object")
- )
- );
- parser.hooks.evaluateTypeof
- .for("System")
- .tap("SystemPlugin", ParserHelpers.evaluateToString("object"));
-
- setNotSupported("System.set");
- setNotSupported("System.get");
- setNotSupported("System.register");
-
- parser.hooks.expression.for("System").tap("SystemPlugin", () => {
- const systemPolyfillRequire = ParserHelpers.requireFileAsExpression(
- parser.state.module.context,
- require.resolve("../../buildin/system")
- );
- return ParserHelpers.addParsedVariableToModule(
- parser,
- "System",
- systemPolyfillRequire
- );
- });
-
- parser.hooks.call.for("System.import").tap("SystemPlugin", expr => {
- if (shouldWarn) {
- parser.state.module.warnings.push(
- new SystemImportDeprecationWarning(
- parser.state.module,
- expr.loc
- )
- );
- }
-
- return parser.hooks.importCall.call(expr);
- });
- };
-
- normalModuleFactory.hooks.parser
- .for("javascript/auto")
- .tap("SystemPlugin", handler);
- normalModuleFactory.hooks.parser
- .for("javascript/dynamic")
- .tap("SystemPlugin", handler);
- }
- );
- }
-}
-
-class SystemImportDeprecationWarning extends WebpackError {
- constructor(module, loc) {
- super(
- "System.import() is deprecated and will be removed soon. Use import() instead.\n" +
- "For more info visit https://webpack.js.org/guides/code-splitting/"
- );
-
- this.name = "SystemImportDeprecationWarning";
-
- this.module = module;
- this.loc = loc;
-
- Error.captureStackTrace(this, this.constructor);
- }
-}
-
-module.exports = SystemPlugin;
diff --git a/node_modules/webpack/lib/dependencies/UnsupportedDependency.js b/node_modules/webpack/lib/dependencies/UnsupportedDependency.js
deleted file mode 100644
index 614af78..0000000
--- a/node_modules/webpack/lib/dependencies/UnsupportedDependency.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const NullDependency = require("./NullDependency");
-const webpackMissingModule = require("./WebpackMissingModule").module;
-
-class UnsupportedDependency extends NullDependency {
- constructor(request, range) {
- super();
- this.request = request;
- this.range = range;
- }
-}
-
-UnsupportedDependency.Template = class UnsupportedDependencyTemplate {
- apply(dep, source, runtime) {
- source.replace(
- dep.range[0],
- dep.range[1],
- webpackMissingModule(dep.request)
- );
- }
-};
-
-module.exports = UnsupportedDependency;
diff --git a/node_modules/webpack/lib/dependencies/WebAssemblyExportImportedDependency.js b/node_modules/webpack/lib/dependencies/WebAssemblyExportImportedDependency.js
deleted file mode 100644
index 9fa55f2..0000000
--- a/node_modules/webpack/lib/dependencies/WebAssemblyExportImportedDependency.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const DependencyReference = require("./DependencyReference");
-const ModuleDependency = require("./ModuleDependency");
-
-class WebAssemblyExportImportedDependency extends ModuleDependency {
- constructor(exportName, request, name, valueType) {
- super(request);
- /** @type {string} */
- this.exportName = exportName;
- /** @type {string} */
- this.name = name;
- /** @type {string} */
- this.valueType = valueType;
- }
-
- getReference() {
- if (!this.module) return null;
- return new DependencyReference(this.module, [this.name], false);
- }
-
- get type() {
- return "wasm export import";
- }
-}
-
-module.exports = WebAssemblyExportImportedDependency;
diff --git a/node_modules/webpack/lib/dependencies/WebAssemblyImportDependency.js b/node_modules/webpack/lib/dependencies/WebAssemblyImportDependency.js
deleted file mode 100644
index 4b36faa..0000000
--- a/node_modules/webpack/lib/dependencies/WebAssemblyImportDependency.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const DependencyReference = require("./DependencyReference");
-const ModuleDependency = require("./ModuleDependency");
-const UnsupportedWebAssemblyFeatureError = require("../wasm/UnsupportedWebAssemblyFeatureError");
-
-/** @typedef {import("@webassemblyjs/ast").ModuleImportDescription} ModuleImportDescription */
-
-class WebAssemblyImportDependency extends ModuleDependency {
- /**
- * @param {string} request the request
- * @param {string} name the imported name
- * @param {ModuleImportDescription} description the WASM ast node
- * @param {false | string} onlyDirectImport if only direct imports are allowed
- */
- constructor(request, name, description, onlyDirectImport) {
- super(request);
- /** @type {string} */
- this.name = name;
- /** @type {ModuleImportDescription} */
- this.description = description;
- /** @type {false | string} */
- this.onlyDirectImport = onlyDirectImport;
- }
-
- getReference() {
- if (!this.module) return null;
- return new DependencyReference(this.module, [this.name], false);
- }
-
- getErrors() {
- if (
- this.onlyDirectImport &&
- this.module &&
- !this.module.type.startsWith("webassembly")
- ) {
- return [
- new UnsupportedWebAssemblyFeatureError(
- `Import "${this.name}" from "${this.request}" with ${this.onlyDirectImport} can only be used for direct wasm to wasm dependencies`
- )
- ];
- }
- }
-
- get type() {
- return "wasm import";
- }
-}
-
-module.exports = WebAssemblyImportDependency;
diff --git a/node_modules/webpack/lib/dependencies/WebpackMissingModule.js b/node_modules/webpack/lib/dependencies/WebpackMissingModule.js
deleted file mode 100644
index a55c9ec..0000000
--- a/node_modules/webpack/lib/dependencies/WebpackMissingModule.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const toErrorCode = err =>
- `var e = new Error(${JSON.stringify(err)}); e.code = 'MODULE_NOT_FOUND';`;
-
-exports.module = request =>
- `!(function webpackMissingModule() { ${exports.moduleCode(request)} }())`;
-
-exports.promise = request => {
- const errorCode = toErrorCode(`Cannot find module '${request}'`);
- return `Promise.reject(function webpackMissingModule() { ${errorCode} return e; }())`;
-};
-
-exports.moduleCode = request => {
- const errorCode = toErrorCode(`Cannot find module '${request}'`);
- return `${errorCode} throw e;`;
-};
diff --git a/node_modules/webpack/lib/dependencies/getFunctionExpression.js b/node_modules/webpack/lib/dependencies/getFunctionExpression.js
deleted file mode 100644
index 0e73840..0000000
--- a/node_modules/webpack/lib/dependencies/getFunctionExpression.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-module.exports = expr => {
- // <FunctionExpression>
- if (
- expr.type === "FunctionExpression" ||
- expr.type === "ArrowFunctionExpression"
- ) {
- return {
- fn: expr,
- expressions: [],
- needThis: false
- };
- }
-
- // <FunctionExpression>.bind(<Expression>)
- if (
- expr.type === "CallExpression" &&
- expr.callee.type === "MemberExpression" &&
- expr.callee.object.type === "FunctionExpression" &&
- expr.callee.property.type === "Identifier" &&
- expr.callee.property.name === "bind" &&
- expr.arguments.length === 1
- ) {
- return {
- fn: expr.callee.object,
- expressions: [expr.arguments[0]],
- needThis: undefined
- };
- }
- // (function(_this) {return <FunctionExpression>})(this) (Coffeescript)
- if (
- expr.type === "CallExpression" &&
- expr.callee.type === "FunctionExpression" &&
- expr.callee.body.type === "BlockStatement" &&
- expr.arguments.length === 1 &&
- expr.arguments[0].type === "ThisExpression" &&
- expr.callee.body.body &&
- expr.callee.body.body.length === 1 &&
- expr.callee.body.body[0].type === "ReturnStatement" &&
- expr.callee.body.body[0].argument &&
- expr.callee.body.body[0].argument.type === "FunctionExpression"
- ) {
- return {
- fn: expr.callee.body.body[0].argument,
- expressions: [],
- needThis: true
- };
- }
-};