Linux ubuntu22 5.15.0-133-generic #144-Ubuntu SMP Fri Feb 7 20:47:38 UTC 2025 x86_64
nginx/1.18.0
: 128.199.27.159 | : 216.73.216.159
Cant Read [ /etc/named.conf ]
8.1.31
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
home /
amatya /
quiz1 /
node_modules /
webpack /
lib /
[ HOME SHELL ]
Name
Size
Permission
Action
asset
[ DIR ]
dr-xr-xr-x
async-modules
[ DIR ]
dr-xr-xr-x
cache
[ DIR ]
dr-xr-xr-x
config
[ DIR ]
dr-xr-xr-x
container
[ DIR ]
dr-xr-xr-x
css
[ DIR ]
dr-xr-xr-x
debug
[ DIR ]
dr-xr-xr-x
dependencies
[ DIR ]
dr-xr-xr-x
electron
[ DIR ]
dr-xr-xr-x
errors
[ DIR ]
dr-xr-xr-x
esm
[ DIR ]
dr-xr-xr-x
hmr
[ DIR ]
dr-xr-xr-x
ids
[ DIR ]
dr-xr-xr-x
javascript
[ DIR ]
dr-xr-xr-x
json
[ DIR ]
dr-xr-xr-x
library
[ DIR ]
dr-xr-xr-x
logging
[ DIR ]
dr-xr-xr-x
node
[ DIR ]
dr-xr-xr-x
optimize
[ DIR ]
dr-xr-xr-x
performance
[ DIR ]
dr-xr-xr-x
prefetch
[ DIR ]
dr-xr-xr-x
rules
[ DIR ]
dr-xr-xr-x
runtime
[ DIR ]
dr-xr-xr-x
schemes
[ DIR ]
dr-xr-xr-x
serialization
[ DIR ]
dr-xr-xr-x
sharing
[ DIR ]
dr-xr-xr-x
stats
[ DIR ]
dr-xr-xr-x
util
[ DIR ]
dr-xr-xr-x
wasm
[ DIR ]
dr-xr-xr-x
wasm-async
[ DIR ]
dr-xr-xr-x
wasm-sync
[ DIR ]
dr-xr-xr-x
web
[ DIR ]
dr-xr-xr-x
webworker
[ DIR ]
dr-xr-xr-x
APIPlugin.js
9.33
KB
-rw-rw-rw-
AbstractMethodError.js
1.2
KB
-rw-rw-rw-
AsyncDependenciesBlock.js
3.26
KB
-rw-rw-rw-
AsyncDependencyToInitialChunkE...
913
B
-rw-rw-rw-
AutomaticPrefetchPlugin.js
1.52
KB
-rw-rw-rw-
BannerPlugin.js
3.6
KB
-rw-rw-rw-
Cache.js
4.02
KB
-rw-rw-rw-
CacheFacade.js
8.5
KB
-rw-rw-rw-
CaseSensitiveModulesWarning.js
2.07
KB
-rw-rw-rw-
Chunk.js
22.66
KB
-rw-rw-rw-
ChunkGraph.js
53.68
KB
-rw-rw-rw-
ChunkGroup.js
15.36
KB
-rw-rw-rw-
ChunkRenderError.js
657
B
-rw-rw-rw-
ChunkTemplate.js
5.74
KB
-rw-rw-rw-
CleanPlugin.js
11.96
KB
-rw-rw-rw-
CodeGenerationError.js
619
B
-rw-rw-rw-
CodeGenerationResults.js
4.56
KB
-rw-rw-rw-
CommentCompilationWarning.js
725
B
-rw-rw-rw-
CompatibilityPlugin.js
5.74
KB
-rw-rw-rw-
Compilation.js
165.88
KB
-rw-rw-rw-
Compiler.js
39.7
KB
-rw-rw-rw-
ConcatenationScope.js
4.23
KB
-rw-rw-rw-
ConcurrentCompilationError.js
441
B
-rw-rw-rw-
ConditionalInitFragment.js
3.68
KB
-rw-rw-rw-
ConstPlugin.js
16.16
KB
-rw-rw-rw-
ContextExclusionPlugin.js
786
B
-rw-rw-rw-
ContextModule.js
37.37
KB
-rw-rw-rw-
ContextModuleFactory.js
13.99
KB
-rw-rw-rw-
ContextReplacementPlugin.js
5.26
KB
-rw-rw-rw-
CssModule.js
4.67
KB
-rw-rw-rw-
DefinePlugin.js
19.65
KB
-rw-rw-rw-
DelegatedModule.js
8.05
KB
-rw-rw-rw-
DelegatedModuleFactoryPlugin.j...
3.44
KB
-rw-rw-rw-
DelegatedPlugin.js
1.11
KB
-rw-rw-rw-
DependenciesBlock.js
3.47
KB
-rw-rw-rw-
Dependency.js
10.23
KB
-rw-rw-rw-
DependencyTemplate.js
2.77
KB
-rw-rw-rw-
DependencyTemplates.js
1.71
KB
-rw-rw-rw-
DllEntryPlugin.js
1.67
KB
-rw-rw-rw-
DllModule.js
5.16
KB
-rw-rw-rw-
DllModuleFactory.js
1018
B
-rw-rw-rw-
DllPlugin.js
1.83
KB
-rw-rw-rw-
DllReferencePlugin.js
6.06
KB
-rw-rw-rw-
DynamicEntryPlugin.js
2.3
KB
-rw-rw-rw-
EntryOptionPlugin.js
2.88
KB
-rw-rw-rw-
EntryPlugin.js
1.73
KB
-rw-rw-rw-
Entrypoint.js
2.99
KB
-rw-rw-rw-
EnvironmentNotSupportAsyncWarn...
1.85
KB
-rw-rw-rw-
EnvironmentPlugin.js
1.87
KB
-rw-rw-rw-
ErrorHelpers.js
2.85
KB
-rw-rw-rw-
EvalDevToolModulePlugin.js
4.17
KB
-rw-rw-rw-
EvalSourceMapDevToolPlugin.js
7.22
KB
-rw-rw-rw-
ExportsInfo.js
45.01
KB
-rw-rw-rw-
ExportsInfoApiPlugin.js
2.52
KB
-rw-rw-rw-
ExternalModule.js
29.18
KB
-rw-rw-rw-
ExternalModuleFactoryPlugin.js
9.68
KB
-rw-rw-rw-
ExternalsPlugin.js
899
B
-rw-rw-rw-
FileSystemInfo.js
116.52
KB
-rw-rw-rw-
FlagAllModulesAsUsedPlugin.js
1.5
KB
-rw-rw-rw-
FlagDependencyExportsPlugin.js
12.94
KB
-rw-rw-rw-
FlagDependencyUsagePlugin.js
10.81
KB
-rw-rw-rw-
FlagEntryExportAsUsedPlugin.js
1.46
KB
-rw-rw-rw-
Generator.js
5.06
KB
-rw-rw-rw-
GraphHelpers.js
1.06
KB
-rw-rw-rw-
HarmonyLinkingError.js
357
B
-rw-rw-rw-
HookWebpackError.js
2.03
KB
-rw-rw-rw-
HotModuleReplacementPlugin.js
29.02
KB
-rw-rw-rw-
HotUpdateChunk.js
353
B
-rw-rw-rw-
IgnoreErrorModuleFactory.js
1.02
KB
-rw-rw-rw-
IgnorePlugin.js
2.66
KB
-rw-rw-rw-
IgnoreWarningsPlugin.js
919
B
-rw-rw-rw-
InitFragment.js
5.35
KB
-rw-rw-rw-
InvalidDependenciesModuleWarni...
1.83
KB
-rw-rw-rw-
JavascriptMetaInfoPlugin.js
2.3
KB
-rw-rw-rw-
LibManifestPlugin.js
4.42
KB
-rw-rw-rw-
LibraryTemplatePlugin.js
1.55
KB
-rw-rw-rw-
LoaderOptionsPlugin.js
2.25
KB
-rw-rw-rw-
LoaderTargetPlugin.js
747
B
-rw-rw-rw-
MainTemplate.js
12.59
KB
-rw-rw-rw-
Module.js
33.3
KB
-rw-rw-rw-
ModuleBuildError.js
1.84
KB
-rw-rw-rw-
ModuleDependencyError.js
1.15
KB
-rw-rw-rw-
ModuleDependencyWarning.js
1.26
KB
-rw-rw-rw-
ModuleError.js
1.48
KB
-rw-rw-rw-
ModuleFactory.js
1.4
KB
-rw-rw-rw-
ModuleFilenameHelpers.js
13.51
KB
-rw-rw-rw-
ModuleGraph.js
25
KB
-rw-rw-rw-
ModuleGraphConnection.js
5.53
KB
-rw-rw-rw-
ModuleHashingError.js
615
B
-rw-rw-rw-
ModuleInfoHeaderPlugin.js
8.87
KB
-rw-rw-rw-
ModuleNotFoundError.js
2.63
KB
-rw-rw-rw-
ModuleParseError.js
3.58
KB
-rw-rw-rw-
ModuleProfile.js
2.44
KB
-rw-rw-rw-
ModuleRestoreError.js
1.01
KB
-rw-rw-rw-
ModuleSourceTypesConstants.js
2.4
KB
-rw-rw-rw-
ModuleStoreError.js
1
KB
-rw-rw-rw-
ModuleTemplate.js
5.17
KB
-rw-rw-rw-
ModuleTypeConstants.js
6.47
KB
-rw-rw-rw-
ModuleWarning.js
1.56
KB
-rw-rw-rw-
MultiCompiler.js
18.04
KB
-rw-rw-rw-
MultiStats.js
5.74
KB
-rw-rw-rw-
MultiWatching.js
1.55
KB
-rw-rw-rw-
NoEmitOnErrorsPlugin.js
713
B
-rw-rw-rw-
NoModeWarning.js
663
B
-rw-rw-rw-
NodeStuffInWebError.js
843
B
-rw-rw-rw-
NodeStuffPlugin.js
8.17
KB
-rw-rw-rw-
NormalModule.js
49.02
KB
-rw-rw-rw-
NormalModuleFactory.js
38.85
KB
-rw-rw-rw-
NormalModuleReplacementPlugin....
2.05
KB
-rw-rw-rw-
NullFactory.js
637
B
-rw-rw-rw-
OptimizationStages.js
225
B
-rw-rw-rw-
OptionsApply.js
523
B
-rw-rw-rw-
Parser.js
968
B
-rw-rw-rw-
PlatformPlugin.js
894
B
-rw-rw-rw-
PrefetchPlugin.js
1.14
KB
-rw-rw-rw-
ProgressPlugin.js
19.76
KB
-rw-rw-rw-
ProvidePlugin.js
3.63
KB
-rw-rw-rw-
RawModule.js
5.18
KB
-rw-rw-rw-
RecordIdsPlugin.js
6.69
KB
-rw-rw-rw-
RequestShortener.js
755
B
-rw-rw-rw-
RequireJsStuffPlugin.js
2.24
KB
-rw-rw-rw-
ResolverFactory.js
5.05
KB
-rw-rw-rw-
RuntimeGlobals.js
9.59
KB
-rw-rw-rw-
RuntimeModule.js
5.97
KB
-rw-rw-rw-
RuntimePlugin.js
16.98
KB
-rw-rw-rw-
RuntimeTemplate.js
32.79
KB
-rw-rw-rw-
SelfModuleFactory.js
844
B
-rw-rw-rw-
SingleEntryPlugin.js
161
B
-rw-rw-rw-
SizeFormatHelpers.js
584
B
-rw-rw-rw-
SourceMapDevToolModuleOptionsP...
1.49
KB
-rw-rw-rw-
SourceMapDevToolPlugin.js
18.47
KB
-rw-rw-rw-
Stats.js
2.23
KB
-rw-rw-rw-
Template.js
12.76
KB
-rw-rw-rw-
TemplatedPathPlugin.js
10.15
KB
-rw-rw-rw-
UnhandledSchemeError.js
833
B
-rw-rw-rw-
UnsupportedFeatureWarning.js
780
B
-rw-rw-rw-
UseStrictPlugin.js
2.61
KB
-rw-rw-rw-
WarnCaseSensitiveModulesPlugin...
1.72
KB
-rw-rw-rw-
WarnDeprecatedOptionPlugin.js
1.46
KB
-rw-rw-rw-
WarnNoModeSetPlugin.js
545
B
-rw-rw-rw-
WatchIgnorePlugin.js
3.93
KB
-rw-rw-rw-
Watching.js
14.34
KB
-rw-rw-rw-
WebpackError.js
1.72
KB
-rw-rw-rw-
WebpackIsIncludedPlugin.js
2.71
KB
-rw-rw-rw-
WebpackOptionsApply.js
28.97
KB
-rw-rw-rw-
WebpackOptionsDefaulter.js
818
B
-rw-rw-rw-
buildChunkGraph.js
41.36
KB
-rw-rw-rw-
cli.js
17.44
KB
-rw-rw-rw-
formatLocation.js
1.73
KB
-rw-rw-rw-
index.js
18.22
KB
-rw-rw-rw-
validateSchema.js
6.34
KB
-rw-rw-rw-
webpack.js
5.99
KB
-rw-rw-rw-
Delete
Unzip
Zip
${this.title}
Close
Code Editor : ProgressPlugin.js
/* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ "use strict"; const Compiler = require("./Compiler"); const MultiCompiler = require("./MultiCompiler"); const NormalModule = require("./NormalModule"); const createSchemaValidation = require("./util/create-schema-validation"); const { contextify } = require("./util/identifier"); /** @typedef {import("tapable").Tap} Tap */ /** @typedef {import("../declarations/plugins/ProgressPlugin").HandlerFunction} HandlerFunction */ /** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginArgument} ProgressPluginArgument */ /** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginOptions} ProgressPluginOptions */ /** @typedef {import("./Compilation").FactorizeModuleOptions} FactorizeModuleOptions */ /** @typedef {import("./Dependency")} Dependency */ /** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ /** @typedef {import("./Module")} Module */ /** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */ /** @typedef {import("./logging/Logger").Logger} Logger */ /** * @template T, K, R * @typedef {import("./util/AsyncQueue")<T, K, R>} AsyncQueue */ /** * @typedef {object} CountsData * @property {number} modulesCount modules count * @property {number} dependenciesCount dependencies count */ const validate = createSchemaValidation( require("../schemas/plugins/ProgressPlugin.check.js"), () => require("../schemas/plugins/ProgressPlugin.json"), { name: "Progress Plugin", baseDataPath: "options" } ); /** * @param {number} a a * @param {number} b b * @param {number} c c * @returns {number} median */ const median3 = (a, b, c) => a + b + c - Math.max(a, b, c) - Math.min(a, b, c); /** * @param {boolean | null | undefined} profile need profile * @param {Logger} logger logger * @returns {defaultHandler} default handler */ const createDefaultHandler = (profile, logger) => { /** @type {{ value: string | undefined, time: number }[]} */ const lastStateInfo = []; /** * @param {number} percentage percentage * @param {string} msg message * @param {...string} args additional arguments */ const defaultHandler = (percentage, msg, ...args) => { if (profile) { if (percentage === 0) { lastStateInfo.length = 0; } const fullState = [msg, ...args]; const state = fullState.map(s => s.replace(/\d+\/\d+ /g, "")); const now = Date.now(); const len = Math.max(state.length, lastStateInfo.length); for (let i = len; i >= 0; i--) { const stateItem = i < state.length ? state[i] : undefined; const lastStateItem = i < lastStateInfo.length ? lastStateInfo[i] : undefined; if (lastStateItem) { if (stateItem !== lastStateItem.value) { const diff = now - lastStateItem.time; if (lastStateItem.value) { let reportState = lastStateItem.value; if (i > 0) { reportState = `${lastStateInfo[i - 1].value} > ${reportState}`; } const stateMsg = `${" | ".repeat(i)}${diff} ms ${reportState}`; const d = diff; // This depends on timing so we ignore it for coverage /* eslint-disable no-lone-blocks */ /* istanbul ignore next */ { if (d > 10000) { logger.error(stateMsg); } else if (d > 1000) { logger.warn(stateMsg); } else if (d > 10) { logger.info(stateMsg); } else if (d > 5) { logger.log(stateMsg); } else { logger.debug(stateMsg); } } /* eslint-enable no-lone-blocks */ } if (stateItem === undefined) { lastStateInfo.length = i; } else { lastStateItem.value = stateItem; lastStateItem.time = now; lastStateInfo.length = i + 1; } } } else { lastStateInfo[i] = { value: stateItem, time: now }; } } } logger.status(`${Math.floor(percentage * 100)}%`, msg, ...args); if (percentage === 1 || (!msg && args.length === 0)) logger.status(); }; return defaultHandler; }; const SKIPPED_QUEUE_CONTEXTS = ["import-module", "load-module"]; /** * @callback ReportProgress * @param {number} p percentage * @param {...string} args additional arguments * @returns {void} */ /** @type {WeakMap<Compiler, ReportProgress | undefined>} */ const progressReporters = new WeakMap(); class ProgressPlugin { /** * @param {Compiler} compiler the current compiler * @returns {ReportProgress | undefined} a progress reporter, if any */ static getReporter(compiler) { return progressReporters.get(compiler); } /** * @param {ProgressPluginArgument} options options */ constructor(options = {}) { if (typeof options === "function") { options = { handler: options }; } validate(options); options = { ...ProgressPlugin.defaultOptions, ...options }; this.profile = options.profile; this.handler = options.handler; this.modulesCount = options.modulesCount; this.dependenciesCount = options.dependenciesCount; this.showEntries = options.entries; this.showModules = options.modules; this.showDependencies = options.dependencies; this.showActiveModules = options.activeModules; this.percentBy = options.percentBy; } /** * @param {Compiler | MultiCompiler} compiler webpack compiler * @returns {void} */ apply(compiler) { const handler = this.handler || createDefaultHandler( this.profile, compiler.getInfrastructureLogger("webpack.Progress") ); if (compiler instanceof MultiCompiler) { this._applyOnMultiCompiler(compiler, handler); } else if (compiler instanceof Compiler) { this._applyOnCompiler(compiler, handler); } } /** * @param {MultiCompiler} compiler webpack multi-compiler * @param {HandlerFunction} handler function that executes for every progress step * @returns {void} */ _applyOnMultiCompiler(compiler, handler) { const states = compiler.compilers.map( () => /** @type {[number, ...string[]]} */ ([0]) ); for (const [idx, item] of compiler.compilers.entries()) { new ProgressPlugin((p, msg, ...args) => { states[idx] = [p, msg, ...args]; let sum = 0; for (const [p] of states) sum += p; handler(sum / states.length, `[${idx}] ${msg}`, ...args); }).apply(item); } } /** * @param {Compiler} compiler webpack compiler * @param {HandlerFunction} handler function that executes for every progress step * @returns {void} */ _applyOnCompiler(compiler, handler) { const showEntries = this.showEntries; const showModules = this.showModules; const showDependencies = this.showDependencies; const showActiveModules = this.showActiveModules; let lastActiveModule = ""; let currentLoader = ""; let lastModulesCount = 0; let lastDependenciesCount = 0; let lastEntriesCount = 0; let modulesCount = 0; let skippedModulesCount = 0; let dependenciesCount = 0; let skippedDependenciesCount = 0; let entriesCount = 1; let doneModules = 0; let doneDependencies = 0; let doneEntries = 0; const activeModules = new Set(); let lastUpdate = 0; const updateThrottled = () => { if (lastUpdate + 500 < Date.now()) update(); }; const update = () => { /** @type {string[]} */ const items = []; const percentByModules = doneModules / Math.max(lastModulesCount || this.modulesCount || 1, modulesCount); const percentByEntries = doneEntries / Math.max(lastEntriesCount || this.dependenciesCount || 1, entriesCount); const percentByDependencies = doneDependencies / Math.max(lastDependenciesCount || 1, dependenciesCount); let percentageFactor; switch (this.percentBy) { case "entries": percentageFactor = percentByEntries; break; case "dependencies": percentageFactor = percentByDependencies; break; case "modules": percentageFactor = percentByModules; break; default: percentageFactor = median3( percentByModules, percentByEntries, percentByDependencies ); } const percentage = 0.1 + percentageFactor * 0.55; if (currentLoader) { items.push( `import loader ${contextify( compiler.context, currentLoader, compiler.root )}` ); } else { const statItems = []; if (showEntries) { statItems.push(`${doneEntries}/${entriesCount} entries`); } if (showDependencies) { statItems.push( `${doneDependencies}/${dependenciesCount} dependencies` ); } if (showModules) { statItems.push(`${doneModules}/${modulesCount} modules`); } if (showActiveModules) { statItems.push(`${activeModules.size} active`); } if (statItems.length > 0) { items.push(statItems.join(" ")); } if (showActiveModules) { items.push(lastActiveModule); } } handler(percentage, "building", ...items); lastUpdate = Date.now(); }; /** * @template T * @param {AsyncQueue<FactorizeModuleOptions, string, Module | ModuleFactoryResult>} factorizeQueue async queue * @param {T} _item item */ const factorizeAdd = (factorizeQueue, _item) => { if (SKIPPED_QUEUE_CONTEXTS.includes(factorizeQueue.getContext())) { skippedDependenciesCount++; } dependenciesCount++; if (dependenciesCount < 50 || dependenciesCount % 100 === 0) updateThrottled(); }; const factorizeDone = () => { doneDependencies++; if (doneDependencies < 50 || doneDependencies % 100 === 0) updateThrottled(); }; /** * @template T * @param {AsyncQueue<Module, string, Module>} addModuleQueue async queue * @param {T} _item item */ const moduleAdd = (addModuleQueue, _item) => { if (SKIPPED_QUEUE_CONTEXTS.includes(addModuleQueue.getContext())) { skippedModulesCount++; } modulesCount++; if (modulesCount < 50 || modulesCount % 100 === 0) updateThrottled(); }; // only used when showActiveModules is set /** * @param {Module} module the module */ const moduleBuild = module => { const ident = module.identifier(); if (ident) { activeModules.add(ident); lastActiveModule = ident; update(); } }; /** * @param {Dependency} entry entry dependency * @param {EntryOptions} options options object */ const entryAdd = (entry, options) => { entriesCount++; if (entriesCount < 5 || entriesCount % 10 === 0) updateThrottled(); }; /** * @param {Module} module the module */ const moduleDone = module => { doneModules++; if (showActiveModules) { const ident = module.identifier(); if (ident) { activeModules.delete(ident); if (lastActiveModule === ident) { lastActiveModule = ""; for (const m of activeModules) { lastActiveModule = m; } update(); return; } } } if (doneModules < 50 || doneModules % 100 === 0) updateThrottled(); }; /** * @param {Dependency} entry entry dependency * @param {EntryOptions} options options object */ const entryDone = (entry, options) => { doneEntries++; update(); }; const cache = compiler .getCache("ProgressPlugin") .getItemCache("counts", null); /** @type {Promise<CountsData> | undefined} */ let cacheGetPromise; compiler.hooks.beforeCompile.tap("ProgressPlugin", () => { if (!cacheGetPromise) { cacheGetPromise = cache.getPromise().then( data => { if (data) { lastModulesCount = lastModulesCount || data.modulesCount; lastDependenciesCount = lastDependenciesCount || data.dependenciesCount; } return data; }, err => { // Ignore error } ); } }); compiler.hooks.afterCompile.tapPromise("ProgressPlugin", compilation => { if (compilation.compiler.isChild()) return Promise.resolve(); return /** @type {Promise<CountsData>} */ (cacheGetPromise).then( async oldData => { const realModulesCount = modulesCount - skippedModulesCount; const realDependenciesCount = dependenciesCount - skippedDependenciesCount; if ( !oldData || oldData.modulesCount !== realModulesCount || oldData.dependenciesCount !== realDependenciesCount ) { await cache.storePromise({ modulesCount: realModulesCount, dependenciesCount: realDependenciesCount }); } } ); }); compiler.hooks.compilation.tap("ProgressPlugin", compilation => { if (compilation.compiler.isChild()) return; lastModulesCount = modulesCount; lastEntriesCount = entriesCount; lastDependenciesCount = dependenciesCount; modulesCount = skippedModulesCount = dependenciesCount = skippedDependenciesCount = entriesCount = 0; doneModules = doneDependencies = doneEntries = 0; compilation.factorizeQueue.hooks.added.tap("ProgressPlugin", item => factorizeAdd(compilation.factorizeQueue, item) ); compilation.factorizeQueue.hooks.result.tap( "ProgressPlugin", factorizeDone ); compilation.addModuleQueue.hooks.added.tap("ProgressPlugin", item => moduleAdd(compilation.addModuleQueue, item) ); compilation.processDependenciesQueue.hooks.result.tap( "ProgressPlugin", moduleDone ); if (showActiveModules) { compilation.hooks.buildModule.tap("ProgressPlugin", moduleBuild); } compilation.hooks.addEntry.tap("ProgressPlugin", entryAdd); compilation.hooks.failedEntry.tap("ProgressPlugin", entryDone); compilation.hooks.succeedEntry.tap("ProgressPlugin", entryDone); // avoid dynamic require if bundled with webpack // @ts-expect-error if (typeof __webpack_require__ !== "function") { const requiredLoaders = new Set(); NormalModule.getCompilationHooks(compilation).beforeLoaders.tap( "ProgressPlugin", loaders => { for (const loader of loaders) { if ( loader.type !== "module" && !requiredLoaders.has(loader.loader) ) { requiredLoaders.add(loader.loader); currentLoader = loader.loader; update(); require(loader.loader); } } if (currentLoader) { currentLoader = ""; update(); } } ); } const hooks = { finishModules: "finish module graph", seal: "plugins", optimizeDependencies: "dependencies optimization", afterOptimizeDependencies: "after dependencies optimization", beforeChunks: "chunk graph", afterChunks: "after chunk graph", optimize: "optimizing", optimizeModules: "module optimization", afterOptimizeModules: "after module optimization", optimizeChunks: "chunk optimization", afterOptimizeChunks: "after chunk optimization", optimizeTree: "module and chunk tree optimization", afterOptimizeTree: "after module and chunk tree optimization", optimizeChunkModules: "chunk modules optimization", afterOptimizeChunkModules: "after chunk modules optimization", reviveModules: "module reviving", beforeModuleIds: "before module ids", moduleIds: "module ids", optimizeModuleIds: "module id optimization", afterOptimizeModuleIds: "module id optimization", reviveChunks: "chunk reviving", beforeChunkIds: "before chunk ids", chunkIds: "chunk ids", optimizeChunkIds: "chunk id optimization", afterOptimizeChunkIds: "after chunk id optimization", recordModules: "record modules", recordChunks: "record chunks", beforeModuleHash: "module hashing", beforeCodeGeneration: "code generation", beforeRuntimeRequirements: "runtime requirements", beforeHash: "hashing", afterHash: "after hashing", recordHash: "record hash", beforeModuleAssets: "module assets processing", beforeChunkAssets: "chunk assets processing", processAssets: "asset processing", afterProcessAssets: "after asset optimization", record: "recording", afterSeal: "after seal" }; const numberOfHooks = Object.keys(hooks).length; for (const [idx, name] of Object.keys(hooks).entries()) { const title = hooks[/** @type {keyof typeof hooks} */ (name)]; const percentage = (idx / numberOfHooks) * 0.25 + 0.7; compilation.hooks[/** @type {keyof typeof hooks} */ (name)].intercept({ name: "ProgressPlugin", call() { handler(percentage, "sealing", title); }, done() { progressReporters.set(compiler, undefined); handler(percentage, "sealing", title); }, result() { handler(percentage, "sealing", title); }, error() { handler(percentage, "sealing", title); }, tap(tap) { // p is percentage from 0 to 1 // args is any number of messages in a hierarchical matter progressReporters.set(compilation.compiler, (p, ...args) => { handler(percentage, "sealing", title, tap.name, ...args); }); handler(percentage, "sealing", title, tap.name); } }); } }); compiler.hooks.make.intercept({ name: "ProgressPlugin", call() { handler(0.1, "building"); }, done() { handler(0.65, "building"); } }); /** * @param {TODO} hook hook * @param {number} progress progress from 0 to 1 * @param {string} category category * @param {string} name name */ const interceptHook = (hook, progress, category, name) => { hook.intercept({ name: "ProgressPlugin", call() { handler(progress, category, name); }, done() { progressReporters.set(compiler, undefined); handler(progress, category, name); }, result() { handler(progress, category, name); }, error() { handler(progress, category, name); }, /** * @param {Tap} tap tap */ tap(tap) { progressReporters.set(compiler, (p, ...args) => { handler(progress, category, name, tap.name, ...args); }); handler(progress, category, name, tap.name); } }); }; compiler.cache.hooks.endIdle.intercept({ name: "ProgressPlugin", call() { handler(0, ""); } }); interceptHook(compiler.cache.hooks.endIdle, 0.01, "cache", "end idle"); compiler.hooks.beforeRun.intercept({ name: "ProgressPlugin", call() { handler(0, ""); } }); interceptHook(compiler.hooks.beforeRun, 0.01, "setup", "before run"); interceptHook(compiler.hooks.run, 0.02, "setup", "run"); interceptHook(compiler.hooks.watchRun, 0.03, "setup", "watch run"); interceptHook( compiler.hooks.normalModuleFactory, 0.04, "setup", "normal module factory" ); interceptHook( compiler.hooks.contextModuleFactory, 0.05, "setup", "context module factory" ); interceptHook( compiler.hooks.beforeCompile, 0.06, "setup", "before compile" ); interceptHook(compiler.hooks.compile, 0.07, "setup", "compile"); interceptHook(compiler.hooks.thisCompilation, 0.08, "setup", "compilation"); interceptHook(compiler.hooks.compilation, 0.09, "setup", "compilation"); interceptHook(compiler.hooks.finishMake, 0.69, "building", "finish"); interceptHook(compiler.hooks.emit, 0.95, "emitting", "emit"); interceptHook(compiler.hooks.afterEmit, 0.98, "emitting", "after emit"); interceptHook(compiler.hooks.done, 0.99, "done", "plugins"); compiler.hooks.done.intercept({ name: "ProgressPlugin", done() { handler(0.99, ""); } }); interceptHook( compiler.cache.hooks.storeBuildDependencies, 0.99, "cache", "store build dependencies" ); interceptHook(compiler.cache.hooks.shutdown, 0.99, "cache", "shutdown"); interceptHook(compiler.cache.hooks.beginIdle, 0.99, "cache", "begin idle"); interceptHook( compiler.hooks.watchClose, 0.99, "end", "closing watch compilation" ); compiler.cache.hooks.beginIdle.intercept({ name: "ProgressPlugin", done() { handler(1, ""); } }); compiler.cache.hooks.shutdown.intercept({ name: "ProgressPlugin", done() { handler(1, ""); } }); } } ProgressPlugin.defaultOptions = { profile: false, modulesCount: 5000, dependenciesCount: 10000, modules: true, dependencies: true, activeModules: false, entries: true }; ProgressPlugin.createDefaultHandler = createDefaultHandler; module.exports = ProgressPlugin;
Close