summaryrefslogtreecommitdiffstats
path: root/node_modules/webpack/lib/node
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/webpack/lib/node')
-rw-r--r--node_modules/webpack/lib/node/NodeChunkTemplatePlugin.js31
-rw-r--r--node_modules/webpack/lib/node/NodeEnvironmentPlugin.js44
-rw-r--r--node_modules/webpack/lib/node/NodeHotUpdateChunkTemplatePlugin.js36
-rw-r--r--node_modules/webpack/lib/node/NodeMainTemplate.runtime.js32
-rw-r--r--node_modules/webpack/lib/node/NodeMainTemplateAsync.runtime.js50
-rw-r--r--node_modules/webpack/lib/node/NodeMainTemplatePlugin.js321
-rw-r--r--node_modules/webpack/lib/node/NodeOutputFileSystem.js22
-rw-r--r--node_modules/webpack/lib/node/NodeSourcePlugin.js141
-rw-r--r--node_modules/webpack/lib/node/NodeTargetPlugin.js19
-rw-r--r--node_modules/webpack/lib/node/NodeTemplatePlugin.js31
-rw-r--r--node_modules/webpack/lib/node/NodeWatchFileSystem.js109
-rw-r--r--node_modules/webpack/lib/node/ReadFileCompileWasmTemplatePlugin.js61
-rw-r--r--node_modules/webpack/lib/node/nodeConsole.js135
13 files changed, 0 insertions, 1032 deletions
diff --git a/node_modules/webpack/lib/node/NodeChunkTemplatePlugin.js b/node_modules/webpack/lib/node/NodeChunkTemplatePlugin.js
deleted file mode 100644
index 292182a..0000000
--- a/node_modules/webpack/lib/node/NodeChunkTemplatePlugin.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-
-"use strict";
-
-const { ConcatSource } = require("webpack-sources");
-
-class NodeChunkTemplatePlugin {
- apply(chunkTemplate) {
- chunkTemplate.hooks.render.tap(
- "NodeChunkTemplatePlugin",
- (modules, chunk) => {
- const source = new ConcatSource();
- source.add(
- `exports.ids = ${JSON.stringify(chunk.ids)};\nexports.modules = `
- );
- source.add(modules);
- source.add(";");
- return source;
- }
- );
- chunkTemplate.hooks.hash.tap("NodeChunkTemplatePlugin", hash => {
- hash.update("node");
- hash.update("3");
- });
- }
-}
-
-module.exports = NodeChunkTemplatePlugin;
diff --git a/node_modules/webpack/lib/node/NodeEnvironmentPlugin.js b/node_modules/webpack/lib/node/NodeEnvironmentPlugin.js
deleted file mode 100644
index 98c7985..0000000
--- a/node_modules/webpack/lib/node/NodeEnvironmentPlugin.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const NodeWatchFileSystem = require("./NodeWatchFileSystem");
-const NodeOutputFileSystem = require("./NodeOutputFileSystem");
-const NodeJsInputFileSystem = require("enhanced-resolve/lib/NodeJsInputFileSystem");
-const CachedInputFileSystem = require("enhanced-resolve/lib/CachedInputFileSystem");
-const createConsoleLogger = require("../logging/createConsoleLogger");
-const nodeConsole = require("./nodeConsole");
-
-class NodeEnvironmentPlugin {
- constructor(options) {
- this.options = options || {};
- }
-
- apply(compiler) {
- compiler.infrastructureLogger = createConsoleLogger(
- Object.assign(
- {
- level: "info",
- debug: false,
- console: nodeConsole
- },
- this.options.infrastructureLogging
- )
- );
- compiler.inputFileSystem = new CachedInputFileSystem(
- new NodeJsInputFileSystem(),
- 60000
- );
- const inputFileSystem = compiler.inputFileSystem;
- compiler.outputFileSystem = new NodeOutputFileSystem();
- compiler.watchFileSystem = new NodeWatchFileSystem(
- compiler.inputFileSystem
- );
- compiler.hooks.beforeRun.tap("NodeEnvironmentPlugin", compiler => {
- if (compiler.inputFileSystem === inputFileSystem) inputFileSystem.purge();
- });
- }
-}
-module.exports = NodeEnvironmentPlugin;
diff --git a/node_modules/webpack/lib/node/NodeHotUpdateChunkTemplatePlugin.js b/node_modules/webpack/lib/node/NodeHotUpdateChunkTemplatePlugin.js
deleted file mode 100644
index bbd2e12..0000000
--- a/node_modules/webpack/lib/node/NodeHotUpdateChunkTemplatePlugin.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const { ConcatSource } = require("webpack-sources");
-
-class NodeHotUpdateChunkTemplatePlugin {
- apply(hotUpdateChunkTemplate) {
- hotUpdateChunkTemplate.hooks.render.tap(
- "NodeHotUpdateChunkTemplatePlugin",
- (modulesSource, modules, removedModules, hash, id) => {
- const source = new ConcatSource();
- source.add(
- "exports.id = " + JSON.stringify(id) + ";\nexports.modules = "
- );
- source.add(modulesSource);
- source.add(";");
- return source;
- }
- );
- hotUpdateChunkTemplate.hooks.hash.tap(
- "NodeHotUpdateChunkTemplatePlugin",
- hash => {
- hash.update("NodeHotUpdateChunkTemplatePlugin");
- hash.update("3");
- hash.update(
- hotUpdateChunkTemplate.outputOptions.hotUpdateFunction + ""
- );
- hash.update(hotUpdateChunkTemplate.outputOptions.library + "");
- }
- );
- }
-}
-module.exports = NodeHotUpdateChunkTemplatePlugin;
diff --git a/node_modules/webpack/lib/node/NodeMainTemplate.runtime.js b/node_modules/webpack/lib/node/NodeMainTemplate.runtime.js
deleted file mode 100644
index 0880124..0000000
--- a/node_modules/webpack/lib/node/NodeMainTemplate.runtime.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-// eslint-disable-next-line no-unused-vars
-var $hotChunkFilename$ = undefined;
-var hotAddUpdateChunk = undefined;
-var installedChunks = undefined;
-var $hotMainFilename$ = undefined;
-
-module.exports = function() {
- // eslint-disable-next-line no-unused-vars
- function hotDownloadUpdateChunk(chunkId) {
- var chunk = require("./" + $hotChunkFilename$);
- hotAddUpdateChunk(chunk.id, chunk.modules);
- }
-
- // eslint-disable-next-line no-unused-vars
- function hotDownloadManifest() {
- try {
- var update = require("./" + $hotMainFilename$);
- } catch (e) {
- return Promise.resolve();
- }
- return Promise.resolve(update);
- }
-
- //eslint-disable-next-line no-unused-vars
- function hotDisposeChunk(chunkId) {
- delete installedChunks[chunkId];
- }
-};
diff --git a/node_modules/webpack/lib/node/NodeMainTemplateAsync.runtime.js b/node_modules/webpack/lib/node/NodeMainTemplateAsync.runtime.js
deleted file mode 100644
index a021f5a..0000000
--- a/node_modules/webpack/lib/node/NodeMainTemplateAsync.runtime.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-// eslint-disable-next-line no-unused-vars
-var $hotChunkFilename$ = undefined;
-var $require$ = undefined;
-var hotAddUpdateChunk = undefined;
-var $hotMainFilename$ = undefined;
-var installedChunks = undefined;
-
-module.exports = function() {
- // eslint-disable-next-line no-unused-vars
- function hotDownloadUpdateChunk(chunkId) {
- var filename = require("path").join(__dirname, $hotChunkFilename$);
- require("fs").readFile(filename, "utf-8", function(err, content) {
- if (err) {
- if ($require$.onError) return $require$.oe(err);
- throw err;
- }
- var chunk = {};
- require("vm").runInThisContext(
- "(function(exports) {" + content + "\n})",
- { filename: filename }
- )(chunk);
- hotAddUpdateChunk(chunk.id, chunk.modules);
- });
- }
-
- // eslint-disable-next-line no-unused-vars
- function hotDownloadManifest() {
- var filename = require("path").join(__dirname, $hotMainFilename$);
- return new Promise(function(resolve, reject) {
- require("fs").readFile(filename, "utf-8", function(err, content) {
- if (err) return resolve();
- try {
- var update = JSON.parse(content);
- } catch (e) {
- return reject(e);
- }
- resolve(update);
- });
- });
- }
-
- // eslint-disable-next-line no-unused-vars
- function hotDisposeChunk(chunkId) {
- delete installedChunks[chunkId];
- }
-};
diff --git a/node_modules/webpack/lib/node/NodeMainTemplatePlugin.js b/node_modules/webpack/lib/node/NodeMainTemplatePlugin.js
deleted file mode 100644
index a270296..0000000
--- a/node_modules/webpack/lib/node/NodeMainTemplatePlugin.js
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const Template = require("../Template");
-
-module.exports = class NodeMainTemplatePlugin {
- constructor(asyncChunkLoading) {
- this.asyncChunkLoading = asyncChunkLoading;
- }
-
- apply(mainTemplate) {
- const needChunkOnDemandLoadingCode = chunk => {
- for (const chunkGroup of chunk.groupsIterable) {
- if (chunkGroup.getNumberOfChildren() > 0) return true;
- }
- return false;
- };
- const asyncChunkLoading = this.asyncChunkLoading;
- mainTemplate.hooks.localVars.tap(
- "NodeMainTemplatePlugin",
- (source, chunk) => {
- if (needChunkOnDemandLoadingCode(chunk)) {
- return Template.asString([
- source,
- "",
- "// object to store loaded chunks",
- '// "0" means "already loaded"',
- "var installedChunks = {",
- Template.indent(
- chunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(",\n")
- ),
- "};"
- ]);
- }
- return source;
- }
- );
- mainTemplate.hooks.requireExtensions.tap(
- "NodeMainTemplatePlugin",
- (source, chunk) => {
- if (needChunkOnDemandLoadingCode(chunk)) {
- return Template.asString([
- source,
- "",
- "// uncaught error handler for webpack runtime",
- `${mainTemplate.requireFn}.oe = function(err) {`,
- Template.indent([
- "process.nextTick(function() {",
- Template.indent(
- "throw err; // catch this error by using import().catch()"
- ),
- "});"
- ]),
- "};"
- ]);
- }
- return source;
- }
- );
- mainTemplate.hooks.requireEnsure.tap(
- "NodeMainTemplatePlugin",
- (source, chunk, hash) => {
- const chunkFilename = mainTemplate.outputOptions.chunkFilename;
- const chunkMaps = chunk.getChunkMaps();
- const insertMoreModules = [
- "var moreModules = chunk.modules, chunkIds = chunk.ids;",
- "for(var moduleId in moreModules) {",
- Template.indent(
- mainTemplate.renderAddModule(
- hash,
- chunk,
- "moduleId",
- "moreModules[moduleId]"
- )
- ),
- "}"
- ];
- if (asyncChunkLoading) {
- return Template.asString([
- source,
- "",
- "// ReadFile + VM.run chunk loading for javascript",
- "",
- "var installedChunkData = installedChunks[chunkId];",
- 'if(installedChunkData !== 0) { // 0 means "already installed".',
- Template.indent([
- '// array of [resolve, reject, promise] means "currently loading"',
- "if(installedChunkData) {",
- Template.indent(["promises.push(installedChunkData[2]);"]),
- "} else {",
- Template.indent([
- "// load the chunk and return promise to it",
- "var promise = new Promise(function(resolve, reject) {",
- Template.indent([
- "installedChunkData = installedChunks[chunkId] = [resolve, reject];",
- "var filename = require('path').join(__dirname, " +
- mainTemplate.getAssetPath(
- JSON.stringify(`/${chunkFilename}`),
- {
- hash: `" + ${mainTemplate.renderCurrentHashCode(
- hash
- )} + "`,
- hashWithLength: length =>
- `" + ${mainTemplate.renderCurrentHashCode(
- hash,
- length
- )} + "`,
- chunk: {
- id: '" + chunkId + "',
- hash: `" + ${JSON.stringify(
- chunkMaps.hash
- )}[chunkId] + "`,
- hashWithLength: length => {
- const shortChunkHashMap = {};
- for (const chunkId of Object.keys(chunkMaps.hash)) {
- if (typeof chunkMaps.hash[chunkId] === "string") {
- shortChunkHashMap[chunkId] = chunkMaps.hash[
- chunkId
- ].substr(0, length);
- }
- }
- return `" + ${JSON.stringify(
- shortChunkHashMap
- )}[chunkId] + "`;
- },
- contentHash: {
- javascript: `" + ${JSON.stringify(
- chunkMaps.contentHash.javascript
- )}[chunkId] + "`
- },
- contentHashWithLength: {
- javascript: length => {
- const shortContentHashMap = {};
- const contentHash =
- chunkMaps.contentHash.javascript;
- for (const chunkId of Object.keys(contentHash)) {
- if (typeof contentHash[chunkId] === "string") {
- shortContentHashMap[chunkId] = contentHash[
- chunkId
- ].substr(0, length);
- }
- }
- return `" + ${JSON.stringify(
- shortContentHashMap
- )}[chunkId] + "`;
- }
- },
- name: `" + (${JSON.stringify(
- chunkMaps.name
- )}[chunkId]||chunkId) + "`
- },
- contentHashType: "javascript"
- }
- ) +
- ");",
- "require('fs').readFile(filename, 'utf-8', function(err, content) {",
- Template.indent(
- [
- "if(err) return reject(err);",
- "var chunk = {};",
- "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" +
- "(chunk, require, require('path').dirname(filename), filename);"
- ]
- .concat(insertMoreModules)
- .concat([
- "var callbacks = [];",
- "for(var i = 0; i < chunkIds.length; i++) {",
- Template.indent([
- "if(installedChunks[chunkIds[i]])",
- Template.indent([
- "callbacks = callbacks.concat(installedChunks[chunkIds[i]][0]);"
- ]),
- "installedChunks[chunkIds[i]] = 0;"
- ]),
- "}",
- "for(i = 0; i < callbacks.length; i++)",
- Template.indent("callbacks[i]();")
- ])
- ),
- "});"
- ]),
- "});",
- "promises.push(installedChunkData[2] = promise);"
- ]),
- "}"
- ]),
- "}"
- ]);
- } else {
- const request = mainTemplate.getAssetPath(
- JSON.stringify(`./${chunkFilename}`),
- {
- hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
- hashWithLength: length =>
- `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`,
- chunk: {
- id: '" + chunkId + "',
- hash: `" + ${JSON.stringify(chunkMaps.hash)}[chunkId] + "`,
- hashWithLength: length => {
- const shortChunkHashMap = {};
- for (const chunkId of Object.keys(chunkMaps.hash)) {
- if (typeof chunkMaps.hash[chunkId] === "string") {
- shortChunkHashMap[chunkId] = chunkMaps.hash[
- chunkId
- ].substr(0, length);
- }
- }
- return `" + ${JSON.stringify(
- shortChunkHashMap
- )}[chunkId] + "`;
- },
- contentHash: {
- javascript: `" + ${JSON.stringify(
- chunkMaps.contentHash.javascript
- )}[chunkId] + "`
- },
- contentHashWithLength: {
- javascript: length => {
- const shortContentHashMap = {};
- const contentHash = chunkMaps.contentHash.javascript;
- for (const chunkId of Object.keys(contentHash)) {
- if (typeof contentHash[chunkId] === "string") {
- shortContentHashMap[chunkId] = contentHash[
- chunkId
- ].substr(0, length);
- }
- }
- return `" + ${JSON.stringify(
- shortContentHashMap
- )}[chunkId] + "`;
- }
- },
- name: `" + (${JSON.stringify(
- chunkMaps.name
- )}[chunkId]||chunkId) + "`
- },
- contentHashType: "javascript"
- }
- );
- return Template.asString([
- source,
- "",
- "// require() chunk loading for javascript",
- "",
- '// "0" is the signal for "already loaded"',
- "if(installedChunks[chunkId] !== 0) {",
- Template.indent(
- [`var chunk = require(${request});`]
- .concat(insertMoreModules)
- .concat([
- "for(var i = 0; i < chunkIds.length; i++)",
- Template.indent("installedChunks[chunkIds[i]] = 0;")
- ])
- ),
- "}"
- ]);
- }
- }
- );
- mainTemplate.hooks.hotBootstrap.tap(
- "NodeMainTemplatePlugin",
- (source, chunk, hash) => {
- const hotUpdateChunkFilename =
- mainTemplate.outputOptions.hotUpdateChunkFilename;
- const hotUpdateMainFilename =
- mainTemplate.outputOptions.hotUpdateMainFilename;
- const chunkMaps = chunk.getChunkMaps();
- const currentHotUpdateChunkFilename = mainTemplate.getAssetPath(
- JSON.stringify(hotUpdateChunkFilename),
- {
- hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
- hashWithLength: length =>
- `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`,
- chunk: {
- id: '" + chunkId + "',
- hash: `" + ${JSON.stringify(chunkMaps.hash)}[chunkId] + "`,
- hashWithLength: length => {
- const shortChunkHashMap = {};
- for (const chunkId of Object.keys(chunkMaps.hash)) {
- if (typeof chunkMaps.hash[chunkId] === "string") {
- shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr(
- 0,
- length
- );
- }
- }
- return `" + ${JSON.stringify(shortChunkHashMap)}[chunkId] + "`;
- },
- name: `" + (${JSON.stringify(
- chunkMaps.name
- )}[chunkId]||chunkId) + "`
- }
- }
- );
- const currentHotUpdateMainFilename = mainTemplate.getAssetPath(
- JSON.stringify(hotUpdateMainFilename),
- {
- hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
- hashWithLength: length =>
- `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`
- }
- );
- return Template.getFunctionContent(
- asyncChunkLoading
- ? require("./NodeMainTemplateAsync.runtime")
- : require("./NodeMainTemplate.runtime")
- )
- .replace(/\$require\$/g, mainTemplate.requireFn)
- .replace(/\$hotMainFilename\$/g, currentHotUpdateMainFilename)
- .replace(/\$hotChunkFilename\$/g, currentHotUpdateChunkFilename);
- }
- );
- mainTemplate.hooks.hash.tap("NodeMainTemplatePlugin", hash => {
- hash.update("node");
- hash.update("4");
- });
- }
-};
diff --git a/node_modules/webpack/lib/node/NodeOutputFileSystem.js b/node_modules/webpack/lib/node/NodeOutputFileSystem.js
deleted file mode 100644
index 2789b57..0000000
--- a/node_modules/webpack/lib/node/NodeOutputFileSystem.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const fs = require("fs");
-const path = require("path");
-const mkdirp = require("mkdirp");
-
-class NodeOutputFileSystem {
- constructor() {
- this.mkdirp = mkdirp;
- this.mkdir = fs.mkdir.bind(fs);
- this.rmdir = fs.rmdir.bind(fs);
- this.unlink = fs.unlink.bind(fs);
- this.writeFile = fs.writeFile.bind(fs);
- this.join = path.join.bind(path);
- }
-}
-
-module.exports = NodeOutputFileSystem;
diff --git a/node_modules/webpack/lib/node/NodeSourcePlugin.js b/node_modules/webpack/lib/node/NodeSourcePlugin.js
deleted file mode 100644
index 081e1a6..0000000
--- a/node_modules/webpack/lib/node/NodeSourcePlugin.js
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-const AliasPlugin = require("enhanced-resolve/lib/AliasPlugin");
-const ParserHelpers = require("../ParserHelpers");
-const nodeLibsBrowser = require("node-libs-browser");
-
-module.exports = class NodeSourcePlugin {
- constructor(options) {
- this.options = options;
- }
- apply(compiler) {
- const options = this.options;
- if (options === false) {
- // allow single kill switch to turn off this plugin
- return;
- }
-
- const getPathToModule = (module, type) => {
- if (type === true || (type === undefined && nodeLibsBrowser[module])) {
- if (!nodeLibsBrowser[module]) {
- throw new Error(
- `No browser version for node.js core module ${module} available`
- );
- }
- return nodeLibsBrowser[module];
- } else if (type === "mock") {
- return require.resolve(`node-libs-browser/mock/${module}`);
- } else if (type === "empty") {
- return require.resolve("node-libs-browser/mock/empty");
- } else {
- return module;
- }
- };
-
- const addExpression = (parser, name, module, type, suffix) => {
- suffix = suffix || "";
- parser.hooks.expression.for(name).tap("NodeSourcePlugin", () => {
- if (
- parser.state.module &&
- parser.state.module.resource === getPathToModule(module, type)
- )
- return;
- const mockModule = ParserHelpers.requireFileAsExpression(
- parser.state.module.context,
- getPathToModule(module, type)
- );
- return ParserHelpers.addParsedVariableToModule(
- parser,
- name,
- mockModule + suffix
- );
- });
- };
-
- compiler.hooks.compilation.tap(
- "NodeSourcePlugin",
- (compilation, { normalModuleFactory }) => {
- const handler = (parser, parserOptions) => {
- if (parserOptions.node === false) return;
-
- let localOptions = options;
- if (parserOptions.node) {
- localOptions = Object.assign({}, localOptions, parserOptions.node);
- }
- if (localOptions.global) {
- parser.hooks.expression
- .for("global")
- .tap("NodeSourcePlugin", () => {
- const retrieveGlobalModule = ParserHelpers.requireFileAsExpression(
- parser.state.module.context,
- require.resolve("../../buildin/global")
- );
- return ParserHelpers.addParsedVariableToModule(
- parser,
- "global",
- retrieveGlobalModule
- );
- });
- }
- if (localOptions.process) {
- const processType = localOptions.process;
- addExpression(parser, "process", "process", processType);
- }
- if (localOptions.console) {
- const consoleType = localOptions.console;
- addExpression(parser, "console", "console", consoleType);
- }
- const bufferType = localOptions.Buffer;
- if (bufferType) {
- addExpression(parser, "Buffer", "buffer", bufferType, ".Buffer");
- }
- if (localOptions.setImmediate) {
- const setImmediateType = localOptions.setImmediate;
- addExpression(
- parser,
- "setImmediate",
- "timers",
- setImmediateType,
- ".setImmediate"
- );
- addExpression(
- parser,
- "clearImmediate",
- "timers",
- setImmediateType,
- ".clearImmediate"
- );
- }
- };
- normalModuleFactory.hooks.parser
- .for("javascript/auto")
- .tap("NodeSourcePlugin", handler);
- normalModuleFactory.hooks.parser
- .for("javascript/dynamic")
- .tap("NodeSourcePlugin", handler);
- }
- );
- compiler.hooks.afterResolvers.tap("NodeSourcePlugin", compiler => {
- for (const lib of Object.keys(nodeLibsBrowser)) {
- if (options[lib] !== false) {
- compiler.resolverFactory.hooks.resolver
- .for("normal")
- .tap("NodeSourcePlugin", resolver => {
- new AliasPlugin(
- "described-resolve",
- {
- name: lib,
- onlyModule: true,
- alias: getPathToModule(lib, options[lib])
- },
- "resolve"
- ).apply(resolver);
- });
- }
- }
- });
- }
-};
diff --git a/node_modules/webpack/lib/node/NodeTargetPlugin.js b/node_modules/webpack/lib/node/NodeTargetPlugin.js
deleted file mode 100644
index 1ac5d8a..0000000
--- a/node_modules/webpack/lib/node/NodeTargetPlugin.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const ExternalsPlugin = require("../ExternalsPlugin");
-
-const builtins =
- // eslint-disable-next-line node/no-unsupported-features/node-builtins,node/no-deprecated-api
- require("module").builtinModules || Object.keys(process.binding("natives"));
-
-class NodeTargetPlugin {
- apply(compiler) {
- new ExternalsPlugin("commonjs", builtins).apply(compiler);
- }
-}
-
-module.exports = NodeTargetPlugin;
diff --git a/node_modules/webpack/lib/node/NodeTemplatePlugin.js b/node_modules/webpack/lib/node/NodeTemplatePlugin.js
deleted file mode 100644
index cdb1076..0000000
--- a/node_modules/webpack/lib/node/NodeTemplatePlugin.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-
-"use strict";
-
-const NodeMainTemplatePlugin = require("./NodeMainTemplatePlugin");
-const NodeChunkTemplatePlugin = require("./NodeChunkTemplatePlugin");
-const NodeHotUpdateChunkTemplatePlugin = require("./NodeHotUpdateChunkTemplatePlugin");
-
-class NodeTemplatePlugin {
- constructor(options) {
- options = options || {};
- this.asyncChunkLoading = options.asyncChunkLoading;
- }
-
- apply(compiler) {
- compiler.hooks.thisCompilation.tap("NodeTemplatePlugin", compilation => {
- new NodeMainTemplatePlugin(this.asyncChunkLoading).apply(
- compilation.mainTemplate
- );
- new NodeChunkTemplatePlugin().apply(compilation.chunkTemplate);
- new NodeHotUpdateChunkTemplatePlugin().apply(
- compilation.hotUpdateChunkTemplate
- );
- });
- }
-}
-
-module.exports = NodeTemplatePlugin;
diff --git a/node_modules/webpack/lib/node/NodeWatchFileSystem.js b/node_modules/webpack/lib/node/NodeWatchFileSystem.js
deleted file mode 100644
index 235e0f0..0000000
--- a/node_modules/webpack/lib/node/NodeWatchFileSystem.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const Watchpack = require("watchpack");
-const objectToMap = require("../util/objectToMap");
-
-class NodeWatchFileSystem {
- constructor(inputFileSystem) {
- this.inputFileSystem = inputFileSystem;
- this.watcherOptions = {
- aggregateTimeout: 0
- };
- this.watcher = new Watchpack(this.watcherOptions);
- }
-
- watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) {
- if (!Array.isArray(files)) {
- throw new Error("Invalid arguments: 'files'");
- }
- if (!Array.isArray(dirs)) {
- throw new Error("Invalid arguments: 'dirs'");
- }
- if (!Array.isArray(missing)) {
- throw new Error("Invalid arguments: 'missing'");
- }
- if (typeof callback !== "function") {
- throw new Error("Invalid arguments: 'callback'");
- }
- if (typeof startTime !== "number" && startTime) {
- throw new Error("Invalid arguments: 'startTime'");
- }
- if (typeof options !== "object") {
- throw new Error("Invalid arguments: 'options'");
- }
- if (typeof callbackUndelayed !== "function" && callbackUndelayed) {
- throw new Error("Invalid arguments: 'callbackUndelayed'");
- }
- const oldWatcher = this.watcher;
- this.watcher = new Watchpack(options);
-
- if (callbackUndelayed) {
- this.watcher.once("change", callbackUndelayed);
- }
- const cachedFiles = files;
- const cachedDirs = dirs;
- this.watcher.once("aggregated", (changes, removals) => {
- changes = changes.concat(removals);
- if (this.inputFileSystem && this.inputFileSystem.purge) {
- this.inputFileSystem.purge(changes);
- }
- const times = objectToMap(this.watcher.getTimes());
- files = new Set(files);
- dirs = new Set(dirs);
- missing = new Set(missing);
- removals = new Set(removals.filter(file => files.has(file)));
- callback(
- null,
- changes.filter(file => files.has(file)).sort(),
- changes.filter(file => dirs.has(file)).sort(),
- changes.filter(file => missing.has(file)).sort(),
- times,
- times,
- removals
- );
- });
-
- this.watcher.watch(
- cachedFiles.concat(missing),
- cachedDirs.concat(missing),
- startTime
- );
-
- if (oldWatcher) {
- oldWatcher.close();
- }
- return {
- close: () => {
- if (this.watcher) {
- this.watcher.close();
- this.watcher = null;
- }
- },
- pause: () => {
- if (this.watcher) {
- this.watcher.pause();
- }
- },
- getFileTimestamps: () => {
- if (this.watcher) {
- return objectToMap(this.watcher.getTimes());
- } else {
- return new Map();
- }
- },
- getContextTimestamps: () => {
- if (this.watcher) {
- return objectToMap(this.watcher.getTimes());
- } else {
- return new Map();
- }
- }
- };
- }
-}
-
-module.exports = NodeWatchFileSystem;
diff --git a/node_modules/webpack/lib/node/ReadFileCompileWasmTemplatePlugin.js b/node_modules/webpack/lib/node/ReadFileCompileWasmTemplatePlugin.js
deleted file mode 100644
index a7566b8..0000000
--- a/node_modules/webpack/lib/node/ReadFileCompileWasmTemplatePlugin.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-"use strict";
-
-const Template = require("../Template");
-const WasmMainTemplatePlugin = require("../wasm/WasmMainTemplatePlugin");
-
-class ReadFileCompileWasmTemplatePlugin {
- constructor(options) {
- this.options = options || {};
- }
-
- apply(compiler) {
- compiler.hooks.thisCompilation.tap(
- "ReadFileCompileWasmTemplatePlugin",
- compilation => {
- const generateLoadBinaryCode = path =>
- Template.asString([
- "new Promise(function (resolve, reject) {",
- Template.indent([
- "var { readFile } = require('fs');",
- "var { join } = require('path');",
- "",
- "try {",
- Template.indent([
- `readFile(join(__dirname, ${path}), function(err, buffer){`,
- Template.indent([
- "if (err) return reject(err);",
- "",
- "// Fake fetch response",
- "resolve({",
- Template.indent([
- "arrayBuffer() { return Promise.resolve(buffer); }"
- ]),
- "});"
- ]),
- "});"
- ]),
- "} catch (err) { reject(err); }"
- ]),
- "})"
- ]);
-
- const plugin = new WasmMainTemplatePlugin(
- Object.assign(
- {
- generateLoadBinaryCode,
- supportsStreaming: false
- },
- this.options
- )
- );
- plugin.apply(compilation.mainTemplate);
- }
- );
- }
-}
-
-module.exports = ReadFileCompileWasmTemplatePlugin;
diff --git a/node_modules/webpack/lib/node/nodeConsole.js b/node_modules/webpack/lib/node/nodeConsole.js
deleted file mode 100644
index 32a8099..0000000
--- a/node_modules/webpack/lib/node/nodeConsole.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-
-"use strict";
-
-const truncateArgs = require("../logging/truncateArgs");
-const util = require("util");
-
-const tty = process.stderr.isTTY && process.env.TERM !== "dumb";
-
-let currentStatusMessage = undefined;
-let hasStatusMessage = false;
-let currentIndent = "";
-let currentCollapsed = 0;
-
-const indent = (str, prefix, colorPrefix, colorSuffix) => {
- if (str === "") return str;
- prefix = currentIndent + prefix;
- if (tty) {
- return (
- prefix +
- colorPrefix +
- str.replace(/\n/g, colorSuffix + "\n" + prefix + colorPrefix) +
- colorSuffix
- );
- } else {
- return prefix + str.replace(/\n/g, "\n" + prefix);
- }
-};
-
-const clearStatusMessage = () => {
- if (hasStatusMessage) {
- process.stderr.write("\x1b[2K\r");
- hasStatusMessage = false;
- }
-};
-
-const writeStatusMessage = () => {
- if (!currentStatusMessage) return;
- const l = process.stderr.columns;
- const args = l
- ? truncateArgs(currentStatusMessage, l - 1)
- : currentStatusMessage;
- const str = args.join(" ");
- const coloredStr = `\u001b[1m${str}\u001b[39m\u001b[22m`;
- process.stderr.write(`\x1b[2K\r${coloredStr}`);
- hasStatusMessage = true;
-};
-
-const writeColored = (prefix, colorPrefix, colorSuffix) => {
- return (...args) => {
- if (currentCollapsed > 0) return;
- clearStatusMessage();
- // @ts-ignore
- const str = indent(util.format(...args), prefix, colorPrefix, colorSuffix);
- process.stderr.write(str + "\n");
- writeStatusMessage();
- };
-};
-
-const writeGroupMessage = writeColored(
- "<-> ",
- "\u001b[1m\u001b[36m",
- "\u001b[39m\u001b[22m"
-);
-
-const writeGroupCollapsedMessage = writeColored(
- "<+> ",
- "\u001b[1m\u001b[36m",
- "\u001b[39m\u001b[22m"
-);
-
-module.exports = {
- log: writeColored(" ", "\u001b[1m", "\u001b[22m"),
- debug: writeColored(" ", "", ""),
- trace: writeColored(" ", "", ""),
- info: writeColored("<i> ", "\u001b[1m\u001b[32m", "\u001b[39m\u001b[22m"),
- warn: writeColored("<w> ", "\u001b[1m\u001b[33m", "\u001b[39m\u001b[22m"),
- error: writeColored("<e> ", "\u001b[1m\u001b[31m", "\u001b[39m\u001b[22m"),
- logTime: writeColored("<t> ", "\u001b[1m\u001b[35m", "\u001b[39m\u001b[22m"),
- group: (...args) => {
- writeGroupMessage(...args);
- if (currentCollapsed > 0) {
- currentCollapsed++;
- } else {
- currentIndent += " ";
- }
- },
- groupCollapsed: (...args) => {
- writeGroupCollapsedMessage(...args);
- currentCollapsed++;
- },
- groupEnd: () => {
- if (currentCollapsed > 0) currentCollapsed--;
- else if (currentIndent.length >= 2)
- currentIndent = currentIndent.slice(0, currentIndent.length - 2);
- },
- // eslint-disable-next-line node/no-unsupported-features/node-builtins
- profile: console.profile && (name => console.profile(name)),
- // eslint-disable-next-line node/no-unsupported-features/node-builtins
- profileEnd: console.profileEnd && (name => console.profileEnd(name)),
- clear:
- tty &&
- // eslint-disable-next-line node/no-unsupported-features/node-builtins
- console.clear &&
- (() => {
- clearStatusMessage();
- // eslint-disable-next-line node/no-unsupported-features/node-builtins
- console.clear();
- writeStatusMessage();
- }),
- status: tty
- ? (name, ...args) => {
- args = args.filter(Boolean);
- if (name === undefined && args.length === 0) {
- clearStatusMessage();
- currentStatusMessage = undefined;
- } else if (
- typeof name === "string" &&
- name.startsWith("[webpack.Progress] ")
- ) {
- currentStatusMessage = [name.slice(19), ...args];
- writeStatusMessage();
- } else if (name === "[webpack.Progress]") {
- currentStatusMessage = [...args];
- writeStatusMessage();
- } else {
- currentStatusMessage = [name, ...args];
- writeStatusMessage();
- }
- }
- : writeColored("<s> ", "", "")
-};