Merge branch 'master' into enable-noImplicitThis

This commit is contained in:
Tobias Koppers 2018-07-11 08:43:26 +02:00 committed by GitHub
commit 569c415623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
110 changed files with 1593 additions and 918 deletions

View File

@ -60,7 +60,7 @@ module.exports = {
browser: true
},
globals: {
Promise: false,
Promise: false
},
parserOptions: {
ecmaVersion: 5
@ -70,6 +70,9 @@ module.exports = {
files: ["test/**/*.js"],
env: {
"jest/globals": true
},
globals: {
nsObj: false
}
}
]

View File

@ -27,7 +27,7 @@ yarn link webpack
yarn test
```
### To run only intergration tests use
### To run only integration tests use
```bash
yarn test:integration

1
declarations.d.ts vendored
View File

@ -7,7 +7,6 @@ declare namespace NodeJS {
}
}
declare module "neo-async" {
export interface Dictionary<T> {
[key: string]: T;

View File

@ -1,6 +1,6 @@
# Info
This example illustrates webpack's algorthim for automatic deduplication using `optimization.splitChunks`.
This example illustrates webpack's algorithm for automatic deduplication using `optimization.splitChunks`.
This example application contains 7 pages, each of them importing 1-3 modules from the `node_modules` folder (vendor libs) and 0-3 modules from the `stuff` folder (application modules). In reallity an application is probably more complex, but the same mechanisms apply.
@ -41,7 +41,7 @@ module.exports = {
chunks: "all",
maxInitialRequests: 20, // for HTTP2
maxAsyncRequests: 20, // for HTTP2
minSize: 40 // for example only: choosen to match 2 modules
minSize: 40 // for example only: chosen to match 2 modules
// omit minSize in real use case to use the default of 30kb
}
}

View File

@ -1,6 +1,6 @@
# Info
This example illustrates webpack's algorthim for automatic deduplication using `optimization.splitChunks`.
This example illustrates webpack's algorithm for automatic deduplication using `optimization.splitChunks`.
This example application contains 7 pages, each of them importing 1-3 modules from the `node_modules` folder (vendor libs) and 0-3 modules from the `stuff` folder (application modules). In reallity an application is probably more complex, but the same mechanisms apply.

View File

@ -14,7 +14,7 @@ module.exports = {
chunks: "all",
maxInitialRequests: 20, // for HTTP2
maxAsyncRequests: 20, // for HTTP2
minSize: 40 // for example only: choosen to match 2 modules
minSize: 40 // for example only: chosen to match 2 modules
// omit minSize in real use case to use the default of 30kb
}
}

View File

@ -40,10 +40,10 @@ if (module.hot) {
"warning",
"[HMR] Cannot apply update. Need to do a full reload!"
);
log("warning", "[HMR] " + err.stack || err.message);
log("warning", "[HMR] " + (err.stack || err.message));
window.location.reload();
} else {
log("warning", "[HMR] Update failed: " + err.stack || err.message);
log("warning", "[HMR] Update failed: " + (err.stack || err.message));
}
});
};

View File

@ -72,11 +72,11 @@ if (module.hot) {
"warning",
"[HMR] Cannot check for update. Need to do a full reload!"
);
log("warning", "[HMR] " + err.stack || err.message);
log("warning", "[HMR] " + (err.stack || err.message));
} else {
log(
"warning",
"[HMR] Update check failed: " + err.stack || err.message
"[HMR] Update check failed: " + (err.stack || err.message)
);
}
});

View File

@ -23,10 +23,13 @@ if (module.hot) {
var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) {
log("warning", "[HMR] Cannot apply update.");
log("warning", "[HMR] " + err.stack || err.message);
log("warning", "[HMR] " + (err.stack || err.message));
log("warning", "[HMR] You need to restart the application!");
} else {
log("warning", "[HMR] Update failed: " + err.stack || err.message);
log(
"warning",
"[HMR] Update failed: " + (err.stack || err.message)
);
}
});
}

View File

@ -37,10 +37,10 @@ if (module.hot) {
var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) {
log("warning", "[HMR] Cannot apply update.");
log("warning", "[HMR] " + err.stack || err.message);
log("warning", "[HMR] " + (err.stack || err.message));
log("warning", "[HMR] You need to restart the application!");
} else {
log("warning", "[HMR] Update failed: " + err.stack || err.message);
log("warning", "[HMR] Update failed: " + (err.stack || err.message));
}
});
};

View File

