Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeRun: new AsyncSeriesHook(["compilation"]),
run: new AsyncSeriesHook(["compilation"]),
emit: new AsyncSeriesHook(["compilation"]),
afterEmit: new AsyncSeriesHook(["compilation"]),
thisCompilation: new SyncHook(["compilation", "params"]),
compilation: new SyncHook(["compilation", "params"]),
normalModuleFactory: new SyncHook(["normalModuleFactory"]),
contextModuleFactory: new SyncHook(["contextModulefactory"]),
beforeCompile: new AsyncSeriesHook(["params"]),
compile: new SyncHook(["params"]),
make: new AsyncParallelHook(["compilation"]),
afterCompile: new AsyncSeriesHook(["compilation"]),
watchRun: new AsyncSeriesHook(["compiler"]),
failed: new SyncHook(["error"]),
invalid: new SyncHook(["filename", "changeTime"]),
watchClose: new SyncHook([]),
// TODO the following hooks are weirdly located here
// TODO move them for webpack 5
environment: new SyncHook([]),
afterEnvironment: new SyncHook([]),
afterPlugins: new SyncHook(["compiler"]),
afterResolvers: new SyncHook(["compiler"]),
entryOption: new SyncBailHook(["context", "entry"])
};
this._pluginCompat.tap("Compiler", options => {
switch (options.name) {
case "additional-pass":
case "before-run":
case "run":
case "emit":
case "after-emit":
"source",
"chunk",
"hash",
"moduleIdExpression"
]),
addModule: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"moduleIdExpression",
"moduleExpression"
]),
currentHash: new SyncWaterfallHook(["source", "requestedLength"]),
assetPath: new SyncWaterfallHook(["path", "options"]),
hash: new SyncHook(["hash"]),
hashForChunk: new SyncHook(["hash", "chunk"]),
globalHashPaths: new SyncWaterfallHook(["paths"]),
globalHash: new SyncBailHook(["chunk", "paths"]),
// TODO this should be moved somewhere else
// It's weird here
hotBootstrap: new SyncWaterfallHook(["source", "chunk", "hash"])
};
this.hooks.startup.tap("MainTemplate", (source, chunk, hash) => {
/** @type {string[]} */
const buf = [];
if (chunk.entryModule) {
buf.push("// Load entry module and return exports");
buf.push(
`return ${this.renderRequireFunctionForModule(
hash,
chunk,
/** @type {SyncHook} */
afterOptimizeTree: new SyncHook(["chunks", "modules"]),
/** @type {SyncBailHook} */
optimizeChunkModulesBasic: new SyncBailHook(["chunks", "modules"]),
/** @type {SyncBailHook} */
optimizeChunkModules: new SyncBailHook(["chunks", "modules"]),
/** @type {SyncBailHook} */
optimizeChunkModulesAdvanced: new SyncBailHook(["chunks", "modules"]),
/** @type {SyncHook} */
afterOptimizeChunkModules: new SyncHook(["chunks", "modules"]),
/** @type {SyncBailHook} */
shouldRecord: new SyncBailHook([]),
/** @type {SyncHook} */
reviveModules: new SyncHook(["modules", "records"]),
/** @type {SyncHook} */
optimizeModuleOrder: new SyncHook(["modules"]),
/** @type {SyncHook} */
advancedOptimizeModuleOrder: new SyncHook(["modules"]),
/** @type {SyncHook} */
beforeModuleIds: new SyncHook(["modules"]),
/** @type {SyncHook} */
moduleIds: new SyncHook(["modules"]),
/** @type {SyncHook} */
optimizeModuleIds: new SyncHook(["modules"]),
/** @type {SyncHook} */
afterOptimizeModuleIds: new SyncHook(["modules"]),
/** @type {SyncHook} */
reviveChunks: new SyncHook(["chunks", "records"]),
/** @type {SyncHook} */
optimizeChunkModules: new SyncBailHook(["chunks", "modules"]),
/** @type {SyncBailHook} */
optimizeChunkModulesAdvanced: new SyncBailHook(["chunks", "modules"]),
/** @type {SyncHook} */
afterOptimizeChunkModules: new SyncHook(["chunks", "modules"]),
/** @type {SyncBailHook} */
shouldRecord: new SyncBailHook([]),
/** @type {SyncHook} */
reviveModules: new SyncHook(["modules", "records"]),
/** @type {SyncHook} */
optimizeModuleOrder: new SyncHook(["modules"]),
/** @type {SyncHook} */
advancedOptimizeModuleOrder: new SyncHook(["modules"]),
/** @type {SyncHook} */
beforeModuleIds: new SyncHook(["modules"]),
/** @type {SyncHook} */
moduleIds: new SyncHook(["modules"]),
/** @type {SyncHook} */
optimizeModuleIds: new SyncHook(["modules"]),
/** @type {SyncHook} */
afterOptimizeModuleIds: new SyncHook(["modules"]),
/** @type {SyncHook} */
reviveChunks: new SyncHook(["chunks", "records"]),
/** @type {SyncHook} */
optimizeChunkOrder: new SyncHook(["chunks"]),
/** @type {SyncHook} */
beforeChunkIds: new SyncHook(["chunks"]),
/** @type {SyncHook} */
optimizeChunkIds: new SyncHook(["chunks"]),
/** @type {SyncHook} */
/** @type {SyncHook} */
afterOptimizeChunks: new SyncHook(["chunks", "chunkGroups"]),
/** @type {AsyncSeriesHook} */
optimizeTree: new AsyncSeriesHook(["chunks", "modules"]),
/** @type {SyncHook} */
afterOptimizeTree: new SyncHook(["chunks", "modules"]),
/** @type {SyncBailHook} */
optimizeChunkModulesBasic: new SyncBailHook(["chunks", "modules"]),
/** @type {SyncBailHook} */
optimizeChunkModules: new SyncBailHook(["chunks", "modules"]),
/** @type {SyncBailHook} */
optimizeChunkModulesAdvanced: new SyncBailHook(["chunks", "modules"]),
/** @type {SyncHook} */
afterOptimizeChunkModules: new SyncHook(["chunks", "modules"]),
/** @type {SyncBailHook} */
shouldRecord: new SyncBailHook([]),
/** @type {SyncHook} */
reviveModules: new SyncHook(["modules", "records"]),
/** @type {SyncHook} */
optimizeModuleOrder: new SyncHook(["modules"]),
/** @type {SyncHook} */
advancedOptimizeModuleOrder: new SyncHook(["modules"]),
/** @type {SyncHook} */
beforeModuleIds: new SyncHook(["modules"]),
/** @type {SyncHook} */
moduleIds: new SyncHook(["modules"]),
/** @type {SyncHook} */
optimizeModuleIds: new SyncHook(["modules"]),
/** @type {SyncHook} */
/** @type {SyncHook} */
reviveChunks: new SyncHook(["chunks", "records"]),
/** @type {SyncHook} */
optimizeChunkOrder: new SyncHook(["chunks"]),
/** @type {SyncHook} */
beforeChunkIds: new SyncHook(["chunks"]),
/** @type {SyncHook} */
optimizeChunkIds: new SyncHook(["chunks"]),
/** @type {SyncHook} */
afterOptimizeChunkIds: new SyncHook(["chunks"]),
/** @type {SyncHook} */
recordModules: new SyncHook(["modules", "records"]),
/** @type {SyncHook} */
recordChunks: new SyncHook(["chunks", "records"]),
/** @type {SyncHook} */
beforeHash: new SyncHook([]),
/** @type {SyncHook} */
contentHash: new SyncHook(["chunk"]),
/** @type {SyncHook} */
afterHash: new SyncHook([]),
/** @type {SyncHook} */
recordHash: new SyncHook(["records"]),
/** @type {SyncHook} */
record: new SyncHook(["compilation", "records"]),
/** @type {SyncHook} */
beforeModuleAssets: new SyncHook([]),
/** @type {SyncBailHook} */
shouldGenerateChunkAssets: new SyncBailHook([]),
/** @type {SyncHook} */
succeedEntry: new SyncHook(["entry", "name", "module"]),
/** @type {SyncWaterfallHook} */
dependencyReference: new SyncWaterfallHook([
"dependencyReference",
"dependency",
"module"
]),
/** @type {SyncHook} */
finishModules: new SyncHook(["modules"]),
/** @type {SyncHook} */
finishRebuildingModule: new SyncHook(["module"]),
/** @type {SyncHook} */
unseal: new SyncHook([]),
/** @type {SyncHook} */
seal: new SyncHook([]),
/** @type {SyncHook} */
beforeChunks: new SyncHook([]),
/** @type {SyncHook} */
afterChunks: new SyncHook(["chunks"]),
/** @type {SyncBailHook} */
optimizeDependenciesBasic: new SyncBailHook(["modules"]),
/** @type {SyncBailHook} */
optimizeDependencies: new SyncBailHook(["modules"]),
/** @type {SyncBailHook} */
optimizeDependenciesAdvanced: new SyncBailHook(["modules"]),
/** @type {SyncBailHook} */
afterOptimizeDependencies: new SyncHook(["modules"]),
contentHash: new SyncHook(["chunk"]),
/** @type {SyncHook} */
afterHash: new SyncHook([]),
/** @type {SyncHook} */
recordHash: new SyncHook(["records"]),
/** @type {SyncHook} */
record: new SyncHook(["compilation", "records"]),
/** @type {SyncHook} */
beforeModuleAssets: new SyncHook([]),
/** @type {SyncBailHook} */
shouldGenerateChunkAssets: new SyncBailHook([]),
/** @type {SyncHook} */
beforeChunkAssets: new SyncHook([]),
/** @type {SyncHook} */
additionalChunkAssets: new SyncHook(["chunks"]),
/** @type {AsyncSeriesHook} */
additionalAssets: new AsyncSeriesHook([]),
/** @type {AsyncSeriesHook} */
optimizeChunkAssets: new AsyncSeriesHook(["chunks"]),
/** @type {SyncHook} */
afterOptimizeChunkAssets: new SyncHook(["chunks"]),
/** @type {AsyncSeriesHook} */
optimizeAssets: new AsyncSeriesHook(["assets"]),
/** @type {SyncHook} */
afterOptimizeAssets: new SyncHook(["assets"]),
/** @type {SyncBailHook} */
needAdditionalSeal: new SyncBailHook([]),
/** @type {AsyncSeriesHook} */
afterSeal: new AsyncSeriesHook([]),
constructor(compiler) {
super();
this.hooks = {
buildModule: new SyncHook(["module"]),
rebuildModule: new SyncHook(["module"]),
failedModule: new SyncHook(["module", "error"]),
succeedModule: new SyncHook(["module"]),
finishModules: new SyncHook(["modules"]),
finishRebuildingModule: new SyncHook(["module"]),
unseal: new SyncHook([]),
seal: new SyncHook([]),
optimizeDependenciesBasic: new SyncBailHook(["modules"]),
optimizeDependencies: new SyncBailHook(["modules"]),
optimizeDependenciesAdvanced: new SyncBailHook(["modules"]),
afterOptimizeDependencies: new SyncHook(["modules"]),
optimize: new SyncHook([]),
optimizeModulesBasic: new SyncBailHook(["modules"]),