Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const needEntryDeferringCode = chunk => {
for (const chunkGroup of chunk.groupsIterable) {
if (chunkGroup.chunks.length > 1) return true;
}
return false;
};
// TODO refactor this
if (!mainTemplate.hooks.jsonpScript) {
mainTemplate.hooks.jsonpScript = new SyncWaterfallHook([
"source",
"chunk",
"hash"
]);
}
if (!mainTemplate.hooks.linkPreload) {
mainTemplate.hooks.linkPreload = new SyncWaterfallHook([
"source",
"chunk",
"hash"
]);
}
if (!mainTemplate.hooks.linkPrefetch) {
mainTemplate.hooks.linkPrefetch = new SyncWaterfallHook([
"source",
"chunk",
"hash"
]);
}
const getScriptSrcPath = (hash, chunk, chunkIdExpression) => {
const chunkFilename = mainTemplate.outputOptions.chunkFilename;
const chunkMaps = chunk.getChunkMaps();
/** @type {SyncWaterfallHook} */
renderManifest: new SyncWaterfallHook(["result", "options"]),
modules: new SyncWaterfallHook([
"modules",
"chunk",
"hash",
"moduleTemplate",
"dependencyTemplates"
]),
moduleObj: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"moduleIdExpression"
]),
requireEnsure: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"chunkIdExpression"
]),
bootstrap: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"moduleTemplate",
"dependencyTemplates"
]),
localVars: new SyncWaterfallHook(["source", "chunk", "hash"]),
require: new SyncWaterfallHook(["source", "chunk", "hash"]),
requireExtensions: new SyncWaterfallHook(["source", "chunk", "hash"]),
/** @type {SyncWaterfallHook} */
"hash",
"chunkIdExpression"
]),
bootstrap: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"moduleTemplate",
"dependencyTemplates"
]),
localVars: new SyncWaterfallHook(["source", "chunk", "hash"]),
require: new SyncWaterfallHook(["source", "chunk", "hash"]),
requireExtensions: new SyncWaterfallHook(["source", "chunk", "hash"]),
beforeStartup: new SyncWaterfallHook(["source", "chunk", "hash"]),
startup: new SyncWaterfallHook(["source", "chunk", "hash"]),
render: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"moduleTemplate",
"dependencyTemplates"
]),
renderWithEntry: new SyncWaterfallHook(["source", "chunk", "hash"]),
moduleRequire: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"moduleIdExpression"
]),
addModule: new SyncWaterfallHook([
"source",
"chunk",
constructor(context, resolverFactory, options) {
super();
this.hooks = {
resolver: new SyncWaterfallHook(["resolver"]),
factory: new SyncWaterfallHook(["factory"]),
beforeResolve: new AsyncSeriesWaterfallHook(["data"]),
afterResolve: new AsyncSeriesWaterfallHook(["data"]),
createModule: new SyncBailHook(["data"]),
module: new SyncWaterfallHook(["module", "data"]),
createParser: new HookMap(() => new SyncBailHook(["parserOptions"])),
parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])),
createGenerator: new HookMap(
() => new SyncBailHook(["generatorOptions"])
),
generator: new HookMap(
() => new SyncHook(["generator", "generatorOptions"])
)
};
this._pluginCompat.tap("NormalModuleFactory", options => {
switch (options.name) {
case "before-resolve":
"moduleTemplate",
"dependencyTemplates"
]),
moduleObj: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"moduleIdExpression"
]),
requireEnsure: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"chunkIdExpression"
]),
bootstrap: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"moduleTemplate",
"dependencyTemplates"
]),
localVars: new SyncWaterfallHook(["source", "chunk", "hash"]),
require: new SyncWaterfallHook(["source", "chunk", "hash"]),
requireExtensions: new SyncWaterfallHook(["source", "chunk", "hash"]),
/** @type {SyncWaterfallHook} */
beforeStartup: new SyncWaterfallHook(["source", "chunk", "hash"]),
/** @type {SyncWaterfallHook} */
startup: new SyncWaterfallHook(["source", "chunk", "hash"]),
render: new SyncWaterfallHook([
"source",
"chunk",
export const makeHooks = (): IAutoHooks => ({
beforeRun: new SyncHook(['config']),
modifyConfig: new SyncWaterfallHook(['config']),
beforeShipIt: new SyncHook(),
afterAddToChangelog: new AsyncSeriesHook(['context']),
beforeCommitChangelog: new AsyncSeriesHook(['context']),
afterShipIt: new AsyncParallelHook(['version', 'commits', 'context']),
afterRelease: new AsyncParallelHook(['releaseInfo']),
onCreateRelease: new SyncHook(['options']),
onCreateChangelog: new SyncHook(['changelog', 'version']),
onCreateLogParse: new SyncHook(['logParse']),
getAuthor: new AsyncSeriesBailHook(),
getPreviousVersion: new AsyncSeriesBailHook(),
getRepository: new AsyncSeriesBailHook(),
version: new AsyncParallelHook(['version']),
afterVersion: new AsyncParallelHook(),
publish: new AsyncParallelHook(['version']),
afterPublish: new AsyncParallelHook(),
canary: new AsyncSeriesBailHook(['canaryVersion', 'postFix']),
constructor(compiler) {
super();
this.hooks = {
/** @type {SyncHook} */
buildModule: new SyncHook(["module"]),
/** @type {SyncHook} */
rebuildModule: new SyncHook(["module"]),
/** @type {SyncHook} */
failedModule: new SyncHook(["module", "error"]),
/** @type {SyncHook} */
succeedModule: new SyncHook(["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([]),
constructor(outputOptions) {
super();
this.outputOptions = outputOptions || {};
this.hooks = {
/** @type {SyncWaterfallHook} */
renderManifest: new SyncWaterfallHook(["result", "options"]),
modules: new SyncWaterfallHook([
"source",
"chunk",
"moduleTemplate",
"dependencyTemplates"
]),
render: new SyncWaterfallHook([
"source",
"chunk",
"moduleTemplate",
"dependencyTemplates"
]),
renderWithEntry: new SyncWaterfallHook(["source", "chunk"]),
hash: new SyncHook(["hash"]),
hashForChunk: new SyncHook(["hash", "chunk"])
};
}
bootstrap: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"moduleTemplate",
"dependencyTemplates"
]),
localVars: new SyncWaterfallHook(["source", "chunk", "hash"]),
require: new SyncWaterfallHook(["source", "chunk", "hash"]),
requireExtensions: new SyncWaterfallHook(["source", "chunk", "hash"]),
/** @type {SyncWaterfallHook} */
beforeStartup: new SyncWaterfallHook(["source", "chunk", "hash"]),
/** @type {SyncWaterfallHook} */
startup: new SyncWaterfallHook(["source", "chunk", "hash"]),
/** @type {SyncWaterfallHook} */
afterStartup: new SyncWaterfallHook(["source", "chunk", "hash"]),
render: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"moduleTemplate",
"dependencyTemplates"
]),
renderWithEntry: new SyncWaterfallHook(["source", "chunk", "hash"]),
moduleRequire: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"moduleIdExpression"
]),
addModule: new SyncWaterfallHook([
"source",