handle runtime requirements

This commit is contained in:
Tobias Koppers 2018-11-16 18:18:44 +01:00
parent 2525c8b7aa
commit 7c37a6a972
36 changed files with 701 additions and 371 deletions

View File

@ -37,6 +37,7 @@ const ModuleNotFoundError = require("./ModuleNotFoundError");
const ModuleProfile = require("./ModuleProfile");
const ModuleRestoreError = require("./ModuleRestoreError");
const ModuleTemplate = require("./ModuleTemplate");
const RuntimeGlobals = require("./RuntimeGlobals");
const RuntimeTemplate = require("./RuntimeTemplate");
const Stats = require("./Stats");
const compareLocations = require("./compareLocations");
@ -290,6 +291,14 @@ class Compilation {
runtimeRequirementInChunk: new HookMap(
() => new SyncBailHook(["chunk", "runtimeRequirements"])
),
/** @type {SyncHook<Module>} */
additionalModuleRuntimeRequirements: new SyncHook([
"module",
"runtimeRequirements"
]),
runtimeRequirementInModule: new HookMap(
() => new SyncBailHook(["module", "runtimeRequirements"])
),
/** @type {SyncHook<Chunk>} */
additionalTreeRuntimeRequirements: new SyncHook([
"chunk",
@ -1310,6 +1319,9 @@ class Compilation {
dependencyTemplates
} = this;
const additionalModuleRuntimeRequirements = /** @type {TODO} */ (this.hooks
.additionalModuleRuntimeRequirements);
const runtimeRequirementInModule = this.hooks.runtimeRequirementInModule;
for (const module of this.modules) {
if (chunkGraph.getNumberOfModuleChunks(module) > 0) {
const runtimeRequirements = module.getRuntimeRequirements({
@ -1318,9 +1330,21 @@ class Compilation {
moduleGraph,
chunkGraph
});
let set;
if (runtimeRequirements) {
chunkGraph.addModuleRuntimeRequirements(module, runtimeRequirements);
set = new Set(runtimeRequirements);
} else if (additionalModuleRuntimeRequirements.isUsed()) {
set = new Set();
} else {
continue;
}
additionalModuleRuntimeRequirements.call(module, set);
for (const r of set) {
const hook = runtimeRequirementInModule.get(r);
if (hook !== undefined) hook.call(module, set);
}
chunkGraph.addModuleRuntimeRequirements(module, set);
}
}
@ -1330,10 +1354,8 @@ class Compilation {
const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements(
module
);
if (runtimeRequirements !== undefined) {
for (const r of runtimeRequirements) set.add(r);
}
}
this.hooks.additionalChunkRuntimeRequirements.call(chunk, set);
for (const r of set) {
@ -1390,6 +1412,9 @@ class Compilation {
// Setup internals
this.moduleGraph.setUsedExports(module, new SortableSet());
this.chunkGraph.addModuleRuntimeRequirements(module, [
RuntimeGlobals.require
]);
// Call hook
this.hooks.runtimeModule.call(module, chunk);

View File

@ -631,13 +631,20 @@ module.exports = webpackAsyncContext;`;
* @param {Object} options options object
* @param {RuntimeTemplate} options.runtimeTemplate the runtime template
* @param {ChunkGraph} options.chunkGraph the chunk graph
* @param {Set<string>} options.runtimeRequirements runtime requirements
* @returns {string} source code
*/
getLazyOnceSource(block, dependencies, id, { runtimeTemplate, chunkGraph }) {
getLazyOnceSource(
block,
dependencies,
id,
{ runtimeTemplate, chunkGraph, runtimeRequirements }
) {
const promise = runtimeTemplate.blockPromise({
chunkGraph,
block,
message: "lazy-once context"
message: "lazy-once context",
runtimeRequirements
});
const map = this.getUserRequestMap(dependencies, chunkGraph);
const fakeMap = this.getFakeMap(dependencies, chunkGraph);
@ -805,7 +812,8 @@ webpackEmptyAsyncContext.id = ${JSON.stringify(id)};`;
if (block) {
return this.getLazyOnceSource(block, block.dependencies, id, {
runtimeTemplate,
chunkGraph
chunkGraph,
runtimeRequirements: null
});
}
return this.getSourceForEmptyAsyncContext(id);
@ -854,8 +862,10 @@ webpackEmptyAsyncContext.id = ${JSON.stringify(id)};`;
const allDeps = /** @type {ContextElementDependency[]} */ (this.dependencies.concat(
this.blocks.map(b => b.dependencies[0])
));
set.push(RuntimeGlobals.module);
if (allDeps.length > 0) {
const asyncMode = this.options.mode;
set.push(RuntimeGlobals.require);
if (asyncMode === "weak") {
set.push(RuntimeGlobals.moduleFactories);
} else if (asyncMode === "async-weak") {

View File

@ -6,8 +6,8 @@
"use strict";
const { OriginalSource, RawSource } = require("webpack-sources");
const Module = require("./Module");
const RuntimeGlobals = require("./RuntimeGlobals");
const DelegatedExportsDependency = require("./dependencies/DelegatedExportsDependency");
const DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
@ -115,7 +115,8 @@ class DelegatedModule extends Module {
str = `module.exports = (${runtimeTemplate.moduleExports({
module: sourceModule,
chunkGraph,
request: dep.request
request: dep.request,
runtimeRequirements: new Set()
})})`;
switch (this.delegationType) {
@ -137,6 +138,15 @@ class DelegatedModule extends Module {
}
}
/**
* Get a list of runtime requirements
* @param {SourceContext} context context for code generation
* @returns {Iterable<string> | null} required runtime modules
*/
getRuntimeRequirements(context) {
return [RuntimeGlobals.module, RuntimeGlobals.require];
}
/**
* @returns {number} the estimated size of the module
*/

View File

@ -7,6 +7,7 @@
const { RawSource } = require("webpack-sources");
const Module = require("./Module");
const RuntimeGlobals = require("./RuntimeGlobals");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("./ChunkGraph")} ChunkGraph */
@ -65,6 +66,15 @@ class DllModule extends Module {
return new RawSource("module.exports = __webpack_require__;");
}
/**
* Get a list of runtime requirements
* @param {SourceContext} context context for code generation
* @returns {Iterable<string> | null} required runtime modules
*/
getRuntimeRequirements(context) {
return [RuntimeGlobals.require, RuntimeGlobals.module];
}
/**
* @param {NeedBuildContext} context context info
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild

View File

@ -7,6 +7,7 @@
const { OriginalSource, RawSource } = require("webpack-sources");
const Module = require("./Module");
const RuntimeGlobals = require("./RuntimeGlobals");
const Template = require("./Template");
const makeSerializable = require("./util/makeSerializable");
@ -249,6 +250,15 @@ class ExternalModule extends Module {
return 42;
}
/**
* Get a list of runtime requirements
* @param {SourceContext} context context for code generation
* @returns {Iterable<string> | null} required runtime modules
*/
getRuntimeRequirements(context) {
return [RuntimeGlobals.module];
}
/**
* @param {Hash} hash the hash used to track dependencies
* @param {ChunkGraph} chunkGraph the chunk graph

View File

@ -26,7 +26,7 @@ class FunctionModuleTemplatePlugin {
(moduleSource, module) => {
const { chunkGraph } = this.compilation;
const source = new ConcatSource();
const args = [module.moduleArgument];
const args = [];
const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements(
module
);
@ -34,8 +34,17 @@ class FunctionModuleTemplatePlugin {
const needExports = runtimeRequirements.has(RuntimeGlobals.exports);
const needRequire = runtimeRequirements.has(RuntimeGlobals.require);
if (needExports || needRequire || needModule)
args.push(module.moduleArgument);
if (needExports || needRequire) args.push(module.exportsArgument);
args.push(
needModule
? module.moduleArgument
: "__unused" + module.moduleArgument
);
if (needExports || needRequire)
args.push(
needExports
? module.exportsArgument
: "__unused" + module.exportsArgument
);
if (needRequire) args.push("__webpack_require__");
source.add("/***/ (function(" + args.join(", ") + ") {\n\n");
if (module.buildInfo.strict) source.add('"use strict";\n');
@ -47,7 +56,7 @@ class FunctionModuleTemplatePlugin {
moduleTemplate.hooks.package.tap(
"FunctionModuleTemplatePlugin",
(moduleSource, module, { moduleGraph }) => {
(moduleSource, module, { moduleGraph, chunkGraph }) => {
if (moduleTemplate.runtimeTemplate.outputOptions.pathinfo) {
const source = new ConcatSource();
const req = module.readableIdentifier(
@ -71,6 +80,13 @@ class FunctionModuleTemplatePlugin {
} else if (module.buildMeta.providedExports) {
source.add(Template.toComment("no static exports found") + "\n");
}
source.add(
Template.toComment(
`runtime requirements: ${Array.from(
chunkGraph.getModuleRuntimeRequirements(module)
).join(", ")}`
) + "\n"
);
const usedExports = moduleGraph.getUsedExports(module);
if (usedExports === true) {
source.add(Template.toComment("all exports used") + "\n");

View File

@ -7,6 +7,7 @@
const { ConcatSource, RawSource } = require("webpack-sources");
const Generator = require("./Generator");
const RuntimeGlobals = require("./RuntimeGlobals");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("./Generator").GenerateContext} GenerateContext */
@ -30,7 +31,7 @@ class JsonGenerator extends Generator {
* @param {GenerateContext} generateContext context for generate
* @returns {Source} generated code
*/
generate(module, { moduleGraph, runtimeTemplate }) {
generate(module, { moduleGraph, runtimeTemplate, runtimeRequirements }) {
const source = new ConcatSource();
const data = module.buildInfo.jsonData;
if (data === undefined) {
@ -40,6 +41,7 @@ class JsonGenerator extends Generator {
})
);
}
runtimeRequirements.add(RuntimeGlobals.module);
if (
Array.isArray(module.buildMeta.providedExports) &&
!module.isExportUsed(moduleGraph, "default")

View File

@ -151,22 +151,30 @@ class NodeStuffPlugin {
.tap("NodeStuffPlugin", expr => {
parser.state.module.buildMeta.moduleConcatenationBailout =
"module.loaded";
return toConstantDependency(parser, "module.l")(expr);
return toConstantDependency(parser, "module.l", [
RuntimeGlobals.module
])(expr);
});
parser.hooks.expression
.for("module.id")
.tap("NodeStuffPlugin", expr => {
parser.state.module.buildMeta.moduleConcatenationBailout =
"module.id";
return toConstantDependency(parser, "module.i")(expr);
return toConstantDependency(parser, "module.i", [
RuntimeGlobals.module
])(expr);
});
parser.hooks.expression
.for("module.exports")
.tap("NodeStuffPlugin", () => {
.tap("NodeStuffPlugin", expr => {
const module = parser.state.module;
const isHarmony =
module.buildMeta && module.buildMeta.exportsType;
if (!isHarmony) return true;
if (!isHarmony) {
return toConstantDependency(parser, "module.exports", [
RuntimeGlobals.module
])(expr);
}
});
parser.hooks.evaluateIdentifier
.for("module.hot")

View File

@ -515,9 +515,8 @@ class NormalModule extends Module {
this.buildMeta = {};
this.buildInfo = {
cacheable: false,
fileDependencies: new Set(),
contextDependencies: new Set(),
runtimeRequirements: new Set()
parsed: true,
fileDependencies: new Set()
};
return this.doBuild(options, compilation, resolver, fs, err => {
@ -535,8 +534,7 @@ class NormalModule extends Module {
const noParseRule = options.module && options.module.noParse;
if (this.shouldPreventParsing(noParseRule, this.request)) {
// We assume that we need module and exports
this.buildInfo.runtimeRequirements.add(RuntimeGlobals.module);
this.buildInfo.runtimeRequirements.add(RuntimeGlobals.exports);
this.buildInfo.parsed = false;
this._initBuildHash(compilation);
return callback();
}
@ -638,6 +636,11 @@ class NormalModule extends Module {
/** @type {Set<string>} */
const runtimeRequirements = new Set();
if (!this.buildInfo.parsed) {
runtimeRequirements.add(RuntimeGlobals.module);
runtimeRequirements.add(RuntimeGlobals.exports);
}
const source = this.generator.generate(this, {
dependencyTemplates,
runtimeTemplate,

59
lib/RuntimePlugin.js Normal file
View File

@ -0,0 +1,59 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const RuntimeGlobals = require("./RuntimeGlobals");
/** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Module")} Module */
const NEED_REQUIRE = [
RuntimeGlobals.chunkName,
RuntimeGlobals.compatGetDefaultExport,
RuntimeGlobals.createFakeNamespaceObject,
RuntimeGlobals.definePropertyGetter,
RuntimeGlobals.ensureChunk,
RuntimeGlobals.entryModuleId,
RuntimeGlobals.getFullHash,
RuntimeGlobals.hasOwnProperty,
RuntimeGlobals.makeNamespaceObject,
RuntimeGlobals.moduleCache,
RuntimeGlobals.moduleFactories,
RuntimeGlobals.publicPath,
RuntimeGlobals.scriptNonce,
RuntimeGlobals.uncaughtErrorHandler,
RuntimeGlobals.wasmInstances
];
class RuntimePlugin {
/**
* @param {Compiler} compiler the Compiler
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap("RuntimePlugin", compilation => {
for (const req of NEED_REQUIRE) {
compilation.hooks.runtimeRequirementInModule
.for(req)
.tap("RuntimePlugin", (module, set) => {
set.add(RuntimeGlobals.require);
});
}
compilation.hooks.runtimeRequirementInModule
.for(RuntimeGlobals.makeNamespaceObject)
.tap("RuntimePlugin", (module, set) => {
set.add(RuntimeGlobals.definePropertyGetter);
});
compilation.hooks.runtimeRequirementInModule
.for(RuntimeGlobals.compatGetDefaultExport)
.tap("RuntimePlugin", (module, set) => {
set.add(RuntimeGlobals.definePropertyGetter);
});
});
}
}
module.exports = RuntimePlugin;

View File

@ -174,9 +174,10 @@ class RuntimeTemplate {
* @param {ChunkGraph} options.chunkGraph the chunk graph
* @param {string} options.request the request that should be printed as comment
* @param {boolean=} options.weak if the dependency is weak (will create a nice error message)
* @param {Set<string>} options.runtimeRequirements if set, will be filled with runtime requirements
* @returns {string} the expression
*/
moduleRaw({ module, chunkGraph, request, weak }) {
moduleRaw({ module, chunkGraph, request, weak, runtimeRequirements }) {
if (!module) {
return this.missingModule({
request
@ -198,6 +199,7 @@ class RuntimeTemplate {
`RuntimeTemplate.moduleId(): Module ${module.identifier()} has no id. This should not happen.`
);
}
runtimeRequirements.add(RuntimeGlobals.require);
return `__webpack_require__(${this.moduleId({
module,
chunkGraph,
@ -212,14 +214,16 @@ class RuntimeTemplate {
* @param {ChunkGraph} options.chunkGraph the chunk graph
* @param {string} options.request the request that should be printed as comment
* @param {boolean=} options.weak if the dependency is weak (will create a nice error message)
* @param {Set<string>} options.runtimeRequirements if set, will be filled with runtime requirements
* @returns {string} the expression
*/
moduleExports({ module, chunkGraph, request, weak }) {
moduleExports({ module, chunkGraph, request, weak, runtimeRequirements }) {
return this.moduleRaw({
module,
chunkGraph,
request,
weak
weak,
runtimeRequirements
});
}
@ -230,7 +234,7 @@ class RuntimeTemplate {
* @param {string} options.request the request that should be printed as comment
* @param {boolean=} options.strict if the current module is in strict esm mode
* @param {boolean=} options.weak if the dependency is weak (will create a nice error message)
* @param {Set<string>=} options.runtimeRequirements if set, will be filled with runtime requirements
* @param {Set<string>} options.runtimeRequirements if set, will be filled with runtime requirements
* @returns {string} the expression
*/
moduleNamespace({
@ -273,7 +277,8 @@ class RuntimeTemplate {
module,
chunkGraph,
request,
weak
weak,
runtimeRequirements
});
return rawModule;
} else if (exportsType === "named") {
@ -303,7 +308,7 @@ class RuntimeTemplate {
* @param {string} options.message a message for the comment
* @param {boolean=} options.strict if the current module is in strict esm mode
* @param {boolean=} options.weak if the dependency is weak (will create a nice error message)
* @param {Set<string>=} options.runtimeRequirements if set, will be filled with runtime requirements
* @param {Set<string>} options.runtimeRequirements if set, will be filled with runtime requirements
* @returns {string} the promise expression
*/
moduleNamespacePromise({
@ -340,7 +345,8 @@ class RuntimeTemplate {
const promise = this.blockPromise({
chunkGraph,
block,
message
message,
runtimeRequirements
});
let getModuleFunction;
@ -378,10 +384,12 @@ class RuntimeTemplate {
module,
chunkGraph,
request,
weak
weak,
runtimeRequirements
});
getModuleFunction = `function() { ${header}return ${rawModule}; }`;
} else {
runtimeRequirements.add(RuntimeGlobals.require);
getModuleFunction = `__webpack_require__.bind(null, ${comment}${idExpr})`;
}
} else if (exportsType === "named") {
@ -429,7 +437,7 @@ class RuntimeTemplate {
* @param {string} options.importVar name of the import variable
* @param {Module} options.originModule module in which the statement is emitted
* @param {boolean=} options.weak true, if this is a weak dependency
* @param {Set<string>=} options.runtimeRequirements if set, will be filled with runtime requirements
* @param {Set<string>} options.runtimeRequirements if set, will be filled with runtime requirements
* @returns {string} the import statement
*/
importStatement({
@ -471,6 +479,7 @@ class RuntimeTemplate {
const optDeclaration = update ? "" : "var ";
const exportsType = module.buildMeta && module.buildMeta.exportsType;
runtimeRequirements.add(RuntimeGlobals.require);
let content = `/* harmony import */ ${optDeclaration}${importVar} = __webpack_require__(${moduleId});\n`;
if (!exportsType && !originModule.buildMeta.strictHarmonyModule) {
@ -509,7 +518,7 @@ class RuntimeTemplate {
* @param {boolean} options.isCall true, if expression will be called
* @param {boolean} options.callContext when false, call context will not be preserved
* @param {string} options.importVar the identifier name of the import variable
* @param {Set<string>=} options.runtimeRequirements if set, will be filled with runtime requirements
* @param {Set<string>} options.runtimeRequirements if set, will be filled with runtime requirements
* @returns {string} expression
*/
exportFromImport({
@ -593,7 +602,7 @@ class RuntimeTemplate {
* @param {AsyncDependenciesBlock} options.block the async block
* @param {string} options.message the message
* @param {ChunkGraph} options.chunkGraph the chunk graph
* @param {Set<string>=} options.runtimeRequirements if set, will be filled with runtime requirements
* @param {Set<string>} options.runtimeRequirements if set, will be filled with runtime requirements
* @returns {string} expression
*/
blockPromise({ block, message, chunkGraph, runtimeRequirements }) {
@ -641,7 +650,15 @@ class RuntimeTemplate {
return RuntimeGlobals.uncaughtErrorHandler;
}
defineEsModuleFlagStatement({ exportsArgument }) {
/**
* @param {Object} options options
* @param {string} options.exportsArgument the name of the exports object
* @param {Set<string>} options.runtimeRequirements if set, will be filled with runtime requirements
*
*/
defineEsModuleFlagStatement({ exportsArgument, runtimeRequirements }) {
runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject);
runtimeRequirements.add(RuntimeGlobals.exports);
return `${RuntimeGlobals.makeNamespaceObject}(${exportsArgument});\n`;
}
}

View File

@ -20,6 +20,8 @@ const SourceMapDevToolPlugin = require("./SourceMapDevToolPlugin");
const EntryOptionPlugin = require("./EntryOptionPlugin");
const RecordIdsPlugin = require("./RecordIdsPlugin");
const RuntimePlugin = require("./RuntimePlugin");
const APIPlugin = require("./APIPlugin");
const CompatibilityPlugin = require("./CompatibilityPlugin");
const ConstPlugin = require("./ConstPlugin");
@ -312,6 +314,8 @@ class WebpackOptionsApply extends OptionsApply {
new EntryOptionPlugin().apply(compiler);
compiler.hooks.entryOption.call(options.context, options.entry);
new RuntimePlugin().apply(compiler);
new CompatibilityPlugin().apply(compiler);
new HarmonyModulesPlugin(options.module).apply(compiler);
new AMDPlugin(options.module, options.amd || {}).apply(compiler);

View File

@ -5,6 +5,7 @@
"use strict";
const RuntimeGlobals = require("../RuntimeGlobals");
const makeSerializable = require("../util/makeSerializable");
const NullDependency = require("./NullDependency");
@ -12,6 +13,69 @@ const NullDependency = require("./NullDependency");
/** @typedef {import("../Dependency")} Dependency */
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
const DEFINITIONS = {
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__))`,
RuntimeGlobals.require,
RuntimeGlobals.exports,
RuntimeGlobals.module
],
o: ["", "!(module.exports = #)", RuntimeGlobals.module],
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__))`,
RuntimeGlobals.require,
RuntimeGlobals.exports,
RuntimeGlobals.module
],
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__))`,
RuntimeGlobals.exports
],
ao: ["", "!(#, module.exports = #)", RuntimeGlobals.module],
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__))`,
RuntimeGlobals.exports,
RuntimeGlobals.module
],
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))",
RuntimeGlobals.require
],
lo: ["var XXX;", "!(XXX = #)"],
lof: [
"var XXX, XXXfactory, XXXmodule;",
"!(XXXfactory = (#), (typeof XXXfactory === 'function' ? (XXXmodule = { id: YYY, exports: {}, loaded: false }), (XXX = XXXfactory.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule)), (XXXmodule.loaded = true), XXX === undefined && (XXX = XXXmodule.exports) : XXX = XXXfactory))",
RuntimeGlobals.require
],
laf: [
"var __WEBPACK_AMD_DEFINE_ARRAY__, XXX, XXXexports;",
"!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, XXX = (#).apply(XXXexports = {}, __WEBPACK_AMD_DEFINE_ARRAY__), XXX === undefined && (XXX = XXXexports))"
],
lao: ["var XXX;", "!(#, XXX = #)"],
laof: [
"var XXXarray, XXXfactory, XXXexports, XXX;",
`!(XXXarray = #, XXXfactory = (#),
(typeof XXXfactory === 'function' ?
((XXX = XXXfactory.apply(XXXexports = {}, XXXarray)), XXX === undefined && (XXX = XXXexports)) :
(XXX = XXXfactory)
))`
]
};
class AMDDefineDependency extends NullDependency {
constructor(range, arrayRange, functionRange, objectRange, namedModule) {
super();
@ -56,70 +120,21 @@ makeSerializable(
);
AMDDefineDependency.Template = class AMDDefineDependencyTemplate extends NullDependency.Template {
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__))`
]
};
}
/**
* @param {Dependency} dependency the dependency for which the template should be applied
* @param {ReplaceSource} source the current replace source which can be modified
* @param {DependencyTemplateContext} templateContext the context object
* @returns {void}
*/
apply(dependency, source, templateContext) {
apply(dependency, source, { runtimeRequirements }) {
const dep = /** @type {AMDDefineDependency} */ (dependency);
const branch = this.branch(dep);
const defAndText = this.definitions[branch];
const defAndText = DEFINITIONS[branch];
const definitions = defAndText[0];
const text = defAndText[1];
for (let i = 2; i < defAndText.length; i++) {
runtimeRequirements.add(defAndText[i]);
}
this.replace(dep, source, definitions, text);
}

View File

@ -5,6 +5,7 @@
"use strict";
const RuntimeGlobals = require("../RuntimeGlobals");
const AMDDefineDependency = require("./AMDDefineDependency");
const AMDRequireArrayDependency = require("./AMDRequireArrayDependency");
const AMDRequireContextDependency = require("./AMDRequireContextDependency");
@ -107,9 +108,17 @@ class AMDDefineDependencyParserPlugin {
} 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);
dep = new ConstDependency("__webpack_require__", param.range, [
RuntimeGlobals.require
]);
} else if (param.string === "exports") {
dep = new ConstDependency("exports", param.range, [
RuntimeGlobals.exports
]);
} else if (param.string === "module") {
dep = new ConstDependency("module", param.range, [
RuntimeGlobals.module
]);
} else if (
(localModule = getLocalModule(parser.state, param.string, namedModule))
) {

View File

@ -55,28 +55,23 @@ AMDRequireArrayDependency.Template = class AMDRequireArrayDependencyTemplate ext
* @param {DependencyTemplateContext} templateContext the context object
* @returns {void}
*/
apply(dependency, source, { runtimeTemplate, moduleGraph, chunkGraph }) {
apply(dependency, source, templateContext) {
const dep = /** @type {AMDRequireArrayDependency} */ (dependency);
const content = this.getContent(dep, {
runtimeTemplate,
moduleGraph,
chunkGraph
});
const content = this.getContent(dep, templateContext);
source.replace(dep.range[0], dep.range[1] - 1, content);
}
getContent(dep, { runtimeTemplate, moduleGraph, chunkGraph }) {
getContent(dep, templateContext) {
const requires = dep.depsArray.map(dependency => {
return this.contentForDependency(dependency, {
runtimeTemplate,
moduleGraph,
chunkGraph
});
return this.contentForDependency(dependency, templateContext);
});
return `[${requires.join(", ")}]`;
}
contentForDependency(dep, { runtimeTemplate, moduleGraph, chunkGraph }) {
contentForDependency(
dep,
{ runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements }
) {
if (typeof dep === "string") {
return dep;
}
@ -87,7 +82,8 @@ AMDRequireArrayDependency.Template = class AMDRequireArrayDependencyTemplate ext
return runtimeTemplate.moduleExports({
module: moduleGraph.getModule(dep),
chunkGraph,
request: dep.request
request: dep.request,
runtimeRequirements
});
}
}

View File

@ -5,6 +5,7 @@
"use strict";
const RuntimeGlobals = require("../RuntimeGlobals");
const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
const AMDRequireArrayDependency = require("./AMDRequireArrayDependency");
const AMDRequireContextDependency = require("./AMDRequireContextDependency");
@ -107,16 +108,20 @@ class AMDRequireDependenciesBlockParserPlugin {
} else if (param.isString()) {
let dep, localModule;
if (param.string === "require") {
dep = new ConstDependency("__webpack_require__", param.string);
dep = new ConstDependency("__webpack_require__", param.string, [
RuntimeGlobals.require
]);
} else if (param.string === "module") {
dep = new ConstDependency(
parser.state.module.buildInfo.moduleArgument,
param.range
param.range,
[RuntimeGlobals.module]
);
} else if (param.string === "exports") {
dep = new ConstDependency(
parser.state.module.buildInfo.exportsArgument,
param.range
param.range,
[RuntimeGlobals.exports]
);
} else if ((localModule = getLocalModule(parser.state, param.string))) {
localModule.flagUsed();

View File

@ -5,6 +5,7 @@
"use strict";
const RuntimeGlobals = require("../RuntimeGlobals");
const makeSerializable = require("../util/makeSerializable");
const NullDependency = require("./NullDependency");
@ -64,7 +65,11 @@ AMDRequireDependency.Template = class AMDRequireDependencyTemplate extends NullD
* @param {DependencyTemplateContext} templateContext the context object
* @returns {void}
*/
apply(dependency, source, { runtimeTemplate, moduleGraph, chunkGraph }) {
apply(
dependency,
source,
{ runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements }
) {
const dep = /** @type {AMDRequireDependency} */ (dependency);
const depBlock = /** @type {AsyncDependenciesBlock} */ (moduleGraph.getParentBlock(
dep
@ -72,13 +77,15 @@ AMDRequireDependency.Template = class AMDRequireDependencyTemplate extends NullD
const promise = runtimeTemplate.blockPromise({
chunkGraph,
block: depBlock,
message: "AMD require"
message: "AMD require",
runtimeRequirements
});
// has array range but no function range
if (dep.arrayRange && !dep.functionRange) {
const startBlock = `${promise}.then(function() {`;
const endBlock = `;}).catch(${runtimeTemplate.onError()})`;
const endBlock = `;}).catch(${RuntimeGlobals.uncaughtErrorHandler})`;
runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler);
source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock);
@ -90,7 +97,10 @@ AMDRequireDependency.Template = class AMDRequireDependencyTemplate extends NullD
// has function range but no array range
if (dep.functionRange && !dep.arrayRange) {
const startBlock = `${promise}.then((`;
const endBlock = `).bind(exports, __webpack_require__, exports, module)).catch(${runtimeTemplate.onError()})`;
const endBlock = `).bind(exports, __webpack_require__, exports, module)).catch(${
RuntimeGlobals.uncaughtErrorHandler
})`;
runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler);
source.replace(dep.outerRange[0], dep.functionRange[0] - 1, startBlock);
@ -139,9 +149,10 @@ AMDRequireDependency.Template = class AMDRequireDependencyTemplate extends NullD
// has array range, function range, but no errorCallbackRange
if (dep.arrayRange && dep.functionRange) {
const startBlock = `${promise}.then(function() { `;
const endBlock = `}${
dep.functionBindThis ? ".bind(this)" : ""
}).catch(${runtimeTemplate.onError()})`;
const endBlock = `}${dep.functionBindThis ? ".bind(this)" : ""}).catch(${
RuntimeGlobals.uncaughtErrorHandler
})`;
runtimeRequirements.add(RuntimeGlobals.uncaughtErrorHandler);
source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock);

View File

@ -18,6 +18,8 @@ const NullFactory = require("../NullFactory");
const CommonJsRequireDependencyParserPlugin = require("./CommonJsRequireDependencyParserPlugin");
const RequireResolveDependencyParserPlugin = require("./RequireResolveDependencyParserPlugin");
const RuntimeGlobals = require("../RuntimeGlobals");
const {
evaluateToIdentifier,
evaluateToString,
@ -115,6 +117,15 @@ class CommonJsPlugin {
parser.hooks.evaluateTypeof
.for("module")
.tap("CommonJsPlugin", evaluateToString("object"));
parser.hooks.expression.for("exports").tap("CommonJsPlugin", expr => {
const module = parser.state.module;
const isHarmony = module.buildMeta && module.buildMeta.exportsType;
if (!isHarmony) {
return toConstantDependency(parser, module.exportsArgument, [
RuntimeGlobals.exports
])(expr);
}
});
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);
@ -133,7 +144,12 @@ class CommonJsPlugin {
parser.state.current.addDependency(dep);
return false;
});
parser.hooks.typeof.for("module").tap("CommonJsPlugin", () => true);
parser.hooks.typeof
.for("module")
.tap(
"CommonJsPlugin",
toConstantDependency(parser, JSON.stringify("object"))
);
parser.hooks.evaluateTypeof
.for("exports")
.tap("CommonJsPlugin", evaluateToString("object"));

View File

@ -18,13 +18,18 @@ class ContextDependencyTemplateAsId extends ContextDependency.Template {
* @param {DependencyTemplateContext} templateContext the context object
* @returns {void}
*/
apply(dependency, source, { runtimeTemplate, moduleGraph, chunkGraph }) {
apply(
dependency,
source,
{ runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements }
) {
const dep = /** @type {ContextDependency} */ (dependency);
const moduleExports = runtimeTemplate.moduleExports({
module: moduleGraph.getModule(dep),
chunkGraph,
request: dep.request,
weak: dep.weak
weak: dep.weak,
runtimeRequirements
});
if (moduleGraph.getModule(dep)) {

View File

@ -18,12 +18,17 @@ class ContextDependencyTemplateAsRequireCall extends ContextDependency.Template
* @param {DependencyTemplateContext} templateContext the context object
* @returns {void}
*/
apply(dependency, source, { runtimeTemplate, moduleGraph, chunkGraph }) {
apply(
dependency,
source,
{ runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements }
) {
const dep = /** @type {ContextDependency} */ (dependency);
const moduleExports = runtimeTemplate.moduleExports({
module: moduleGraph.getModule(dep),
chunkGraph,
request: dep.request
request: dep.request,
runtimeRequirements
});
if (moduleGraph.getModule(dep)) {

View File

@ -35,12 +35,13 @@ HarmonyCompatibilityDependency.Template = class HarmonyExportDependencyTemplate
apply(
dependency,
source,
{ module, runtimeTemplate, moduleGraph, initFragments }
{ module, runtimeTemplate, moduleGraph, initFragments, runtimeRequirements }
) {
const usedExports = moduleGraph.getUsedExports(module);
if (usedExports === true || usedExports === null) {
const content = runtimeTemplate.defineEsModuleFlagStatement({
exportsArgument: module.exportsArgument
exportsArgument: module.exportsArgument,
runtimeRequirements
});
initFragments.push(
new InitFragment(

View File

@ -5,6 +5,7 @@
"use strict";
const RuntimeGlobals = require("../RuntimeGlobals");
const makeSerializable = require("../util/makeSerializable");
const NullDependency = require("./NullDependency");
@ -67,10 +68,20 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
* @param {DependencyTemplateContext} templateContext the context object
* @returns {void}
*/
apply(dependency, source, { module, moduleGraph }) {
apply(dependency, source, { module, moduleGraph, runtimeRequirements }) {
const dep = /** @type {HarmonyExportExpressionDependency} */ (dependency);
const used = module.getUsedName(moduleGraph, "default");
const content = this.getContent(module, used);
let content;
if (used) {
runtimeRequirements.add(RuntimeGlobals.exports);
const exportsName = module.exportsArgument;
content = `/* harmony default export */ ${exportsName}[${JSON.stringify(
used
)}] = `;
} else {
content =
"/* unused harmony default export */ var _unused_webpack_default_export = ";
}
if (dep.range) {
source.replace(
@ -84,16 +95,6 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
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;

View File

@ -535,7 +535,8 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
const exportFragment = this._getExportFragment(
dep,
templateContext.module,
templateContext.moduleGraph
templateContext.moduleGraph,
templateContext.runtimeRequirements
);
templateContext.initFragments.push(exportFragment);
}
@ -593,9 +594,10 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
* @param {HarmonyExportImportedSpecifierDependency} dep dependency
* @param {Module} module the current module
* @param {ModuleGraph} moduleGraph the module graph
* @param {Set<string>} runtimeRequirements runtime requirements
* @returns {InitFragment} the generated init fragment
*/
_getExportFragment(dep, module, moduleGraph) {
_getExportFragment(dep, module, moduleGraph, runtimeRequirements) {
const mode = dep.getMode(moduleGraph, false);
const importedModule = moduleGraph.getModule(dep);
const importVar = dep.getImportVar(moduleGraph);
@ -624,7 +626,8 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
module,
module.getUsedName(moduleGraph, mode.name),
importVar,
null
null,
runtimeRequirements
),
InitFragment.STAGE_HARMONY_EXPORTS,
1
@ -637,7 +640,8 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
module,
module.getUsedName(moduleGraph, mode.name),
importVar,
""
"",
runtimeRequirements
),
InitFragment.STAGE_HARMONY_EXPORTS,
1
@ -649,7 +653,8 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
this.getReexportFakeNamespaceObjectStatement(
module,
module.getUsedName(moduleGraph, mode.name),
importVar
importVar,
runtimeRequirements
),
InitFragment.STAGE_HARMONY_EXPORTS,
1
@ -662,7 +667,8 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
module,
module.getUsedName(moduleGraph, mode.name),
"undefined",
""
"",
runtimeRequirements
),
InitFragment.STAGE_HARMONY_EXPORTS,
1
@ -675,7 +681,8 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
module,
module.getUsedName(moduleGraph, mode.name),
importVar,
""
"",
runtimeRequirements
),
InitFragment.STAGE_HARMONY_EXPORTS,
1
@ -688,7 +695,8 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
module,
module.getUsedName(moduleGraph, mode.name),
importVar,
""
"",
runtimeRequirements
),
InitFragment.STAGE_HARMONY_EXPORTS,
1
@ -711,7 +719,8 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
module,
module.getUsedName(moduleGraph, item[0]),
importVar,
importedModule.getUsedName(moduleGraph, item[1])
importedModule.getUsedName(moduleGraph, item[1]),
runtimeRequirements
)
);
})
@ -730,7 +739,8 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
module,
item[0],
importVar,
item[1]
item[1],
runtimeRequirements
) +
"\n"
);
@ -761,8 +771,10 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
content += "if(__WEBPACK_IMPORT_KEY__ !== 'default') ";
}
const exportsName = module.exportsArgument;
runtimeRequirements.add(RuntimeGlobals.exports);
runtimeRequirements.add(RuntimeGlobals.definePropertyGetter);
const exportsName = module.exportsArgument;
return new InitFragment(
content +
`(function(key) { ${
@ -778,10 +790,13 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
}
}
getReexportStatement(module, key, name, valueKey) {
getReexportStatement(module, key, name, valueKey, runtimeRequirements) {
const exportsName = module.exportsArgument;
const returnValue = this.getReturnValue(name, valueKey);
runtimeRequirements.add(RuntimeGlobals.exports);
runtimeRequirements.add(RuntimeGlobals.definePropertyGetter);
return `${
RuntimeGlobals.definePropertyGetter
}(${exportsName}, ${JSON.stringify(
@ -789,9 +804,17 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
)}, function() { return ${returnValue}; });\n`;
}
getReexportFakeNamespaceObjectStatement(module, key, name) {
getReexportFakeNamespaceObjectStatement(
module,
key,
name,
runtimeRequirements
) {
const exportsName = module.exportsArgument;
runtimeRequirements.add(RuntimeGlobals.exports);
runtimeRequirements.add(RuntimeGlobals.definePropertyGetter);
return `${
RuntimeGlobals.definePropertyGetter
}(${exportsName}, ${JSON.stringify(key)}, function() { return ${
@ -799,7 +822,13 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
}(${name}); });\n`;
}
getConditionalReexportStatement(module, key, name, valueKey) {
getConditionalReexportStatement(
module,
key,
name,
valueKey,
runtimeRequirements
) {
if (valueKey === false) {
return "/* unused export */\n";
}
@ -807,6 +836,9 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
const exportsName = module.exportsArgument;
const returnValue = this.getReturnValue(name, valueKey);
runtimeRequirements.add(RuntimeGlobals.exports);
runtimeRequirements.add(RuntimeGlobals.definePropertyGetter);
return `if(${RuntimeGlobals.hasOwnProperty}(${name}, ${JSON.stringify(
valueKey
)})) ${

View File

@ -66,17 +66,21 @@ HarmonyExportSpecifierDependency.Template = class HarmonyExportSpecifierDependen
* @param {DependencyTemplateContext} templateContext the context object
* @returns {void}
*/
apply(dependency, source, { module, moduleGraph, initFragments }) {
apply(
dependency,
source,
{ module, moduleGraph, initFragments, runtimeRequirements }
) {
initFragments.push(
new InitFragment(
this.getContent(dependency, module, moduleGraph),
this.getContent(dependency, module, moduleGraph, runtimeRequirements),
InitFragment.STAGE_HARMONY_EXPORTS,
1
)
);
}
getContent(dep, module, moduleGraph) {
getContent(dep, module, moduleGraph, runtimeRequirements) {
const used = module.getUsedName(moduleGraph, dep.name);
if (!used) {
return `/* unused harmony export ${dep.name || "namespace"} */\n`;
@ -84,6 +88,9 @@ HarmonyExportSpecifierDependency.Template = class HarmonyExportSpecifierDependen
const exportsName = module.exportsArgument;
runtimeRequirements.add(RuntimeGlobals.exports);
runtimeRequirements.add(RuntimeGlobals.definePropertyGetter);
return `/* harmony export (binding) */ ${
RuntimeGlobals.definePropertyGetter
}(${exportsName}, ${JSON.stringify(used)}, function() { return ${

View File

@ -71,7 +71,7 @@ class HarmonyImportDependency extends ModuleDependency {
*/
getImportStatement(
update,
{ runtimeTemplate, module, moduleGraph, chunkGraph }
{ runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements }
) {
return runtimeTemplate.importStatement({
update,
@ -79,7 +79,8 @@ class HarmonyImportDependency extends ModuleDependency {
chunkGraph,
importVar: this.getImportVar(moduleGraph),
request: this.request,
originModule: module
originModule: module,
runtimeRequirements
});
}

View File

@ -35,7 +35,7 @@ ImportDependency.Template = class ImportDependencyTemplate extends ModuleDepende
apply(
dependency,
source,
{ runtimeTemplate, module, moduleGraph, chunkGraph }
{ runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements }
) {
const dep = /** @type {ImportDependency} */ (dependency);
const block = /** @type {ImportDependenciesBlock} */ (moduleGraph.getParentBlock(
@ -47,7 +47,8 @@ ImportDependency.Template = class ImportDependencyTemplate extends ModuleDepende
module: moduleGraph.getModule(dep),
request: dep.request,
strict: module.buildMeta.strictHarmonyModule,
message: "import()"
message: "import()",
runtimeRequirements
});
source.replace(block.range[0], block.range[1] - 1, content);

View File

@ -55,7 +55,7 @@ ImportEagerDependency.Template = class ImportEagerDependencyTemplate extends Mod
apply(
dependency,
source,
{ runtimeTemplate, module, moduleGraph, chunkGraph }
{ runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements }
) {
const dep = /** @type {ImportEagerDependency} */ (dependency);
const content = runtimeTemplate.moduleNamespacePromise({
@ -63,7 +63,8 @@ ImportEagerDependency.Template = class ImportEagerDependencyTemplate extends Mod
module: moduleGraph.getModule(dep),
request: dep.request,
strict: module.buildMeta.strictHarmonyModule,
message: "import() eager"
message: "import() eager",
runtimeRequirements
});
source.replace(dep.range[0], dep.range[1] - 1, content);

View File

@ -58,7 +58,7 @@ ImportWeakDependency.Template = class ImportDependencyTemplate extends ModuleDep
apply(
dependency,
source,
{ runtimeTemplate, module, moduleGraph, chunkGraph }
{ runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements }
) {
const dep = /** @type {ImportWeakDependency} */ (dependency);
const content = runtimeTemplate.moduleNamespacePromise({
@ -67,7 +67,8 @@ ImportWeakDependency.Template = class ImportDependencyTemplate extends ModuleDep
request: dep.request,
strict: module.buildMeta.strictHarmonyModule,
message: "import() weak",
weak: true
weak: true,
runtimeRequirements
});
source.replace(dep.range[0], dep.range[1] - 1, content);

View File

@ -6,6 +6,7 @@
"use strict";
const InitFragment = require("../InitFragment");
const RuntimeGlobals = require("../RuntimeGlobals");
const makeSerializable = require("../util/makeSerializable");
const ModuleDependency = require("./ModuleDependency");
@ -46,10 +47,17 @@ ModuleDecoratorDependency.Template = class ModuleDecoratorDependencyTemplate ext
apply(
dependency,
source,
{ runtimeTemplate, moduleGraph, chunkGraph, initFragments }
{
runtimeTemplate,
moduleGraph,
chunkGraph,
initFragments,
runtimeRequirements
}
) {
const dep = /** @type {ModuleDecoratorDependency} */ (dependency);
const originModule = moduleGraph.getOrigin(dep);
runtimeRequirements.add(RuntimeGlobals.module);
initFragments.push(
new InitFragment(
`/* module decorator */ ${
@ -57,7 +65,8 @@ ModuleDecoratorDependency.Template = class ModuleDecoratorDependencyTemplate ext
} = ${runtimeTemplate.moduleExports({
module: moduleGraph.getModule(dep),
chunkGraph,
request: dep.request
request: dep.request,
runtimeRequirements
})}(${originModule.moduleArgument});\n`,
InitFragment.STAGE_PROVIDES,
0,

View File

@ -18,14 +18,19 @@ class ModuleDependencyTemplateAsRequireId extends ModuleDependency.Template {
* @param {DependencyTemplateContext} templateContext the context object
* @returns {void}
*/
apply(dependency, source, { runtimeTemplate, moduleGraph, chunkGraph }) {
apply(
dependency,
source,
{ runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements }
) {
const dep = /** @type {ModuleDependency} */ (dependency);
if (!dep.range) return;
const content = runtimeTemplate.moduleExports({
module: moduleGraph.getModule(dep),
chunkGraph,
request: dep.request,
weak: dep.weak
weak: dep.weak,
runtimeRequirements
});
source.replace(dep.range[0], dep.range[1] - 1, content);
}

View File

@ -79,7 +79,13 @@ class ProvidedDependencyTemplate extends ModuleDependency.Template {
apply(
dependency,
source,
{ runtimeTemplate, moduleGraph, chunkGraph, initFragments }
{
runtimeTemplate,
moduleGraph,
chunkGraph,
initFragments,
runtimeRequirements
}
) {
const dep = /** @type {ProvidedDependency} */ (dependency);
initFragments.push(
@ -89,7 +95,8 @@ class ProvidedDependencyTemplate extends ModuleDependency.Template {
} = ${runtimeTemplate.moduleExports({
module: moduleGraph.getModule(dep),
chunkGraph,
request: dep.request
request: dep.request,
runtimeRequirements
})}${pathToString(dep.path)};\n`,
InitFragment.STAGE_PROVIDES,
1,

View File

@ -59,7 +59,11 @@ RequireEnsureDependency.Template = class RequireEnsureDependencyTemplate extends
* @param {DependencyTemplateContext} templateContext the context object
* @returns {void}
*/
apply(dependency, source, { runtimeTemplate, moduleGraph, chunkGraph }) {
apply(
dependency,
source,
{ runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements }
) {
const dep = /** @type {RequireEnsureDependency} */ (dependency);
const depBlock = /** @type {AsyncDependenciesBlock} */ (moduleGraph.getParentBlock(
dep
@ -67,7 +71,8 @@ RequireEnsureDependency.Template = class RequireEnsureDependencyTemplate extends
const promise = runtimeTemplate.blockPromise({
chunkGraph,
block: depBlock,
message: "require.ensure"
message: "require.ensure",
runtimeRequirements
});
const range = dep.range;
const contentRange = dep.contentRange;

View File

@ -5,6 +5,7 @@
"use strict";
const RuntimeGlobals = require("../RuntimeGlobals");
const makeSerializable = require("../util/makeSerializable");
const NullDependency = require("./NullDependency");
@ -44,14 +45,11 @@ RequireHeaderDependency.Template = class RequireHeaderDependencyTemplate extends
* @param {DependencyTemplateContext} templateContext the context object
* @returns {void}
*/
apply(dependency, source, templateContext) {
apply(dependency, source, { runtimeRequirements }) {
const dep = /** @type {RequireHeaderDependency} */ (dependency);
runtimeRequirements.add(RuntimeGlobals.require);
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;

View File

@ -856,7 +856,8 @@ class ConcatenatedModule extends Module {
if (usedExports === true) {
result.add(
runtimeTemplate.defineEsModuleFlagStatement({
exportsArgument: this.exportsArgument
exportsArgument: this.exportsArgument,
runtimeRequirements: new Set()
})
);
}
@ -1194,6 +1195,7 @@ class ConcatenatedModule extends Module {
});
const set = new Set([
RuntimeGlobals.exports, // TODO check if really used
RuntimeGlobals.makeNamespaceObject,
RuntimeGlobals.definePropertyGetter
]);

View File

@ -24,7 +24,10 @@ class WebAssemblyJavascriptGenerator extends Generator {
* @param {GenerateContext} generateContext context for generate
* @returns {Source} generated code
*/
generate(module, { runtimeTemplate, moduleGraph, chunkGraph }) {
generate(
module,
{ runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements }
) {
const usedExports = moduleGraph.getUsedExports(module);
const initIdentifer =
usedExports && usedExports !== true
@ -73,7 +76,8 @@ class WebAssemblyJavascriptGenerator extends Generator {
exportName: dep.name,
asiSafe: true,
isCall: false,
callContext: null
callContext: null,
runtimeRequirements
})
);
}
@ -84,6 +88,7 @@ class WebAssemblyJavascriptGenerator extends Generator {
importData.names.add(dep.name);
const usedName = module.getUsedName(moduleGraph, dep.exportName);
if (usedName) {
runtimeRequirements.add(RuntimeGlobals.exports);
const exportProp = `${module.exportsArgument}[${JSON.stringify(
usedName
)}]`;
@ -97,7 +102,8 @@ class WebAssemblyJavascriptGenerator extends Generator {
exportName: dep.name,
asiSafe: true,
isCall: false,
callContext: null
callContext: null,
runtimeRequirements
})};`,
`if(WebAssembly.Global) ${exportProp} = ` +
`new WebAssembly.Global({ value: ${JSON.stringify(
@ -119,19 +125,36 @@ class WebAssemblyJavascriptGenerator extends Generator {
chunkGraph,
request,
importVar,
originModule: module
originModule: module,
runtimeRequirements
});
return importStatement + reexports.join("\n");
}
)
);
const copyAllExports =
usedExports && usedExports !== true && !needExportsCopy;
// need these globals
runtimeRequirements.add(RuntimeGlobals.module);
runtimeRequirements.add(RuntimeGlobals.wasmInstances);
if (usedExports === true) {
runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject);
runtimeRequirements.add(RuntimeGlobals.exports);
}
if (!copyAllExports) {
runtimeRequirements.add(RuntimeGlobals.exports);
}
// create source
const source = new RawSource(
[
'"use strict";',
"// Instantiate WebAssembly module",
`var wasmExports = ${RuntimeGlobals.wasmInstances}[module.i];`,
`var wasmExports = ${RuntimeGlobals.wasmInstances}[${
module.moduleArgument
}.i];`,
usedExports === true
? `${RuntimeGlobals.makeNamespaceObject}(${module.exportsArgument});`
@ -139,7 +162,7 @@ class WebAssemblyJavascriptGenerator extends Generator {
// this must be before import for circular dependencies
"// export exports from WebAssembly module",
usedExports && usedExports !== true && !needExportsCopy
copyAllExports
? `${module.moduleArgument}.exports = wasmExports;`
: "for(var name in wasmExports) " +
`if(name != ${JSON.stringify(initIdentifer)}) ` +

View File

@ -7,10 +7,10 @@ Child fitting:
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
0f93dbc57653279c9b6c.js 1.93 KiB 2 [emitted]
138d0972019f89a65bcf.js 1.92 KiB 1 [emitted]
0f93dbc57653279c9b6c.js 1.91 KiB 2 [emitted]
138d0972019f89a65bcf.js 1.91 KiB 1 [emitted]
4f3a8970f29832010a78.js 11 KiB 3 [emitted]
d4b551c6319035df2898.js 1.02 KiB 0 [emitted]
d4b551c6319035df2898.js 1.07 KiB 0 [emitted]
Entrypoint main = 138d0972019f89a65bcf.js 0f93dbc57653279c9b6c.js 4f3a8970f29832010a78.js
chunk {0} d4b551c6319035df2898.js 916 bytes <{1}> <{2}> <{3}>
> ./g [4] ./index.js 7:0-13
@ -33,10 +33,10 @@ Child content-change:
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
0f93dbc57653279c9b6c.js 1.93 KiB 2 [emitted]
138d0972019f89a65bcf.js 1.92 KiB 1 [emitted]
0f93dbc57653279c9b6c.js 1.91 KiB 2 [emitted]
138d0972019f89a65bcf.js 1.91 KiB 1 [emitted]
4f3a8970f29832010a78.js 11 KiB 3 [emitted]
d4b551c6319035df2898.js 1.02 KiB 0 [emitted]
d4b551c6319035df2898.js 1.07 KiB 0 [emitted]
Entrypoint main = 138d0972019f89a65bcf.js 0f93dbc57653279c9b6c.js 4f3a8970f29832010a78.js
chunk {0} d4b551c6319035df2898.js 916 bytes <{1}> <{2}> <{3}>
> ./g [4] ./index.js 7:0-13
@ -62,17 +62,17 @@ Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
01a8254701931adbf278.js 1020 bytes 9 [emitted]
01a8f6900f403d5703b2.js 1.92 KiB 3, 4 [emitted]
138d0972019f89a65bcf.js 1.92 KiB 1 [emitted]
2736cf9d79233cd0a9b6.js 1.92 KiB 0 [emitted]
58f368c01f66002b0eb3.js 1.93 KiB 6, 7 [emitted]
5bc7f208cd99a83b4e33.js 1.92 KiB 8 [emitted]
6a8e74d82c35e3f013d2.js 1020 bytes 7 [emitted]
7f83e5c2f4e52435dd2c.js 1.95 KiB 2 [emitted]
ba9fedb7aa0c69201639.js 1.92 KiB 11 [emitted]
c99c160aba2d9a94e5d1.js 1.92 KiB 5 [emitted]
ebd7809b258eb7949b19.js 9.67 KiB 10 [emitted] main
f0ef1f91cb22147f3f2c.js 1020 bytes 4 [emitted]
01a8f6900f403d5703b2.js 1.91 KiB 3, 4 [emitted]
138d0972019f89a65bcf.js 1.91 KiB 1 [emitted]
2736cf9d79233cd0a9b6.js 1.91 KiB 0 [emitted]
58f368c01f66002b0eb3.js 1.91 KiB 6, 7 [emitted]
5bc7f208cd99a83b4e33.js 1.91 KiB 8 [emitted]
6a8e74d82c35e3f013d2.js 1010 bytes 7 [emitted]
7f83e5c2f4e52435dd2c.js 1.93 KiB 2 [emitted]
ba9fedb7aa0c69201639.js 1.91 KiB 11 [emitted]
c99c160aba2d9a94e5d1.js 1.91 KiB 5 [emitted]
ebd7809b258eb7949b19.js 9.71 KiB 10 [emitted] main
f0ef1f91cb22147f3f2c.js 1010 bytes 4 [emitted]
Entrypoint main = ebd7809b258eb7949b19.js
chunk {0} 2736cf9d79233cd0a9b6.js 1.76 KiB <{10}> ={2}= ={3}= ={4}= ={5}= ={7}= [recorded] aggressive splitted
> ./b ./d ./e ./f ./g [11] ./index.js 5:0-44
@ -463,8 +463,8 @@ exports[`StatsTestCases should print correct stats for chunk-module-id-range 1`]
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
main1.js 4.65 KiB 1 [emitted] main1
main2.js 4.64 KiB 0 [emitted] main2
main1.js 4.9 KiB 1 [emitted] main1
main2.js 4.89 KiB 0 [emitted] main2
Entrypoint main1 = main1.js
Entrypoint main2 = main2.js
chunk {0} main2.js (main2) 136 bytes [entry] [rendered]
@ -484,14 +484,14 @@ chunk {1} main1.js (main1) 136 bytes [entry] [rendered]
`;
exports[`StatsTestCases should print correct stats for chunks 1`] = `
"Hash: 7e9169c0d292752d420d
"Hash: 1f5b72e70e9c3446bd1e
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
1.bundle.js 143 bytes 1 [emitted]
2.bundle.js 259 bytes 2 [emitted]
2.bundle.js 305 bytes 2 [emitted]
3.bundle.js 214 bytes 3 [emitted]
bundle.js 8.24 KiB 0 [emitted] main
bundle.js 8.29 KiB 0 [emitted] main
Entrypoint main = bundle.js
chunk {0} bundle.js (main) 73 bytes >{1}< >{2}< [entry] [rendered]
> ./index main
@ -522,14 +522,14 @@ chunk {3} 3.bundle.js 44 bytes <{2}> [rendered]
`;
exports[`StatsTestCases should print correct stats for chunks-development 1`] = `
"Hash: ec5082ccf21fad8b711b
"Hash: e6c2589ef030fd318f80
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
0.bundle.js 549 bytes 0 [emitted]
b.bundle.js 290 bytes b [emitted]
bundle.js 8.63 KiB main [emitted] main
c.bundle.js 405 bytes c [emitted]
0.bundle.js 680 bytes 0 [emitted]
b.bundle.js 326 bytes b [emitted]
bundle.js 8.81 KiB main [emitted] main
c.bundle.js 523 bytes c [emitted]
Entrypoint main = bundle.js
chunk {0} 0.bundle.js 60 bytes <{c}> [rendered]
> [./c.js] ./c.js 1:0-52
@ -577,7 +577,7 @@ exports[`StatsTestCases should print correct stats for color-disabled 1`] = `
Time: Xms
Built at: Thu Jan 01 1970 <CLR=BOLD>00:00:00</CLR> GMT
Asset Size Chunks Chunk Names
main.js 3.57 KiB 0 [emitted] main
main.js 3.56 KiB 0 [emitted] main
Entrypoint main = main.js
[0] ./index.js 0 bytes {0} [built]"
`;
@ -587,7 +587,7 @@ exports[`StatsTestCases should print correct stats for color-enabled 1`] = `
Time: <CLR=BOLD>X</CLR>ms
Built at: Thu Jan 01 1970 <CLR=BOLD>00:00:00</CLR> GMT
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22><CLR=BOLD>Chunk Names</CLR>
<CLR=32,BOLD>main.js</CLR> 3.57 KiB <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR> main
<CLR=32,BOLD>main.js</CLR> 3.56 KiB <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR> main
Entrypoint <CLR=BOLD>main</CLR> = <CLR=32,BOLD>main.js</CLR>
[0] <CLR=BOLD>./index.js</CLR> 0 bytes {<CLR=33,BOLD>0</CLR>}<CLR=32,BOLD> [built]</CLR>"
`;
@ -597,17 +597,17 @@ exports[`StatsTestCases should print correct stats for color-enabled-custom 1`]
Time: <CLR=BOLD>X</CLR>ms
Built at: Thu Jan 01 1970 <CLR=BOLD>00:00:00</CLR> GMT
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22><CLR=BOLD>Chunk Names</CLR>
<CLR=32>main.js</CLR> 3.57 KiB <CLR=BOLD>0</CLR> <CLR=32>[emitted]</CLR> main
<CLR=32>main.js</CLR> 3.56 KiB <CLR=BOLD>0</CLR> <CLR=32>[emitted]</CLR> main
Entrypoint <CLR=BOLD>main</CLR> = <CLR=32>main.js</CLR>
[0] <CLR=BOLD>./index.js</CLR> 0 bytes {<CLR=33>0</CLR>}<CLR=32> [built]</CLR>"
`;
exports[`StatsTestCases should print correct stats for commons-chunk-min-size-0 1`] = `
"Hash: 909e4c9a262cbe4d7310
"Hash: d46c2719a9dfddae2825
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
entry-1.js 6.54 KiB 0 [emitted] entry-1
entry-1.js 6.59 KiB 0 [emitted] entry-1
vendor-1~entry-1.js 287 bytes 1 [emitted] vendor-1~entry-1
Entrypoint entry-1 = vendor-1~entry-1.js entry-1.js
[0] ./entry-1.js 145 bytes {0} [built]
@ -620,11 +620,11 @@ Entrypoint entry-1 = vendor-1~entry-1.js entry-1.js
`;
exports[`StatsTestCases should print correct stats for commons-chunk-min-size-Infinity 1`] = `
"Hash: 809e6039b017b13ffe7f
"Hash: ae576a8d09046587d7bb
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
entry-1.js 6.54 KiB 0 [emitted] entry-1
entry-1.js 6.59 KiB 0 [emitted] entry-1
vendor-1.js 287 bytes 1 [emitted] vendor-1
Entrypoint entry-1 = vendor-1.js entry-1.js
[0] ./entry-1.js 145 bytes {0} [built]
@ -643,8 +643,8 @@ Child
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
app.js 6.65 KiB 1 [emitted] app
vendor.js 577 bytes 0 [emitted] vendor
app.js 6.7 KiB 1 [emitted] app
vendor.js 627 bytes 0 [emitted] vendor
Entrypoint app = vendor.js app.js
[./constants.js] 87 bytes {0} [built]
[./entry-1.js] ./entry-1.js + 2 modules 190 bytes {1} [built]
@ -656,8 +656,8 @@ Child
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
app.js 6.66 KiB 1 [emitted] app
vendor.js 577 bytes 0 [emitted] vendor
app.js 6.71 KiB 1 [emitted] app
vendor.js 627 bytes 0 [emitted] vendor
Entrypoint app = vendor.js app.js
[./constants.js] 87 bytes {0} [built]
[./entry-2.js] ./entry-2.js + 2 modules 197 bytes {1} [built]
@ -684,9 +684,9 @@ exports[`StatsTestCases should print correct stats for concat-and-sideeffects 1`
`;
exports[`StatsTestCases should print correct stats for define-plugin 1`] = `
"Hash: a832a1afec1afe690454f4d178b864cbd8d3f77b9c09dee18146dbdfffec
"Hash: 1cabdaf8418387a3997d034461b3ed7d94511dacae9db129fc6bec09a97e
Child
Hash: a832a1afec1afe690454
Hash: 1cabdaf8418387a3997d
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
@ -694,7 +694,7 @@ Child
Entrypoint main = main.js
[0] ./index.js 24 bytes {0} [built]
Child
Hash: f4d178b864cbd8d3f77b
Hash: 034461b3ed7d94511dac
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
@ -702,7 +702,7 @@ Child
Entrypoint main = main.js
[0] ./index.js 24 bytes {0} [built]
Child
Hash: 9c09dee18146dbdfffec
Hash: ae9db129fc6bec09a97e
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
@ -735,11 +735,11 @@ Unexpected end of JSON input while parsing near ''"
`;
exports[`StatsTestCases should print correct stats for exclude-with-loader 1`] = `
"Hash: 678de6ada6423fea43da
"Hash: 0f30488345ac3f69796b
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 3.94 KiB 0 [emitted] main
bundle.js 4.02 KiB 0 [emitted] main
+ 1 hidden asset
Entrypoint main = bundle.js
[0] ./index.js 77 bytes {0} [built]
@ -752,20 +752,20 @@ exports[`StatsTestCases should print correct stats for external 1`] = `
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
main.js 3.67 KiB 0 [emitted] main
main.js 3.71 KiB 0 [emitted] main
Entrypoint main = main.js
[0] ./index.js 17 bytes {0} [built]
[1] external \\"test\\" 42 bytes {0} [built]"
`;
exports[`StatsTestCases should print correct stats for filter-warnings 1`] = `
"Hash: 70b5eb88941464457a7d70b5eb88941464457a7d70b5eb88941464457a7d70b5eb88941464457a7d70b5eb88941464457a7d70b5eb88941464457a7d70b5eb88941464457a7d70b5eb88941464457a7d70b5eb88941464457a7d70b5eb88941464457a7d70b5eb88941464457a7d70b5eb88941464457a7d70b5eb88941464457a7d
"Hash: e209ebf494c676aaca15e209ebf494c676aaca15e209ebf494c676aaca15e209ebf494c676aaca15e209ebf494c676aaca15e209ebf494c676aaca15e209ebf494c676aaca15e209ebf494c676aaca15e209ebf494c676aaca15e209ebf494c676aaca15e209ebf494c676aaca15e209ebf494c676aaca15e209ebf494c676aaca15
Child undefined:
Hash: 70b5eb88941464457a7d
Hash: e209ebf494c676aaca15
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0]
@ -790,53 +790,53 @@ Child undefined:
WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0]
Child Terser:
Hash: 70b5eb88941464457a7d
Hash: e209ebf494c676aaca15
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
Child /Terser/:
Hash: 70b5eb88941464457a7d
Hash: e209ebf494c676aaca15
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
Child warnings => true:
Hash: 70b5eb88941464457a7d
Hash: e209ebf494c676aaca15
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
Child [Terser]:
Hash: 70b5eb88941464457a7d
Hash: e209ebf494c676aaca15
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
Child [/Terser/]:
Hash: 70b5eb88941464457a7d
Hash: e209ebf494c676aaca15
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
Child [warnings => true]:
Hash: 70b5eb88941464457a7d
Hash: e209ebf494c676aaca15
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
Child should not filter:
Hash: 70b5eb88941464457a7d
Hash: e209ebf494c676aaca15
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0]
@ -861,11 +861,11 @@ Child should not filter:
WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0]
Child /should not filter/:
Hash: 70b5eb88941464457a7d
Hash: e209ebf494c676aaca15
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0]
@ -890,11 +890,11 @@ Child /should not filter/:
WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0]
Child warnings => false:
Hash: 70b5eb88941464457a7d
Hash: e209ebf494c676aaca15
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0]
@ -919,11 +919,11 @@ Child warnings => false:
WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0]
Child [should not filter]:
Hash: 70b5eb88941464457a7d
Hash: e209ebf494c676aaca15
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0]
@ -948,11 +948,11 @@ Child [should not filter]:
WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0]
Child [/should not filter/]:
Hash: 70b5eb88941464457a7d
Hash: e209ebf494c676aaca15
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0]
@ -977,11 +977,11 @@ Child [/should not filter/]:
WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0]
Child [warnings => false]:
Hash: 70b5eb88941464457a7d
Hash: e209ebf494c676aaca15
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0]
@ -1067,10 +1067,10 @@ exports[`StatsTestCases should print correct stats for import-context-filter 1`]
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
1.js 266 bytes 1 [emitted]
2.js 266 bytes 2 [emitted]
3.js 266 bytes 3 [emitted]
entry.js 9 KiB 0 [emitted] entry
1.js 316 bytes 1 [emitted]
2.js 316 bytes 2 [emitted]
3.js 316 bytes 3 [emitted]
entry.js 9.08 KiB 0 [emitted] entry
Entrypoint entry = entry.js
[0] ./entry.js 450 bytes {0} [built]
[1] ./templates lazy ^\\\\.\\\\/.*$ include: \\\\.js$ exclude: \\\\.noimport\\\\.js$ namespace object 160 bytes {0} [optional] [built]
@ -1080,12 +1080,12 @@ Entrypoint entry = entry.js
`;
exports[`StatsTestCases should print correct stats for import-weak 1`] = `
"Hash: d0b2fa8b534a1b76d092
"Hash: dd2829d614ecea0a7399
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
1.js 149 bytes 1 [emitted]
entry.js 8.43 KiB 0 [emitted] entry
entry.js 8.47 KiB 0 [emitted] entry
Entrypoint entry = entry.js
[0] ./entry.js 120 bytes {0} [built]
[1] ./modules/b.js 22 bytes {1} [built]
@ -1121,7 +1121,7 @@ Child
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
a-all~main-0034bb84916bcade4cc7.js 145 bytes all~main [emitted] all~main
a-all~main-0034bb84916bcade4cc7.js 139 bytes all~main [emitted] all~main
a-main-9407860001b0bf9acb00.js 108 bytes main [emitted] main
a-runtime~main-3965b14e62ab18a5b93e.js 6.05 KiB runtime~main [emitted] runtime~main
Entrypoint main = a-runtime~main-3965b14e62ab18a5b93e.js a-all~main-0034bb84916bcade4cc7.js a-main-9407860001b0bf9acb00.js
@ -1131,10 +1131,10 @@ Child
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
b-all~main-8fc824ada14cfa87179b.js 417 bytes all~main [emitted] all~main
b-all~main-8fc824ada14cfa87179b.js 467 bytes all~main [emitted] all~main
b-main-9b8bde6297868240e02c.js 123 bytes main [emitted] main
b-runtime~main-3965b14e62ab18a5b93e.js 6.05 KiB runtime~main [emitted] runtime~main
b-vendors~main-13c0fc262f08dee65613.js 163 bytes vendors~main [emitted] vendors~main
b-vendors~main-13c0fc262f08dee65613.js 157 bytes vendors~main [emitted] vendors~main
Entrypoint main = b-runtime~main-3965b14e62ab18a5b93e.js b-vendors~main-13c0fc262f08dee65613.js b-all~main-8fc824ada14cfa87179b.js b-main-9b8bde6297868240e02c.js
[0] ./b.js 17 bytes {all~main} [built]
[1] ./node_modules/vendor.js 23 bytes {vendors~main} [built]
@ -1143,9 +1143,9 @@ Child
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
c-all~main-3f17001edc510ffa13b4.js 272 bytes all~main [emitted] all~main
c-b0-08b1c51075eefabb49b0.js 420 bytes b0 [emitted]
c-b1-b4adffe55c7947bb635f.js 147 bytes b1 [emitted]
c-all~main-3f17001edc510ffa13b4.js 318 bytes all~main [emitted] all~main
c-b0-08b1c51075eefabb49b0.js 470 bytes b0 [emitted]
c-b1-b4adffe55c7947bb635f.js 141 bytes b1 [emitted]
c-main-d86aa80e7330f9a4e0c2.js 120 bytes main [emitted] main
c-runtime~main-aee5be026dc40ed615b1.js 8.84 KiB runtime~main [emitted] runtime~main
Entrypoint main = c-runtime~main-aee5be026dc40ed615b1.js c-all~main-3f17001edc510ffa13b4.js c-main-d86aa80e7330f9a4e0c2.js (prefetch: c-b1-b4adffe55c7947bb635f.js c-b0-08b1c51075eefabb49b0.js)
@ -1155,13 +1155,13 @@ Child
`;
exports[`StatsTestCases should print correct stats for limit-chunk-count-plugin 1`] = `
"Hash: a25acced7f3c09454b1841186629d7e58ef80e368b91914e07e28dd7218e7feaf0ceedae853c7093
"Hash: 9051f6e453f3b194508e7d8ad753c0d39b301c6d148d7c4fc3c8bef23f6f5e3351db3d1f8af66181
Child 1 chunks:
Hash: a25acced7f3c09454b18
Hash: 9051f6e453f3b194508e
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 6.58 KiB 0 [emitted] main
bundle.js 6.62 KiB 0 [emitted] main
Entrypoint main = bundle.js
chunk {0} bundle.js (main) 219 bytes <{0}> >{0}< [entry] [rendered]
[0] ./index.js 101 bytes {0} [built]
@ -1171,12 +1171,12 @@ Child 1 chunks:
[4] ./d.js 22 bytes {0} [built]
[5] ./e.js 22 bytes {0} [built]
Child 2 chunks:
Hash: 41186629d7e58ef80e36
Hash: 7d8ad753c0d39b301c6d
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
1.bundle.js 575 bytes 1 [emitted] c
bundle.js 8.25 KiB 0 [emitted] main
1.bundle.js 621 bytes 1 [emitted] c
bundle.js 8.3 KiB 0 [emitted] main
Entrypoint main = bundle.js
chunk {0} bundle.js (main) 101 bytes >{1}< [entry] [rendered]
[0] ./index.js 101 bytes {0} [built]
@ -1187,13 +1187,13 @@ Child 2 chunks:
[4] ./d.js 22 bytes {1} [built]
[5] ./e.js 22 bytes {1} [built]
Child 3 chunks:
Hash: 8b91914e07e28dd7218e
Hash: 148d7c4fc3c8bef23f6f
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
1.bundle.js 437 bytes 1 [emitted] c
1.bundle.js 483 bytes 1 [emitted] c
2.bundle.js 214 bytes 2 [emitted]
bundle.js 8.25 KiB 0 [emitted] main
bundle.js 8.3 KiB 0 [emitted] main
Entrypoint main = bundle.js
chunk {0} bundle.js (main) 101 bytes >{1}< [entry] [rendered]
[0] ./index.js 101 bytes {0} [built]
@ -1205,14 +1205,14 @@ Child 3 chunks:
[4] ./d.js 22 bytes {2} [built]
[5] ./e.js 22 bytes {2} [built]
Child 4 chunks:
Hash: 7feaf0ceedae853c7093
Hash: 5e3351db3d1f8af66181
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
1.bundle.js 218 bytes 1 [emitted]
2.bundle.js 293 bytes 2 [emitted] c
2.bundle.js 339 bytes 2 [emitted] c
3.bundle.js 214 bytes 3 [emitted]
bundle.js 8.25 KiB 0 [emitted] main
bundle.js 8.3 KiB 0 [emitted] main
Entrypoint main = bundle.js
chunk {0} bundle.js (main) 101 bytes >{1}< >{2}< [entry] [rendered]
[0] ./index.js 101 bytes {0} [built]
@ -1231,7 +1231,7 @@ exports[`StatsTestCases should print correct stats for max-modules 1`] = `
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
main.js 5.91 KiB 0 [emitted] main
main.js 7.3 KiB 0 [emitted] main
Entrypoint main = main.js
[0] ./index.js 181 bytes {0} [built]
[1] ./a.js?1 33 bytes {0} [built]
@ -1261,7 +1261,7 @@ exports[`StatsTestCases should print correct stats for max-modules-default 1`] =
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
main.js 5.91 KiB 0 [emitted] main
main.js 7.3 KiB 0 [emitted] main
Entrypoint main = main.js
[0] ./index.js 181 bytes {0} [built]
[1] ./a.js?1 33 bytes {0} [built]
@ -1282,7 +1282,7 @@ Entrypoint main = main.js
`;
exports[`StatsTestCases should print correct stats for module-assets 1`] = `
"Hash: 6ef7e8c9a66af04209d9
"Hash: 4e1223fd04544bb8aa8b
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Entrypoint main = main.js
@ -1298,15 +1298,15 @@ chunk {1} 1.js 68 bytes <{0}> [rendered]
exports[`StatsTestCases should print correct stats for module-deduplication 1`] = `
"Asset Size Chunks Chunk Names
3.js 680 bytes 3, 6 [emitted]
4.js 680 bytes 4, 7 [emitted]
5.js 682 bytes 5, 8 [emitted]
6.js 620 bytes 6 [emitted]
7.js 620 bytes 7 [emitted]
8.js 621 bytes 8 [emitted]
e1.js 9.3 KiB 0 [emitted] e1
e2.js 9.33 KiB 1 [emitted] e2
e3.js 9.36 KiB 2 [emitted] e3
3.js 724 bytes 3, 6 [emitted]
4.js 724 bytes 4, 7 [emitted]
5.js 726 bytes 5, 8 [emitted]
6.js 670 bytes 6 [emitted]
7.js 670 bytes 7 [emitted]
8.js 671 bytes 8 [emitted]
e1.js 9.33 KiB 0 [emitted] e1
e2.js 9.36 KiB 1 [emitted] e2
e3.js 9.38 KiB 2 [emitted] e3
Entrypoint e1 = e1.js
Entrypoint e2 = e2.js
Entrypoint e3 = e3.js
@ -1347,12 +1347,12 @@ chunk {8} 8.js 28 bytes <{2}> [rendered]
exports[`StatsTestCases should print correct stats for module-deduplication-named 1`] = `
" Asset Size Chunks Chunk Names
async1.js 769 bytes 3 [emitted] async1
async2.js 769 bytes 4 [emitted] async2
async3.js 771 bytes 5 [emitted] async3
e1.js 9.19 KiB 0 [emitted] e1
e2.js 9.22 KiB 1 [emitted] e2
e3.js 9.25 KiB 2 [emitted] e3
async1.js 813 bytes 3 [emitted] async1
async2.js 813 bytes 4 [emitted] async2
async3.js 815 bytes 5 [emitted] async3
e1.js 9.22 KiB 0 [emitted] e1
e2.js 9.24 KiB 1 [emitted] e2
e3.js 9.27 KiB 2 [emitted] e3
Entrypoint e1 = e1.js
Entrypoint e2 = e2.js
Entrypoint e3 = e3.js
@ -1389,7 +1389,7 @@ exports[`StatsTestCases should print correct stats for module-trace-disabled-in-
"Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
main.js 4.09 KiB 0 main
main.js 4.22 KiB 0 main
Entrypoint main = main.js
[0] ./index.js 19 bytes {0} [built]
[1] ./inner.js 53 bytes {0} [built]
@ -1413,7 +1413,7 @@ exports[`StatsTestCases should print correct stats for module-trace-enabled-in-e
"Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
main.js 4.09 KiB 0 main
main.js 4.22 KiB 0 main
Entrypoint main = main.js
[0] ./index.js 19 bytes {0} [built]
[1] ./inner.js 53 bytes {0} [built]
@ -1491,11 +1491,11 @@ Child
`;
exports[`StatsTestCases should print correct stats for named-chunks-plugin 1`] = `
"Hash: ff2c7f78a6150020d64f
"Hash: e63ce7afba6e5dfcaa4b
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
entry.js 6.41 KiB entry [emitted] entry
entry.js 6.45 KiB entry [emitted] entry
vendor.js 251 bytes vendor [emitted] vendor
Entrypoint entry = vendor.js entry.js
[./entry.js] 72 bytes {entry} [built]
@ -1505,13 +1505,13 @@ Entrypoint entry = vendor.js entry.js
`;
exports[`StatsTestCases should print correct stats for named-chunks-plugin-async 1`] = `
"Hash: 44978a8e319fa3aa36fc
"Hash: 6344a30d7877bfe2e817
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
chunk-containing-__a_js.js 283 bytes chunk-containing-__a_js [emitted]
chunk-containing-__a_js.js 321 bytes chunk-containing-__a_js [emitted]
chunk-containing-__b_js.js 167 bytes chunk-containing-__b_js [emitted]
entry.js 8.15 KiB entry [emitted] entry
entry.js 8.2 KiB entry [emitted] entry
Entrypoint entry = entry.js
[0] ./entry.js 47 bytes {entry} [built]
[1] ./modules/a.js 37 bytes {chunk-containing-__a_js} [built]
@ -1545,14 +1545,14 @@ exports[`StatsTestCases should print correct stats for optimize-chunks 1`] = `
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
ab.js 183 bytes 1 [emitted] ab
abd.js 232 bytes 2, 1 [emitted] abd
ac in ab.js 121 bytes 7 [emitted] ac in ab
chunk.js 172 bytes 3, 7 [emitted] chunk
cir1.js 269 bytes 4 [emitted] cir1
cir2 from cir1.js 320 bytes 6, 5 [emitted] cir2 from cir1
cir2.js 269 bytes 5 [emitted] cir2
main.js 9.04 KiB 0 [emitted] main
ab.js 171 bytes 1 [emitted] ab
abd.js 214 bytes 2, 1 [emitted] abd
ac in ab.js 115 bytes 7 [emitted] ac in ab
chunk.js 160 bytes 3, 7 [emitted] chunk
cir1.js 315 bytes 4 [emitted] cir1
cir2 from cir1.js 360 bytes 6, 5 [emitted] cir2 from cir1
cir2.js 315 bytes 5 [emitted] cir2
main.js 9.08 KiB 0 [emitted] main
Entrypoint main = main.js
chunk {0} main.js (main) 523 bytes >{1}< >{2}< >{4}< >{5}< [entry] [rendered]
> ./index main
@ -1590,7 +1590,7 @@ chunk {7} ac in ab.js (ac in ab) 0 bytes <{1}> >{3}< [rendered]
exports[`StatsTestCases should print correct stats for parse-error 1`] = `
" Asset Size Chunks Chunk Names
main.js 3.96 KiB 0 main
main.js 4 KiB 0 main
Entrypoint main = main.js
[0] ./index.js + 1 modules 35 bytes {0} [built]
| ./a.js 15 bytes [built]
@ -1610,9 +1610,9 @@ You may need an appropriate loader to handle this file type.
`;
exports[`StatsTestCases should print correct stats for performance-different-mode-and-target 1`] = `
"Hash: 14c687fa94e5597c25efbddc960367fc5c3136a64114eba737a6f1aade86c2f01aa8141bc3a117844617dac22b3202732c60c2f01aa8141bc3a117844114eba737a6f1aade86
"Hash: 617575f8deb69af92727f8fccf6d727527ff30f8c5f33f5b799b081ace180f338ebe12266b2790add2ab50f21ef8694b8c4d0f338ebe12266b2790adc5f33f5b799b081ace18
Child
Hash: 14c687fa94e5597c25ef
Hash: 617575f8deb69af92727
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
@ -1635,7 +1635,7 @@ Child
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
Child
Hash: bddc960367fc5c3136a6
Hash: f8fccf6d727527ff30f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
@ -1658,7 +1658,7 @@ Child
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
Child
Hash: 4114eba737a6f1aade86
Hash: c5f33f5b799b081ace18
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
@ -1666,7 +1666,7 @@ Child
Entrypoint main = no-warning.pro-node.js
[0] ./index.js 293 KiB {0} [built]
Child
Hash: c2f01aa8141bc3a11784
Hash: 0f338ebe12266b2790ad
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
@ -1674,7 +1674,7 @@ Child
Entrypoint main = no-warning.dev-web.js
[./index.js] 293 KiB {main} [built]
Child
Hash: 4617dac22b3202732c60
Hash: d2ab50f21ef8694b8c4d
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
@ -1682,7 +1682,7 @@ Child
Entrypoint main = no-warning.dev-node.js
[./index.js] 293 KiB {main} [built]
Child
Hash: c2f01aa8141bc3a11784
Hash: 0f338ebe12266b2790ad
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
@ -1690,7 +1690,7 @@ Child
Entrypoint main [big] = no-warning.dev-web-with-limit-set.js
[./index.js] 293 KiB {main} [built]
Child
Hash: 4114eba737a6f1aade86
Hash: c5f33f5b799b081ace18
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
@ -1719,7 +1719,7 @@ exports[`StatsTestCases should print correct stats for performance-disabled 1`]
Built at: Thu Jan 01 1970 <CLR=BOLD>00:00:00</CLR> GMT
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22><CLR=BOLD>Chunk Names</CLR>
<CLR=32,BOLD>1.js</CLR> 143 bytes <CLR=BOLD>1</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>2.js</CLR> 259 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>2.js</CLR> 305 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>3.js</CLR> 214 bytes <CLR=BOLD>3</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>main.js</CLR> 301 KiB <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR> main
Entrypoint <CLR=BOLD>main</CLR> = <CLR=32,BOLD>main.js</CLR>
@ -1736,7 +1736,7 @@ exports[`StatsTestCases should print correct stats for performance-error 1`] = `
Built at: Thu Jan 01 1970 <CLR=BOLD>00:00:00</CLR> GMT
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22> <CLR=BOLD>Chunk Names</CLR>
<CLR=32,BOLD>1.js</CLR> 143 bytes <CLR=BOLD>1</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>2.js</CLR> 259 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>2.js</CLR> 305 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>3.js</CLR> 214 bytes <CLR=BOLD>3</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=33,BOLD>main.js</CLR> <CLR=33,BOLD>301 KiB</CLR> <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR> <CLR=33,BOLD>[big]</CLR> main
Entrypoint <CLR=BOLD>main</CLR> <CLR=33,BOLD>[big]</CLR> = <CLR=32,BOLD>main.js</CLR>
@ -1764,7 +1764,7 @@ exports[`StatsTestCases should print correct stats for performance-no-async-chun
Built at: Thu Jan 01 1970 <CLR=BOLD>00:00:00</CLR> GMT
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22> <CLR=BOLD>Chunk Names</CLR>
<CLR=33,BOLD>main.js</CLR> <CLR=33,BOLD>297 KiB</CLR> <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR> <CLR=33,BOLD>[big]</CLR> main
<CLR=32,BOLD>sec.js</CLR> 3.86 KiB <CLR=BOLD>1</CLR> <CLR=32,BOLD>[emitted]</CLR> sec
<CLR=32,BOLD>sec.js</CLR> 3.9 KiB <CLR=BOLD>1</CLR> <CLR=32,BOLD>[emitted]</CLR> sec
Entrypoint <CLR=BOLD>main</CLR> <CLR=33,BOLD>[big]</CLR> = <CLR=32,BOLD>main.js</CLR>
Entrypoint <CLR=BOLD>sec</CLR> = <CLR=32,BOLD>sec.js</CLR>
[0] <CLR=BOLD>./index.js</CLR> 32 bytes {<CLR=33,BOLD>0</CLR>}<CLR=32,BOLD> [built]</CLR>
@ -1795,7 +1795,7 @@ exports[`StatsTestCases should print correct stats for performance-no-hints 1`]
Built at: Thu Jan 01 1970 <CLR=BOLD>00:00:00</CLR> GMT
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22> <CLR=BOLD>Chunk Names</CLR>
<CLR=32,BOLD>1.js</CLR> 143 bytes <CLR=BOLD>1</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>2.js</CLR> 259 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>2.js</CLR> 305 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>3.js</CLR> 214 bytes <CLR=BOLD>3</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=33,BOLD>main.js</CLR> <CLR=33,BOLD>301 KiB</CLR> <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR> <CLR=33,BOLD>[big]</CLR> main
Entrypoint <CLR=BOLD>main</CLR> <CLR=33,BOLD>[big]</CLR> = <CLR=32,BOLD>main.js</CLR>
@ -1840,13 +1840,13 @@ For more info visit https://webpack.js.org/guides/code-splitting/</CLR>"
exports[`StatsTestCases should print correct stats for prefetch 1`] = `
" Asset Size Chunks Chunk Names
inner.js 121 bytes 5 [emitted] inner
inner2.js 170 bytes 6 [emitted] inner2
main.js 9.58 KiB 0 [emitted] main
normal.js 121 bytes 2 [emitted] normal
prefetched.js 445 bytes 1 [emitted] prefetched
prefetched2.js 121 bytes 3 [emitted] prefetched2
prefetched3.js 121 bytes 4 [emitted] prefetched3
inner.js 115 bytes 5 [emitted] inner
inner2.js 158 bytes 6 [emitted] inner2
main.js 9.68 KiB 0 [emitted] main
normal.js 115 bytes 2 [emitted] normal
prefetched.js 491 bytes 1 [emitted] prefetched
prefetched2.js 115 bytes 3 [emitted] prefetched2
prefetched3.js 115 bytes 4 [emitted] prefetched3
Entrypoint main = main.js (prefetch: prefetched2.js prefetched.js prefetched3.js)
chunk {0} main.js (main) 436 bytes >{1}< >{2}< >{3}< >{4}< (prefetch: {3} {1} {4}) [entry] [rendered]
chunk {1} prefetched.js (prefetched) 228 bytes <{0}> >{5}< >{6}< (prefetch: {6} {5}) [rendered]
@ -1873,13 +1873,13 @@ chunk {10} c2.js (c2) 0 bytes <{3}> [rendered]"
exports[`StatsTestCases should print correct stats for preload 1`] = `
" Asset Size Chunks Chunk Names
inner.js 121 bytes 5 [emitted] inner
inner2.js 170 bytes 6 [emitted] inner2
main.js 9.79 KiB 0 [emitted] main
normal.js 121 bytes 2 [emitted] normal
preloaded.js 437 bytes 1 [emitted] preloaded
preloaded2.js 121 bytes 3 [emitted] preloaded2
preloaded3.js 121 bytes 4 [emitted] preloaded3
inner.js 115 bytes 5 [emitted] inner
inner2.js 158 bytes 6 [emitted] inner2
main.js 9.88 KiB 0 [emitted] main
normal.js 115 bytes 2 [emitted] normal
preloaded.js 483 bytes 1 [emitted] preloaded
preloaded2.js 115 bytes 3 [emitted] preloaded2
preloaded3.js 115 bytes 4 [emitted] preloaded3
Entrypoint main = main.js (preload: preloaded2.js preloaded.js preloaded3.js)
chunk {0} main.js (main) 424 bytes >{1}< >{2}< >{3}< >{4}< (preload: {3} {1} {4}) [entry] [rendered]
chunk {1} preloaded.js (preloaded) 226 bytes <{0}> >{5}< >{6}< (preload: {6} {5}) [rendered]
@ -1891,14 +1891,14 @@ chunk {6} inner2.js (inner2) 0 bytes <{1}> [rendered]"
`;
exports[`StatsTestCases should print correct stats for preset-detailed 1`] = `
"Hash: aa8e18628ab2e088bd92
"Hash: 5e2793c5d2c916748f58
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
1.js 143 bytes 1 [emitted]
2.js 259 bytes 2 [emitted]
2.js 305 bytes 2 [emitted]
3.js 214 bytes 3 [emitted]
main.js 8.25 KiB 0 [emitted] main
main.js 8.3 KiB 0 [emitted] main
Entrypoint main = main.js
chunk {0} main.js (main) 73 bytes >{1}< >{2}< [entry] [rendered]
> ./index main
@ -1949,14 +1949,14 @@ exports[`StatsTestCases should print correct stats for preset-none-array 1`] = `
exports[`StatsTestCases should print correct stats for preset-none-error 1`] = `""`;
exports[`StatsTestCases should print correct stats for preset-normal 1`] = `
"Hash: aa8e18628ab2e088bd92
"Hash: 5e2793c5d2c916748f58
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
1.js 143 bytes 1 [emitted]
2.js 259 bytes 2 [emitted]
2.js 305 bytes 2 [emitted]
3.js 214 bytes 3 [emitted]
main.js 8.25 KiB 0 [emitted] main
main.js 8.3 KiB 0 [emitted] main
Entrypoint main = main.js
[0] ./index.js 51 bytes {0} [built]
[1] ./a.js 22 bytes {0} [built]
@ -1971,7 +1971,7 @@ exports[`StatsTestCases should print correct stats for preset-normal-performance
Built at: Thu Jan 01 1970 <CLR=BOLD>00:00:00</CLR> GMT
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22> <CLR=BOLD>Chunk Names</CLR>
<CLR=32,BOLD>1.js</CLR> 143 bytes <CLR=BOLD>1</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>2.js</CLR> 259 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>2.js</CLR> 305 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>3.js</CLR> 214 bytes <CLR=BOLD>3</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=33,BOLD>main.js</CLR> <CLR=33,BOLD>301 KiB</CLR> <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR> <CLR=33,BOLD>[big]</CLR> main
Entrypoint <CLR=BOLD>main</CLR> <CLR=33,BOLD>[big]</CLR> = <CLR=32,BOLD>main.js</CLR>
@ -1999,11 +1999,11 @@ exports[`StatsTestCases should print correct stats for preset-normal-performance
Built at: Thu Jan 01 1970 <CLR=BOLD>00:00:00</CLR> GMT
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=39,BOLD><CLR=22> <CLR=39,BOLD><CLR=22> <CLR=BOLD>Chunk Names</CLR>
<CLR=32,BOLD>1.js</CLR> 173 bytes <CLR=BOLD>1</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>1.js.map</CLR> 156 bytes <CLR=BOLD>1</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>2.js</CLR> 289 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>1.js.map</CLR> 161 bytes <CLR=BOLD>1</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>2.js</CLR> 335 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>2.js.map</CLR> 210 bytes <CLR=BOLD>2</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>3.js</CLR> 244 bytes <CLR=BOLD>3</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>3.js.map</CLR> 216 bytes <CLR=BOLD>3</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=32,BOLD>3.js.map</CLR> 226 bytes <CLR=BOLD>3</CLR> <CLR=32,BOLD>[emitted]</CLR>
<CLR=33,BOLD>main.js</CLR> <CLR=33,BOLD>301 KiB</CLR> <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR> <CLR=33,BOLD>[big]</CLR> main
<CLR=32,BOLD>main.js.map</CLR> 1.72 MiB <CLR=BOLD>0</CLR> <CLR=32,BOLD>[emitted]</CLR> main
Entrypoint <CLR=BOLD>main</CLR> <CLR=33,BOLD>[big]</CLR> = <CLR=32,BOLD>main.js</CLR> <CLR=32,BOLD>main.js.map</CLR>
@ -2027,14 +2027,14 @@ Entrypoints:
`;
exports[`StatsTestCases should print correct stats for preset-verbose 1`] = `
"Hash: aa8e18628ab2e088bd92
"Hash: 5e2793c5d2c916748f58
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
1.js 143 bytes 1 [emitted]
2.js 259 bytes 2 [emitted]
2.js 305 bytes 2 [emitted]
3.js 214 bytes 3 [emitted]
main.js 8.25 KiB 0 [emitted] main
main.js 8.3 KiB 0 [emitted] main
Entrypoint main = main.js
chunk {0} main.js (main) 73 bytes >{1}< >{2}< [entry] [rendered]
> ./index main
@ -2075,7 +2075,7 @@ exports[`StatsTestCases should print correct stats for resolve-plugin-context 1`
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 3.87 KiB 0 [emitted] main
bundle.js 3.99 KiB 0 [emitted] main
Entrypoint main = bundle.js
[0] ./index.js 48 bytes {0} [built]
[1] ./node_modules/abc/index.js 16 bytes {0} [built]
@ -2089,7 +2089,7 @@ exports[`StatsTestCases should print correct stats for reverse-sort-modules 1`]
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
main.js 5.91 KiB 0 [emitted] main
main.js 7.3 KiB 0 [emitted] main
Entrypoint main = main.js
[28] ./a.js?10 33 bytes {0} [built]
[26] ./c.js?9 33 bytes {0} [built]
@ -2122,8 +2122,8 @@ Entrypoint e2 = runtime~e2.js e2.js"
exports[`StatsTestCases should print correct stats for runtime-chunk-integration 1`] = `
"Child base:
Asset Size Chunks Chunk Names
2.js 602 bytes 2 [emitted]
main1.js 497 bytes 1 [emitted] main1
2.js 752 bytes 2 [emitted]
main1.js 547 bytes 1 [emitted] main1
runtime.js 8.75 KiB 0 [emitted] runtime
Entrypoint main1 = runtime.js main1.js
[0] ./main1.js 66 bytes {1} [built]
@ -2132,9 +2132,9 @@ exports[`StatsTestCases should print correct stats for runtime-chunk-integration
[3] ./d.js 20 bytes {2} [built]
Child manifest is named entry:
Asset Size Chunks Chunk Names
2.js 611 bytes 2 [emitted]
main1.js 497 bytes 0 [emitted] main1
manifest.js 9.02 KiB 1 [emitted] manifest
2.js 761 bytes 2 [emitted]
main1.js 547 bytes 0 [emitted] main1
manifest.js 9.07 KiB 1 [emitted] manifest
Entrypoint main1 = manifest.js main1.js
Entrypoint manifest = manifest.js
[0] ./main1.js 66 bytes {0} [built]
@ -2155,7 +2155,7 @@ Entrypoint e2 = runtime.js e2.js"
`;
exports[`StatsTestCases should print correct stats for scope-hoisting-bailouts 1`] = `
"Hash: ae29a383463c6e043d6e
"Hash: 65425c0a9ffac2cde5ef
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Entrypoint index = index.js
@ -2239,8 +2239,8 @@ exports[`StatsTestCases should print correct stats for side-effects-issue-7428 1
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
1.js 439 bytes 1 [emitted]
main.js 9.18 KiB 0 [emitted] main
1.js 489 bytes 1 [emitted]
main.js 9.33 KiB 0 [emitted] main
Entrypoint main = main.js
[0] ./main.js + 1 modules 231 bytes {0} [built]
harmony side effect evaluation ./CompB ./components/src/CompAB/index.js 2:0-43
@ -2287,7 +2287,7 @@ exports[`StatsTestCases should print correct stats for side-effects-simple-unuse
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
main.js 3.86 KiB 0 [emitted] main
main.js 3.91 KiB 0 [emitted] main
Entrypoint main = main.js
[0] ./index.js + 2 modules 158 bytes {0} [built]
harmony side effect evaluation ./c ./node_modules/pmodule/b.js 5:0-24
@ -2318,7 +2318,7 @@ exports[`StatsTestCases should print correct stats for simple 1`] = `
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 3.74 KiB main [emitted] main
bundle.js 3.76 KiB main [emitted] main
Entrypoint main = bundle.js
[./index.js] 0 bytes {main} [built]"
`;
@ -2328,7 +2328,7 @@ exports[`StatsTestCases should print correct stats for simple-more-info 1`] = `
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 3.57 KiB 0 [emitted] main
bundle.js 3.56 KiB 0 [emitted] main
Entrypoint main = bundle.js
[0] ./index.js 0 bytes {0} [built]
entry ./index main
@ -3193,7 +3193,7 @@ exports[`StatsTestCases should print correct stats for tree-shaking 1`] = `
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 7.84 KiB 0 [emitted] main
bundle.js 8.16 KiB 0 [emitted] main
Entrypoint main = bundle.js
[0] ./index.js 315 bytes {0} [built]
[no exports]
@ -3226,11 +3226,11 @@ Entrypoint main = bundle.js
`;
exports[`StatsTestCases should print correct stats for warnings-terser 1`] = `
"Hash: fa6b3521fcdefe0a2ec8
"Hash: 2857a82cfe9668429adb
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 2.78 KiB 0 [emitted] main
bundle.js 2.86 KiB 0 [emitted] main
Entrypoint main = bundle.js
[0] ./index.js 299 bytes {0} [built]
[1] ./a.js 249 bytes {0} [built]