@ -8,7 +8,7 @@ const asyncLib = require("neo-async");
const PrefetchDependency = require("./dependencies/PrefetchDependency");
const NormalModule = require("./NormalModule");
/** @typedef {import("./Compiler.js")} Compiler */
/** @typedef {import("./Compiler")} Compiler */
class AutomaticPrefetchPlugin {
/**

View File

@ -13,10 +13,10 @@ const ERR_CHUNK_ENTRY = "Chunk.entry was removed. Use hasRuntime()";
const ERR_CHUNK_INITIAL =
"Chunk.initial was removed. Use canBeInitial/isOnlyInitial()";
/** @typedef {import("./Module.js")} Module */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./ChunkGroup")} ChunkGroup */
/** @typedef {import("./Entrypoint")} Entrypoint */
/** @typedef {import("./ModuleReason.js")} ModuleReason */
/** @typedef {import("./ModuleReason")} ModuleReason */
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("./util/createHash").Hash} Hash */
@ -633,7 +633,7 @@ class Chunk {
list.sort((a, b) => {
const cmp = b.order - a.order;
if (cmp !== 0) return cmp;
// TOOD webpack 5 remove this check of compareTo
// TODO webpack 5 remove this check of compareTo
if (a.group.compareTo) {
return a.group.compareTo(b.group);
}

View File

@ -442,7 +442,7 @@ class ChunkGroup {
list.sort((a, b) => {
const cmp = b.order - a.order;
if (cmp !== 0) return cmp;
// TOOD webpack 5 remove this check of compareTo
// TODO webpack 5 remove this check of compareTo
if (a.group.compareTo) {
return a.group.compareTo(b.group);
}

View File

@ -6,9 +6,9 @@
const WebpackError = require("./WebpackError");
/** @typedef {import("./Module.js")} Module */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./Dependency.js").DependencyLocation} DependencyLocation */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
class CommentCompilationWarning extends WebpackError {
/**

View File

@ -8,7 +8,7 @@ const ConstDependency = require("./dependencies/ConstDependency");
const NullFactory = require("./NullFactory");
/** @typedef {import("./Compiler.js")} Compiler */
/** @typedef {import("./Compiler")} Compiler */
class CompatibilityPlugin {
/**

View File

@ -26,7 +26,6 @@ const ChunkTemplate = require("./ChunkTemplate");
const HotUpdateChunkTemplate = require("./HotUpdateChunkTemplate");
const ModuleTemplate = require("./ModuleTemplate");
const RuntimeTemplate = require("./RuntimeTemplate");
const Dependency = require("./Dependency");
const ChunkRenderError = require("./ChunkRenderError");
const AsyncDependencyToInitialChunkError = require("./AsyncDependencyToInitialChunkError");
const Stats = require("./Stats");
@ -36,6 +35,7 @@ const Queue = require("./util/Queue");
const SortableSet = require("./util/SortableSet");
const GraphHelpers = require("./GraphHelpers");
const ModuleDependency = require("./dependencies/ModuleDependency");
const compareLocations = require("./compareLocations");
/** @typedef {import("./Module")} Module */
/** @typedef {import("./Compiler")} Compiler */
@ -642,7 +642,7 @@ class Compilation extends Tapable {
war.dependencies = dependencies;
this.warnings.push(war);
}
module.dependencies.sort(Dependency.compare);
module.dependencies.sort((a, b) => compareLocations(a.loc, b.loc));
if (error) {
this.hooks.failedModule.call(module, error);
return callback(error);
@ -1292,6 +1292,9 @@ class Compilation extends Tapable {
* @returns {void}
*/
sortModules(modules) {
// TODO webpack 5: this should only be enabled when `moduleIds: "natural"`
// TODO move it into a plugin (NaturalModuleIdsPlugin) and use this in WebpackOptionsApply
// TODO remove this method
modules.sort(byIndexOrIdentifier);
}
@ -1453,7 +1456,7 @@ class Compilation extends Tapable {
* @returns {DependencyReference} a reference for the dependency
*/
getDependencyReference(module, dependency) {
// TODO remove dep.getReference existance check in webpack 5
// TODO remove dep.getReference existence check in webpack 5
if (typeof dependency.getReference !== "function") return null;
const ref = dependency.getReference();
if (!ref) return null;
@ -2113,7 +2116,7 @@ class Compilation extends Tapable {
/**
* Used to sort errors and warnings in compilation. this.warnings, and
* this.errors contribute to the compilation hash and therefore shoudl be
* this.errors contribute to the compilation hash and therefore should be
* updated whenever other references (having a chunk id) are sorted. This preserves the hash
* integrity
*

View File

@ -13,11 +13,28 @@ const contextify = require("./util/identifier").contextify;
/** @typedef {"sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once"} ContextMode Context mode */
/** @typedef {import("./dependencies/ContextElementDependency")} ContextElementDependency */
/**
* @callback ResolveDependenciesCallback
* @param {Error=} err
* @param {ContextElementDependency[]} dependencies
*/
/**
* @callback ResolveDependencies
* @param {TODO} fs
* @param {TODO} options
* @param {ResolveDependenciesCallback} callback
*/
class ContextModule extends Module {
// type ContextMode = "sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once"
// type ContextOptions = { resource: string, recursive: boolean, regExp: RegExp, addon?: string, mode?: ContextMode, chunkName?: string, include?: RegExp, exclude?: RegExp, groupOptions?: Object }
// resolveDependencies: (fs: FS, options: ContextOptions, (err: Error?, dependencies: Dependency[]) => void) => void
// options: ContextOptions
/**
* @param {ResolveDependencies} resolveDependencies function to get dependencies in this context
* @param {TODO} options options object
*/
constructor(resolveDependencies, options) {
let resource;
let resourceQuery;
@ -195,7 +212,9 @@ class ContextModule extends Module {
// enhance dependencies with meta info
for (const dep of dependencies) {
dep.loc = dep.userRequest;
dep.loc = {
name: dep.userRequest
};
dep.request = this.options.addon + dep.request;
}

View File

@ -15,7 +15,13 @@ class DelegatedModuleFactoryPlugin {
constructor(options) {
this.options = options;
options.type = options.type || "require";
options.extensions = options.extensions || ["", ".js"];
options.extensions = options.extensions || [
"",
".wasm",
".mjs",
".js",
".json"
];
}
apply(normalModuleFactory) {

View File

@ -4,6 +4,7 @@
*/
"use strict";
const util = require("util");
const compareLocations = require("./compareLocations");
const DependencyReference = require("./dependencies/DependencyReference");
@ -17,19 +18,19 @@ const DependencyReference = require("./dependencies/DependencyReference");
*/
/** @typedef {Object} SourcePosition
* @property {number} column
* @property {number} line
* @property {number=} column
*/
/** @typedef {Object} RealDependencyLocation
* @property {SourcePosition} start
* @property {SourcePosition} end
* @property {SourcePosition=} end
* @property {number=} index
*/
/** @typedef {Object} SynteticDependencyLocation
* @property {string} name
* @property {number} index
* @property {number=} index
*/
/** @typedef {SynteticDependencyLocation|RealDependencyLocation} DependencyLocation */
@ -78,6 +79,11 @@ class Dependency {
this.module = null;
}
}
Dependency.compare = (a, b) => compareLocations(a.loc, b.loc);
// TODO remove in webpack 5
Dependency.compare = util.deprecate(
(a, b) => compareLocations(a.loc, b.loc),
"Dependency.compare is deprecated and will be removed in the next major version"
);
module.exports = Dependency;

View File

@ -6,7 +6,7 @@
const ChunkGroup = require("./ChunkGroup");
/** @typedef {import("./Chunk.js")} Chunk */
/** @typedef {import("./Chunk")} Chunk */
/**
* Entrypoint serves as an encapsulation primitive for chunks that are

View File

@ -5,6 +5,9 @@
"use strict";
/** @typedef {import("./Compiler")} Compiler */
const WebpackError = require("./WebpackError");
const DefinePlugin = require("./DefinePlugin");
const needsEnvVarFix =
@ -25,6 +28,10 @@ class EnvironmentPlugin {
}
}
/**
* @param {Compiler} compiler webpack compiler instance
* @returns {void}
*/
apply(compiler) {
const definitions = this.keys.reduce((defs, key) => {
// TODO remove once the fix has made its way into Node 8.
@ -41,7 +48,7 @@ class EnvironmentPlugin {
if (value === undefined) {
compiler.hooks.thisCompilation.tap("EnvironmentPlugin", compilation => {
const error = new Error(
const error = new WebpackError(
`EnvironmentPlugin - ${key} environment variable is undefined.\n\n` +
"You can pass an object with default values to suppress this warning.\n" +
"See https://webpack.js.org/plugins/environment-plugin for example."

View File

@ -25,7 +25,7 @@ class Generator {
* @returns {Source} generated code
*/
generate(module, dependencyTemplates, runtimeTemplate, type) {
throw new Error("Generator.generate: must be overriden");
throw new Error("Generator.generate: must be overridden");
}
}

View File

@ -35,6 +35,118 @@ module.exports = class HotModuleReplacementPlugin {
return callback();
}
);
const addParserPlugins = (parser, parserOptions) => {
parser.hooks.expression
.for("__webpack_hash__")
.tap(
"HotModuleReplacementPlugin",
ParserHelpers.toConstantDependencyWithWebpackRequire(
parser,
"__webpack_require__.h()"
)
);
parser.hooks.evaluateTypeof
.for("__webpack_hash__")
.tap(
"HotModuleReplacementPlugin",
ParserHelpers.evaluateToString("string")
);
parser.hooks.evaluateIdentifier.for("module.hot").tap(
{
name: "HotModuleReplacementPlugin",
before: "NodeStuffPlugin"
},
expr => {
return ParserHelpers.evaluateToIdentifier(
"module.hot",
!!parser.state.compilation.hotUpdateChunkTemplate
)(expr);
}
);
// TODO webpack 5: refactor this, no custom hooks
if (!parser.hooks.hotAcceptCallback) {
parser.hooks.hotAcceptCallback = new SyncBailHook([
"expression",
"requests"
]);
}
if (!parser.hooks.hotAcceptWithoutCallback) {
parser.hooks.hotAcceptWithoutCallback = new SyncBailHook([
"expression",
"requests"
]);
}
parser.hooks.call
.for("module.hot.accept")
.tap("HotModuleReplacementPlugin", expr => {
if (!parser.state.compilation.hotUpdateChunkTemplate) {
return false;
}
if (expr.arguments.length >= 1) {
const arg = parser.evaluateExpression(expr.arguments[0]);
let params = [];
let requests = [];
if (arg.isString()) {
params = [arg];
} else if (arg.isArray()) {
params = arg.items.filter(param => param.isString());
}
if (params.length > 0) {
params.forEach((param, idx) => {
const request = param.string;
const dep = new ModuleHotAcceptDependency(request, param.range);
dep.optional = true;
dep.loc = Object.create(expr.loc);
dep.loc.index = idx;
parser.state.module.addDependency(dep);
requests.push(request);
});
if (expr.arguments.length > 1) {
parser.hooks.hotAcceptCallback.call(
expr.arguments[1],
requests
);
parser.walkExpression(expr.arguments[1]); // other args are ignored
return true;
} else {
parser.hooks.hotAcceptWithoutCallback.call(expr, requests);
return true;
}
}
}
});
parser.hooks.call
.for("module.hot.decline")
.tap("HotModuleReplacementPlugin", expr => {
if (!parser.state.compilation.hotUpdateChunkTemplate) {
return false;
}
if (expr.arguments.length === 1) {
const arg = parser.evaluateExpression(expr.arguments[0]);
let params = [];
if (arg.isString()) {
params = [arg];
} else if (arg.isArray()) {
params = arg.items.filter(param => param.isString());
}
params.forEach((param, idx) => {
const dep = new ModuleHotDeclineDependency(
param.string,
param.range
);
dep.optional = true;
dep.loc = Object.create(expr.loc);
dep.loc.index = idx;
parser.state.module.addDependency(dep);
});
}
});
parser.hooks.expression
.for("module.hot")
.tap("HotModuleReplacementPlugin", ParserHelpers.skipTraversal);
};
compiler.hooks.compilation.tap(
"HotModuleReplacementPlugin",
(compilation, { normalModuleFactory }) => {
@ -275,127 +387,13 @@ module.exports = class HotModuleReplacementPlugin {
}
);
const handler = (parser, parserOptions) => {
parser.hooks.expression
.for("__webpack_hash__")
.tap(
"HotModuleReplacementPlugin",
ParserHelpers.toConstantDependencyWithWebpackRequire(
parser,
"__webpack_require__.h()"
)
);
parser.hooks.evaluateTypeof
.for("__webpack_hash__")
.tap(
"HotModuleReplacementPlugin",
ParserHelpers.evaluateToString("string")
);
parser.hooks.evaluateIdentifier.for("module.hot").tap(
{
name: "HotModuleReplacementPlugin",
before: "NodeStuffPlugin"
},
expr => {
return ParserHelpers.evaluateToIdentifier(
"module.hot",
!!parser.state.compilation.hotUpdateChunkTemplate
)(expr);
}
);
// TODO webpack 5: refactor this, no custom hooks
if (!parser.hooks.hotAcceptCallback) {
parser.hooks.hotAcceptCallback = new SyncBailHook([
"expression",
"requests"
]);
}
if (!parser.hooks.hotAcceptWithoutCallback) {
parser.hooks.hotAcceptWithoutCallback = new SyncBailHook([
"expression",
"requests"
]);
}
parser.hooks.call
.for("module.hot.accept")
.tap("HotModuleReplacementPlugin", expr => {
if (!parser.state.compilation.hotUpdateChunkTemplate) {
return false;
}
if (expr.arguments.length >= 1) {
const arg = parser.evaluateExpression(expr.arguments[0]);
let params = [];
let requests = [];
if (arg.isString()) {
params = [arg];
} else if (arg.isArray()) {
params = arg.items.filter(param => param.isString());
}
if (params.length > 0) {
params.forEach((param, idx) => {
const request = param.string;
const dep = new ModuleHotAcceptDependency(
request,
param.range
);
dep.optional = true;
dep.loc = Object.create(expr.loc);
dep.loc.index = idx;
parser.state.module.addDependency(dep);
requests.push(request);
});
if (expr.arguments.length > 1) {
parser.hooks.hotAcceptCallback.call(
expr.arguments[1],
requests
);
parser.walkExpression(expr.arguments[1]); // other args are ignored
return true;
} else {
parser.hooks.hotAcceptWithoutCallback.call(expr, requests);
return true;
}
}
}
});
parser.hooks.call
.for("module.hot.decline")
.tap("HotModuleReplacementPlugin", expr => {
if (!parser.state.compilation.hotUpdateChunkTemplate) {
return false;
}
if (expr.arguments.length === 1) {
const arg = parser.evaluateExpression(expr.arguments[0]);
let params = [];
if (arg.isString()) {
params = [arg];
} else if (arg.isArray()) {
params = arg.items.filter(param => param.isString());
}
params.forEach((param, idx) => {
const dep = new ModuleHotDeclineDependency(
param.string,
param.range
);
dep.optional = true;
dep.loc = Object.create(expr.loc);
dep.loc.index = idx;
parser.state.module.addDependency(dep);
});
}
});
parser.hooks.expression
.for("module.hot")
.tap("HotModuleReplacementPlugin", ParserHelpers.skipTraversal);
};
// TODO add HMR support for javascript/esm
normalModuleFactory.hooks.parser
.for("javascript/auto")
.tap("HotModuleReplacementPlugin", handler);
.tap("HotModuleReplacementPlugin", addParserPlugins);
normalModuleFactory.hooks.parser
.for("javascript/dynamic")
.tap("HotModuleReplacementPlugin", handler);
.tap("HotModuleReplacementPlugin", addParserPlugins);
compilation.hooks.normalModuleLoader.tap(
"HotModuleReplacementPlugin",
@ -409,5 +407,5 @@ module.exports = class HotModuleReplacementPlugin {
};
const hotInitCode = Template.getFunctionContent(
require("./HotModuleReplacement.runtime.js")
require("./HotModuleReplacement.runtime")
);

View File

@ -4,7 +4,7 @@
*/
"use strict";
/** @typedef {import("./Compiler.js")} Compiler */
/** @typedef {import("./Compiler")} Compiler */
class IgnorePlugin {
/**

View File

@ -48,9 +48,14 @@ class SingleEntryPlugin {
);
}
/**
* @param {string} entry entry request
* @param {string} name entry name
* @returns {SingleEntryDependency} the dependency
*/
static createDependency(entry, name) {
const dep = new SingleEntryDependency(entry);
dep.loc = name;
dep.loc = { name };
return dep;
}
}

View File

@ -15,6 +15,12 @@ const optionsOrFallback = (...args) => {
return optionValues.find(optionValue => typeof optionValue !== "undefined");
};
const compareId = (a, b) => {
if (a < b) return -1;
if (a > b) return 1;
return 0;
};
class Stats {
constructor(compilation) {
this.compilation = compilation;
@ -543,7 +549,7 @@ class Stats {
}
return obj;
})
.sort((a, b) => a.moduleId - b.moduleId);
.sort(compareId);
}
if (showUsedExports) {
if (module.used === true) {
@ -614,9 +620,9 @@ class Stats {
names: chunk.name ? [chunk.name] : [],
files: chunk.files.slice(),
hash: chunk.renderedHash,
siblings: Array.from(siblings).sort(),
parents: Array.from(parents).sort(),
children: Array.from(children).sort(),
siblings: Array.from(siblings).sort(compareId),
parents: Array.from(parents).sort(compareId),
children: Array.from(children).sort(compareId),
childrenByOrder: childIdByOrder
};
if (showChunkModules) {

View File

@ -6,7 +6,7 @@
const ConstDependency = require("./dependencies/ConstDependency");
/** @typedef {import("./Compiler.js")} Compiler */
/** @typedef {import("./Compiler")} Compiler */
class UseStrictPlugin {
/**

View File

@ -46,7 +46,9 @@ const RemoveParentModulesPlugin = require("./optimize/RemoveParentModulesPlugin"
const RemoveEmptyChunksPlugin = require("./optimize/RemoveEmptyChunksPlugin");
const MergeDuplicateChunksPlugin = require("./optimize/MergeDuplicateChunksPlugin");
const FlagIncludedChunksPlugin = require("./optimize/FlagIncludedChunksPlugin");
const OccurrenceOrderPlugin = require("./optimize/OccurrenceOrderPlugin");
const OccurrenceChunkOrderPlugin = require("./optimize/OccurrenceChunkOrderPlugin");
const OccurrenceModuleOrderPlugin = require("./optimize/OccurrenceModuleOrderPlugin");
const NaturalChunkOrderPlugin = require("./optimize/NaturalChunkOrderPlugin");
const SideEffectsFlagPlugin = require("./optimize/SideEffectsFlagPlugin");
const FlagDependencyUsagePlugin = require("./FlagDependencyUsagePlugin");
const FlagDependencyExportsPlugin = require("./FlagDependencyExportsPlugin");
@ -171,9 +173,13 @@ class WebpackOptionsApply extends OptionsApply {
break;
case "electron-renderer":
JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin");
FetchCompileWasmTemplatePlugin = require("./web/FetchCompileWasmTemplatePlugin");
NodeTargetPlugin = require("./node/NodeTargetPlugin");
ExternalsPlugin = require("./ExternalsPlugin");
new JsonpTemplatePlugin().apply(compiler);
new FetchCompileWasmTemplatePlugin({
mangleImports: options.optimization.mangleWasmImports
}).apply(compiler);
new FunctionModulePlugin().apply(compiler);
new NodeTargetPlugin().apply(compiler);
new ExternalsPlugin("commonjs", [
@ -325,9 +331,6 @@ class WebpackOptionsApply extends OptionsApply {
if (options.optimization.flagIncludedChunks) {
new FlagIncludedChunksPlugin().apply(compiler);
}
if (options.optimization.occurrenceOrder) {
new OccurrenceOrderPlugin(true).apply(compiler);
}
if (options.optimization.sideEffects) {
new SideEffectsFlagPlugin().apply(compiler);
}
@ -352,14 +355,93 @@ class WebpackOptionsApply extends OptionsApply {
if (options.optimization.checkWasmTypes) {
new WasmFinalizeExportsPlugin().apply(compiler);
}
if (options.optimization.namedModules) {
new NamedModulesPlugin().apply(compiler);
let moduleIds = options.optimization.moduleIds;
if (moduleIds === undefined) {
// TODO webpack 5 remove all these options
if (options.optimization.occurrenceOrder) {
moduleIds = "size";
}
if (options.optimization.namedModules) {
moduleIds = "named";
}
if (options.optimization.hashedModuleIds) {
moduleIds = "hashed";
}
if (moduleIds === undefined) {
moduleIds = "natural";
}
}
if (options.optimization.hashedModuleIds) {
new HashedModuleIdsPlugin().apply(compiler);
if (moduleIds) {
switch (moduleIds) {
case "natural":
// TODO webpack 5: see hint in Compilation.sortModules
break;
case "named":
new NamedModulesPlugin().apply(compiler);
break;
case "hashed":
new HashedModuleIdsPlugin().apply(compiler);
break;
case "size":
new OccurrenceModuleOrderPlugin({
prioritiseInitial: true
}).apply(compiler);
break;
case "total-size":
new OccurrenceModuleOrderPlugin({
prioritiseInitial: false
}).apply(compiler);
break;
default:
throw new Error(
`webpack bug: moduleIds: ${moduleIds} is not implemented`
);
}
}
if (options.optimization.namedChunks) {
new NamedChunksPlugin().apply(compiler);
let chunkIds = options.optimization.chunkIds;
if (chunkIds === undefined) {
// TODO webpack 5 remove all these options
if (options.optimization.occurrenceOrder) {
// This looks weird but it's for backward-compat
// This bug already existed before adding this feature
chunkIds = "total-size";
}
if (options.optimization.namedChunks) {
chunkIds = "named";
}
if (chunkIds === undefined) {
chunkIds = "natural";
}
}
if (chunkIds) {
switch (chunkIds) {
case "natural":
new NaturalChunkOrderPlugin().apply(compiler);
break;
case "named":
// TODO webapck 5: for backward-compat this need to have OccurrenceChunkOrderPlugin too
// The NamedChunksPlugin doesn't give every chunk a name
// This should be fixed, and the OccurrenceChunkOrderPlugin should be removed here.
new OccurrenceChunkOrderPlugin({
prioritiseInitial: false
}).apply(compiler);
new NamedChunksPlugin().apply(compiler);
break;
case "size":
new OccurrenceChunkOrderPlugin({
prioritiseInitial: true
}).apply(compiler);
break;
case "total-size":
new OccurrenceChunkOrderPlugin({
prioritiseInitial: false
}).apply(compiler);
break;
default:
throw new Error(
`webpack bug: chunkIds: ${chunkIds} is not implemented`
);
}
}
if (options.optimization.nodeEnv) {
new DefinePlugin({

View File

@ -17,6 +17,16 @@ const isWebLikeTarget = options => {
return options.target === "web" || options.target === "webworker";
};
const getDevtoolNamespace = library => {
// if options.output.library is a string
if (Array.isArray(library)) {
return library.join(".");
} else if (typeof library === "object") {
return getDevtoolNamespace(library.root);
}
return library || "";
};
class WebpackOptionsDefaulter extends OptionsDefaulter {
constructor() {
super();
@ -136,12 +146,7 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
}
});
this.set("output.devtoolNamespace", "make", options => {
if (Array.isArray(options.output.library)) {
return options.output.library.join(".");
} else if (typeof options.output.library === "object") {
return options.output.library.root || "";
}
return options.output.library || "";
return getDevtoolNamespace(options.output.library);
});
this.set("output.libraryTarget", "var");
this.set("output.path", path.join(process.cwd(), "dist"));
@ -201,6 +206,9 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
this.set("optimization.flagIncludedChunks", "make", options =>
isProductionLikeMode(options)
);
// TODO webpack 5 add `moduleIds: "named"` default for development
// TODO webpack 5 add `moduleIds: "size"` default for production
// TODO webpack 5 remove optimization.occurrenceOrder
this.set("optimization.occurrenceOrder", "make", options =>
isProductionLikeMode(options)
);
@ -233,11 +241,13 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
this.set("optimization.splitChunks.name", true);
this.set("optimization.splitChunks.cacheGroups", {});
this.set("optimization.splitChunks.cacheGroups.default", {
automaticNamePrefix: "",
reuseExistingChunk: true,
minChunks: 2,
priority: -20
});
this.set("optimization.splitChunks.cacheGroups.vendors", {
automaticNamePrefix: "vendors",
test: /[\\/]node_modules[\\/]/,
priority: -10
});
@ -261,12 +271,16 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
isProductionLikeMode(options)
);
this.set("optimization.mangleWasmImports", false);
// TODO webpack 5 remove optimization.namedModules
this.set(
"optimization.namedModules",
"make",
options => options.mode === "development"
);
this.set("optimization.hashedModuleIds", false);
// TODO webpack 5 add `chunkIds: "named"` default for development
// TODO webpack 5 add `chunkIds: "size"` default for production
// TODO webpack 5 remove optimization.namedChunks
this.set(
"optimization.namedChunks",
"make",

View File

@ -137,7 +137,7 @@ const createTrace = outputPath => {
callback();
});
// Tear down the readable trace stream.
trace.destroy();
trace.push(null);
}
};
};

View File

@ -244,7 +244,8 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
return new DependencyReference(
mode.module,
Array.from(mode.map.values()),
false
false,
this.sourceOrder
);
case "dynamic-reexport":

View File

@ -7,6 +7,16 @@
const LoaderDependency = require("./LoaderDependency");
const NormalModule = require("../NormalModule");
/** @typedef {import("../Module")} Module */
/**
* @callback LoadModuleCallback
* @param {Error=} err error object
* @param {string=} source source code
* @param {object=} map source map
* @param {Module=} module loaded module if successful
*/
class LoaderPlugin {
apply(compiler) {
compiler.hooks.compilation.tap(
@ -23,9 +33,16 @@ class LoaderPlugin {
compilation.hooks.normalModuleLoader.tap(
"LoaderPlugin",
(loaderContext, module) => {
/**
* @param {string} request the request string to load the module from
* @param {LoadModuleCallback} callback callback returning the loaded module or error
* @returns {void}
*/
loaderContext.loadModule = (request, callback) => {
const dep = new LoaderDependency(request);
dep.loc = request;
dep.loc = {
name: request
};
const factory = compilation.dependencyFactories.get(
dep.constructor
);

View File

@ -72,7 +72,7 @@ class SystemPlugin {
parser.hooks.expression.for("System").tap("SystemPlugin", () => {
const systemPolyfillRequire = ParserHelpers.requireFileAsExpression(
parser.state.module.context,
require.resolve("../../buildin/system.js")
require.resolve("../../buildin/system")
);
return ParserHelpers.addParsedVariableToModule(
parser,

View File

@ -5,57 +5,71 @@
"use strict";
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Dependency").SourcePosition} SourcePosition */
// TODO webpack 5: pos must be SourcePosition
/**
* @param {SourcePosition|DependencyLocation|string} pos position
* @returns {string} formatted position
*/
const formatPosition = pos => {
if (pos === null) return "";
const typeOfPos = typeof pos;
switch (typeOfPos) {
case "string":
return pos;
case "number":
return `${pos}`;
case "object":
if (typeof pos.line === "number" && typeof pos.column === "number") {
return `${pos.line}:${pos.column}`;
} else if (typeof pos.line === "number") {
return `${pos.line}:?`;
} else if (typeof pos.index === "number") {
return `+${pos.index}`;
} else {
return "";
}
default:
// TODO webpack 5: Simplify this
if (typeof pos === "string") return pos;
if (typeof pos === "number") return `${pos}`;
if (typeof pos === "object") {
if ("line" in pos && "column" in pos) {
return `${pos.line}:${pos.column}`;
} else if ("line" in pos) {
return `${pos.line}:?`;
} else if ("index" in pos) {
// TODO webpack 5 remove this case
return `+${pos.index}`;
} else {
return "";
}
}
return "";
};
// TODO webpack 5: loc must be DependencyLocation
/**
* @param {DependencyLocation|SourcePosition|string} loc location
* @returns {string} formatted location
*/
const formatLocation = loc => {
if (loc === null) return "";
const typeOfLoc = typeof loc;
switch (typeOfLoc) {
case "string":
return loc;
case "number":
return `${loc}`;
case "object":
if (loc.start && loc.end) {
if (
typeof loc.start.line === "number" &&
typeof loc.end.line === "number" &&
typeof loc.end.column === "number" &&
loc.start.line === loc.end.line
) {
return `${formatPosition(loc.start)}-${loc.end.column}`;
} else {
return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`;
}
// TODO webpack 5: Simplify this
if (typeof loc === "string") return loc;
if (typeof loc === "number") return `${loc}`;
if (typeof loc === "object") {
if ("start" in loc && loc.start && "end" in loc && loc.end) {
if (
typeof loc.start === "object" &&
typeof loc.start.line === "number" &&
typeof loc.end === "object" &&
typeof loc.end.line === "number" &&
typeof loc.end.column === "number" &&
loc.start.line === loc.end.line
) {
return `${formatPosition(loc.start)}-${loc.end.column}`;
} else {
return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`;
}
if (loc.start) {
return formatPosition(loc.start);
}
return formatPosition(loc);
default:
return "";
}
if ("start" in loc && loc.start) {
return formatPosition(loc.start);
}
if ("name" in loc && "index" in loc) {
return `${loc.name}[${loc.index}]`;
}
if ("name" in loc) {
return loc.name;
}
return formatPosition(loc);
}
return "";
};
module.exports = formatLocation;

View File

@ -305,8 +305,8 @@ module.exports = class NodeMainTemplatePlugin {
);
return Template.getFunctionContent(
asyncChunkLoading
? require("./NodeMainTemplateAsync.runtime.js")
: require("./NodeMainTemplate.runtime.js")
? require("./NodeMainTemplateAsync.runtime")
: require("./NodeMainTemplate.runtime")
)
.replace(/\$require\$/g, mainTemplate.requireFn)
.replace(/\$hotMainFilename\$/g, currentHotUpdateMainFilename)

View File

@ -71,7 +71,7 @@ module.exports = class NodeSourcePlugin {
.tap("NodeSourcePlugin", () => {
const retrieveGlobalModule = ParserHelpers.requireFileAsExpression(
parser.state.module.context,
require.resolve("../../buildin/global.js")
require.resolve("../../buildin/global")
);
return ParserHelpers.addParsedVariableToModule(
parser,

View File

@ -0,0 +1,41 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("../Compiler")} Compiler */
class NaturalChunkOrderPlugin {
/**
* @param {Compiler} compiler webpack compiler
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap("NaturalChunkOrderPlugin", compilation => {
compilation.hooks.optimizeChunkOrder.tap(
"NaturalChunkOrderPlugin",
chunks => {
chunks.sort((chunkA, chunkB) => {
const a = chunkA.modulesIterable[Symbol.iterator]();
const b = chunkB.modulesIterable[Symbol.iterator]();
// eslint-disable-next-line no-constant-condition
while (true) {
const aItem = a.next();
const bItem = b.next();
if (aItem.done && bItem.done) return 0;
if (aItem.done) return -1;
if (bItem.done) return 1;
const aModuleId = aItem.value.id;
const bModuleId = bItem.value.id;
if (aModuleId < bModuleId) return -1;
if (aModuleId > bModuleId) return 1;
}
});
}
);
});
}
}
module.exports = NaturalChunkOrderPlugin;

View File

@ -0,0 +1,61 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const validateOptions = require("schema-utils");
const schema = require("../../schemas/plugins/optimize/OccurrenceOrderChunkIdsPlugin.json");
class OccurrenceOrderChunkIdsPlugin {
constructor(options = {}) {
validateOptions(schema, options, "Occurrence Order Chunk Ids Plugin");
this.options = options;
}
apply(compiler) {
const prioritiseInitial = this.options.prioritiseInitial;
compiler.hooks.compilation.tap(
"OccurrenceOrderChunkIdsPlugin",
compilation => {
compilation.hooks.optimizeChunkOrder.tap(
"OccurrenceOrderChunkIdsPlugin",
chunks => {
const occursInInitialChunksMap = new Map();
const originalOrder = new Map();
let i = 0;
for (const c of chunks) {
let occurs = 0;
for (const chunkGroup of c.groupsIterable) {
for (const parent of chunkGroup.parentsIterable) {
if (parent.isInitial()) occurs++;
}
}
occursInInitialChunksMap.set(c, occurs);
originalOrder.set(c, i++);
}
chunks.sort((a, b) => {
if (prioritiseInitial) {
const aEntryOccurs = occursInInitialChunksMap.get(a);
const bEntryOccurs = occursInInitialChunksMap.get(b);
if (aEntryOccurs > bEntryOccurs) return -1;
if (aEntryOccurs < bEntryOccurs) return 1;
}
const aOccurs = a.getNumberOfGroups();
const bOccurs = b.getNumberOfGroups();
if (aOccurs > bOccurs) return -1;
if (aOccurs < bOccurs) return 1;
const orgA = originalOrder.get(a);
const orgB = originalOrder.get(b);
return orgB - orgA;
});
}
);
}
);
}
}
module.exports = OccurrenceOrderChunkIdsPlugin;

View File

@ -0,0 +1,103 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const validateOptions = require("schema-utils");
const schema = require("../../schemas/plugins/optimize/OccurrenceOrderModuleIdsPlugin.json");
class OccurrenceOrderModuleIdsPlugin {
constructor(options = {}) {
validateOptions(schema, options, "Occurrence Order Module Ids Plugin");
this.options = options;
}
apply(compiler) {
const prioritiseInitial = this.options.prioritiseInitial;
compiler.hooks.compilation.tap(
"OccurrenceOrderModuleIdsPlugin",
compilation => {
compilation.hooks.optimizeModuleOrder.tap(
"OccurrenceOrderModuleIdsPlugin",
modules => {
const occursInInitialChunksMap = new Map();
const occursInAllChunksMap = new Map();
const initialChunkChunkMap = new Map();
const entryCountMap = new Map();
for (const m of modules) {
let initial = 0;
let entry = 0;
for (const c of m.chunksIterable) {
if (c.canBeInitial()) initial++;
if (c.entryModule === m) entry++;
}
initialChunkChunkMap.set(m, initial);
entryCountMap.set(m, entry);
}
const countOccursInEntry = (sum, r) => {
if (!r.module) {
return sum;
}
return sum + initialChunkChunkMap.get(r.module);
};
const countOccurs = (sum, r) => {
if (!r.module) {
return sum;
}
let factor = 1;
if (typeof r.dependency.getNumberOfIdOccurrences === "function") {
factor = r.dependency.getNumberOfIdOccurrences();
}
if (factor === 0) {
return sum;
}
return sum + factor * r.module.getNumberOfChunks();
};
if (prioritiseInitial) {
for (const m of modules) {
const result =
m.reasons.reduce(countOccursInEntry, 0) +
initialChunkChunkMap.get(m) +
entryCountMap.get(m);
occursInInitialChunksMap.set(m, result);
}
}
const originalOrder = new Map();
let i = 0;
for (const m of modules) {
const result =
m.reasons.reduce(countOccurs, 0) +
m.getNumberOfChunks() +
entryCountMap.get(m);
occursInAllChunksMap.set(m, result);
originalOrder.set(m, i++);
}
modules.sort((a, b) => {
if (prioritiseInitial) {
const aEntryOccurs = occursInInitialChunksMap.get(a);
const bEntryOccurs = occursInInitialChunksMap.get(b);
if (aEntryOccurs > bEntryOccurs) return -1;
if (aEntryOccurs < bEntryOccurs) return 1;
}
const aOccurs = occursInAllChunksMap.get(a);
const bOccurs = occursInAllChunksMap.get(b);
if (aOccurs > bOccurs) return -1;
if (aOccurs < bOccurs) return 1;
const orgA = originalOrder.get(a);
const orgB = originalOrder.get(b);
return orgB - orgA;
});
}
);
}
);
}
}
module.exports = OccurrenceOrderModuleIdsPlugin;

View File

@ -4,6 +4,8 @@
*/
"use strict";
// TODO webpack 5 remove this plugin
// It has been splitted into separate plugins for modules and chunks
class OccurrenceOrderPlugin {
constructor(preferEntry) {
if (preferEntry !== undefined && typeof preferEntry !== "boolean") {

View File

@ -115,17 +115,14 @@ module.exports = class SplitChunksPlugin {
minChunks: options.minChunks || 1,
maxAsyncRequests: options.maxAsyncRequests || 1,
maxInitialRequests: options.maxInitialRequests || 1,
getName:
SplitChunksPlugin.normalizeName({
name: options.name,
automaticNameDelimiter: options.automaticNameDelimiter
}) || (() => {}),
hidePathInfo: options.hidePathInfo || false,
filename: options.filename || undefined,
getCacheGroups: SplitChunksPlugin.normalizeCacheGroups({
cacheGroups: options.cacheGroups,
name: options.name,
automaticNameDelimiter: options.automaticNameDelimiter
}),
automaticNameDelimiter: options.automaticNameDelimiter,
fallbackCacheGroup: SplitChunksPlugin.normalizeFallbackCacheGroup(
options.fallbackCacheGroup || {},
options
@ -133,9 +130,10 @@ module.exports = class SplitChunksPlugin {
};
}
static normalizeName({ name, automaticNameDelimiter }) {
static normalizeName({ name, automaticNameDelimiter, automaticNamePrefix }) {
if (name === true) {
const cache = new Map();
/** @type {WeakMap<Chunk[], Record<string, string>>} */
const cache = new WeakMap();
const fn = (module, chunks, cacheGroup) => {
let cacheEntry = cache.get(chunks);
if (cacheEntry === undefined) {
@ -150,10 +148,12 @@ module.exports = class SplitChunksPlugin {
return;
}
names.sort();
let name =
(cacheGroup && cacheGroup !== "default"
? cacheGroup + automaticNameDelimiter
: "") + names.join(automaticNameDelimiter);
const prefix =
typeof automaticNamePrefix === "string"
? automaticNamePrefix
: cacheGroup;
const namePrefix = prefix ? prefix + automaticNameDelimiter : "";
let name = namePrefix + names.join(automaticNameDelimiter);
// Filenames and paths can't be too long otherwise an
// ENAMETOOLONG error is raised. If the generated name if too
// long, it is truncated and a hash is appended. The limit has
@ -210,7 +210,7 @@ module.exports = class SplitChunksPlugin {
};
}
static normalizeCacheGroups({ cacheGroups, automaticNameDelimiter }) {
static normalizeCacheGroups({ cacheGroups, name, automaticNameDelimiter }) {
if (typeof cacheGroups === "function") {
// TODO webpack 5 remove this
if (cacheGroups.length !== 1) {
@ -249,10 +249,15 @@ module.exports = class SplitChunksPlugin {
results.push({
key: key,
priority: option.priority,
getName: SplitChunksPlugin.normalizeName({
name: option.name,
automaticNameDelimiter
}),
getName:
SplitChunksPlugin.normalizeName({
name: option.name || name,
automaticNameDelimiter:
typeof option.automaticNameDelimiter === "string"
? option.automaticNameDelimiter
: automaticNameDelimiter,
automaticNamePrefix: option.automaticNamePrefix
}) || (() => {}),
chunksFilter: SplitChunksPlugin.normalizeChunksFilter(
option.chunks
),
@ -485,6 +490,12 @@ module.exports = class SplitChunksPlugin {
chunksKeys: new Set()
})
);
} else {
if (info.cacheGroup !== cacheGroup) {
if (info.cacheGroup.priority < cacheGroup.priority) {
info.cacheGroup = cacheGroup;
}
}
}
info.modules.add(module);
info.size += module.size();
@ -556,6 +567,10 @@ module.exports = class SplitChunksPlugin {
cacheGroupSource.filename !== undefined
? cacheGroupSource.filename
: this.options.filename,
automaticNameDelimiter:
cacheGroupSource.automaticNameDelimiter !== undefined
? cacheGroupSource.automaticNameDelimiter
: this.options.automaticNameDelimiter,
reuseExistingChunk: cacheGroupSource.reuseExistingChunk
};
// For all combination of chunk selection
@ -639,7 +654,7 @@ module.exports = class SplitChunksPlugin {
isReused = true;
}
}
// Check if maxRequests condition can be fullfilled
// Check if maxRequests condition can be fulfilled
const usedChunks = Array.from(item.chunks).filter(chunk => {
// skip if we address ourself
@ -825,6 +840,7 @@ module.exports = class SplitChunksPlugin {
if (i !== results.length - 1) {
newPart = compilation.addChunk(name);
chunk.split(newPart);
newPart.chunkReason = chunk.chunkReason;
// Add all modules to the new chunk
for (const module of group.items) {
if (typeof module.chunkCondition === "function") {

View File

@ -7,7 +7,7 @@
const mergeCache = new WeakMap();
/**
* Merges two given objects and caches the result to avoid computation if same objects passed as arguements again.
* Merges two given objects and caches the result to avoid computation if same objects passed as arguments again.
* @example
* // performs Object.assign(first, second), stores the result in WeakMap and returns result
* cachedMerge({a: 1}, {a: 2})

View File

@ -186,7 +186,7 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
if (left <= right) {
// when there is a area between left and right
// we look for best split point
// we split at the minimum similiarity
// we split at the minimum similarity
// here key space is separated the most
let best = left - 1;
let bestSimilarity = group.similarities[best];

View File

@ -4,7 +4,7 @@
*/
"use strict";
const UnsupportedWebAssemblyFeatureError = require("../wasm/UnsupportedWebAssemblyFeatureError");
const UnsupportedWebAssemblyFeatureError = require("./UnsupportedWebAssemblyFeatureError");
class WasmFinalizeExportsPlugin {
apply(compiler) {

View File

@ -556,7 +556,7 @@ class JsonpMainTemplatePlugin {
}
);
const runtimeSource = Template.getFunctionContent(
require("./JsonpMainTemplate.runtime.js")
require("./JsonpMainTemplate.runtime")
)
.replace(/\/\/\$semicolon/g, ";")
.replace(/\$require\$/g, mainTemplate.requireFn)

View File

@ -138,6 +138,10 @@ exportPlugins((exports.optimize = {}), {
ModuleConcatenationPlugin: () =>
require("./optimize/ModuleConcatenationPlugin"),
OccurrenceOrderPlugin: () => require("./optimize/OccurrenceOrderPlugin"),
OccurrenceModuleOrderPlugin: () =>
require("./optimize/OccurrenceModuleOrderPlugin"),
OccurrenceChunkOrderPlugin: () =>
require("./optimize/OccurrenceChunkOrderPlugin"),
RuntimeChunkPlugin: () => require("./optimize/RuntimeChunkPlugin"),
SideEffectsFlagPlugin: () => require("./optimize/SideEffectsFlagPlugin"),
SplitChunksPlugin: () => require("./optimize/SplitChunksPlugin")

View File

@ -172,7 +172,7 @@ class WebWorkerMainTemplatePlugin {
)}];\n` +
`${globalObject}[${JSON.stringify(hotUpdateFunction)}] = ` +
Template.getFunctionContent(
require("./WebWorkerMainTemplate.runtime.js")
require("./WebWorkerMainTemplate.runtime")
)
.replace(/\/\/\$semicolon/g, ";")
.replace(/\$require\$/g, mainTemplate.requireFn)

View File

@ -1,6 +1,6 @@
{
"name": "webpack",
"version": "4.15.0",
"version": "4.15.1",
"author": "Tobias Koppers @sokra",
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
"license": "MIT",
@ -56,7 +56,7 @@
"istanbul": "^0.4.5",
"jade": "^1.11.0",
"jade-loader": "~0.8.0",
"jest": "^23.0.1",
"jest": "^23.3.0",
"jest-silent-reporter": "^0.0.5",
"json-loader": "^0.5.7",
"less": "^2.5.1",
@ -82,6 +82,14 @@
"worker-loader": "^1.1.1",
"xxhashjs": "^0.2.1"
},
"resolutions": {
"**/jest-message-util/micromatch": "^2.3.11",
"**/jest-cli/micromatch": "^2.3.11",
"**/jest-runtime/micromatch": "^2.3.11",
"**/jest-haste-map/micromatch": "^2.3.11",
"**/jest-haste-map/sane/micromatch": "^2.3.11",
"**/jest-config/babel-jest/babel-plugin-istanbul/test-exclude/micromatch": "^2.3.11"
},
"engines": {
"node": ">=6.11.5"
},
@ -109,11 +117,11 @@
"test:integration": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.test.js\"",
"test:basic": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/{TestCasesNormal,StatsTestCases,ConfigTestCases}.test.js\"",
"test:unit": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\"",
"travis:integration": "yarn cover:init && yarn cover:integration \"test/((?!TestCases)|TestCasesD)\" --ci $JEST && mv coverage/coverage-final.json coverage/coverage-final-1.json && yarn cover:integration \"test/TestCases(?!D)\" --ci $JEST && mv coverage/coverage-final.json coverage/coverage-final-2.json",
"travis:integration": "yarn cover:init && yarn cover:integration \"test/(?!TestCases)\" --ci $JEST && mv coverage/coverage-final.json coverage/coverage-final-1.json && yarn cover:integration \"test/TestCasesD\" --ci $JEST && mv coverage/coverage-final.json coverage/coverage-final-2.json && yarn cover:integration \"test/TestCases(?!D)\" --ci $JEST && mv coverage/coverage-final.json coverage/coverage-final-3.json",
"travis:basic": "yarn test:basic --ci $JEST",
"travis:lint-unit": "yarn lint && yarn cover:init && yarn cover:unit --ci $JEST",
"travis:benchmark": "yarn benchmark --ci",
"appveyor:integration": "yarn cover:init && yarn cover:integration \"test/((?!TestCases)|TestCasesD)\" --ci %JEST% && move coverage\\coverage-final.json coverage\\coverage-final-1.json && yarn cover:integration \"test/TestCases(?!D)\" --ci %JEST% && move coverage\\coverage-final.json coverage\\coverage-final-2.json",
"appveyor:integration": "yarn cover:init && yarn cover:integration \"test/(?!TestCases)\" --ci %JEST% && move coverage\\coverage-final.json coverage\\coverage-final-1.json&& yarn cover:integration \"test/TestCasesD\" --ci %JEST% && move coverage\\coverage-final.json coverage\\coverage-final-2.json && yarn cover:integration \"test/TestCases(?!D)\" --ci %JEST% && move coverage\\coverage-final.json coverage\\coverage-final-3.json",
"appveyor:unit": "yarn cover:init && yarn cover:unit --ci %JEST%",
"appveyor:benchmark": "yarn benchmark --ci",
"build:examples": "cd examples && node buildAll.js",
@ -179,7 +187,8 @@
"coveragePathIgnorePatterns": [
"\\.runtime\\.js$",
"<rootDir>/test/",
"<rootDir>/schemas/"
"<rootDir>/schemas/",
"<rootDir>/node_modules/"
],
"testEnvironment": "node",
"coverageReporters": [

View File

@ -1529,6 +1529,15 @@
}
]
},
"automaticNameDelimiter": {
"description": "Sets the name delimiter for created chunks",
"type": "string",
"minLength": 1
},
"automaticNamePrefix": {
"description": "Sets the name prefix for created chunks",
"type": "string"
},
"filename": {
"description": "Sets the template for the filename for created chunks (Only works for initial chunks)",
"type": "string",
@ -1586,16 +1595,37 @@
"description": "Reduce size of WASM by changing imports to shorter strings.",
"type": "boolean"
},
"moduleIds": {
"description": "Define the algorithm to choose module ids (natural: numeric ids in order for usage, named: readable ids for better debugging, hashed: short hashes as ids for better long term caching, size: numeric ids focused on minimal initial download size, total-size: numeric ids focused on minimal total download size, false: no algorithm used, as custom one can be provided via plugin)",
"enum": [
"natural",
"named",
"hashed",
"size",
"total-size",
false
]
},
"chunkIds": {
"description": "Define the algorithm to choose chunk ids (named: readable ids for better debugging, size: numeric ids focused on minimal initial download size, total-size: numeric ids focused on minimal total download size, false: no algorithm used, as custom one can be provided via plugin)",
"enum": [
"natural",
"named",
"size",
"total-size",
false
]
},
"namedModules": {
"description": "Use readable module identifiers for better debugging",
"description": "Use readable module identifiers for better debugging (deprecated, used moduleIds: named instead)",
"type": "boolean"
},
"hashedModuleIds": {
"description": "Use hashed module id instead module identifiers for better long term caching",
"description": "Use hashed module id instead module identifiers for better long term caching (deprecated, used moduleIds: hashed instead)",
"type": "boolean"
},
"namedChunks": {
"description": "Use readable chunk identifiers for better debugging",
"description": "Use readable chunk identifiers for better debugging (deprecated, used chunkIds: named instead)",
"type": "boolean"
},
"portableRecords": {

View File

@ -0,0 +1,10 @@
{
"additionalProperties": false,
"type": "object",
"properties": {
"prioritiseInitial": {
"description": "Prioritise initial size over total size",
"type": "boolean"
}
}
}

View File

@ -0,0 +1,10 @@
{
"additionalProperties": false,
"type": "object",
"properties": {
"prioritiseInitial": {
"description": "Prioritise initial size over total size",
"type": "boolean"
}
}
}

View File

@ -17,7 +17,7 @@ describe("ConfigTestCases", () => {
const casesPath = path.join(__dirname, "configCases");
let categories = fs.readdirSync(casesPath);
jest.setTimeout(10000);
jest.setTimeout(20000);
categories = categories.map(cat => {
return {
@ -211,6 +211,7 @@ describe("ConfigTestCases", () => {
) {
fn = vm.runInNewContext(
"(function(require, module, exports, __dirname, __filename, it, beforeEach, afterEach, expect, jest, window) {" +
'function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }' +
content +
"\n})",
globalContext,
@ -220,6 +221,7 @@ describe("ConfigTestCases", () => {
fn = vm.runInThisContext(
"(function(require, module, exports, __dirname, __filename, it, beforeEach, afterEach, expect, jest) {" +
"global.expect = expect; " +
'function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }' +
content +
"\n})",
p

View File

@ -151,6 +151,7 @@ describe("HotTestCases", () => {
const fn = vm.runInThisContext(
"(function(require, module, exports, __dirname, __filename, it, expect, NEXT, STATS) {" +
"global.expect = expect;" +
'function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }' +
fs.readFileSync(p, "utf-8") +
"\n})",
p

View File

@ -216,6 +216,7 @@ const describeCases = config => {
const fn = vm.runInThisContext(
"(function(require, module, exports, __dirname, it, expect) {" +
"global.expect = expect;" +
'function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }' +
fs.readFileSync(p, "utf-8") +
"\n})",
p

View File

@ -245,6 +245,7 @@ describe("WatchTestCases", () => {
) {
fn = vm.runInNewContext(
"(function(require, module, exports, __dirname, __filename, it, WATCH_STEP, STATS_JSON, STATE, expect, window) {" +
'function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }' +
content +
"\n})",
globalContext,
@ -254,6 +255,7 @@ describe("WatchTestCases", () => {
fn = vm.runInThisContext(
"(function(require, module, exports, __dirname, __filename, it, WATCH_STEP, STATS_JSON, STATE, expect) {" +
"global.expect = expect;" +
'function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }' +
content +
"\n})",
p

View File

@ -83,7 +83,7 @@ chunk {1} 29de52df747b400f6177.js 899 bytes <{10}> ={0}= ={2}= ={8}=
> ./c ./d ./e [11] ./index.js 3:0-30
> ./b ./d ./e ./f ./g [11] ./index.js 5:0-44
[2] ./e.js 899 bytes {1} {3} [built]
chunk {2} 7f83e5c2f4e52435dd2c.js 1.76 KiB <{10}> ={0}= ={1}= ={11}= ={3}= ={6}= ={7}= ={9}= [recorded] aggressive splitted
chunk {2} 7f83e5c2f4e52435dd2c.js 1.76 KiB <{10}> ={0}= ={1}= ={3}= ={6}= ={7}= ={9}= ={11}= [recorded] aggressive splitted
> ./f ./g ./h ./i ./j ./k [11] ./index.js 4:0-51
> ./b ./d ./e ./f ./g [11] ./index.js 5:0-44
> ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72
@ -100,7 +100,7 @@ chunk {5} e5fb899955fa03a8053b.js 1.76 KiB <{10}>
> ./b ./c [11] ./index.js 2:0-23
[0] ./b.js 899 bytes {0} {5} [built]
[5] ./c.js 899 bytes {5} {8} [built]
chunk {6} 58f368c01f66002b0eb3.js 1.76 KiB <{10}> ={11}= ={2}=
chunk {6} 58f368c01f66002b0eb3.js 1.76 KiB <{10}> ={2}= ={11}=
> ./f ./g ./h ./i ./j ./k [11] ./index.js 4:0-51
[8] ./j.js 901 bytes {6} {9} [built]
[9] ./k.js 899 bytes {6} {7} [built]
@ -115,7 +115,7 @@ chunk {9} 13713792eb1b5038ab8b.js 1.76 KiB <{10}> ={0}= ={2}= ={3}= ={7}= [re
> ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72
[7] ./i.js 899 bytes {9} {11} [built]
[8] ./j.js 901 bytes {6} {9} [built]
chunk {10} d886db099ddf05aadc6d.js (main) 248 bytes >{0}< >{1}< >{11}< >{2}< >{3}< >{4}< >{5}< >{6}< >{7}< >{8}< >{9}< [entry] [rendered]
chunk {10} d886db099ddf05aadc6d.js (main) 248 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{5}< >{6}< >{7}< >{8}< >{9}< >{11}< [entry] [rendered]
> ./index main
[11] ./index.js 248 bytes {10} [built]
chunk {11} ba9fedb7aa0c69201639.js 1.76 KiB <{10}> ={2}= ={6}= [rendered] [recorded] aggressive splitted
@ -217,7 +217,7 @@ Child default:
> ./b [8] ./index.js 2:0-47
> ./c [8] ./index.js 3:0-47
[0] ./d.js 20 bytes {1} {10} {11} {12} [built]
chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{4}> <{9}> ={0}= ={1}= ={3}= ={5}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g)
chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{3}> <{4}> <{9}> <{10}> ={0}= ={1}= ={3}= ={5}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g)
> ./g [] 6:0-47
> ./g [] 6:0-47
> ./b [8] ./index.js 2:0-47
@ -238,7 +238,7 @@ Child default:
chunk {6} default/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={8}= [rendered]
> ./c [8] ./index.js 3:0-47
[6] ./c.js 72 bytes {6} {12} [built]
chunk {7} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{4}> ={2}= [rendered]
chunk {7} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{3}> <{4}> <{10}> ={2}= [rendered]
> ./g [] 6:0-47
> ./g [] 6:0-47
[9] ./g.js 34 bytes {7} [built]
@ -333,7 +333,7 @@ Child multiple-vendors:
Entrypoint a = multiple-vendors/libs-x.js multiple-vendors/vendors~a~async-a~async-b~b.js multiple-vendors/a.js
Entrypoint b = multiple-vendors/libs-x.js multiple-vendors/vendors~a~async-a~async-b~b.js multiple-vendors/b.js
Entrypoint c = multiple-vendors/libs-x.js multiple-vendors/vendors~async-c~c.js multiple-vendors/c.js
chunk {0} multiple-vendors/libs-x.js (libs-x) 20 bytes <{9}> ={1}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: libs) (name: libs-x)
chunk {0} multiple-vendors/libs-x.js (libs-x) 20 bytes <{9}> ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={10}= ={11}= ={12}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: libs) (name: libs-x)
> ./a a
> ./b b
> ./c c
@ -346,19 +346,19 @@ Child multiple-vendors:
> ./b [8] ./index.js 2:0-47
> ./c [8] ./index.js 3:0-47
[0] ./d.js 20 bytes {1} {10} {11} {12} [built]
chunk {2} multiple-vendors/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{5}> <{9}> ={0}= ={1}= ={3}= ={4}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g)
chunk {2} multiple-vendors/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{3}> <{5}> <{9}> <{10}> ={0}= ={1}= ={3}= ={4}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g)
> ./g [] 6:0-47
> ./g [] 6:0-47
> ./b [8] ./index.js 2:0-47
> ./c [8] ./index.js 3:0-47
[1] ./f.js 20 bytes {2} {11} {12} [built]
chunk {3} multiple-vendors/vendors~a~async-a~async-b~b.js (vendors~a~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={10}= ={11}= ={2}= ={5}= ={6}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~b)
chunk {3} multiple-vendors/vendors~a~async-a~async-b~b.js (vendors~a~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={2}= ={5}= ={6}= ={10}= ={11}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~b)
> ./a a
> ./b b
> ./a [8] ./index.js 1:0-47
> ./b [8] ./index.js 2:0-47
[3] ./node_modules/y.js 20 bytes {3} [built]
chunk {4} multiple-vendors/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={7}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c)
chunk {4} multiple-vendors/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={2}= ={7}= ={12}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c)
> ./c c
> ./c [8] ./index.js 3:0-47
[7] ./node_modules/z.js 20 bytes {4} [built]
@ -373,7 +373,7 @@ Child multiple-vendors:
chunk {7} multiple-vendors/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={4}= [rendered]
> ./c [8] ./index.js 3:0-47
[5] ./c.js 72 bytes {7} {12} [built]
chunk {8} multiple-vendors/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{5}> ={2}= [rendered]
chunk {8} multiple-vendors/async-g.js (async-g) 34 bytes <{0}> <{1}> <{3}> <{5}> <{10}> ={2}= [rendered]
> ./g [] 6:0-47
> ./g [] 6:0-47
[9] ./g.js 34 bytes {8} [built]
@ -401,7 +401,7 @@ Child all:
Entrypoint a = all/vendors~a~async-a~async-b~async-c~b~c.js all/vendors~a~async-a~async-b~b.js all/a.js
Entrypoint b = all/vendors~a~async-a~async-b~async-c~b~c.js all/vendors~a~async-a~async-b~b.js all/b.js
Entrypoint c = all/vendors~a~async-a~async-b~async-c~b~c.js all/vendors~async-c~c.js all/c.js
chunk {0} all/vendors~a~async-a~async-b~async-c~b~c.js (vendors~a~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={1}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~async-c~b~c)
chunk {0} all/vendors~a~async-a~async-b~async-c~b~c.js (vendors~a~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={10}= ={11}= ={12}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~async-c~b~c)
> ./a a
> ./b b
> ./c c
@ -414,19 +414,19 @@ Child all:
> ./b [8] ./index.js 2:0-47
> ./c [8] ./index.js 3:0-47
[0] ./d.js 20 bytes {1} {10} {11} {12} [built]
chunk {2} all/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{5}> <{9}> ={0}= ={1}= ={3}= ={4}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g)
chunk {2} all/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{3}> <{5}> <{9}> <{10}> ={0}= ={1}= ={3}= ={4}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g)
> ./g [] 6:0-47
> ./g [] 6:0-47
> ./b [8] ./index.js 2:0-47
> ./c [8] ./index.js 3:0-47
[1] ./f.js 20 bytes {2} {11} {12} [built]
chunk {3} all/vendors~a~async-a~async-b~b.js (vendors~a~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={10}= ={11}= ={2}= ={5}= ={6}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~b)
chunk {3} all/vendors~a~async-a~async-b~b.js (vendors~a~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={2}= ={5}= ={6}= ={10}= ={11}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~b)
> ./a a
> ./b b
> ./a [8] ./index.js 1:0-47
> ./b [8] ./index.js 2:0-47
[3] ./node_modules/y.js 20 bytes {3} [built]
chunk {4} all/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={7}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c)
chunk {4} all/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={2}= ={7}= ={12}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c)
> ./c c
> ./c [8] ./index.js 3:0-47
[7] ./node_modules/z.js 20 bytes {4} [built]
@ -441,7 +441,7 @@ Child all:
chunk {7} all/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={4}= [rendered]
> ./c [8] ./index.js 3:0-47
[5] ./c.js 72 bytes {7} {12} [built]
chunk {8} all/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{5}> ={2}= [rendered]
chunk {8} all/async-g.js (async-g) 34 bytes <{0}> <{1}> <{3}> <{5}> <{10}> ={2}= [rendered]
> ./g [] 6:0-47
> ./g [] 6:0-47
[9] ./g.js 34 bytes {8} [built]
@ -467,28 +467,28 @@ Child all:
`;
exports[`StatsTestCases should print correct stats for chunk-module-id-range 1`] = `
"Hash: 7d8eb8b4418c6ae6a262
"Hash: b385901db3d63ff731a3
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
main2.js 4.85 KiB 0 [emitted] main2
main1.js 4.86 KiB 1 [emitted] main1
main1.js 4.86 KiB 0 [emitted] main1
main2.js 4.85 KiB 1 [emitted] main2
Entrypoint main1 = main1.js
Entrypoint main2 = main2.js
chunk {0} main2.js (main2) 136 bytes [entry] [rendered]
> ./main2 main2
[0] ./e.js 20 bytes {0} [built]
[1] ./f.js 20 bytes {0} [built]
[2] ./main2.js 56 bytes {0} [built]
[100] ./d.js 20 bytes {0} {1} [built]
[101] ./a.js 20 bytes {0} {1} [built]
chunk {1} main1.js (main1) 136 bytes [entry] [rendered]
chunk {0} main1.js (main1) 136 bytes [entry] [rendered]
> ./main1 main1
[3] ./b.js 20 bytes {1} [built]
[4] ./main1.js 56 bytes {1} [built]
[3] ./b.js 20 bytes {0} [built]
[4] ./main1.js 56 bytes {0} [built]
[100] ./d.js 20 bytes {0} {1} [built]
[101] ./a.js 20 bytes {0} {1} [built]
[102] ./c.js 20 bytes {1} [built]"
[102] ./c.js 20 bytes {0} [built]
chunk {1} main2.js (main2) 136 bytes [entry] [rendered]
> ./main2 main2
[0] ./e.js 20 bytes {1} [built]
[1] ./f.js 20 bytes {1} [built]
[2] ./main2.js 56 bytes {1} [built]
[100] ./d.js 20 bytes {0} {1} [built]
[101] ./a.js 20 bytes {0} {1} [built]"
`;
exports[`StatsTestCases should print correct stats for chunks 1`] = `
@ -530,14 +530,14 @@ chunk {3} 3.bundle.js 44 bytes <{1}> [rendered]
`;
exports[`StatsTestCases should print correct stats for chunks-development 1`] = `
"Hash: 491964abb8a9925c2f65
"Hash: 83bf92a94bc3834801e8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
0.bundle.js 433 bytes 0 [emitted]
1.bundle.js 297 bytes 1 [emitted]
2.bundle.js 588 bytes 2 [emitted]
0.bundle.js 297 bytes 0 [emitted]
1.bundle.js 433 bytes 1 [emitted]
bundle.js 8.67 KiB main [emitted] main
2.bundle.js 588 bytes 2 [emitted]
Entrypoint main = bundle.js
chunk {main} bundle.js (main) 73 bytes >{0}< >{1}< [entry] [rendered]
> ./index main
@ -548,17 +548,17 @@ chunk {main} bundle.js (main) 73 bytes >{0}< >{1}< [entry] [rendered]
[./index.js] 51 bytes {main} [built]
single entry ./index main
factory:Xms building:Xms = Xms
chunk {0} 0.bundle.js 54 bytes <{main}> >{2}< [rendered]
> ./c [./index.js] ./index.js 3:0-16
[./c.js] 54 bytes {0} [built]
amd require ./c [./index.js] 3:0-16
[./index.js] Xms -> factory:Xms building:Xms = Xms
chunk {1} 1.bundle.js 22 bytes <{main}> [rendered]
chunk {0} 0.bundle.js 22 bytes <{main}> [rendered]
> ./b [./index.js] ./index.js 2:0-16
[./b.js] 22 bytes {1} [built]
[./b.js] 22 bytes {0} [built]
amd require ./b [./index.js] 2:0-16
[./index.js] Xms -> factory:Xms building:Xms = Xms
chunk {2} 2.bundle.js 60 bytes <{0}> [rendered]
chunk {1} 1.bundle.js 54 bytes <{main}> >{2}< [rendered]
> ./c [./index.js] ./index.js 3:0-16
[./c.js] 54 bytes {1} [built]
amd require ./c [./index.js] 3:0-16
[./index.js] Xms -> factory:Xms building:Xms = Xms
chunk {2} 2.bundle.js 60 bytes <{1}> [rendered]
> [./c.js] ./c.js 1:0-52
[./d.js] 22 bytes {2} [built]
require.ensure item ./d [./c.js] 1:0-52
@ -1821,7 +1821,7 @@ chunk {6} inner2.js (inner2) 0 bytes <{0}> [rendered]"
exports[`StatsTestCases should print correct stats for prefetch-preload-mixed 1`] = `
"chunk {0} a.js (a) 136 bytes <{3}> >{4}< >{5}< (prefetch: {4} {5}) [rendered]
chunk {1} b.js (b) 203 bytes <{3}> >{6}< >{7}< >{8}< (prefetch: {6} {8}) (preload: {7}) [rendered]
chunk {2} c.js (c) 134 bytes <{3}> >{10}< >{9}< (preload: {9} {10}) [rendered]
chunk {2} c.js (c) 134 bytes <{3}> >{9}< >{10}< (preload: {9} {10}) [rendered]
chunk {3} main.js (main) 195 bytes >{0}< >{1}< >{2}< (prefetch: {0} {1} {2}) [entry] [rendered]
chunk {4} a1.js (a1) 0 bytes <{0}> [rendered]
chunk {5} a2.js (a2) 0 bytes <{0}> [rendered]
@ -2214,9 +2214,9 @@ Entrypoint main = main.js
| single entry ./main.js main
| ./components/src/CompAB/CompB.js 77 bytes [built]
| [only some exports used: default]
| harmony import specifier ./components ./main.js 4:15-20 (skipped side-effect-free modules)
| harmony side effect evaluation ./CompB [7] ./components/src/CompAB/index.js 2:0-43
| harmony export imported specifier ./CompB [7] ./components/src/CompAB/index.js 2:0-43
| harmony import specifier ./components ./main.js 4:15-20 (skipped side-effect-free modules)
[2] ./components/src/index.js 84 bytes [built]
[no exports used]
harmony side effect evaluation ./components [1] ./main.js + 1 modules 1:0-44
@ -2301,7 +2301,7 @@ exports[`StatsTestCases should print correct stats for split-chunks 1`] = `
> ./b [8] ./index.js 2:0-47
> ./c [8] ./index.js 3:0-47
[0] ./d.js 20 bytes {1} {10} {11} {12} [built]
chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{4}> <{9}> ={0}= ={1}= ={3}= ={5}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g)
chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{3}> <{4}> <{9}> <{10}> ={0}= ={1}= ={3}= ={5}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g)
> ./g [] 6:0-47
> ./g [] 6:0-47
> ./b [8] ./index.js 2:0-47
@ -2322,7 +2322,7 @@ exports[`StatsTestCases should print correct stats for split-chunks 1`] = `
chunk {6} default/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={8}= [rendered]
> ./c [8] ./index.js 3:0-47
[6] ./c.js 72 bytes {6} {12} [built]
chunk {7} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{4}> ={2}= [rendered]
chunk {7} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{3}> <{4}> <{10}> ={2}= [rendered]
> ./g [] 6:0-47
> ./g [] 6:0-47
[9] ./g.js 34 bytes {7} [built]
@ -2359,7 +2359,7 @@ Child all-chunks:
Entrypoint a = default/vendors~a~async-a~async-b~async-c~b~c.js default/vendors~a~async-a~async-b~b.js default/a.js
Entrypoint b = default/vendors~a~async-a~async-b~async-c~b~c.js default/vendors~a~async-a~async-b~b.js default/b.js
Entrypoint c = default/vendors~a~async-a~async-b~async-c~b~c.js default/vendors~async-c~c.js default/c.js
chunk {0} default/vendors~a~async-a~async-b~async-c~b~c.js (vendors~a~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={1}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~async-c~b~c)
chunk {0} default/vendors~a~async-a~async-b~async-c~b~c.js (vendors~a~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={10}= ={11}= ={12}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~async-c~b~c)
> ./a a
> ./b b
> ./c c
@ -2372,19 +2372,19 @@ Child all-chunks:
> ./b [8] ./index.js 2:0-47
> ./c [8] ./index.js 3:0-47
[0] ./d.js 20 bytes {1} {10} {11} {12} [built]
chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{5}> <{9}> ={0}= ={1}= ={3}= ={4}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g)
chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{3}> <{5}> <{9}> <{10}> ={0}= ={1}= ={3}= ={4}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g)
> ./g [] 6:0-47
> ./g [] 6:0-47
> ./b [8] ./index.js 2:0-47
> ./c [8] ./index.js 3:0-47
[1] ./f.js 20 bytes {2} {11} {12} [built]
chunk {3} default/vendors~a~async-a~async-b~b.js (vendors~a~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={10}= ={11}= ={2}= ={5}= ={6}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~b)
chunk {3} default/vendors~a~async-a~async-b~b.js (vendors~a~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={2}= ={5}= ={6}= ={10}= ={11}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~a~async-a~async-b~b)
> ./a a
> ./b b
> ./a [8] ./index.js 1:0-47
> ./b [8] ./index.js 2:0-47
[3] ./node_modules/y.js 20 bytes {3} [built]
chunk {4} default/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={7}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c)
chunk {4} default/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={2}= ={7}= ={12}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c)
> ./c c
> ./c [8] ./index.js 3:0-47
[7] ./node_modules/z.js 20 bytes {4} [built]
@ -2399,7 +2399,7 @@ Child all-chunks:
chunk {7} default/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={4}= [rendered]
> ./c [8] ./index.js 3:0-47
[5] ./c.js 72 bytes {7} {12} [built]
chunk {8} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{5}> ={2}= [rendered]
chunk {8} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{3}> <{5}> <{10}> ={2}= [rendered]
> ./g [] 6:0-47
> ./g [] 6:0-47
[9] ./g.js 34 bytes {8} [built]
@ -2483,7 +2483,7 @@ Child name-too-long:
Entrypoint aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f.js vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793.js async-a.js aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.js
Entrypoint bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb = vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f.js vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793.js async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc.js async-b.js bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js
Entrypoint cccccccccccccccccccccccccccccc = vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f.js vendors~async-c~cccccccccccccccccccccccccccccc.js aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793.js async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc.js async-c.js cccccccccccccccccccccccccccccc.js
chunk {0} vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f.js (vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f) 20 bytes <{9}> ={1}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f)
chunk {0} vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f.js (vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f) 20 bytes <{9}> ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={10}= ={11}= ={12}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccc~50ebc41f)
> ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
> ./c cccccccccccccccccccccccccccccc
@ -2491,7 +2491,7 @@ Child name-too-long:
> ./b [4] ./index.js 2:0-47
> ./c [4] ./index.js 3:0-47
[2] ./node_modules/x.js 20 bytes {0} [built]
chunk {1} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793.js (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793) 20 bytes <{9}> ={0}= ={10}= ={11}= ={12}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: default) (name: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793)
chunk {1} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793.js (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793) 20 bytes <{9}> ={0}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={10}= ={11}= ={12}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: default) (name: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~async-c~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccc~18066793)
> ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
> ./c cccccccccccccccccccccccccccccc
@ -2499,7 +2499,7 @@ Child name-too-long:
> ./b [4] ./index.js 2:0-47
> ./c [4] ./index.js 3:0-47
[1] ./d.js 20 bytes {1} [built]
chunk {2} async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc.js (async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc) 20 bytes <{0}> <{1}> <{10}> <{3}> <{4}> <{9}> ={0}= ={1}= ={11}= ={12}= ={3}= ={5}= ={6}= ={7}= ={8}= [initial] [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc)
chunk {2} async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc.js (async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc) 20 bytes <{0}> <{1}> <{3}> <{4}> <{9}> <{10}> ={0}= ={1}= ={3}= ={5}= ={6}= ={7}= ={8}= ={11}= ={12}= [initial] [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb~cccccccccccccccccccccccccccccc)
> ./g [] 6:0-47
> ./g [] 6:0-47
> ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
@ -2507,31 +2507,31 @@ Child name-too-long:
> ./b [4] ./index.js 2:0-47
> ./c [4] ./index.js 3:0-47
[0] ./f.js 20 bytes {2} [built]
chunk {3} vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js (vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) 20 bytes <{9}> ={0}= ={1}= ={10}= ={11}= ={2}= ={4}= ={5}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)
chunk {3} vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js (vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) 20 bytes <{9}> ={0}= ={1}= ={2}= ={4}= ={5}= ={10}= ={11}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa~async-a~async-b~bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)
> ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
> ./a [4] ./index.js 1:0-47
> ./b [4] ./index.js 2:0-47
[3] ./node_modules/y.js 20 bytes {3} [built]
chunk {4} async-a.js (async-a) 156 bytes <{9}> ={0}= ={1}= ={10}= ={3}= >{2}< >{8}< [initial] [rendered] reused as split chunk (cache group: default)
chunk {4} async-a.js (async-a) 156 bytes <{9}> ={0}= ={1}= ={3}= ={10}= >{2}< >{8}< [initial] [rendered] reused as split chunk (cache group: default)
> ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> ./a [4] ./index.js 1:0-47
[8] ./a.js + 1 modules 156 bytes {4} [built]
| ./a.js 121 bytes [built]
| ./e.js 20 bytes [built]
chunk {5} async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={11}= ={2}= ={3}= [initial] [rendered] reused as split chunk (cache group: default)
chunk {5} async-b.js (async-b) 72 bytes <{9}> ={0}= ={1}= ={2}= ={3}= ={11}= [initial] [rendered] reused as split chunk (cache group: default)
> ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
> ./b [4] ./index.js 2:0-47
[5] ./b.js 72 bytes {5} [built]
chunk {6} async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={7}= [initial] [rendered] reused as split chunk (cache group: default)
chunk {6} async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={7}= ={12}= [initial] [rendered] reused as split chunk (cache group: default)
> ./c cccccccccccccccccccccccccccccc
> ./c [4] ./index.js 3:0-47
[6] ./c.js 72 bytes {6} [built]
chunk {7} vendors~async-c~cccccccccccccccccccccccccccccc.js (vendors~async-c~cccccccccccccccccccccccccccccc) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={6}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~cccccccccccccccccccccccccccccc)
chunk {7} vendors~async-c~cccccccccccccccccccccccccccccc.js (vendors~async-c~cccccccccccccccccccccccccccccc) 20 bytes <{9}> ={0}= ={1}= ={2}= ={6}= ={12}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~cccccccccccccccccccccccccccccc)
> ./c cccccccccccccccccccccccccccccc
> ./c [4] ./index.js 3:0-47
[7] ./node_modules/z.js 20 bytes {7} [built]
chunk {8} async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{4}> ={2}= [rendered]
chunk {8} async-g.js (async-g) 34 bytes <{0}> <{1}> <{3}> <{4}> <{10}> ={2}= [rendered]
> ./g [] 6:0-47
> ./g [] 6:0-47
[9] ./g.js 34 bytes {8} [built]
@ -2549,7 +2549,7 @@ Child custom-chunks-filter:
Entrypoint a = default/a.js
Entrypoint b = default/vendors~async-a~async-b~async-c~b~c.js default/vendors~async-a~async-b~b.js default/b.js
Entrypoint c = default/vendors~async-a~async-b~async-c~b~c.js default/vendors~async-c~c.js default/c.js
chunk {0} default/vendors~async-a~async-b~async-c~b~c.js (vendors~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={1}= ={11}= ={12}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~async-c~b~c)
chunk {0} default/vendors~async-a~async-b~async-c~b~c.js (vendors~async-a~async-b~async-c~b~c) 20 bytes <{9}> ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={11}= ={12}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~async-c~b~c)
> ./b b
> ./c c
> ./a [8] ./index.js 1:0-47
@ -2561,18 +2561,18 @@ Child custom-chunks-filter:
> ./b [8] ./index.js 2:0-47
> ./c [8] ./index.js 3:0-47
[0] ./d.js 20 bytes {1} {10} {11} {12} [built]
chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{10}> <{3}> <{5}> <{9}> ={0}= ={1}= ={3}= ={4}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g)
chunk {2} default/async-b~async-c~async-g.js (async-b~async-c~async-g) 20 bytes <{0}> <{1}> <{3}> <{5}> <{9}> <{10}> ={0}= ={1}= ={3}= ={4}= ={6}= ={7}= ={8}= [rendered] split chunk (cache group: default) (name: async-b~async-c~async-g)
> ./g [] 6:0-47
> ./g [] 6:0-47
> ./b [8] ./index.js 2:0-47
> ./c [8] ./index.js 3:0-47
[1] ./f.js 20 bytes {2} {11} {12} [built]
chunk {3} default/vendors~async-a~async-b~b.js (vendors~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={11}= ={2}= ={5}= ={6}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~b)
chunk {3} default/vendors~async-a~async-b~b.js (vendors~async-a~async-b~b) 20 bytes <{9}> ={0}= ={1}= ={2}= ={5}= ={6}= ={11}= >{2}< >{8}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-a~async-b~b)
> ./b b
> ./a [8] ./index.js 1:0-47
> ./b [8] ./index.js 2:0-47
[3] ./node_modules/y.js 20 bytes {3} {10} [built]
chunk {4} default/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={12}= ={2}= ={7}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c)
chunk {4} default/vendors~async-c~c.js (vendors~async-c~c) 20 bytes <{9}> ={0}= ={1}= ={2}= ={7}= ={12}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~async-c~c)
> ./c c
> ./c [8] ./index.js 3:0-47
[7] ./node_modules/z.js 20 bytes {4} [built]
@ -2587,7 +2587,7 @@ Child custom-chunks-filter:
chunk {7} default/async-c.js (async-c) 72 bytes <{9}> ={0}= ={1}= ={2}= ={4}= [rendered]
> ./c [8] ./index.js 3:0-47
[5] ./c.js 72 bytes {7} {12} [built]
chunk {8} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{10}> <{3}> <{5}> ={2}= [rendered]
chunk {8} default/async-g.js (async-g) 34 bytes <{0}> <{1}> <{3}> <{5}> <{10}> ={2}= [rendered]
> ./g [] 6:0-47
> ./g [] 6:0-47
[9] ./g.js 34 bytes {8} [built]
@ -2671,6 +2671,41 @@ Child custom-chunks-filter-in-cache-groups:
[5] ./c.js 72 bytes {3} {8} [built]"
`;
exports[`StatsTestCases should print correct stats for split-chunks-automatic-name 1`] = `
"Entrypoint main = main.js
chunk {0} common~async-a~async-b~async-c.js (common~async-a~async-b~async-c) 40 bytes <{7}> ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= [rendered] split chunk (cache group: vendors) (name: common~async-a~async-b~async-c)
> ./a [8] ./index.js 1:0-47
> ./b [8] ./index.js 2:0-47
> ./c [8] ./index.js 3:0-47
[0] ./d.js 20 bytes {0} [built]
[1] ./node_modules/x.js 20 bytes {0} [built]
chunk {1} common~async-b~async-c.js (common~async-b~async-c) 20 bytes <{7}> ={0}= ={2}= ={4}= ={5}= ={6}= [rendered] split chunk (cache group: vendors) (name: common~async-b~async-c)
> ./b [8] ./index.js 2:0-47
> ./c [8] ./index.js 3:0-47
[3] ./f.js 20 bytes {1} [built]
chunk {2} common~async-a~async-b.js (common~async-a~async-b) 20 bytes <{7}> ={0}= ={1}= ={3}= ={4}= [rendered] split chunk (cache group: vendors) (name: common~async-a~async-b)
> ./a [8] ./index.js 1:0-47
> ./b [8] ./index.js 2:0-47
[2] ./node_modules/y.js 20 bytes {2} [built]
chunk {3} async-a.js (async-a) 107 bytes <{7}> ={0}= ={2}= [rendered]
> ./a [8] ./index.js 1:0-47
[7] ./a.js + 1 modules 107 bytes {3} [built]
| ./a.js 72 bytes [built]
| ./e.js 20 bytes [built]
chunk {4} async-b.js (async-b) 72 bytes <{7}> ={0}= ={1}= ={2}= [rendered]
> ./b [8] ./index.js 2:0-47
[5] ./b.js 72 bytes {4} [built]
chunk {5} async-c.js (async-c) 72 bytes <{7}> ={0}= ={1}= ={6}= [rendered]
> ./c [8] ./index.js 3:0-47
[6] ./c.js 72 bytes {5} [built]
chunk {6} common~async-c.js (common~async-c) 20 bytes <{7}> ={0}= ={1}= ={5}= [rendered] split chunk (cache group: vendors) (name: common~async-c)
> ./c [8] ./index.js 3:0-47
[4] ./node_modules/z.js 20 bytes {6} [built]
chunk {7} main.js (main) 147 bytes >{0}< >{1}< >{2}< >{3}< >{4}< >{5}< >{6}< [entry] [rendered]
> ./ main
[8] ./index.js 147 bytes {7} [built]"
`;
exports[`StatsTestCases should print correct stats for split-chunks-combinations 1`] = `
"Entrypoint main = main.js
chunk {0} async-a~async-b.js (async-a~async-b) 134 bytes <{8}> ={1}= ={2}= [rendered] split chunk (cache group: default) (name: async-a~async-b)
@ -2774,90 +2809,98 @@ chunk {3} b.js (b) 43 bytes >{0}< >{1}< [entry] [rendered]
exports[`StatsTestCases should print correct stats for split-chunks-max-size 1`] = `
"Child production:
Entrypoint main = prod-main~6e7ead72.js prod-main~6a2ae26b.js prod-main~17acad98.js prod-main~b2c7414a.js prod-main~75f09de8.js prod-main~052b3814.js prod-main~3ff27526.js prod-main~11485824.js prod-main~c6931360.js prod-main~cd7c5bfc.js prod-main~02369f19.js
chunk {0} prod-main~02369f19.js (main~02369f19) 1.57 KiB ={1}= ={10}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= [entry] [rendered]
Entrypoint main = prod-vendors~main~7274e1de.js prod-vendors~main~0feae4ad.js prod-main~6e7ead72.js prod-main~6a2ae26b.js prod-main~17acad98.js prod-main~b2c7414a.js prod-main~75f09de8.js prod-main~052b3814.js prod-main~3ff27526.js prod-main~11485824.js prod-main~c6931360.js prod-main~cd7c5bfc.js prod-main~02369f19.js
chunk {0} prod-main~02369f19.js (main~02369f19) 1.57 KiB ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= ={10}= ={11}= ={12}= [entry] [rendered]
> ./ main
[11] ./very-big.js?1 1.57 KiB {0} [built]
chunk {1} prod-main~6e7ead72.js (main~6e7ead72) 536 bytes ={0}= ={10}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= [initial] [rendered]
chunk {1} prod-vendors~main~0feae4ad.js (vendors~main~0feae4ad) 1.57 KiB ={0}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= ={10}= ={11}= ={12}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~main)
> ./ main
[0] ./big.js?1 268 bytes {1} [built]
[1] ./big.js?2 268 bytes {1} [built]
chunk {2} prod-main~6a2ae26b.js (main~6a2ae26b) 536 bytes ={0}= ={1}= ={10}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= [initial] [rendered]
[43] ./node_modules/very-big.js?1 1.57 KiB {1} [built]
chunk {2} prod-main~6e7ead72.js (main~6e7ead72) 536 bytes ={0}= ={1}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= ={10}= ={11}= ={12}= [initial] [rendered]
> ./ main
[34] ./in-some-directory/big.js?1 268 bytes {2} [built]
[35] ./in-some-directory/small.js?1 67 bytes {2} [built]
[36] ./in-some-directory/small.js?2 67 bytes {2} [built]
[37] ./in-some-directory/small.js?3 67 bytes {2} [built]
[38] ./in-some-directory/small.js?4 67 bytes {2} [built]
chunk {3} prod-main~17acad98.js (main~17acad98) 1.57 KiB ={0}= ={1}= ={10}= ={2}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= [initial] [rendered]
[0] ./big.js?1 268 bytes {2} [built]
[1] ./big.js?2 268 bytes {2} [built]
chunk {3} prod-main~6a2ae26b.js (main~6a2ae26b) 536 bytes ={0}= ={1}= ={2}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= ={10}= ={11}= ={12}= [initial] [rendered]
> ./ main
[39] ./in-some-directory/very-big.js?1 1.57 KiB {3} [built]
chunk {4} prod-main~b2c7414a.js (main~b2c7414a) 1.11 KiB ={0}= ={1}= ={10}= ={2}= ={3}= ={5}= ={6}= ={7}= ={8}= ={9}= [initial] [rendered]
[34] ./in-some-directory/big.js?1 268 bytes {3} [built]
[35] ./in-some-directory/small.js?1 67 bytes {3} [built]
[36] ./in-some-directory/small.js?2 67 bytes {3} [built]
[37] ./in-some-directory/small.js?3 67 bytes {3} [built]
[38] ./in-some-directory/small.js?4 67 bytes {3} [built]
chunk {4} prod-main~17acad98.js (main~17acad98) 1.57 KiB ={0}= ={1}= ={2}= ={3}= ={5}= ={6}= ={7}= ={8}= ={9}= ={10}= ={11}= ={12}= [initial] [rendered]
> ./ main
[40] ./index.js 1.11 KiB {4} [built]
chunk {5} prod-main~75f09de8.js (main~75f09de8) 603 bytes ={0}= ={1}= ={10}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= ={9}= [initial] [rendered]
[39] ./in-some-directory/very-big.js?1 1.57 KiB {4} [built]
chunk {5} prod-main~b2c7414a.js (main~b2c7414a) 1.19 KiB ={0}= ={1}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= ={9}= ={10}= ={11}= ={12}= [initial] [rendered]
> ./ main
[25] ./inner-module/small.js?1 67 bytes {5} [built]
[26] ./inner-module/small.js?2 67 bytes {5} [built]
[27] ./inner-module/small.js?3 67 bytes {5} [built]
[28] ./inner-module/small.js?4 67 bytes {5} [built]
[29] ./inner-module/small.js?5 67 bytes {5} [built]
[30] ./inner-module/small.js?6 67 bytes {5} [built]
[31] ./inner-module/small.js?7 67 bytes {5} [built]
[32] ./inner-module/small.js?8 67 bytes {5} [built]
[33] ./inner-module/small.js?9 67 bytes {5} [built]
chunk {6} prod-main~052b3814.js (main~052b3814) 603 bytes ={0}= ={1}= ={10}= ={2}= ={3}= ={4}= ={5}= ={7}= ={8}= ={9}= [initial] [rendered]
[44] ./index.js 1.19 KiB {5} [built]
chunk {6} prod-main~75f09de8.js (main~75f09de8) 603 bytes ={0}= ={1}= ={2}= ={3}= ={4}= ={5}= ={7}= ={8}= ={9}= ={10}= ={11}= ={12}= [initial] [rendered]
> ./ main
[2] ./small.js?1 67 bytes {6} [built]
[3] ./small.js?2 67 bytes {6} [built]
[4] ./small.js?3 67 bytes {6} [built]
[5] ./small.js?4 67 bytes {6} [built]
[6] ./small.js?5 67 bytes {6} [built]
[7] ./small.js?6 67 bytes {6} [built]
[8] ./small.js?7 67 bytes {6} [built]
[9] ./small.js?8 67 bytes {6} [built]
[10] ./small.js?9 67 bytes {6} [built]
chunk {7} prod-main~3ff27526.js (main~3ff27526) 536 bytes ={0}= ={1}= ={10}= ={2}= ={3}= ={4}= ={5}= ={6}= ={8}= ={9}= [initial] [rendered]
[25] ./inner-module/small.js?1 67 bytes {6} [built]
[26] ./inner-module/small.js?2 67 bytes {6} [built]
[27] ./inner-module/small.js?3 67 bytes {6} [built]
[28] ./inner-module/small.js?4 67 bytes {6} [built]
[29] ./inner-module/small.js?5 67 bytes {6} [built]
[30] ./inner-module/small.js?6 67 bytes {6} [built]
[31] ./inner-module/small.js?7 67 bytes {6} [built]
[32] ./inner-module/small.js?8 67 bytes {6} [built]
[33] ./inner-module/small.js?9 67 bytes {6} [built]
chunk {7} prod-main~052b3814.js (main~052b3814) 603 bytes ={0}= ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={8}= ={9}= ={10}= ={11}= ={12}= [initial] [rendered]
> ./ main
[14] ./subfolder/big.js?1 268 bytes {7} [built]
[15] ./subfolder/big.js?2 268 bytes {7} [built]
chunk {8} prod-main~11485824.js (main~11485824) 603 bytes ={0}= ={1}= ={10}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={9}= [initial] [rendered]
[2] ./small.js?1 67 bytes {7} [built]
[3] ./small.js?2 67 bytes {7} [built]
[4] ./small.js?3 67 bytes {7} [built]
[5] ./small.js?4 67 bytes {7} [built]
[6] ./small.js?5 67 bytes {7} [built]
[7] ./small.js?6 67 bytes {7} [built]
[8] ./small.js?7 67 bytes {7} [built]
[9] ./small.js?8 67 bytes {7} [built]
[10] ./small.js?9 67 bytes {7} [built]
chunk {8} prod-main~3ff27526.js (main~3ff27526) 536 bytes ={0}= ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={9}= ={10}= ={11}= ={12}= [initial] [rendered]
> ./ main
[16] ./subfolder/small.js?1 67 bytes {8} [built]
[17] ./subfolder/small.js?2 67 bytes {8} [built]
[18] ./subfolder/small.js?3 67 bytes {8} [built]
[19] ./subfolder/small.js?4 67 bytes {8} [built]
[20] ./subfolder/small.js?5 67 bytes {8} [built]
[21] ./subfolder/small.js?6 67 bytes {8} [built]
[22] ./subfolder/small.js?7 67 bytes {8} [built]
[23] ./subfolder/small.js?8 67 bytes {8} [built]
[24] ./subfolder/small.js?9 67 bytes {8} [built]
chunk {9} prod-main~c6931360.js (main~c6931360) 1.57 KiB ={0}= ={1}= ={10}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= [initial] [rendered]
[14] ./subfolder/big.js?1 268 bytes {8} [built]
[15] ./subfolder/big.js?2 268 bytes {8} [built]
chunk {9} prod-main~11485824.js (main~11485824) 603 bytes ={0}= ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={10}= ={11}= ={12}= [initial] [rendered]
> ./ main
[12] ./very-big.js?2 1.57 KiB {9} [built]
chunk {10} prod-main~cd7c5bfc.js (main~cd7c5bfc) 1.57 KiB ={0}= ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= [initial] [rendered]
[16] ./subfolder/small.js?1 67 bytes {9} [built]
[17] ./subfolder/small.js?2 67 bytes {9} [built]
[18] ./subfolder/small.js?3 67 bytes {9} [built]
[19] ./subfolder/small.js?4 67 bytes {9} [built]
[20] ./subfolder/small.js?5 67 bytes {9} [built]
[21] ./subfolder/small.js?6 67 bytes {9} [built]
[22] ./subfolder/small.js?7 67 bytes {9} [built]
[23] ./subfolder/small.js?8 67 bytes {9} [built]
[24] ./subfolder/small.js?9 67 bytes {9} [built]
chunk {10} prod-main~c6931360.js (main~c6931360) 1.57 KiB ={0}= ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= ={11}= ={12}= [initial] [rendered]
> ./ main
[13] ./very-big.js?3 1.57 KiB {10} [built]
[12] ./very-big.js?2 1.57 KiB {10} [built]
chunk {11} prod-main~cd7c5bfc.js (main~cd7c5bfc) 1.57 KiB ={0}= ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= ={10}= ={12}= [initial] [rendered]
> ./ main
[13] ./very-big.js?3 1.57 KiB {11} [built]
chunk {12} prod-vendors~main~7274e1de.js (vendors~main~7274e1de) 402 bytes ={0}= ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= ={10}= ={11}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~main)
> ./ main
[40] ./node_modules/big.js?1 268 bytes {12} [built]
[41] ./node_modules/small.js?1 67 bytes {12} [built]
[42] ./node_modules/small.js?2 67 bytes {12} [built]
Child development:
Entrypoint main = dev-main~._big.js~1.js dev-main~._in-some-directory_b.js dev-main~._in-some-directory_very-big.js~8d76cf03.js dev-main~._index.js~41f5a26e.js dev-main~._inner-module_small.js~3.js dev-main~._small.js~1.js dev-main~._subfolder_big.js~b.js dev-main~._subfolder_small.js~1.js dev-main~._very-big.js~08cf55cf.js dev-main~._very-big.js~4647fb9d.js dev-main~._very-big.js~62f7f644.js
chunk {main~._big.js~1} dev-main~._big.js~1.js (main~._big.js~1) 536 bytes ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered]
Entrypoint main = dev-vendors~main~._node_modules_b.js dev-vendors~main~._node_modules_very-big.js~6bdbed7b.js dev-main~._big.js~1.js dev-main~._in-some-directory_b.js dev-main~._in-some-directory_very-big.js~8d76cf03.js dev-main~._index.js~41f5a26e.js dev-main~._inner-module_small.js~3.js dev-main~._small.js~1.js dev-main~._subfolder_big.js~b.js dev-main~._subfolder_small.js~1.js dev-main~._very-big.js~08cf55cf.js dev-main~._very-big.js~4647fb9d.js dev-main~._very-big.js~62f7f644.js
chunk {main~._big.js~1} dev-main~._big.js~1.js (main~._big.js~1) 536 bytes ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= ={vendors~main~._node_modules_b}= ={vendors~main~._node_modules_very-big.js~6bdbed7b}= [initial] [rendered]
> ./ main
[./big.js?1] 268 bytes {main~._big.js~1} [built]
[./big.js?2] 268 bytes {main~._big.js~1} [built]
chunk {main~._in-some-directory_b} dev-main~._in-some-directory_b.js (main~._in-some-directory_b) 536 bytes ={main~._big.js~1}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered]
chunk {main~._in-some-directory_b} dev-main~._in-some-directory_b.js (main~._in-some-directory_b) 536 bytes ={main~._big.js~1}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= ={vendors~main~._node_modules_b}= ={vendors~main~._node_modules_very-big.js~6bdbed7b}= [initial] [rendered]
> ./ main
[./in-some-directory/big.js?1] 268 bytes {main~._in-some-directory_b} [built]
[./in-some-directory/small.js?1] 67 bytes {main~._in-some-directory_b} [built]
[./in-some-directory/small.js?2] 67 bytes {main~._in-some-directory_b} [built]
[./in-some-directory/small.js?3] 67 bytes {main~._in-some-directory_b} [built]
[./in-some-directory/small.js?4] 67 bytes {main~._in-some-directory_b} [built]
chunk {main~._in-some-directory_very-big.js~8d76cf03} dev-main~._in-some-directory_very-big.js~8d76cf03.js (main~._in-some-directory_very-big.js~8d76cf03) 1.57 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered]
chunk {main~._in-some-directory_very-big.js~8d76cf03} dev-main~._in-some-directory_very-big.js~8d76cf03.js (main~._in-some-directory_very-big.js~8d76cf03) 1.57 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= ={vendors~main~._node_modules_b}= ={vendors~main~._node_modules_very-big.js~6bdbed7b}= [initial] [rendered]
> ./ main
[./in-some-directory/very-big.js?1] 1.57 KiB {main~._in-some-directory_very-big.js~8d76cf03} [built]
chunk {main~._index.js~41f5a26e} dev-main~._index.js~41f5a26e.js (main~._index.js~41f5a26e) 1.11 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered]
chunk {main~._index.js~41f5a26e} dev-main~._index.js~41f5a26e.js (main~._index.js~41f5a26e) 1.19 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= ={vendors~main~._node_modules_b}= ={vendors~main~._node_modules_very-big.js~6bdbed7b}= [initial] [rendered]
> ./ main
[./index.js] 1.11 KiB {main~._index.js~41f5a26e} [built]
chunk {main~._inner-module_small.js~3} dev-main~._inner-module_small.js~3.js (main~._inner-module_small.js~3) 603 bytes ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered]
[./index.js] 1.19 KiB {main~._index.js~41f5a26e} [built]
chunk {main~._inner-module_small.js~3} dev-main~._inner-module_small.js~3.js (main~._inner-module_small.js~3) 603 bytes ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= ={vendors~main~._node_modules_b}= ={vendors~main~._node_modules_very-big.js~6bdbed7b}= [initial] [rendered]
> ./ main
[./inner-module/small.js?1] 67 bytes {main~._inner-module_small.js~3} [built]
[./inner-module/small.js?2] 67 bytes {main~._inner-module_small.js~3} [built]
@ -2868,7 +2911,7 @@ Child development:
[./inner-module/small.js?7] 67 bytes {main~._inner-module_small.js~3} [built]
[./inner-module/small.js?8] 67 bytes {main~._inner-module_small.js~3} [built]
[./inner-module/small.js?9] 67 bytes {main~._inner-module_small.js~3} [built]
chunk {main~._small.js~1} dev-main~._small.js~1.js (main~._small.js~1) 603 bytes ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered]
chunk {main~._small.js~1} dev-main~._small.js~1.js (main~._small.js~1) 603 bytes ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= ={vendors~main~._node_modules_b}= ={vendors~main~._node_modules_very-big.js~6bdbed7b}= [initial] [rendered]
> ./ main
[./small.js?1] 67 bytes {main~._small.js~1} [built]
[./small.js?2] 67 bytes {main~._small.js~1} [built]
@ -2879,11 +2922,11 @@ Child development:
[./small.js?7] 67 bytes {main~._small.js~1} [built]
[./small.js?8] 67 bytes {main~._small.js~1} [built]
[./small.js?9] 67 bytes {main~._small.js~1} [built]
chunk {main~._subfolder_big.js~b} dev-main~._subfolder_big.js~b.js (main~._subfolder_big.js~b) 536 bytes ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered]
chunk {main~._subfolder_big.js~b} dev-main~._subfolder_big.js~b.js (main~._subfolder_big.js~b) 536 bytes ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= ={vendors~main~._node_modules_b}= ={vendors~main~._node_modules_very-big.js~6bdbed7b}= [initial] [rendered]
> ./ main
[./subfolder/big.js?1] 268 bytes {main~._subfolder_big.js~b} [built]
[./subfolder/big.js?2] 268 bytes {main~._subfolder_big.js~b} [built]
chunk {main~._subfolder_small.js~1} dev-main~._subfolder_small.js~1.js (main~._subfolder_small.js~1) 603 bytes ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered]
chunk {main~._subfolder_small.js~1} dev-main~._subfolder_small.js~1.js (main~._subfolder_small.js~1) 603 bytes ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= ={vendors~main~._node_modules_b}= ={vendors~main~._node_modules_very-big.js~6bdbed7b}= [initial] [rendered]
> ./ main
[./subfolder/small.js?1] 67 bytes {main~._subfolder_small.js~1} [built]
[./subfolder/small.js?2] 67 bytes {main~._subfolder_small.js~1} [built]
@ -2894,15 +2937,23 @@ Child development:
[./subfolder/small.js?7] 67 bytes {main~._subfolder_small.js~1} [built]
[./subfolder/small.js?8] 67 bytes {main~._subfolder_small.js~1} [built]
[./subfolder/small.js?9] 67 bytes {main~._subfolder_small.js~1} [built]
chunk {main~._very-big.js~08cf55cf} dev-main~._very-big.js~08cf55cf.js (main~._very-big.js~08cf55cf) 1.57 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered]
chunk {main~._very-big.js~08cf55cf} dev-main~._very-big.js~08cf55cf.js (main~._very-big.js~08cf55cf) 1.57 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= ={vendors~main~._node_modules_b}= ={vendors~main~._node_modules_very-big.js~6bdbed7b}= [initial] [rendered]
> ./ main
[./very-big.js?2] 1.57 KiB {main~._very-big.js~08cf55cf} [built]
chunk {main~._very-big.js~4647fb9d} dev-main~._very-big.js~4647fb9d.js (main~._very-big.js~4647fb9d) 1.57 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~62f7f644}= [initial] [rendered]
chunk {main~._very-big.js~4647fb9d} dev-main~._very-big.js~4647fb9d.js (main~._very-big.js~4647fb9d) 1.57 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~62f7f644}= ={vendors~main~._node_modules_b}= ={vendors~main~._node_modules_very-big.js~6bdbed7b}= [initial] [rendered]
> ./ main
[./very-big.js?3] 1.57 KiB {main~._very-big.js~4647fb9d} [built]
chunk {main~._very-big.js~62f7f644} dev-main~._very-big.js~62f7f644.js (main~._very-big.js~62f7f644) 1.57 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= [entry] [rendered]
chunk {main~._very-big.js~62f7f644} dev-main~._very-big.js~62f7f644.js (main~._very-big.js~62f7f644) 1.57 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={vendors~main~._node_modules_b}= ={vendors~main~._node_modules_very-big.js~6bdbed7b}= [entry] [rendered]
> ./ main
[./very-big.js?1] 1.57 KiB {main~._very-big.js~62f7f644} [built]"
[./very-big.js?1] 1.57 KiB {main~._very-big.js~62f7f644} [built]
chunk {vendors~main~._node_modules_b} dev-vendors~main~._node_modules_b.js (vendors~main~._node_modules_b) 402 bytes ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= ={vendors~main~._node_modules_very-big.js~6bdbed7b}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~main)
> ./ main
[./node_modules/big.js?1] 268 bytes {vendors~main~._node_modules_b} [built]
[./node_modules/small.js?1] 67 bytes {vendors~main~._node_modules_b} [built]
[./node_modules/small.js?2] 67 bytes {vendors~main~._node_modules_b} [built]
chunk {vendors~main~._node_modules_very-big.js~6bdbed7b} dev-vendors~main~._node_modules_very-big.js~6bdbed7b.js (vendors~main~._node_modules_very-big.js~6bdbed7b) 1.57 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= ={vendors~main~._node_modules_b}= [initial] [rendered] split chunk (cache group: vendors) (name: vendors~main)
> ./ main
[./node_modules/very-big.js?1] 1.57 KiB {vendors~main~._node_modules_very-big.js~6bdbed7b} [built]"
`;
exports[`StatsTestCases should print correct stats for split-chunks-prefer-bigger-splits 1`] = `

View File

@ -23,10 +23,9 @@ function testCase(load, done) {
it("should be able to use expressions in import", function(done) {
function load(name, expected, callback) {
import("./dir/" + name).then(function(result) {
expect(result).toEqual({
default: expected,
[Symbol.toStringTag]: "Module"
});
expect(result).toEqual(nsObj({
default: expected
}));
callback();
}).catch(function(err) {
done(err);

View File

@ -1,9 +1,8 @@
it("should be able to use import", function(done) {
import("./two").then(function(two) {
expect(two).toEqual({
default: 2,
[Symbol.toStringTag]: "Module"
});
expect(two).toEqual(nsObj({
default: 2
}));
done();
}).catch(function(err) {
done(err);

View File

@ -110,17 +110,15 @@ function testChunkLoading(load, expectedSyncInitial, expectedSyncRequested) {
sync = true;
var p = Promise.all([
load("a").then(function(a) {
expect(a).toEqual({
default: "a",
[Symbol.toStringTag]: "Module"
});
expect(a).toEqual(nsObj({
default: "a"
}));
expect(sync).toBe(true);
}),
load("c").then(function(c) {
expect(c).toEqual({
default: "c",
[Symbol.toStringTag]: "Module"
});
expect(c).toEqual(nsObj({
default: "c"
}));
expect(sync).toBe(expectedSyncRequested);
})
]);

View File

@ -1,10 +1,9 @@
it("should be able to use expressions in import (directory)", function(done) {
function load(name, expected, callback) {
import("./dir/" + name + "/file.js").then(function(result) {
expect(result).toEqual({
default: expected,
[Symbol.toStringTag]: "Module"
});
expect(result).toEqual(nsObj({
default: expected
}));
callback();
}).catch(function(err) {
done(err);

View File

@ -9,27 +9,23 @@ it("should be possible to import json data async", function() {
import("../data/f.json"),
import("../data/g.json")
]).then(([a, b, c, d, e, f, g]) => {
expect(a).toEqual({
default: null,
[Symbol.toStringTag]: "Module"
});
expect(b).toEqual({
default: 123,
[Symbol.toStringTag]: "Module"
});
expect(c).toEqual({
expect(a).toEqual(nsObj({
default: null
}));
expect(b).toEqual(nsObj({
default: 123
}));
expect(c).toEqual(nsObj({
0: 1,
1: 2,
2: 3,
3: 4,
default: [1, 2, 3, 4],
[Symbol.toStringTag]: "Module"
});
expect(d).toEqual({
default: {},
[Symbol.toStringTag]: "Module"
});
expect(e).toEqual({
default: [1, 2, 3, 4]
}));
expect(d).toEqual(nsObj({
default: {}
}));
expect(e).toEqual(nsObj({
aa: 1,
bb: 2,
1: "x",
@ -37,25 +33,22 @@ it("should be possible to import json data async", function() {
aa: 1,
bb: 2,
"1": "x"
},
[Symbol.toStringTag]: "Module"
});
expect(f).toEqual({
}
}));
expect(f).toEqual(nsObj({
named: "named",
default: {
named: "named",
"default": "default",
__esModule: true
},
[Symbol.toStringTag]: "Module"
});
expect(g).toEqual({
}
}));
expect(g).toEqual(nsObj({
named: {},
default: {
named: {}
},
[Symbol.toStringTag]: "Module"
});
}
}));
expect(g.named).toBe(g.default.named);
});
});

View File

@ -17,33 +17,30 @@ it("should get correct values when importing named exports from a CommonJs modul
default: "default"
}
});
expect(star).toEqual({
expect(star).toEqual(nsObj({
default: {
data: "ok",
default: "default"
},
[Symbol.toStringTag]: "Module"
});
}
}));
expect({ star }).toEqual({
star: {
star: nsObj({
default: {
data: "ok",
default: "default"
},
[Symbol.toStringTag]: "Module"
}
}
})
});
expect(star.default).toEqual({
data: "ok",
default: "default"
});
expect(ns).toEqual({
expect(ns).toEqual(nsObj({
default: {
data: "ok",
default: "default"
},
[Symbol.toStringTag]: "Module"
});
}
}));
expect(def1).toEqual({
data: "ok",
default: "default"
@ -53,14 +50,13 @@ it("should get correct values when importing named exports from a CommonJs modul
default: "default"
});
expect((typeof data2)).toBe("undefined");
expect(reexport).toEqual({
ns: {
expect(reexport).toEqual(nsObj({
ns: nsObj({
default: {
data: "ok",
default: "default"
},
[Symbol.toStringTag]: "Module"
},
}
}),
default: {
data: "ok",
default: "default"
@ -69,7 +65,6 @@ it("should get correct values when importing named exports from a CommonJs modul
data: "ok",
default: "default"
},
data: undefined,
[Symbol.toStringTag]: "Module"
});
data: undefined
}));
});

View File

@ -1,13 +1,13 @@
it("should receive a namespace object when importing commonjs", function(done) {
import("./cjs.js").then(function(result) {
expect(result).toEqual({ default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" });
expect(result).toEqual(nsObj({ default: { named: "named", default: "default" } }));
done();
}).catch(done);
});
it("should receive a namespace object when importing commonjs with __esModule", function(done) {
import("./cjs-esmodule.js").then(function(result) {
expect(result).toEqual({ default: { __esModule: true, named: "named", default: "default" }, [Symbol.toStringTag]: "Module" });
expect(result).toEqual(nsObj({ default: { __esModule: true, named: "named", default: "default" } }));
done();
}).catch(done);
});
@ -60,27 +60,27 @@ function promiseTest(promise, equalsTo) {
it("should receive a namespace object when importing commonjs via context", function() {
return Promise.all([
promiseTest(contextCJS("one"), { default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }),
promiseTest(contextCJS("two"), { default: { __esModule: true, named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }),
promiseTest(contextCJS("three"), { default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }),
promiseTest(contextCJS("null"), { default: null, [Symbol.toStringTag]: "Module" })
promiseTest(contextCJS("one"), nsObj({ default: { named: "named", default: "default" } })),
promiseTest(contextCJS("two"), nsObj({ default: { __esModule: true, named: "named", default: "default" } })),
promiseTest(contextCJS("three"), nsObj({ default: { named: "named", default: "default" } })),
promiseTest(contextCJS("null"), nsObj({ default: null }))
]);
});
it("should receive a namespace object when importing harmony via context", function() {
return Promise.all([
promiseTest(contextHarmony("one"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }),
promiseTest(contextHarmony("two"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }),
promiseTest(contextHarmony("three"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" })
promiseTest(contextHarmony("one"), nsObj({ named: "named", default: "default" })),
promiseTest(contextHarmony("two"), nsObj({ named: "named", default: "default" })),
promiseTest(contextHarmony("three"), nsObj({ named: "named", default: "default" }))
]);
});
it("should receive a namespace object when importing mixed content via context", function() {
return Promise.all([
promiseTest(contextMixed("one"), { default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }),
promiseTest(contextMixed("two"), { default: { __esModule: true, named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }),
promiseTest(contextMixed("three"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }),
promiseTest(contextMixed("null"), { default: null, [Symbol.toStringTag]: "Module" }),
promiseTest(contextMixed("json.json"), { named: "named", default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" })
promiseTest(contextMixed("one"), nsObj({ default: { named: "named", default: "default" } })),
promiseTest(contextMixed("two"), nsObj({ default: { __esModule: true, named: "named", default: "default" } })),
promiseTest(contextMixed("three"), nsObj({ named: "named", default: "default" })),
promiseTest(contextMixed("null"), nsObj({ default: null })),
promiseTest(contextMixed("json.json"), nsObj({ named: "named", default: { named: "named", default: "default" } }))
]);
});

View File

@ -1,6 +1,6 @@
it("should receive a namespace object when importing commonjs", function(done) {
import("./cjs").then(function(result) {
expect(result).toEqual({ named: "named", default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" });
expect(result).toEqual(nsObj({ named: "named", default: { named: "named", default: "default" } }));
done();
}).catch(done);
});
@ -60,27 +60,27 @@ function promiseTest(promise, equalsTo) {
it("should receive a namespace object when importing commonjs via context", function() {
return Promise.all([
promiseTest(contextCJS("one"), { named: "named", default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }),
promiseTest(contextCJS("one"), nsObj({ named: "named", default: { named: "named", default: "default" } })),
promiseTest(contextCJS("two"), { __esModule: true, named: "named", default: "default" }),
promiseTest(contextCJS("three"), { named: "named", default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }),
promiseTest(contextCJS("null"), { default: null, [Symbol.toStringTag]: "Module" })
promiseTest(contextCJS("three"), nsObj({ named: "named", default: { named: "named", default: "default" } })),
promiseTest(contextCJS("null"), nsObj({ default: null }))
]);
});
it("should receive a namespace object when importing harmony via context", function() {
return Promise.all([
promiseTest(contextHarmony("one"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }),
promiseTest(contextHarmony("two"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }),
promiseTest(contextHarmony("three"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" })
promiseTest(contextHarmony("one"), nsObj({ named: "named", default: "default" })),
promiseTest(contextHarmony("two"), nsObj({ named: "named", default: "default" })),
promiseTest(contextHarmony("three"), nsObj({ named: "named", default: "default" }))
]);
});
it("should receive a namespace object when importing mixed content via context", function() {
return Promise.all([
promiseTest(contextMixed("one"), { named: "named", default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" }),
promiseTest(contextMixed("one"), nsObj({ named: "named", default: { named: "named", default: "default" } })),
promiseTest(contextMixed("two"), { __esModule: true, named: "named", default: "default" }),
promiseTest(contextMixed("three"), { named: "named", default: "default", [Symbol.toStringTag]: "Module" }),
promiseTest(contextMixed("null"), { default: null, [Symbol.toStringTag]: "Module" }),
promiseTest(contextMixed("json.json"), { named: "named", default: { named: "named", default: "default" }, [Symbol.toStringTag]: "Module" })
promiseTest(contextMixed("three"), nsObj({ named: "named", default: "default" })),
promiseTest(contextMixed("null"), nsObj({ default: null })),
promiseTest(contextMixed("json.json"), nsObj({ named: "named", default: { named: "named", default: "default" } }))
]);
});

View File

@ -2,5 +2,5 @@ import * as m from "m";
it("should handle unknown exports fine", function() {
var x = m;
expect(x).toEqual({ foo: "foo", [Symbol.toStringTag]: "Module" });
expect(x).toEqual(nsObj({ foo: "foo" }));
});

View File

@ -6,9 +6,8 @@ it("should correctly tree shake star exports", function() {
expect(aa).toBe("aa");
expect(aa2).toBe("aa");
expect(d).toBe("d");
expect(root6).toEqual({
expect(root6).toEqual(nsObj({
aa: "aa",
c: "c",
[Symbol.toStringTag]: "Module"
});
c: "c"
}));
});

View File

@ -1,7 +1,6 @@
it("should result in a warning when using module.exports in harmony module", function() {
var x = require("./module1");
expect(x).toEqual({
default: 1234,
[Symbol.toStringTag]: "Module"
});
expect(x).toEqual(nsObj({
default: 1234
}));
});

View File

@ -1,9 +1,8 @@
it("should support multiple reexports", function() {
expect(require("./x")).toEqual({
expect(require("./x")).toEqual(nsObj({
xa: "a",
xb: "b",
xc: "c",
xd: "d",
[Symbol.toStringTag]: "Module"
});
xd: "d"
}));
});

View File

@ -13,10 +13,9 @@ it("should import into object shorthand", function() {
a: 123,
aa: 123,
b: 456,
c: {
c: nsObj({
a: 123,
default: 456,
[Symbol.toStringTag]: "Module"
}
default: 456
})
});
})

View File

@ -1,4 +1,4 @@
it("should be possible to export default an imported name", function() {
var x = require("./module");
expect(x).toEqual({ default: 1234, [Symbol.toStringTag]: "Module" });
expect(x).toEqual(nsObj({ default: 1234 }));
});

View File

@ -2,7 +2,7 @@ import def from "./module?harmony";
import * as mod from "./module?harmony-start"
it("should export a sequence expression correctly", function() {
expect(require("./module?cjs")).toEqual({ default: 2, [Symbol.toStringTag]: "Module" });
expect(require("./module?cjs")).toEqual(nsObj({ default: 2 }));
expect(def).toBe(2);
expect(mod.default).toBe(2);
});

View File

@ -2,17 +2,15 @@ import { ns as ns1 } from "./module1";
const ns2 = require("./module2").ns;
it("should allow to export a namespace object (concated)", function() {
expect(ns1).toEqual({
expect(ns1).toEqual(nsObj({
a: "a",
b: "b",
[Symbol.toStringTag]: "Module"
});
b: "b"
}));
});
it("should allow to export a namespace object (exposed)", function() {
expect(ns2).toEqual({
expect(ns2).toEqual(nsObj({
a: "a",
b: "b",
[Symbol.toStringTag]: "Module"
});
b: "b"
}));
});

View File

@ -1,14 +1,13 @@
var testData = require("./src/index.js");
it("should export the correct values", function() {
expect(testData).toEqual({
icon: {
svg: {
default: 1,
[Symbol.toStringTag]: "Module"
},
[Symbol.toStringTag]: "Module"
},
[Symbol.toStringTag]: "Module"
});
expect(testData).toEqual(
nsObj({
icon: nsObj({
svg: nsObj({
default: 1
})
})
})
);
});

View File

@ -1,31 +1,28 @@
var testData = require("./src/index.js");
it("should export the correct values", function() {
expect(testData).toEqual({
svg5: {
svg: {
clinical1: {
svg1: 1
},
clinical2: {
svg2: 2
},
[Symbol.toStringTag]: "Module"
},
[Symbol.toStringTag]: "Module"
},
svg6: {
svg: {
test: {
svg1: 10
},
clinical2: {
svg2: 20
},
[Symbol.toStringTag]: "Module"
},
[Symbol.toStringTag]: "Module"
},
[Symbol.toStringTag]: "Module"
});
expect(testData).toEqual(
nsObj({
svg5: nsObj({
svg: nsObj({
clinical1: {
svg1: 1
},
clinical2: {
svg2: 2
}
})
}),
svg6: nsObj({
svg: nsObj({
test: {
svg1: 10
},
clinical2: {
svg2: 20
}
})
})
})
);
})

View File

@ -1,9 +1,8 @@
import { module } from "./reexport";
it("should have the correct values", function() {
expect(module).toEqual({
expect(module).toEqual(nsObj({
default: "default",
named: "named",
[Symbol.toStringTag]: "Module"
});
named: "named"
}));
});

View File

@ -2,9 +2,8 @@ import './example'
it("should run correctly", function() {
return import('./lazy').then(lazy => {
expect(lazy.default()).toEqual({
hello: "world",
[Symbol.toStringTag]: "Module"
});
expect(lazy.default()).toEqual(nsObj({
hello: "world"
}));
})
});

View File

@ -0,0 +1,7 @@
import array from "./tracker";
import { b } from "./module";
it("should evaulate modules in the correct order", () => {
expect(b).toEqual("b");
expect(array).toEqual(["b", "a"]);
})

View File

@ -0,0 +1,5 @@
import array from "../tracker";
array.push("a");
export default "a";

View File

@ -0,0 +1,5 @@
import array from "../tracker";
array.push("b");
export default "b";

View File

@ -0,0 +1,4 @@
import b from './b';
import './a';
export { b };

View File

@ -0,0 +1,6 @@
{
"sideEffects": [
"./index.js",
"./a.js"
]
}

View File

@ -0,0 +1 @@
export default [];

View File

@ -1,6 +1,6 @@
it("should replace a async context with a manual map", function() {
var a = "a";
return import(a).then(function(a) {
expect(a).toEqual({ default: "b", [Symbol.toStringTag]: "Module" });
expect(a).toEqual(nsObj({ default: "b" }));
});
});

View File

@ -1,7 +1,7 @@
import Answer, { bar } from "dll/index";
it("should load a module from dll", function() {
expect(require("dll/index")).toEqual({ bar: "bar", default: 42, [Symbol.toStringTag]: "Module" });
expect(require("dll/index")).toEqual(nsObj({ bar: "bar", default: 42 }));
});
it("should load an harmony module from dll (default export)", function() {

View File

@ -12,7 +12,7 @@ it("should load a module of non-default type without extension from dll", functi
it("should load an async module from dll", function(done) {
require("dll/b")().then(function(c) {
expect(c).toEqual({ default: "c", [Symbol.toStringTag]: "Module" });
expect(c).toEqual(nsObj({ default: "c" }));
done();
}).catch(done);
});

View File

@ -12,7 +12,7 @@ it("should load a module of non-default type without extension from dll", functi
it("should load an async module from dll", function(done) {
require("../0-create-dll/b")().then(function(c) {
expect(c).toEqual({ default: "c", [Symbol.toStringTag]: "Module" });
expect(c).toEqual(nsObj({ default: "c" }));
done();
}).catch(done);
});

View File

@ -8,7 +8,7 @@ it("should load a module from dll", function() {
it("should load an async module from dll", function(done) {
require("../0-create-dll/b")().then(function(c) {
expect(c).toEqual({ default: "c", [Symbol.toStringTag]: "Module" });
expect(c).toEqual(nsObj({ default: "c" }));
done();
}).catch(done);
});

View File

@ -22,7 +22,7 @@ it("should be able to use System.import()", done => {
if(__SYSTEM__ === false) {
done(new Error("System.import should not be parsed"));
} else {
expect(mod).toEqual({ default: "ok", [Symbol.toStringTag]: "Module" });
expect(mod).toEqual(nsObj({ default: "ok" }));
done();
}
});

View File

@ -0,0 +1 @@
it("should compile successfully when output.library.root is an array of strings", function () { });

View File

@ -0,0 +1,11 @@
module.exports = {
devtool: "source-map",
output: {
library: {
root: ["Foo", "[name]"],
amd: "[name]",
commonjs: "[name]"
},
libraryTarget: "umd"
}
};

View File

@ -23,10 +23,9 @@ function testCase(load, done) {
it("should be able to use expressions in import", function(done) {
function load(name, expected, callback) {
import("./dir/" + name + '.js')
.then((result) => {expect(result).toEqual({
default: expected,
[Symbol.toStringTag]: "Module"
}); callback()})
.then((result) => {expect(result).toEqual(nsObj({
default: expected
})); callback()})
.catch((err) => {done(err)});
}
testCase(load, done);
@ -35,10 +34,9 @@ it("should be able to use expressions in import", function(done) {
it("should be able to use expressions in lazy-once import", function(done) {
function load(name, expected, callback) {
import(/* webpackMode: "lazy-once" */ "./dir/" + name + '.js')
.then((result) => {expect(result).toEqual({
default: expected,
[Symbol.toStringTag]: "Module"
}); callback()})
.then((result) => {expect(result).toEqual(nsObj({
default: expected
})); callback()})
.catch((err) => {done(err)});
}
testCase(load, done);
@ -47,10 +45,9 @@ it("should be able to use expressions in lazy-once import", function(done) {
it("should be able to use expressions in import", function(done) {
function load(name, expected, callback) {
import("./dir2/" + name).then((result) => {
expect(result).toEqual({
default: expected,
[Symbol.toStringTag]: "Module"
});
expect(result).toEqual(nsObj({
default: expected
}));
callback();
}).catch((err) => {
done(err);
@ -65,10 +62,9 @@ it("should convert to function in node", function() {
it("should be able to use import", function(done) {
import("./two").then((two) => {
expect(two).toEqual({
default: 2,
[Symbol.toStringTag]: "Module"
});
expect(two).toEqual(nsObj({
default: 2
}));
done();
}).catch(function(err) {
done(err);

View File

@ -1,16 +1,14 @@
var x = require("./module");
it("should allow to hot replace modules in a ConcatenatedModule", (done) => {
expect(x).toEqual({
default: "ok1",
[Symbol.toStringTag]: "Module"
});
expect(x).toEqual(nsObj({
default: "ok1"
}));
module.hot.accept("./module", () => {
x = require("./module");
expect(x).toEqual({
default: "ok2",
[Symbol.toStringTag]: "Module"
});
expect(x).toEqual(nsObj({
default: "ok2"
}));
done();
});
NEXT(require("../../update")(done));

View File

@ -0,0 +1,5 @@
import "./d";
import "./e";
import "x";
import "y";
export default "a";

View File

@ -0,0 +1,5 @@
import "./d";
import "./f";
import "x";
import "y";
export default "b";

View File

@ -0,0 +1,5 @@
import "./d";
import "./f";
import "x";
import "z";
export default "c";

View File

@ -0,0 +1 @@
export default "d";

View File

@ -0,0 +1 @@
export default "e";

View File

@ -0,0 +1 @@
export default "f";

View File

@ -0,0 +1,3 @@
import(/* webpackChunkName: "async-a" */ "./a");
import(/* webpackChunkName: "async-b" */ "./b");
import(/* webpackChunkName: "async-c" */ "./c");

View File

@ -0,0 +1 @@
export default "x";

Some files were not shown because too many files have changed in this diff Show More