mirror of https://github.com/webpack/webpack.git
commit
7bde43f47a
|
@ -257,6 +257,8 @@ declare module "webpack-sources" {
|
|||
updateHash(hash: import("./lib/util/Hash")): void;
|
||||
|
||||
source(): string | Buffer;
|
||||
|
||||
buffer(): Buffer;
|
||||
}
|
||||
|
||||
export class RawSource extends Source {
|
||||
|
|
|
@ -1016,7 +1016,10 @@ export interface OptimizationSplitChunksOptions {
|
|||
*/
|
||||
filename?:
|
||||
| string
|
||||
| ((pathData: import("../lib/Compilation").PathData) => string);
|
||||
| ((
|
||||
pathData: import("../lib/Compilation").PathData,
|
||||
assetInfo?: import("../lib/Compilation").AssetInfo
|
||||
) => string);
|
||||
/**
|
||||
* Prevents exposing path info when creating names for parts splitted by maxSize
|
||||
*/
|
||||
|
@ -1082,7 +1085,10 @@ export interface OptimizationSplitChunksCacheGroup {
|
|||
*/
|
||||
filename?:
|
||||
| string
|
||||
| ((pathData: import("../lib/Compilation").PathData) => string);
|
||||
| ((
|
||||
pathData: import("../lib/Compilation").PathData,
|
||||
assetInfo?: import("../lib/Compilation").AssetInfo
|
||||
) => string);
|
||||
/**
|
||||
* Sets the hint for chunk id
|
||||
*/
|
||||
|
@ -1150,7 +1156,10 @@ export interface OutputOptions {
|
|||
*/
|
||||
assetModuleFilename?:
|
||||
| string
|
||||
| ((pathData: import("../lib/Compilation").PathData) => string);
|
||||
| ((
|
||||
pathData: import("../lib/Compilation").PathData,
|
||||
assetInfo?: import("../lib/Compilation").AssetInfo
|
||||
) => string);
|
||||
/**
|
||||
* Add a comment in the UMD wrapper.
|
||||
*/
|
||||
|
@ -1211,7 +1220,10 @@ export interface OutputOptions {
|
|||
*/
|
||||
filename?:
|
||||
| string
|
||||
| ((pathData: import("../lib/Compilation").PathData) => string);
|
||||
| ((
|
||||
pathData: import("../lib/Compilation").PathData,
|
||||
assetInfo?: import("../lib/Compilation").AssetInfo
|
||||
) => string);
|
||||
/**
|
||||
* An expression which is used to address the global object/scope in runtime code
|
||||
*/
|
||||
|
|
|
@ -91,10 +91,9 @@ class BannerPlugin {
|
|||
|
||||
const comment = compilation.getPath(banner, data);
|
||||
|
||||
compilation.assets[file] = new ConcatSource(
|
||||
comment,
|
||||
"\n",
|
||||
compilation.assets[file]
|
||||
compilation.updateAsset(
|
||||
file,
|
||||
old => new ConcatSource(comment, "\n", old)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ const { createArrayToSetDeprecationSet } = require("./util/deprecation");
|
|||
/** @typedef {import("./ChunkGraph").ModuleFilterPredicate} ModuleFilterPredicate */
|
||||
/** @typedef {import("./ChunkGroup")} ChunkGroup */
|
||||
/** @typedef {import("./Compilation")} Compilation */
|
||||
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
|
||||
/** @typedef {import("./Compilation").PathData} PathData */
|
||||
/** @typedef {import("./Module")} Module */
|
||||
/** @typedef {import("./ModuleGraph")} ModuleGraph */
|
||||
|
@ -73,7 +74,7 @@ class Chunk {
|
|||
this.idNameHints = new SortableSet();
|
||||
/** @type {boolean} */
|
||||
this.preventIntegration = false;
|
||||
/** @type {(string | function(PathData): string)?} */
|
||||
/** @type {(string | function(PathData, AssetInfo=): string)?} */
|
||||
this.filenameTemplate = undefined;
|
||||
/** @private @type {SortableSet<ChunkGroup>} */
|
||||
this._groups = new SortableSet(undefined, sortChunkGroupById);
|
||||
|
|
|
@ -134,6 +134,21 @@ const { arrayToSetDeprecation } = require("./util/deprecation");
|
|||
* @property {string[]=} trace
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} AssetInfo
|
||||
* @property {boolean=} immutable true, if the asset can be long term cached forever (contains a hash)
|
||||
* @property {number=} size size in bytes, only set after asset has been emitted
|
||||
* @property {boolean=} development true, when asset is only used for development and doesn't count towards user-facing assets
|
||||
* @property {boolean=} hotModuleReplacement true, when asset ships data for updating an existing application (HMR)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} Asset
|
||||
* @property {string} name the filename of the asset
|
||||
* @property {Source} source source of the asset
|
||||
* @property {AssetInfo} info info about the asset
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ModulePathData
|
||||
* @property {string|number} id
|
||||
|
@ -507,6 +522,8 @@ class Compilation {
|
|||
this.additionalChunkAssets = [];
|
||||
/** @type {CompilationAssets} */
|
||||
this.assets = {};
|
||||
/** @type {Map<string, AssetInfo>} */
|
||||
this.assetsInfo = new Map();
|
||||
/** @type {WebpackError[]} */
|
||||
this.errors = [];
|
||||
/** @type {WebpackError[]} */
|
||||
|
@ -1275,6 +1292,7 @@ class Compilation {
|
|||
this.entrypoints.clear();
|
||||
this.additionalChunkAssets.length = 0;
|
||||
this.assets = {};
|
||||
this.assetsInfo.clear();
|
||||
this.moduleGraph.removeAllModuleAttributes();
|
||||
}
|
||||
|
||||
|
@ -1985,6 +2003,89 @@ class Compilation {
|
|||
this.hash = this.fullHash.substr(0, hashDigestLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} file file name
|
||||
* @param {Source} source asset source
|
||||
* @param {AssetInfo} assetInfo extra asset information
|
||||
* @returns {void}
|
||||
*/
|
||||
emitAsset(file, source, assetInfo = {}) {
|
||||
if (this.assets[file]) {
|
||||
if (this.assets[file] !== source) {
|
||||
throw new Error(
|
||||
`Conflict: Multiple assets emit to the same filename ${file}`
|
||||
);
|
||||
}
|
||||
const oldInfo = this.assetsInfo.get(file);
|
||||
this.assetsInfo.set(file, Object.assign({}, oldInfo, assetInfo));
|
||||
return;
|
||||
}
|
||||
this.assets[file] = source;
|
||||
this.assetsInfo.set(file, assetInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} file file name
|
||||
* @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new
|
||||
* @param {AssetInfo | function(AssetInfo | undefined): AssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new
|
||||
*/
|
||||
updateAsset(
|
||||
file,
|
||||
newSourceOrFunction,
|
||||
assetInfoUpdateOrFunction = undefined
|
||||
) {
|
||||
if (!this.assets[file]) {
|
||||
throw new Error(
|
||||
`Called Compilation.updateAsset for not existing filename ${file}`
|
||||
);
|
||||
}
|
||||
if (typeof newSourceOrFunction === "function") {
|
||||
this.assets[file] = newSourceOrFunction(this.assets[file]);
|
||||
} else {
|
||||
this.assets[file] = newSourceOrFunction;
|
||||
}
|
||||
if (assetInfoUpdateOrFunction !== undefined) {
|
||||
const oldInfo = this.assetsInfo.get(file);
|
||||
if (typeof assetInfoUpdateOrFunction === "function") {
|
||||
this.assetsInfo.set(file, assetInfoUpdateOrFunction(oldInfo || {}));
|
||||
} else {
|
||||
this.assetsInfo.set(
|
||||
file,
|
||||
Object.assign({}, oldInfo, assetInfoUpdateOrFunction)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getAssets() {
|
||||
/** @type {Asset[]} */
|
||||
const array = [];
|
||||
for (const assetName of Object.keys(this.assets)) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.assets, assetName)) {
|
||||
array.push({
|
||||
name: assetName,
|
||||
source: this.assets[assetName],
|
||||
info: this.assetsInfo.get(assetName) || {}
|
||||
});
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name the name of the asset
|
||||
* @returns {Asset | undefined} the asset or undefined when not found
|
||||
*/
|
||||
getAsset(name) {
|
||||
if (!Object.prototype.hasOwnProperty.call(this.assets, name))
|
||||
return undefined;
|
||||
return {
|
||||
name,
|
||||
source: this.assets[name],
|
||||
info: this.assetsInfo.get(name) || {}
|
||||
};
|
||||
}
|
||||
|
||||
clearAssets() {
|
||||
for (const chunk of this.chunks) {
|
||||
chunk.files.clear();
|
||||
|
@ -1996,6 +2097,7 @@ class Compilation {
|
|||
const { chunkGraph } = this;
|
||||
for (const module of this.modules) {
|
||||
if (module.buildInfo.assets) {
|
||||
const assetsInfo = module.buildInfo.assetsInfo;
|
||||
for (const assetName of Object.keys(module.buildInfo.assets)) {
|
||||
const fileName = this.getPath(assetName, {
|
||||
chunkGraph: this.chunkGraph,
|
||||
|
@ -2004,7 +2106,11 @@ class Compilation {
|
|||
for (const chunk of chunkGraph.getModuleChunksIterable(module)) {
|
||||
chunk.auxiliaryFiles.add(fileName);
|
||||
}
|
||||
this.assets[fileName] = module.buildInfo.assets[assetName];
|
||||
this.emitAsset(
|
||||
fileName,
|
||||
module.buildInfo.assets[assetName],
|
||||
assetsInfo ? assetsInfo.get(assetName) : undefined
|
||||
);
|
||||
this.hooks.moduleAsset.call(module, fileName);
|
||||
}
|
||||
}
|
||||
|
@ -2053,7 +2159,7 @@ class Compilation {
|
|||
const usedHash = fileManifest.hash;
|
||||
|
||||
this.cache.get(cacheName, usedHash, (err, sourceFromCache) => {
|
||||
/** @type {string | function(PathData): string} */
|
||||
/** @type {string | function(PathData, AssetInfo=): string} */
|
||||
let filenameTemplate;
|
||||
/** @type {string} */
|
||||
let file;
|
||||
|
@ -2073,7 +2179,12 @@ class Compilation {
|
|||
|
||||
try {
|
||||
filenameTemplate = fileManifest.filenameTemplate;
|
||||
file = this.getPath(filenameTemplate, fileManifest.pathOptions);
|
||||
const pathAndInfo = this.getPathWithInfo(
|
||||
filenameTemplate,
|
||||
fileManifest.pathOptions
|
||||
);
|
||||
file = pathAndInfo.path;
|
||||
const assetInfo = pathAndInfo.info;
|
||||
|
||||
if (err) {
|
||||
return errorAndCallback(err);
|
||||
|
@ -2111,18 +2222,7 @@ class Compilation {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (this.assets[file] && this.assets[file] !== source) {
|
||||
inTry = false;
|
||||
return callback(
|
||||
new WebpackError(
|
||||
`Conflict: Rendering chunk ${chunk.id} ` +
|
||||
`emits to the filename ${file} ` +
|
||||
"which was already written to by something else " +
|
||||
"(but not another chunk)"
|
||||
)
|
||||
);
|
||||
}
|
||||
this.assets[file] = source;
|
||||
this.emitAsset(file, source, assetInfo);
|
||||
if (fileManifest.auxiliary) {
|
||||
chunk.auxiliaryFiles.add(file);
|
||||
} else {
|
||||
|
@ -2157,7 +2257,7 @@ class Compilation {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {string | function(PathData): string} filename used to get asset path with hash
|
||||
* @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash
|
||||
* @param {PathData} data context data
|
||||
* @returns {string} interpolated path
|
||||
*/
|
||||
|
@ -2171,6 +2271,17 @@ class Compilation {
|
|||
return this.mainTemplate.getAssetPath(filename, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | function(PathData, AssetInfo=): string} filename used to get asset path with hash
|
||||
* @param {PathData} data context data
|
||||
* @returns {{ path: string, info: AssetInfo }} interpolated path and asset info
|
||||
*/
|
||||
getPathWithInfo(filename, data) {
|
||||
data = data || {};
|
||||
data.hash = data.hash || this.hash;
|
||||
return this.mainTemplate.getAssetPathWithInfo(filename, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function allows you to run another instance of webpack inside of webpack however as
|
||||
* a child with different settings and configurations (if desired) applied. It copies all hooks, plugins
|
||||
|
|
|
@ -378,8 +378,8 @@ class Compiler {
|
|||
if (err) return callback(err);
|
||||
|
||||
this.parentCompilation.children.push(compilation);
|
||||
for (const name of Object.keys(compilation.assets)) {
|
||||
this.parentCompilation.assets[name] = compilation.assets[name];
|
||||
for (const { name, source, info } of compilation.getAssets()) {
|
||||
this.parentCompilation.emitAsset(name, source, info);
|
||||
}
|
||||
|
||||
const entries = Array.from(
|
||||
|
@ -411,9 +411,9 @@ class Compiler {
|
|||
if (err) return callback(err);
|
||||
|
||||
asyncLib.forEachLimit(
|
||||
compilation.assets,
|
||||
compilation.getAssets(),
|
||||
15,
|
||||
(source, file, callback) => {
|
||||
({ name: file, source }, callback) => {
|
||||
let targetFile = file;
|
||||
const queryStringIdx = targetFile.indexOf("?");
|
||||
if (queryStringIdx >= 0) {
|
||||
|
@ -451,10 +451,18 @@ class Compiler {
|
|||
// if yes, we skip writing the file
|
||||
// as it's already there
|
||||
// (we assume one doesn't remove files while the Compiler is running)
|
||||
|
||||
compilation.updateAsset(file, cacheEntry.sizeOnlySource, {
|
||||
size: cacheEntry.sizeOnlySource.size()
|
||||
});
|
||||
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO webpack 5: if info.immutable check if file already exists in output
|
||||
// skip emitting if it's already there
|
||||
|
||||
// get the binary (Buffer) content from the Source
|
||||
/** @type {Buffer} */
|
||||
let content;
|
||||
|
@ -473,7 +481,9 @@ class Compiler {
|
|||
// This allows to GC all memory allocated by the Source
|
||||
// (expect when the Source is stored in any other cache)
|
||||
cacheEntry.sizeOnlySource = new SizeOnlySource(content.length);
|
||||
compilation.assets[file] = cacheEntry.sizeOnlySource;
|
||||
compilation.updateAsset(file, cacheEntry.sizeOnlySource, {
|
||||
size: content.length
|
||||
});
|
||||
|
||||
// Write the file to output file system
|
||||
this.outputFileSystem.writeFile(targetPath, content, err => {
|
||||
|
|
|
@ -350,13 +350,19 @@ class HotModuleReplacementPlugin {
|
|||
chunkGraph
|
||||
});
|
||||
for (const entry of renderManifest) {
|
||||
const filename = compilation.getPath(
|
||||
const {
|
||||
path: filename,
|
||||
info: assetInfo
|
||||
} = compilation.getPathWithInfo(
|
||||
entry.filenameTemplate,
|
||||
entry.pathOptions
|
||||
);
|
||||
const source = entry.render();
|
||||
compilation.additionalChunkAssets.push(filename);
|
||||
compilation.assets[filename] = source;
|
||||
compilation.emitAsset(filename, source, {
|
||||
hotModuleReplacement: true,
|
||||
...assetInfo
|
||||
});
|
||||
currentChunk.files.add(filename);
|
||||
compilation.hooks.chunkAsset.call(currentChunk, filename);
|
||||
}
|
||||
|
@ -370,10 +376,16 @@ class HotModuleReplacementPlugin {
|
|||
}
|
||||
hotUpdateMainContent.m = Array.from(allRemovedModules);
|
||||
const source = new RawSource(JSON.stringify(hotUpdateMainContent));
|
||||
const filename = compilation.getPath(hotUpdateMainFilename, {
|
||||
const {
|
||||
path: filename,
|
||||
info: assetInfo
|
||||
} = compilation.getPathWithInfo(hotUpdateMainFilename, {
|
||||
hash: records.hash
|
||||
});
|
||||
compilation.assets[filename] = source;
|
||||
compilation.emitAsset(filename, source, {
|
||||
hotModuleReplacement: true,
|
||||
...assetInfo
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ const defaultParserOptions = {
|
|||
onComment: null
|
||||
};
|
||||
|
||||
// regexp to match at lease one "magic comment"
|
||||
// regexp to match at least one "magic comment"
|
||||
const webpackCommentRegExp = new RegExp(/(^|\W)webpack[A-Z]{1,}[A-Za-z]{1,}:/);
|
||||
|
||||
const EMPTY_COMMENT_OPTIONS = {
|
||||
|
|
|
@ -19,6 +19,7 @@ const Template = require("./Template");
|
|||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("./ModuleTemplate")} ModuleTemplate */
|
||||
/** @typedef {import("./Chunk")} Chunk */
|
||||
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
|
||||
/** @typedef {import("./Module")} Module} */
|
||||
/** @typedef {import("./util/Hash")} Hash} */
|
||||
/** @typedef {import("./DependencyTemplates")} DependencyTemplates} */
|
||||
|
@ -107,8 +108,8 @@ module.exports = class MainTemplate {
|
|||
"hash",
|
||||
"moduleIdExpression"
|
||||
]),
|
||||
/** @type {SyncWaterfallHook<[string, object]>} */
|
||||
assetPath: new SyncWaterfallHook(["path", "options"]),
|
||||
/** @type {SyncWaterfallHook<[string, object, AssetInfo]>} */
|
||||
assetPath: new SyncWaterfallHook(["path", "options", "assetInfo"]),
|
||||
/** @type {SyncHook<[Hash]>} */
|
||||
hash: new SyncHook(["hash"]),
|
||||
/** @type {SyncHook<[Hash, Chunk]>} */
|
||||
|
@ -404,12 +405,20 @@ module.exports = class MainTemplate {
|
|||
getPublicPath(options) {
|
||||
return this.hooks.assetPath.call(
|
||||
this.outputOptions.publicPath || "",
|
||||
options
|
||||
options,
|
||||
undefined
|
||||
);
|
||||
}
|
||||
|
||||
getAssetPath(path, options) {
|
||||
return this.hooks.assetPath.call(path, options);
|
||||
return this.hooks.assetPath.call(path, options, undefined);
|
||||
}
|
||||
|
||||
getAssetPathWithInfo(path, options) {
|
||||
const assetInfo = {};
|
||||
// TODO webpack 5: refactor assetPath hook to receive { path, info } object
|
||||
const newPath = this.hooks.assetPath.call(path, options, assetInfo);
|
||||
return { path: newPath, info: assetInfo };
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -301,15 +301,17 @@ class NormalModule extends Module {
|
|||
}
|
||||
};
|
||||
},
|
||||
emitFile: (name, content, sourceMap) => {
|
||||
emitFile: (name, content, sourceMap, assetInfo) => {
|
||||
if (!this.buildInfo.assets) {
|
||||
this.buildInfo.assets = Object.create(null);
|
||||
this.buildInfo.assetsInfo = new Map();
|
||||
}
|
||||
this.buildInfo.assets[name] = this.createSourceForAsset(
|
||||
name,
|
||||
content,
|
||||
sourceMap
|
||||
);
|
||||
this.buildInfo.assetsInfo.set(name, assetInfo);
|
||||
},
|
||||
rootContext: options.context,
|
||||
webpack: true,
|
||||
|
@ -564,7 +566,8 @@ class NormalModule extends Module {
|
|||
contextDependencies: undefined,
|
||||
missingDependencies: undefined,
|
||||
hash: undefined,
|
||||
assets: undefined
|
||||
assets: undefined,
|
||||
assetsInfo: undefined
|
||||
};
|
||||
|
||||
return this.doBuild(options, compilation, resolver, fs, err => {
|
||||
|
|
|
@ -164,14 +164,20 @@ class SourceMapDevToolPlugin {
|
|||
/** @type {SourceMapTask[]} */
|
||||
const tasks = [];
|
||||
files.forEach((file, idx) => {
|
||||
const asset = compilation.assets[file];
|
||||
const asset = compilation.getAsset(file).source;
|
||||
const cache = assetsCache.get(asset);
|
||||
/**
|
||||
* If presented in cache, reassigns assets. Cache assets already have source maps.
|
||||
*/
|
||||
if (cache && cache.file === file) {
|
||||
for (const cachedFile in cache.assets) {
|
||||
compilation.assets[cachedFile] = cache.assets[cachedFile];
|
||||
if (cachedFile === file) {
|
||||
compilation.updateAsset(cachedFile, cache.assets[cachedFile]);
|
||||
} else {
|
||||
compilation.emitAsset(cachedFile, cache.assets[cachedFile], {
|
||||
development: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Add file to chunk, if not presented there
|
||||
*/
|
||||
|
@ -338,20 +344,24 @@ class SourceMapDevToolPlugin {
|
|||
* Add source map url to compilation asset, if {@link currentSourceMappingURLComment} presented
|
||||
*/
|
||||
if (currentSourceMappingURLComment !== false) {
|
||||
assets[file] = compilation.assets[file] = new ConcatSource(
|
||||
const asset = new ConcatSource(
|
||||
new RawSource(source),
|
||||
compilation.getPath(
|
||||
currentSourceMappingURLComment,
|
||||
Object.assign({ url: sourceMapUrl }, pathParams)
|
||||
)
|
||||
);
|
||||
assets[file] = asset;
|
||||
compilation.updateAsset(file, asset);
|
||||
}
|
||||
/**
|
||||
* Add source map file to compilation assets and chunk files
|
||||
*/
|
||||
assets[sourceMapFile] = compilation.assets[
|
||||
sourceMapFile
|
||||
] = new RawSource(sourceMapString);
|
||||
const asset = new RawSource(sourceMapString);
|
||||
assets[sourceMapFile] = asset;
|
||||
compilation.emitAsset(sourceMapFile, asset, {
|
||||
development: true
|
||||
});
|
||||
if (chunk !== undefined) chunk.auxiliaryFiles.add(sourceMapFile);
|
||||
} else {
|
||||
if (currentSourceMappingURLComment === false) {
|
||||
|
@ -362,7 +372,7 @@ class SourceMapDevToolPlugin {
|
|||
/**
|
||||
* Add source map as data url to asset
|
||||
*/
|
||||
assets[file] = compilation.assets[file] = new ConcatSource(
|
||||
const asset = new ConcatSource(
|
||||
new RawSource(source),
|
||||
currentSourceMappingURLComment
|
||||
.replace(/\[map\]/g, () => sourceMapString)
|
||||
|
@ -375,6 +385,8 @@ class SourceMapDevToolPlugin {
|
|||
).toString("base64")}`
|
||||
)
|
||||
);
|
||||
assets[file] = asset;
|
||||
compilation.updateAsset(file, asset);
|
||||
}
|
||||
});
|
||||
reportProgress(1.0);
|
||||
|
|
|
@ -16,6 +16,7 @@ const {
|
|||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("./Chunk")} Chunk */
|
||||
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
|
||||
/** @typedef {import("./Compilation").PathData} PathData */
|
||||
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
|
||||
/** @typedef {import("./Module")} Module */
|
||||
|
@ -53,7 +54,7 @@ const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g;
|
|||
/**
|
||||
* @typedef {Object} RenderManifestEntry
|
||||
* @property {function(): Source} render
|
||||
* @property {string | function(PathData): string} filenameTemplate
|
||||
* @property {string | function(PathData, AssetInfo=): string} filenameTemplate
|
||||
* @property {PathData=} pathOptions
|
||||
* @property {string} identifier
|
||||
* @property {string=} hash
|
||||
|
|
|
@ -9,6 +9,7 @@ const { basename, extname } = require("path");
|
|||
const util = require("util");
|
||||
const Module = require("./Module");
|
||||
|
||||
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
|
||||
/** @typedef {import("./Compilation").PathData} PathData */
|
||||
/** @typedef {import("./Compiler")} Compiler */
|
||||
|
||||
|
@ -28,8 +29,9 @@ const prepareId = id => {
|
|||
return id.replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_");
|
||||
};
|
||||
|
||||
const hashLength = (replacer, handler) => {
|
||||
const hashLength = (replacer, handler, assetInfo) => {
|
||||
const fn = (match, arg, input) => {
|
||||
if (assetInfo) assetInfo.immutable = true;
|
||||
const length = arg && parseInt(arg, 10);
|
||||
|
||||
if (length && handler) {
|
||||
|
@ -77,11 +79,12 @@ const deprecated = (fn, message) => {
|
|||
};
|
||||
|
||||
/**
|
||||
* @param {string | function(PathData): string} path the raw path
|
||||
* @param {string | function(PathData, AssetInfo=): string} path the raw path
|
||||
* @param {PathData} data context data
|
||||
* @param {AssetInfo} assetInfo extra info about the asset (will be written to)
|
||||
* @returns {string} the interpolated path
|
||||
*/
|
||||
const replacePathVariables = (path, data) => {
|
||||
const replacePathVariables = (path, data, assetInfo) => {
|
||||
const chunkGraph = data.chunkGraph;
|
||||
|
||||
/** @type {Map<string, Function>} */
|
||||
|
@ -141,7 +144,11 @@ const replacePathVariables = (path, data) => {
|
|||
//
|
||||
// [hash] - data.hash (3a4b5c6e7f)
|
||||
if (data.hash) {
|
||||
const hashReplacer = hashLength(replacer(data.hash), data.hashWithLength);
|
||||
const hashReplacer = hashLength(
|
||||
replacer(data.hash),
|
||||
data.hashWithLength,
|
||||
assetInfo
|
||||
);
|
||||
|
||||
replacements.set("fullhash", hashReplacer);
|
||||
|
||||
|
@ -172,7 +179,8 @@ const replacePathVariables = (path, data) => {
|
|||
const nameReplacer = replacer(chunk.name || chunk.id);
|
||||
const chunkhashReplacer = hashLength(
|
||||
replacer(chunk.renderedHash || chunk.hash),
|
||||
"hashWithLength" in chunk ? chunk.hashWithLength : undefined
|
||||
"hashWithLength" in chunk ? chunk.hashWithLength : undefined,
|
||||
assetInfo
|
||||
);
|
||||
const contenthashReplacer = hashLength(
|
||||
replacer(
|
||||
|
@ -184,7 +192,8 @@ const replacePathVariables = (path, data) => {
|
|||
data.contentHashWithLength ||
|
||||
("contentHashWithLength" in chunk && chunk.contentHashWithLength
|
||||
? chunk.contentHashWithLength[contentHashType]
|
||||
: undefined)
|
||||
: undefined),
|
||||
assetInfo
|
||||
);
|
||||
|
||||
replacements.set("id", idReplacer);
|
||||
|
@ -218,7 +227,8 @@ const replacePathVariables = (path, data) => {
|
|||
? chunkGraph.getRenderedModuleHash(module)
|
||||
: module.renderedHash || module.hash
|
||||
),
|
||||
"hashWithLength" in module ? module.hashWithLength : undefined
|
||||
"hashWithLength" in module ? module.hashWithLength : undefined,
|
||||
assetInfo
|
||||
);
|
||||
|
||||
replacements.set("id", idReplacer);
|
||||
|
@ -240,7 +250,7 @@ const replacePathVariables = (path, data) => {
|
|||
}
|
||||
|
||||
if (typeof path === "function") {
|
||||
path = path(data);
|
||||
path = path(data, assetInfo);
|
||||
}
|
||||
|
||||
path = path.replace(REGEXP, (match, content) => {
|
||||
|
|
|
@ -32,14 +32,14 @@ const LogType = Object.freeze({
|
|||
|
||||
exports.LogType = LogType;
|
||||
|
||||
/** @typedef {LogType} LogTypeEnum */
|
||||
/** @typedef {keyof LogType} LogTypeEnum */
|
||||
|
||||
const LOG_SYMBOL = Symbol("webpack logger raw log method");
|
||||
const TIMERS_SYMBOL = Symbol("webpack logger times");
|
||||
|
||||
class WebpackLogger {
|
||||
/**
|
||||
* @param {function(LogType, any[]=): void} log log function
|
||||
* @param {function(LogTypeEnum, any[]=): void} log log function
|
||||
*/
|
||||
constructor(log) {
|
||||
this[LOG_SYMBOL] = log;
|
||||
|
|
|
@ -47,7 +47,8 @@ const filterToFunction = item => {
|
|||
};
|
||||
|
||||
/**
|
||||
* @enum {number} */
|
||||
* @enum {number}
|
||||
*/
|
||||
const LogLevel = {
|
||||
none: 6,
|
||||
false: 6,
|
||||
|
|
|
@ -602,6 +602,14 @@ class ConcatenatedModule extends Module {
|
|||
}
|
||||
Object.assign(this.buildInfo.assets, m.buildInfo.assets);
|
||||
}
|
||||
if (m.buildInfo.assetsInfo) {
|
||||
if (this.buildInfo.assetsInfo === undefined) {
|
||||
this.buildInfo.assetsInfo = new Map();
|
||||
}
|
||||
for (const [key, value] of m.buildInfo.assetsInfo) {
|
||||
this.buildInfo.assetsInfo.set(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this._identifier = this._createIdentifier(compilation.compiler.root);
|
||||
|
|
|
@ -25,6 +25,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|||
/** @typedef {import("../../declarations/WebpackOptions").OptimizationSplitChunksSizes} OptimizationSplitChunksSizes */
|
||||
/** @typedef {import("../Chunk")} Chunk */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Compilation").AssetInfo} AssetInfo */
|
||||
/** @typedef {import("../Compilation").PathData} PathData */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
|
@ -61,7 +62,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|||
* @property {number=} minChunks
|
||||
* @property {number=} maxAsyncRequests
|
||||
* @property {number=} maxInitialRequests
|
||||
* @property {(string | function(PathData): string)=} filename
|
||||
* @property {(string | function(PathData, AssetInfo=): string)=} filename
|
||||
* @property {string=} idHint
|
||||
* @property {string} automaticNameDelimiter
|
||||
* @property {boolean=} reuseExistingChunk
|
||||
|
@ -82,7 +83,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|||
* @property {number=} minChunks
|
||||
* @property {number=} maxAsyncRequests
|
||||
* @property {number=} maxInitialRequests
|
||||
* @property {(string | function(PathData): string)=} filename
|
||||
* @property {(string | function(PathData, AssetInfo=): string)=} filename
|
||||
* @property {string=} idHint
|
||||
* @property {string} automaticNameDelimiter
|
||||
* @property {boolean=} reuseExistingChunk
|
||||
|
@ -128,7 +129,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|||
* @property {number} maxAsyncRequests
|
||||
* @property {number} maxInitialRequests
|
||||
* @property {boolean} hidePathInfo
|
||||
* @property {string | function(PathData): string} filename
|
||||
* @property {string | function(PathData, AssetInfo=): string} filename
|
||||
* @property {string} automaticNameDelimiter
|
||||
* @property {GetCacheGroups} getCacheGroups
|
||||
* @property {GetName} getName
|
||||
|
|
|
@ -14,6 +14,7 @@ const NoAsyncChunksWarning = require("./NoAsyncChunksWarning");
|
|||
/** @typedef {import("../../declarations/WebpackOptions").PerformanceOptions} PerformanceOptions */
|
||||
/** @typedef {import("../ChunkGroup")} ChunkGroup */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../Entrypoint")} Entrypoint */
|
||||
/** @typedef {import("../WebpackError")} WebpackError */
|
||||
|
||||
/**
|
||||
|
@ -31,7 +32,7 @@ const NoAsyncChunksWarning = require("./NoAsyncChunksWarning");
|
|||
|
||||
const isOverSizeLimitSet = new WeakSet();
|
||||
|
||||
const excludeSourceMap = asset => !asset.endsWith(".map");
|
||||
const excludeSourceMap = (name, source, info) => !info.development;
|
||||
|
||||
module.exports = class SizeLimitsPlugin {
|
||||
/**
|
||||
|
@ -67,13 +68,17 @@ module.exports = class SizeLimitsPlugin {
|
|||
const warnings = [];
|
||||
|
||||
/**
|
||||
* @param {ChunkGroup} entrypoint the entrypoint
|
||||
* @returns {number} its calculated size
|
||||
* @param {Entrypoint} entrypoint an entrypoint
|
||||
* @returns {number} the size of the entrypoint
|
||||
*/
|
||||
const getEntrypointSize = entrypoint =>
|
||||
entrypoint.getFiles().reduce((currentSize, file) => {
|
||||
if (assetFilter(file) && compilation.assets[file]) {
|
||||
return currentSize + compilation.assets[file].size();
|
||||
const asset = compilation.getAsset(file);
|
||||
if (
|
||||
assetFilter(asset.name, asset.source, asset.info) &&
|
||||
asset.source
|
||||
) {
|
||||
return currentSize + (asset.info.size || asset.source.size());
|
||||
}
|
||||
|
||||
return currentSize;
|
||||
|
@ -81,34 +86,36 @@ module.exports = class SizeLimitsPlugin {
|
|||
|
||||
/** @type {AssetDetails[]} */
|
||||
const assetsOverSizeLimit = [];
|
||||
for (const assetName of Object.keys(compilation.assets)) {
|
||||
if (!assetFilter(assetName)) {
|
||||
for (const { name, source, info } of compilation.getAssets()) {
|
||||
if (!assetFilter(name, source, info) || !source) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const asset = compilation.assets[assetName];
|
||||
const size = asset.size();
|
||||
const size = info.size || source.size();
|
||||
if (size > assetSizeLimit) {
|
||||
assetsOverSizeLimit.push({
|
||||
name: assetName,
|
||||
size: size
|
||||
name,
|
||||
size
|
||||
});
|
||||
isOverSizeLimitSet.add(asset);
|
||||
isOverSizeLimitSet.add(source);
|
||||
}
|
||||
}
|
||||
|
||||
const fileFilter = name => {
|
||||
const asset = compilation.getAsset(name);
|
||||
return assetFilter(asset.name, asset.source, asset.info);
|
||||
};
|
||||
|
||||
/** @type {EntrypointDetails[]} */
|
||||
const entrypointsOverLimit = [];
|
||||
for (const pair of compilation.entrypoints) {
|
||||
const name = pair[0];
|
||||
const entry = pair[1];
|
||||
for (const [name, entry] of compilation.entrypoints) {
|
||||
const size = getEntrypointSize(entry);
|
||||
|
||||
if (size > entrypointSizeLimit) {
|
||||
entrypointsOverLimit.push({
|
||||
name: name,
|
||||
size: size,
|
||||
files: entry.getFiles().filter(assetFilter)
|
||||
files: entry.getFiles().filter(fileFilter)
|
||||
});
|
||||
isOverSizeLimitSet.add(entry);
|
||||
}
|
||||
|
|
|
@ -10,9 +10,10 @@ const Template = require("../Template");
|
|||
|
||||
/** @typedef {import("../Chunk")} Chunk */
|
||||
/** @typedef {import("../Compilation")} Compilation */
|
||||
/** @typedef {import("../Compilation").AssetInfo} AssetInfo */
|
||||
/** @typedef {import("../Compilation").PathData} PathData */
|
||||
|
||||
/** @typedef {function(PathData): string} FilenameFunction */
|
||||
/** @typedef {function(PathData, AssetInfo=): string} FilenameFunction */
|
||||
|
||||
class GetChunkFilenameRuntimeModule extends RuntimeModule {
|
||||
/**
|
||||
|
|
|
@ -27,6 +27,7 @@ const identifierUtils = require("../util/identifier");
|
|||
/** @typedef {import("../ChunkGroup")} ChunkGroup */
|
||||
/** @typedef {import("../ChunkGroup").OriginRecord} OriginRecord */
|
||||
/** @typedef {import("../Compilation")} Compilation */
|
||||
/** @typedef {import("../Compilation").Asset} Asset */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
||||
|
@ -42,8 +43,8 @@ const identifierUtils = require("../util/identifier");
|
|||
* @typedef {Object} UsualContext
|
||||
* @property {string} type
|
||||
* @property {Compilation} compilation
|
||||
* @property {Map<string|Chunk[]>} compilationFileToChunks
|
||||
* @property {Map<string|Chunk[]>} compilationAuxiliaryFileToChunks
|
||||
* @property {Map<string,Chunk[]>} compilationFileToChunks
|
||||
* @property {Map<string,Chunk[]>} compilationAuxiliaryFileToChunks
|
||||
* @property {number} startTime
|
||||
* @property {number} endTime
|
||||
*/
|
||||
|
@ -70,7 +71,7 @@ const identifierUtils = require("../util/identifier");
|
|||
/**
|
||||
* @typedef {Object} SimpleExtractors
|
||||
* @property {ExtractorsByOption<Compilation>} compilation
|
||||
* @property {ExtractorsByOption<{ name: string, source: Source }>} asset
|
||||
* @property {ExtractorsByOption<Asset>} asset
|
||||
* @property {ExtractorsByOption<{ name: string, chunkGroup: ChunkGroup }>} chunkGroup
|
||||
* @property {ExtractorsByOption<Module>} module
|
||||
* @property {ExtractorsByOption<Module>} moduleIssuer
|
||||
|
@ -213,14 +214,10 @@ const SIMPLE_EXTRACTORS = {
|
|||
},
|
||||
assets: (object, compilation, context, options, factory) => {
|
||||
const { type } = context;
|
||||
const array = Object.keys(compilation.assets).map(name => {
|
||||
const source = compilation.assets[name];
|
||||
return {
|
||||
name,
|
||||
source
|
||||
};
|
||||
});
|
||||
const array = compilation.getAssets();
|
||||
/** @type {Map<string, Chunk[]>} */
|
||||
const compilationFileToChunks = new Map();
|
||||
/** @type {Map<string, Chunk[]>} */
|
||||
const compilationAuxiliaryFileToChunks = new Map();
|
||||
for (const chunk of compilation.chunks) {
|
||||
for (const file of chunk.files) {
|
||||
|
@ -478,6 +475,7 @@ const SIMPLE_EXTRACTORS = {
|
|||
compareIds
|
||||
);
|
||||
object.emitted = compilation.emittedAssets.has(asset.name);
|
||||
object.info = asset.info;
|
||||
},
|
||||
performance: (object, asset) => {
|
||||
object.isOverSizeLimit = SizeLimitsPlugin.isOverSizeLimit(asset.source);
|
||||
|
|
|
@ -158,6 +158,15 @@ const SIMPLE_PRINTERS = {
|
|||
"asset.isOverSizeLimit": (isOverSizeLimit, { yellow, formatFlag }) =>
|
||||
isOverSizeLimit ? yellow(formatFlag("big")) : undefined,
|
||||
|
||||
"asset.info.immutable": (immutable, { green, formatFlag }) =>
|
||||
immutable ? green(formatFlag("immutable")) : undefined,
|
||||
"asset.info.development": (development, { green, formatFlag }) =>
|
||||
development ? green(formatFlag("dev")) : undefined,
|
||||
"asset.info.hotModuleReplacement": (
|
||||
hotModuleReplacement,
|
||||
{ green, formatFlag }
|
||||
) => ((hotModuleReplacement ? green(formatFlag("hmr")) : undefined)),
|
||||
|
||||
assetChunk: (id, { formatChunkId }) => formatChunkId(id),
|
||||
|
||||
assetChunkName: name => name,
|
||||
|
@ -535,10 +544,12 @@ const PREFERED_ORDERS = {
|
|||
"chunks",
|
||||
"auxiliaryChunks",
|
||||
"emitted",
|
||||
"info",
|
||||
"isOverSizeLimit",
|
||||
"chunkNames",
|
||||
"auxiliaryChunkNames"
|
||||
],
|
||||
"asset.info": ["immutable", "development", "hotModuleReplacement"],
|
||||
chunkGroup: [
|
||||
"kind!",
|
||||
"name",
|
||||
|
@ -1086,7 +1097,9 @@ class DefaultStatsPrinterPlugin {
|
|||
[elementsMap.chunks, elementsMap.auxiliaryChunks]
|
||||
.filter(Boolean)
|
||||
.join(" "),
|
||||
elementsMap.emitted || "",
|
||||
[elementsMap.emitted, elementsMap.info]
|
||||
.filter(Boolean)
|
||||
.join(" "),
|
||||
elementsMap.isOverSizeLimit || "",
|
||||
[elementsMap.chunkNames, elementsMap.auxiliaryChunkNames]
|
||||
.filter(Boolean)
|
||||
|
|
|
@ -48,8 +48,8 @@
|
|||
"glob": "^7.1.3",
|
||||
"husky": "^3.0.2",
|
||||
"istanbul": "^0.4.5",
|
||||
"jest": "24.1.0",
|
||||
"jest-junit": "^7.0.0",
|
||||
"jest": "^24.9.0",
|
||||
"jest-junit": "^8.0.0",
|
||||
"json-loader": "^0.5.7",
|
||||
"json-schema-to-typescript": "^7.0.0",
|
||||
"less": "^3.9.0",
|
||||
|
|
|
@ -708,7 +708,7 @@
|
|||
},
|
||||
{
|
||||
"instanceof": "Function",
|
||||
"tsType": "((pathData: import(\"../lib/Compilation\").PathData) => string)"
|
||||
"tsType": "((pathData: import(\"../lib/Compilation\").PathData, assetInfo?: import(\"../lib/Compilation\").AssetInfo) => string)"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -933,7 +933,7 @@
|
|||
},
|
||||
{
|
||||
"instanceof": "Function",
|
||||
"tsType": "((pathData: import(\"../lib/Compilation\").PathData) => string)"
|
||||
"tsType": "((pathData: import(\"../lib/Compilation\").PathData, assetInfo?: import(\"../lib/Compilation\").AssetInfo) => string)"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -1043,7 +1043,7 @@
|
|||
},
|
||||
{
|
||||
"instanceof": "Function",
|
||||
"tsType": "((pathData: import(\"../lib/Compilation\").PathData) => string)"
|
||||
"tsType": "((pathData: import(\"../lib/Compilation\").PathData, assetInfo?: import(\"../lib/Compilation\").AssetInfo) => string)"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -1146,7 +1146,7 @@
|
|||
},
|
||||
{
|
||||
"instanceof": "Function",
|
||||
"tsType": "((pathData: import(\"../lib/Compilation\").PathData) => string)"
|
||||
"tsType": "((pathData: import(\"../lib/Compilation\").PathData, assetInfo?: import(\"../lib/Compilation\").AssetInfo) => string)"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -7,11 +7,11 @@ Child fitting:
|
|||
Time: Xms
|
||||
Built at: 1970-04-20 12:42:42
|
||||
PublicPath: (none)
|
||||
Asset Size Chunks Chunk Names
|
||||
3c19ea16aff43940b7fd.js 12.8 KiB {10} [emitted]
|
||||
501a16e2f184bd3b8ea5.js 1.07 KiB {785} [emitted]
|
||||
b655127fd4eca55a90aa.js 1.91 KiB {394} [emitted]
|
||||
bac8938bfd9c34df221b.js 1.91 KiB {102} [emitted]
|
||||
Asset Size Chunks Chunk Names
|
||||
3c19ea16aff43940b7fd.js 12.8 KiB {10} [emitted] [immutable]
|
||||
501a16e2f184bd3b8ea5.js 1.07 KiB {785} [emitted] [immutable]
|
||||
b655127fd4eca55a90aa.js 1.91 KiB {394} [emitted] [immutable]
|
||||
bac8938bfd9c34df221b.js 1.91 KiB {102} [emitted] [immutable]
|
||||
Entrypoint main = b655127fd4eca55a90aa.js bac8938bfd9c34df221b.js 3c19ea16aff43940b7fd.js
|
||||
chunk {10} 3c19ea16aff43940b7fd.js 1.87 KiB (javascript) 6.41 KiB (runtime) [entry] [rendered]
|
||||
> ./index main
|
||||
|
@ -35,11 +35,11 @@ Child content-change:
|
|||
Time: Xms
|
||||
Built at: 1970-04-20 12:42:42
|
||||
PublicPath: (none)
|
||||
Asset Size Chunks Chunk Names
|
||||
3c19ea16aff43940b7fd.js 12.8 KiB {10} [emitted]
|
||||
501a16e2f184bd3b8ea5.js 1.07 KiB {785} [emitted]
|
||||
b655127fd4eca55a90aa.js 1.91 KiB {394} [emitted]
|
||||
bac8938bfd9c34df221b.js 1.91 KiB {102} [emitted]
|
||||
Asset Size Chunks Chunk Names
|
||||
3c19ea16aff43940b7fd.js 12.8 KiB {10} [emitted] [immutable]
|
||||
501a16e2f184bd3b8ea5.js 1.07 KiB {785} [emitted] [immutable]
|
||||
b655127fd4eca55a90aa.js 1.91 KiB {394} [emitted] [immutable]
|
||||
bac8938bfd9c34df221b.js 1.91 KiB {102} [emitted] [immutable]
|
||||
Entrypoint main = b655127fd4eca55a90aa.js bac8938bfd9c34df221b.js 3c19ea16aff43940b7fd.js
|
||||
chunk {10} 3c19ea16aff43940b7fd.js 1.87 KiB (javascript) 6.41 KiB (runtime) [entry] [rendered]
|
||||
> ./index main
|
||||
|
@ -65,19 +65,19 @@ exports[`StatsTestCases should print correct stats for aggressive-splitting-on-d
|
|||
Time: Xms
|
||||
Built at: 1970-04-20 12:42:42
|
||||
PublicPath: (none)
|
||||
Asset Size Chunks Chunk Names
|
||||
035ce1d102419ee4897b.js 1010 bytes {701} [emitted]
|
||||
1ffcc984ad7d7c92ab0b.js 1.91 KiB {594} [emitted]
|
||||
2d925701a76fac28b8cc.js 1.91 KiB {817} [emitted]
|
||||
4717957e3d668ff4f9e8.js 1.91 KiB {591} [emitted]
|
||||
49dd7266942f0ed4ae64.js 1010 bytes {847} [emitted]
|
||||
61fe00576946c9f2606d.js 1.91 KiB {454} [emitted]
|
||||
b18de3d2b973b820ea21.js 1.91 KiB {294}, {701} [emitted]
|
||||
bac8938bfd9c34df221b.js 1.91 KiB {102} [emitted]
|
||||
c0e562c433da5d2d3cb7.js 1.91 KiB {390}, {523} [emitted]
|
||||
d1200bb114eb31d95075.js 9.43 KiB {179} [emitted] main
|
||||
f2593c9acd7da73fffbe.js 1010 bytes {390} [emitted]
|
||||
f50587036d9d0e61836c.js 1.91 KiB {613} [emitted]
|
||||
Asset Size Chunks Chunk Names
|
||||
035ce1d102419ee4897b.js 1010 bytes {701} [emitted] [immutable]
|
||||
1ffcc984ad7d7c92ab0b.js 1.91 KiB {594} [emitted] [immutable]
|
||||
2d925701a76fac28b8cc.js 1.91 KiB {817} [emitted] [immutable]
|
||||
4717957e3d668ff4f9e8.js 1.91 KiB {591} [emitted] [immutable]
|
||||
49dd7266942f0ed4ae64.js 1010 bytes {847} [emitted] [immutable]
|
||||
61fe00576946c9f2606d.js 1.91 KiB {454} [emitted] [immutable]
|
||||
b18de3d2b973b820ea21.js 1.91 KiB {294}, {701} [emitted] [immutable]
|
||||
bac8938bfd9c34df221b.js 1.91 KiB {102} [emitted] [immutable]
|
||||
c0e562c433da5d2d3cb7.js 1.91 KiB {390}, {523} [emitted] [immutable]
|
||||
d1200bb114eb31d95075.js 9.43 KiB {179} [emitted] [immutable] main
|
||||
f2593c9acd7da73fffbe.js 1010 bytes {390} [emitted] [immutable]
|
||||
f50587036d9d0e61836c.js 1.91 KiB {613} [emitted] [immutable]
|
||||
Entrypoint main = d1200bb114eb31d95075.js
|
||||
chunk {102} bac8938bfd9c34df221b.js 1.76 KiB [rendered] [recorded] aggressive splitted
|
||||
> ./c ./d ./e [942] ./index.js 3:0-30
|
||||
|
@ -134,11 +134,11 @@ exports[`StatsTestCases should print correct stats for asset 1`] = `
|
|||
"Hash: 69bf1248ab820a0f4d8d
|
||||
Time: Xms
|
||||
Built at: 1970-04-20 12:42:42
|
||||
Asset Size Chunks Chunk Names
|
||||
44af8fe384aadccba06e.svg 656 bytes ({179}) [emitted] (main)
|
||||
62787d6ac9d673cc8926.png 14.6 KiB ({179}) [emitted] (main)
|
||||
bundle.js 4.42 KiB {179} [emitted] main
|
||||
c2a9ba2e6ec92fd70245.jpg 5.89 KiB ({179}) [emitted] (main)
|
||||
Asset Size Chunks Chunk Names
|
||||
44af8fe384aadccba06e.svg 656 bytes ({179}) [emitted] [immutable] (main)
|
||||
62787d6ac9d673cc8926.png 14.6 KiB ({179}) [emitted] [immutable] (main)
|
||||
bundle.js 4.42 KiB {179} [emitted] main
|
||||
c2a9ba2e6ec92fd70245.jpg 5.89 KiB ({179}) [emitted] [immutable] (main)
|
||||
Entrypoint main = bundle.js (44af8fe384aadccba06e.svg 62787d6ac9d673cc8926.png c2a9ba2e6ec92fd70245.jpg)
|
||||
[10] ./index.js 111 bytes {179} [built]
|
||||
[359] ./images/file.jpg 5.89 KiB (asset) 42 bytes (javascript) {179} [built]
|
||||
|
@ -640,9 +640,9 @@ Child
|
|||
Hash: e8a1307ea3c860453151
|
||||
Time: Xms
|
||||
Built at: 1970-04-20 12:42:42
|
||||
Asset Size Chunks Chunk Names
|
||||
app.20e7d920f7a5dd7ba86a.js 6.72 KiB {143} [emitted] app
|
||||
vendor.3ca106870164d059e3b7.js 606 bytes {736} [emitted] vendor
|
||||
Asset Size Chunks Chunk Names
|
||||
app.20e7d920f7a5dd7ba86a.js 6.72 KiB {143} [emitted] [immutable] app
|
||||
vendor.3ca106870164d059e3b7.js 606 bytes {736} [emitted] [immutable] vendor
|
||||
Entrypoint app = vendor.3ca106870164d059e3b7.js app.20e7d920f7a5dd7ba86a.js
|
||||
[117] ./entry-1.js + 2 modules 190 bytes {143} [built]
|
||||
[381] ./constants.js 87 bytes {736} [built]
|
||||
|
@ -651,9 +651,9 @@ Child
|
|||
Hash: 9325cea6a11512fc55f7
|
||||
Time: Xms
|
||||
Built at: 1970-04-20 12:42:42
|
||||
Asset Size Chunks Chunk Names
|
||||
app.9ff34c93a677586ea3e1.js 6.74 KiB {143} [emitted] app
|
||||
vendor.3ca106870164d059e3b7.js 606 bytes {736} [emitted] vendor
|
||||
Asset Size Chunks Chunk Names
|
||||
app.9ff34c93a677586ea3e1.js 6.74 KiB {143} [emitted] [immutable] app
|
||||
vendor.3ca106870164d059e3b7.js 606 bytes {736} [emitted] [immutable] vendor
|
||||
Entrypoint app = vendor.3ca106870164d059e3b7.js app.9ff34c93a677586ea3e1.js
|
||||
[381] ./constants.js 87 bytes {736} [built]
|
||||
[655] ./entry-2.js + 2 modules 197 bytes {143} [built]
|
||||
|
@ -1102,6 +1102,12 @@ chunk {trees} trees.js (trees) 71 bytes [rendered]
|
|||
+ 3 hidden dependent modules"
|
||||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for immutable 1`] = `
|
||||
" Asset Size Chunks Chunk Names
|
||||
5a00a5aaadb77d195a77.js 346 bytes {chunk_js} [emitted] [immutable]
|
||||
6f3582e5d1757d08c675.js 10.1 KiB {main} [emitted] [immutable] main"
|
||||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for import-context-filter 1`] = `
|
||||
"Hash: 10cc1554ce1aa0fa0104
|
||||
Time: Xms
|
||||
|
@ -1163,10 +1169,10 @@ Child
|
|||
Hash: 99ffcd8f42141d9c28b7
|
||||
Time: Xms
|
||||
Built at: 1970-04-20 12:42:42
|
||||
Asset Size Chunks Chunk Names
|
||||
a-all-a_js-5ed868390c43e7086a86.js 144 bytes {all-a_js} [emitted]
|
||||
a-main-5b1dc11fec11f25eaf1b.js 115 bytes {main} [emitted] main
|
||||
a-runtime~main-d1e9699b86adac706ec9.js 4.75 KiB {runtime~main} [emitted] runtime~main
|
||||
Asset Size Chunks Chunk Names
|
||||
a-all-a_js-5ed868390c43e7086a86.js 144 bytes {all-a_js} [emitted] [immutable]
|
||||
a-main-5b1dc11fec11f25eaf1b.js 115 bytes {main} [emitted] [immutable] main
|
||||
a-runtime~main-d1e9699b86adac706ec9.js 4.75 KiB {runtime~main} [emitted] [immutable] runtime~main
|
||||
Entrypoint main = a-runtime~main-d1e9699b86adac706ec9.js a-all-a_js-5ed868390c43e7086a86.js a-main-5b1dc11fec11f25eaf1b.js
|
||||
[./a.js] 18 bytes {all-a_js} [built]
|
||||
+ 1 hidden module
|
||||
|
@ -1174,11 +1180,11 @@ Child
|
|||
Hash: 6d345881901567a13eae
|
||||
Time: Xms
|
||||
Built at: 1970-04-20 12:42:42
|
||||
Asset Size Chunks Chunk Names
|
||||
b-all-b_js-89c3127ba563ffa436dc.js 497 bytes {all-b_js} [emitted]
|
||||
b-main-f043bf83e8ebac493a99.js 148 bytes {main} [emitted] main
|
||||
b-runtime~main-4dcb3ddd3a8a25ba0a97.js 6.2 KiB {runtime~main} [emitted] runtime~main
|
||||
b-vendors-node_modules_vendor_js-a7aa3079a16cbae3f591.js 189 bytes {vendors-node_modules_vendor_js} [emitted]
|
||||
Asset Size Chunks Chunk Names
|
||||
b-all-b_js-89c3127ba563ffa436dc.js 497 bytes {all-b_js} [emitted] [immutable]
|
||||
b-main-f043bf83e8ebac493a99.js 148 bytes {main} [emitted] [immutable] main
|
||||
b-runtime~main-4dcb3ddd3a8a25ba0a97.js 6.2 KiB {runtime~main} [emitted] [immutable] runtime~main
|
||||
b-vendors-node_modules_vendor_js-a7aa3079a16cbae3f591.js 189 bytes {vendors-node_modules_vendor_js} [emitted] [immutable]
|
||||
Entrypoint main = b-runtime~main-4dcb3ddd3a8a25ba0a97.js b-vendors-node_modules_vendor_js-a7aa3079a16cbae3f591.js b-all-b_js-89c3127ba563ffa436dc.js b-main-f043bf83e8ebac493a99.js
|
||||
[./b.js] 17 bytes {all-b_js} [built]
|
||||
[./node_modules/vendor.js] 23 bytes {vendors-node_modules_vendor_js} [built]
|
||||
|
@ -1187,12 +1193,12 @@ Child
|
|||
Hash: ecf48c9ff644f453240d
|
||||
Time: Xms
|
||||
Built at: 1970-04-20 12:42:42
|
||||
Asset Size Chunks Chunk Names
|
||||
c-all-b_js-89c3127ba563ffa436dc.js 497 bytes {all-b_js} [emitted]
|
||||
c-all-c_js-936472833753792cc303.js 364 bytes {all-c_js} [emitted]
|
||||
c-main-74481bfa6b28e9e83c8f.js 164 bytes {main} [emitted] main
|
||||
c-runtime~main-07662f2ca56a15eb8680.js 11.2 KiB {runtime~main} [emitted] runtime~main
|
||||
c-vendors-node_modules_vendor_js-a7aa3079a16cbae3f591.js 189 bytes {vendors-node_modules_vendor_js} [emitted]
|
||||
Asset Size Chunks Chunk Names
|
||||
c-all-b_js-89c3127ba563ffa436dc.js 497 bytes {all-b_js} [emitted] [immutable]
|
||||
c-all-c_js-936472833753792cc303.js 364 bytes {all-c_js} [emitted] [immutable]
|
||||
c-main-74481bfa6b28e9e83c8f.js 164 bytes {main} [emitted] [immutable] main
|
||||
c-runtime~main-07662f2ca56a15eb8680.js 11.2 KiB {runtime~main} [emitted] [immutable] runtime~main
|
||||
c-vendors-node_modules_vendor_js-a7aa3079a16cbae3f591.js 189 bytes {vendors-node_modules_vendor_js} [emitted] [immutable]
|
||||
Entrypoint main = c-runtime~main-07662f2ca56a15eb8680.js c-all-c_js-936472833753792cc303.js c-main-74481bfa6b28e9e83c8f.js (prefetch: c-vendors-node_modules_vendor_js-a7aa3079a16cbae3f591.js c-all-b_js-89c3127ba563ffa436dc.js)
|
||||
[./b.js] 17 bytes {all-b_js} [built]
|
||||
[./c.js] 61 bytes {all-c_js} [built]
|
||||
|
@ -2238,15 +2244,15 @@ Entrypoints:
|
|||
exports[`StatsTestCases should print correct stats for preset-normal-performance-ensure-filter-sourcemaps 1`] = `
|
||||
"Time: <CLR=BOLD>X</CLR>ms
|
||||
Built at: 1970-04-20 <CLR=BOLD>12:42:42</CLR>
|
||||
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=BOLD>Chunk Names</CLR>
|
||||
<CLR=BOLD>Asset</CLR> <CLR=BOLD>Size</CLR> <CLR=BOLD>Chunks</CLR> <CLR=BOLD>Chunk Names</CLR>
|
||||
<CLR=32,BOLD>460.js</CLR> 338 bytes {<CLR=33,BOLD>460</CLR>} <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=32,BOLD>460.js.map</CLR> 212 bytes ({<CLR=33,BOLD>460</CLR>}) <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=32,BOLD>460.js.map</CLR> 212 bytes ({<CLR=33,BOLD>460</CLR>}) <CLR=32,BOLD>[emitted]</CLR> <CLR=32,BOLD>[dev]</CLR>
|
||||
<CLR=32,BOLD>524.js</CLR> 242 bytes {<CLR=33,BOLD>524</CLR>} <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=32,BOLD>524.js.map</CLR> 228 bytes ({<CLR=33,BOLD>524</CLR>}) <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=32,BOLD>524.js.map</CLR> 228 bytes ({<CLR=33,BOLD>524</CLR>}) <CLR=32,BOLD>[emitted]</CLR> <CLR=32,BOLD>[dev]</CLR>
|
||||
<CLR=32,BOLD>996.js</CLR> 174 bytes {<CLR=33,BOLD>996</CLR>} <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=32,BOLD>996.js.map</CLR> 163 bytes ({<CLR=33,BOLD>996</CLR>}) <CLR=32,BOLD>[emitted]</CLR>
|
||||
<CLR=33,BOLD>main.js</CLR> <CLR=33,BOLD>301 KiB</CLR> {<CLR=33,BOLD>179</CLR>} <CLR=32,BOLD>[emitted]</CLR> <CLR=33,BOLD>[big]</CLR> main
|
||||
<CLR=32,BOLD>main.js.map</CLR> 1.72 MiB ({<CLR=33,BOLD>179</CLR>}) <CLR=32,BOLD>[emitted]</CLR> (main)
|
||||
<CLR=32,BOLD>996.js.map</CLR> 163 bytes ({<CLR=33,BOLD>996</CLR>}) <CLR=32,BOLD>[emitted]</CLR> <CLR=32,BOLD>[dev]</CLR>
|
||||
<CLR=33,BOLD>main.js</CLR> <CLR=33,BOLD>301 KiB</CLR> {<CLR=33,BOLD>179</CLR>} <CLR=32,BOLD>[emitted]</CLR> <CLR=33,BOLD>[big]</CLR> main
|
||||
<CLR=32,BOLD>main.js.map</CLR> 1.72 MiB ({<CLR=33,BOLD>179</CLR>}) <CLR=32,BOLD>[emitted]</CLR> <CLR=32,BOLD>[dev]</CLR> (main)
|
||||
Entrypoint <CLR=BOLD>main</CLR> <CLR=33,BOLD>[big]</CLR> = <CLR=32,BOLD>main.js</CLR> (<CLR=32,BOLD>main.js.map</CLR>)
|
||||
[10] <CLR=BOLD>./index.js</CLR> 52 bytes {<CLR=33,BOLD>179</CLR>} <CLR=32,BOLD>[built]</CLR>
|
||||
[390] <CLR=BOLD>./e.js</CLR> 22 bytes {<CLR=33,BOLD>524</CLR>} <CLR=32,BOLD>[built]</CLR>
|
||||
|
@ -3689,19 +3695,19 @@ exports[`StatsTestCases should print correct stats for wasm-explorer-examples-sy
|
|||
"Hash: 95cded38c001e943cb13
|
||||
Time: Xms
|
||||
Built at: 1970-04-20 12:42:42
|
||||
Asset Size Chunks Chunk Names
|
||||
1d55f77c08cd19684f13.module.wasm 154 bytes ({325}) [emitted]
|
||||
200c03abdc3f4ae1e15c.module.wasm 290 bytes ({780}) [emitted]
|
||||
Asset Size Chunks Chunk Names
|
||||
1d55f77c08cd19684f13.module.wasm 154 bytes ({325}) [emitted] [immutable]
|
||||
200c03abdc3f4ae1e15c.module.wasm 290 bytes ({780}) [emitted] [immutable]
|
||||
230.bundle.js 207 bytes {230} [emitted]
|
||||
256e72dd8b9a83a6e45b.module.wasm 120 bytes ({325}) [emitted]
|
||||
256e72dd8b9a83a6e45b.module.wasm 120 bytes ({325}) [emitted] [immutable]
|
||||
325.bundle.js 3.71 KiB {325} [emitted]
|
||||
526.bundle.js 359 bytes {526} [emitted]
|
||||
780.bundle.js 495 bytes {780} [emitted]
|
||||
99.bundle.js 205 bytes {99} [emitted]
|
||||
a0e9dd97d7ced35a5b2c.module.wasm 154 bytes ({780}) [emitted]
|
||||
bundle.js 11.2 KiB {520} [emitted] main-1df31ce3
|
||||
d37b3336426771c2a6e2.module.wasm 531 bytes ({99}) [emitted]
|
||||
ebd3f263522776d85971.module.wasm 156 bytes ({230}) [emitted]
|
||||
a0e9dd97d7ced35a5b2c.module.wasm 154 bytes ({780}) [emitted] [immutable]
|
||||
bundle.js 11.2 KiB {520} [emitted] main-1df31ce3
|
||||
d37b3336426771c2a6e2.module.wasm 531 bytes ({99}) [emitted] [immutable]
|
||||
ebd3f263522776d85971.module.wasm 156 bytes ({230}) [emitted] [immutable]
|
||||
Entrypoint main = bundle.js
|
||||
chunk {99} 99.bundle.js 50 bytes (javascript) 531 bytes (webassembly) [rendered]
|
||||
[99] ./duff.wasm 50 bytes (javascript) 531 bytes (webassembly) {99} [built]
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
import("./chunk");
|
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
mode: "development",
|
||||
entry: "./index.js",
|
||||
output: {
|
||||
filename: "[contenthash].js"
|
||||
},
|
||||
stats: {
|
||||
all: false,
|
||||
assets: true
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue