Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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":
case "before-compile":
case "make":
case "after-compile":
case "watch-run":
options.async = true;
break;
}
});
needAdditionalPass: new SyncBailHook([]),
/** @type {SyncHook} */
childCompiler: new SyncHook([
"childCompiler",
"compilerName",
"compilerIndex"
]),
// TODO the following hooks are weirdly located here
// TODO move them for webpack 5
/** @type {SyncHook} */
normalModuleLoader: new SyncHook(["loaderContext", "module"]),
/** @type {SyncBailHook} */
optimizeExtractedChunksBasic: new SyncBailHook(["chunks"]),
/** @type {SyncBailHook} */
optimizeExtractedChunks: new SyncBailHook(["chunks"]),
/** @type {SyncBailHook} */
optimizeExtractedChunksAdvanced: new SyncBailHook(["chunks"]),
/** @type {SyncHook} */
afterOptimizeExtractedChunks: new SyncHook(["chunks"])
};
this._pluginCompat.tap("Compilation", options => {
switch (options.name) {
case "optimize-tree":
case "additional-assets":
case "optimize-chunk-assets":
case "optimize-assets":
case "after-seal":
options.async = true;
break;
recordHash: new SyncHook(["records"]),
record: new SyncHook(["compilation", "records"]),
beforeModuleAssets: new SyncHook([]),
shouldGenerateChunkAssets: new SyncBailHook([]),
beforeChunkAssets: new SyncHook([]),
additionalChunkAssets: new SyncHook(["chunks"]),
additionalAssets: new AsyncSeriesHook([]),
optimizeChunkAssets: new AsyncSeriesHook(["chunks"]),
afterOptimizeChunkAssets: new SyncHook(["chunks"]),
optimizeAssets: new AsyncSeriesHook(["assets"]),
afterOptimizeAssets: new SyncHook(["assets"]),
needAdditionalSeal: new SyncBailHook([]),
afterSeal: new AsyncSeriesHook([]),
chunkHash: new SyncHook(["chunk", "chunkHash"]),
moduleAsset: new SyncHook(["module", "filename"]),
chunkAsset: new SyncHook(["chunk", "filename"]),
assetPath: new SyncWaterfallHook(["filename", "data"]), // TODO MainTemplate
needAdditionalPass: new SyncBailHook([]),
childCompiler: new SyncHook([
"childCompiler",
"compilerName",
"compilerIndex"
]),
// TODO the following hooks are weirdly located here
/** @type {SyncBailHook} */
optimizeChunksBasic: new SyncBailHook(["chunks", "chunkGroups"]),
/** @type {SyncBailHook} */
optimizeChunks: new SyncBailHook(["chunks", "chunkGroups"]),
/** @type {SyncBailHook} */
optimizeChunksAdvanced: new SyncBailHook(["chunks", "chunkGroups"]),
/** @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} */
() => new SyncBailHook(["expression"])
),
evaluateCallExpressionMember: new HookMap(
() => new SyncBailHook(["expression", "param"])
),
statement: new SyncBailHook(["statement"]),
statementIf: new SyncBailHook(["statement"]),
label: new HookMap(() => new SyncBailHook(["statement"])),
import: new SyncBailHook(["statement", "source"]),
importSpecifier: new SyncBailHook([
"statement",
"source",
"exportName",
"identifierName"
]),
export: new SyncBailHook(["statement"]),
exportImport: new SyncBailHook(["statement", "source"]),
exportDeclaration: new SyncBailHook(["statement", "declaration"]),
exportExpression: new SyncBailHook(["statement", "declaration"]),
exportSpecifier: new SyncBailHook([
"statement",
"identifierName",
"exportName",
"index"
]),
exportImportSpecifier: new SyncBailHook([
"statement",
"source",
"identifierName",
"exportName",
"index"
]),
super();
this.hooks = {
evaluateTypeof: new HookMap(() => new SyncBailHook(["expression"])),
evaluate: new HookMap(() => new SyncBailHook(["expression"])),
evaluateIdentifier: new HookMap(() => new SyncBailHook(["expression"])),
evaluateDefinedIdentifier: new HookMap(
() => new SyncBailHook(["expression"])
),
evaluateCallExpressionMember: new HookMap(
() => new SyncBailHook(["expression", "param"])
),
statement: new SyncBailHook(["statement"]),
statementIf: new SyncBailHook(["statement"]),
label: new HookMap(() => new SyncBailHook(["statement"])),
import: new SyncBailHook(["statement", "source"]),
importSpecifier: new SyncBailHook([
"statement",
"source",
"exportName",
"identifierName"
]),
export: new SyncBailHook(["statement"]),
exportImport: new SyncBailHook(["statement", "source"]),
exportDeclaration: new SyncBailHook(["statement", "declaration"]),
exportExpression: new SyncBailHook(["statement", "declaration"]),
exportSpecifier: new SyncBailHook([
"statement",
"identifierName",
"exportName",
"index"
]),
exportImportSpecifier: new SyncBailHook([
/** @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"]),
/** @type {SyncHook} */
optimize: new SyncHook([]),
/** @type {SyncBailHook} */
optimizeModulesBasic: new SyncBailHook(["modules"]),
/** @type {SyncBailHook} */
optimizeModules: new SyncBailHook(["modules"]),
/** @type {SyncBailHook} */
optimizeModulesAdvanced: new SyncBailHook(["modules"]),
/** @type {SyncHook} */
afterOptimizeModules: new SyncHook(["modules"]),
/** @type {SyncBailHook} */
optimizeChunksBasic: new SyncBailHook(["chunks", "chunkGroups"]),
/** @type {SyncBailHook} */
optimizeChunks: new SyncBailHook(["chunks", "chunkGroups"]),
/** @type {SyncBailHook} */
optimizeChunksAdvanced: new SyncBailHook(["chunks", "chunkGroups"]),
/** @type {SyncHook} */
afterOptimizeChunks: new SyncHook(["chunks", "chunkGroups"]),
),
evaluateCallExpressionMember: new HookMap(
() => new SyncBailHook(["expression", "param"])
),
statement: new SyncBailHook(["statement"]),
statementIf: new SyncBailHook(["statement"]),
label: new HookMap(() => new SyncBailHook(["statement"])),
import: new SyncBailHook(["statement", "source"]),
importSpecifier: new SyncBailHook([
"statement",
"source",
"exportName",
"identifierName"
]),
export: new SyncBailHook(["statement"]),
exportImport: new SyncBailHook(["statement", "source"]),
exportDeclaration: new SyncBailHook(["statement", "declaration"]),
exportExpression: new SyncBailHook(["statement", "declaration"]),
exportSpecifier: new SyncBailHook([
"statement",
"identifierName",
"exportName",
"index"
]),
exportImportSpecifier: new SyncBailHook([
"statement",
"source",
"identifierName",
"exportName",
"index"
]),
varDeclaration: new HookMap(() => new SyncBailHook(["declaration"])),
/** @type {SyncBailHook} */
optimizeChunksBasic: new SyncBailHook(["chunks", "chunkGroups"]),
/** @type {SyncBailHook} */
optimizeChunks: new SyncBailHook(["chunks", "chunkGroups"]),
/** @type {SyncBailHook} */
optimizeChunksAdvanced: new SyncBailHook(["chunks", "chunkGroups"]),
/** @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} */
varDeclarationLet: new HookMap(() => new SyncBailHook(["declaration"])),
varDeclarationConst: new HookMap(() => new SyncBailHook(["declaration"])),
varDeclarationVar: new HookMap(() => new SyncBailHook(["declaration"])),
canRename: new HookMap(() => new SyncBailHook(["initExpression"])),
rename: new HookMap(() => new SyncBailHook(["initExpression"])),
assigned: new HookMap(() => new SyncBailHook(["expression"])),
assign: new HookMap(() => new SyncBailHook(["expression"])),
typeof: new HookMap(() => new SyncBailHook(["expression"])),
importCall: new SyncBailHook(["expression"]),
call: new HookMap(() => new SyncBailHook(["expression"])),
callAnyMember: new HookMap(() => new SyncBailHook(["expression"])),
new: new HookMap(() => new SyncBailHook(["expression"])),
expression: new HookMap(() => new SyncBailHook(["expression"])),
expressionAnyMember: new HookMap(() => new SyncBailHook(["expression"])),
expressionConditionalOperator: new SyncBailHook(["expression"]),
expressionLogicalOperator: new SyncBailHook(["expression"]),
program: new SyncBailHook(["ast", "comments"])
};
const HOOK_MAP_COMPAT_CONFIG = {
evaluateTypeof: /^evaluate typeof (.+)$/,
evaluateIdentifier: /^evaluate Identifier (.+)$/,
evaluateDefinedIdentifier: /^evaluate defined Identifier (.+)$/,
evaluateCallExpressionMember: /^evaluate CallExpression .(.+)$/,
evaluate: /^evaluate (.+)$/,
label: /^label (.+)$/,
varDeclarationLet: /^var-let (.+)$/,
varDeclarationConst: /^var-const (.+)$/,
varDeclarationVar: /^var-var (.+)$/,
varDeclaration: /^var (.+)$/,
canRename: /^can-rename (.+)$/,
rename: /^rename (.+)$/,
typeof: /^typeof (.+)$/,