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.52
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 : Chunk.js
/* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ "use strict"; const ChunkGraph = require("./ChunkGraph"); const Entrypoint = require("./Entrypoint"); const { intersect } = require("./util/SetHelpers"); const SortableSet = require("./util/SortableSet"); const StringXor = require("./util/StringXor"); const { compareModulesByIdentifier, compareChunkGroupsByIndex, compareModulesById } = require("./util/comparators"); const { createArrayToSetDeprecationSet } = require("./util/deprecation"); const { mergeRuntime } = require("./util/runtime"); /** @typedef {import("webpack-sources").Source} Source */ /** @typedef {import("./ChunkGraph").ChunkFilterPredicate} ChunkFilterPredicate */ /** @typedef {import("./ChunkGraph").ChunkSizeOptions} ChunkSizeOptions */ /** @typedef {import("./ChunkGraph").ModuleFilterPredicate} ModuleFilterPredicate */ /** @typedef {import("./ChunkGraph").ModuleId} ModuleId */ /** @typedef {import("./ChunkGroup")} ChunkGroup */ /** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */ /** @typedef {import("./Compilation")} Compilation */ /** @typedef {import("./Compilation").AssetInfo} AssetInfo */ /** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */ /** @typedef {import("./Module")} Module */ /** @typedef {import("./ModuleGraph")} ModuleGraph */ /** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */ /** @typedef {import("./util/Hash")} Hash */ /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ /** @typedef {number | string} ChunkId */ const ChunkFilesSet = createArrayToSetDeprecationSet("chunk.files"); /** * @typedef {object} WithId an object who has an id property * * @property {string | number} id the id of the object */ /** * @deprecated * @typedef {object} ChunkMaps * @property {Record<string|number, string>} hash * @property {Record<string|number, Record<string, string>>} contentHash * @property {Record<string|number, string>} name */ /** * @deprecated * @typedef {object} ChunkModuleMaps * @property {Record<string|number, (string|number)[]>} id * @property {Record<string|number, string>} hash */ let debugId = 1000; /** * A Chunk is a unit of encapsulation for Modules. * Chunks are "rendered" into bundles that get emitted when the build completes. */ class Chunk { /** * @param {string=} name of chunk being created, is optional (for subclasses) * @param {boolean} backCompat enable backward-compatibility */ constructor(name, backCompat = true) { /** @type {ChunkId | null} */ this.id = null; /** @type {ChunkId[] | null} */ this.ids = null; /** @type {number} */ this.debugId = debugId++; /** @type {string | undefined} */ this.name = name; /** @type {SortableSet<string>} */ this.idNameHints = new SortableSet(); /** @type {boolean} */ this.preventIntegration = false; /** @type {TemplatePath | undefined} */ this.filenameTemplate = undefined; /** @type {TemplatePath | undefined} */ this.cssFilenameTemplate = undefined; /** * @private * @type {SortableSet<ChunkGroup>} */ this._groups = new SortableSet(undefined, compareChunkGroupsByIndex); /** @type {RuntimeSpec} */ this.runtime = undefined; /** @type {Set<string>} */ this.files = backCompat ? new ChunkFilesSet() : new Set(); /** @type {Set<string>} */ this.auxiliaryFiles = new Set(); /** @type {boolean} */ this.rendered = false; /** @type {string=} */ this.hash = undefined; /** @type {Record<string, string>} */ this.contentHash = Object.create(null); /** @type {string=} */ this.renderedHash = undefined; /** @type {string=} */ this.chunkReason = undefined; /** @type {boolean} */ this.extraAsync = false; } // TODO remove in webpack 6 // BACKWARD-COMPAT START get entryModule() { const entryModules = Array.from( ChunkGraph.getChunkGraphForChunk( this, "Chunk.entryModule", "DEP_WEBPACK_CHUNK_ENTRY_MODULE" ).getChunkEntryModulesIterable(this) ); if (entryModules.length === 0) { return undefined; } else if (entryModules.length === 1) { return entryModules[0]; } throw new Error( "Module.entryModule: Multiple entry modules are not supported by the deprecated API (Use the new ChunkGroup API)" ); } /** * @returns {boolean} true, if the chunk contains an entry module */ hasEntryModule() { return ( ChunkGraph.getChunkGraphForChunk( this, "Chunk.hasEntryModule", "DEP_WEBPACK_CHUNK_HAS_ENTRY_MODULE" ).getNumberOfEntryModules(this) > 0 ); } /** * @param {Module} module the module * @returns {boolean} true, if the chunk could be added */ addModule(module) { const chunkGraph = ChunkGraph.getChunkGraphForChunk( this, "Chunk.addModule", "DEP_WEBPACK_CHUNK_ADD_MODULE" ); if (chunkGraph.isModuleInChunk(module, this)) return false; chunkGraph.connectChunkAndModule(this, module); return true; } /** * @param {Module} module the module * @returns {void} */ removeModule(module) { ChunkGraph.getChunkGraphForChunk( this, "Chunk.removeModule", "DEP_WEBPACK_CHUNK_REMOVE_MODULE" ).disconnectChunkAndModule(this, module); } /** * @returns {number} the number of module which are contained in this chunk */ getNumberOfModules() { return ChunkGraph.getChunkGraphForChunk( this, "Chunk.getNumberOfModules", "DEP_WEBPACK_CHUNK_GET_NUMBER_OF_MODULES" ).getNumberOfChunkModules(this); } get modulesIterable() { const chunkGraph = ChunkGraph.getChunkGraphForChunk( this, "Chunk.modulesIterable", "DEP_WEBPACK_CHUNK_MODULES_ITERABLE" ); return chunkGraph.getOrderedChunkModulesIterable( this, compareModulesByIdentifier ); } /** * @param {Chunk} otherChunk the chunk to compare with * @returns {-1|0|1} the comparison result */ compareTo(otherChunk) { const chunkGraph = ChunkGraph.getChunkGraphForChunk( this, "Chunk.compareTo", "DEP_WEBPACK_CHUNK_COMPARE_TO" ); return chunkGraph.compareChunks(this, otherChunk); } /** * @param {Module} module the module * @returns {boolean} true, if the chunk contains the module */ containsModule(module) { return ChunkGraph.getChunkGraphForChunk( this, "Chunk.containsModule", "DEP_WEBPACK_CHUNK_CONTAINS_MODULE" ).isModuleInChunk(module, this); } /** * @returns {Module[]} the modules for this chunk */ getModules() { return ChunkGraph.getChunkGraphForChunk( this, "Chunk.getModules", "DEP_WEBPACK_CHUNK_GET_MODULES" ).getChunkModules(this); } /** * @returns {void} */ remove() { const chunkGraph = ChunkGraph.getChunkGraphForChunk( this, "Chunk.remove", "DEP_WEBPACK_CHUNK_REMOVE" ); chunkGraph.disconnectChunk(this); this.disconnectFromGroups(); } /** * @param {Module} module the module * @param {Chunk} otherChunk the target chunk * @returns {void} */ moveModule(module, otherChunk) { const chunkGraph = ChunkGraph.getChunkGraphForChunk( this, "Chunk.moveModule", "DEP_WEBPACK_CHUNK_MOVE_MODULE" ); chunkGraph.disconnectChunkAndModule(this, module); chunkGraph.connectChunkAndModule(otherChunk, module); } /** * @param {Chunk} otherChunk the other chunk * @returns {boolean} true, if the specified chunk has been integrated */ integrate(otherChunk) { const chunkGraph = ChunkGraph.getChunkGraphForChunk( this, "Chunk.integrate", "DEP_WEBPACK_CHUNK_INTEGRATE" ); if (chunkGraph.canChunksBeIntegrated(this, otherChunk)) { chunkGraph.integrateChunks(this, otherChunk); return true; } return false; } /** * @param {Chunk} otherChunk the other chunk * @returns {boolean} true, if chunks could be integrated */ canBeIntegrated(otherChunk) { const chunkGraph = ChunkGraph.getChunkGraphForChunk( this, "Chunk.canBeIntegrated", "DEP_WEBPACK_CHUNK_CAN_BE_INTEGRATED" ); return chunkGraph.canChunksBeIntegrated(this, otherChunk); } /** * @returns {boolean} true, if this chunk contains no module */ isEmpty() { const chunkGraph = ChunkGraph.getChunkGraphForChunk( this, "Chunk.isEmpty", "DEP_WEBPACK_CHUNK_IS_EMPTY" ); return chunkGraph.getNumberOfChunkModules(this) === 0; } /** * @returns {number} total size of all modules in this chunk */ modulesSize() { const chunkGraph = ChunkGraph.getChunkGraphForChunk( this, "Chunk.modulesSize", "DEP_WEBPACK_CHUNK_MODULES_SIZE" ); return chunkGraph.getChunkModulesSize(this); } /** * @param {ChunkSizeOptions} options options object * @returns {number} total size of this chunk */ size(options = {}) { const chunkGraph = ChunkGraph.getChunkGraphForChunk( this, "Chunk.size", "DEP_WEBPACK_CHUNK_SIZE" ); return chunkGraph.getChunkSize(this, options); } /** * @param {Chunk} otherChunk the other chunk * @param {ChunkSizeOptions} options options object * @returns {number} total size of the chunk or false if the chunk can't be integrated */ integratedSize(otherChunk, options) { const chunkGraph = ChunkGraph.getChunkGraphForChunk( this, "Chunk.integratedSize", "DEP_WEBPACK_CHUNK_INTEGRATED_SIZE" ); return chunkGraph.getIntegratedChunksSize(this, otherChunk, options); } /** * @param {ModuleFilterPredicate} filterFn function used to filter modules * @returns {ChunkModuleMaps} module map information */ getChunkModuleMaps(filterFn) { const chunkGraph = ChunkGraph.getChunkGraphForChunk( this, "Chunk.getChunkModuleMaps", "DEP_WEBPACK_CHUNK_GET_CHUNK_MODULE_MAPS" ); /** @type {Record<string|number, (string|number)[]>} */ const chunkModuleIdMap = Object.create(null); /** @type {Record<string|number, string>} */ const chunkModuleHashMap = Object.create(null); for (const asyncChunk of this.getAllAsyncChunks()) { /** @type {ChunkId[] | undefined} */ let array; for (const module of chunkGraph.getOrderedChunkModulesIterable( asyncChunk, compareModulesById(chunkGraph) )) { if (filterFn(module)) { if (array === undefined) { array = []; chunkModuleIdMap[/** @type {ChunkId} */ (asyncChunk.id)] = array; } const moduleId = /** @type {ModuleId} */ (chunkGraph.getModuleId(module)); array.push(moduleId); chunkModuleHashMap[moduleId] = chunkGraph.getRenderedModuleHash( module, undefined ); } } } return { id: chunkModuleIdMap, hash: chunkModuleHashMap }; } /** * @param {ModuleFilterPredicate} filterFn predicate function used to filter modules * @param {ChunkFilterPredicate=} filterChunkFn predicate function used to filter chunks * @returns {boolean} return true if module exists in graph */ hasModuleInGraph(filterFn, filterChunkFn) { const chunkGraph = ChunkGraph.getChunkGraphForChunk( this, "Chunk.hasModuleInGraph", "DEP_WEBPACK_CHUNK_HAS_MODULE_IN_GRAPH" ); return chunkGraph.hasModuleInGraph(this, filterFn, filterChunkFn); } /** * @deprecated * @param {boolean} realHash whether the full hash or the rendered hash is to be used * @returns {ChunkMaps} the chunk map information */ getChunkMaps(realHash) { /** @type {Record<string|number, string>} */ const chunkHashMap = Object.create(null); /** @type {Record<string|number, Record<string, string>>} */ const chunkContentHashMap = Object.create(null); /** @type {Record<string|number, string>} */ const chunkNameMap = Object.create(null); for (const chunk of this.getAllAsyncChunks()) { const id = /** @type {ChunkId} */ (chunk.id); chunkHashMap[id] = /** @type {string} */ (realHash ? chunk.hash : chunk.renderedHash); for (const key of Object.keys(chunk.contentHash)) { if (!chunkContentHashMap[key]) { chunkContentHashMap[key] = Object.create(null); } chunkContentHashMap[key][id] = chunk.contentHash[key]; } if (chunk.name) { chunkNameMap[id] = chunk.name; } } return { hash: chunkHashMap, contentHash: chunkContentHashMap, name: chunkNameMap }; } // BACKWARD-COMPAT END /** * @returns {boolean} whether or not the Chunk will have a runtime */ hasRuntime() { for (const chunkGroup of this._groups) { if ( chunkGroup instanceof Entrypoint && chunkGroup.getRuntimeChunk() === this ) { return true; } } return false; } /** * @returns {boolean} whether or not this chunk can be an initial chunk */ canBeInitial() { for (const chunkGroup of this._groups) { if (chunkGroup.isInitial()) return true; } return false; } /** * @returns {boolean} whether this chunk can only be an initial chunk */ isOnlyInitial() { if (this._groups.size <= 0) return false; for (const chunkGroup of this._groups) { if (!chunkGroup.isInitial()) return false; } return true; } /** * @returns {EntryOptions | undefined} the entry options for this chunk */ getEntryOptions() { for (const chunkGroup of this._groups) { if (chunkGroup instanceof Entrypoint) { return chunkGroup.options; } } return undefined; } /** * @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being added * @returns {void} */ addGroup(chunkGroup) { this._groups.add(chunkGroup); } /** * @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being removed from * @returns {void} */ removeGroup(chunkGroup) { this._groups.delete(chunkGroup); } /** * @param {ChunkGroup} chunkGroup the chunkGroup to check * @returns {boolean} returns true if chunk has chunkGroup reference and exists in chunkGroup */ isInGroup(chunkGroup) { return this._groups.has(chunkGroup); } /** * @returns {number} the amount of groups that the said chunk is in */ getNumberOfGroups() { return this._groups.size; } /** * @returns {SortableSet<ChunkGroup>} the chunkGroups that the said chunk is referenced in */ get groupsIterable() { this._groups.sort(); return this._groups; } /** * @returns {void} */ disconnectFromGroups() { for (const chunkGroup of this._groups) { chunkGroup.removeChunk(this); } } /** * @param {Chunk} newChunk the new chunk that will be split out of * @returns {void} */ split(newChunk) { for (const chunkGroup of this._groups) { chunkGroup.insertChunk(newChunk, this); newChunk.addGroup(chunkGroup); } for (const idHint of this.idNameHints) { newChunk.idNameHints.add(idHint); } newChunk.runtime = mergeRuntime(newChunk.runtime, this.runtime); } /** * @param {Hash} hash hash (will be modified) * @param {ChunkGraph} chunkGraph the chunk graph * @returns {void} */ updateHash(hash, chunkGraph) { hash.update( `${this.id} ${this.ids ? this.ids.join() : ""} ${this.name || ""} ` ); const xor = new StringXor(); for (const m of chunkGraph.getChunkModulesIterable(this)) { xor.add(chunkGraph.getModuleHash(m, this.runtime)); } xor.updateHash(hash); const entryModules = chunkGraph.getChunkEntryModulesWithChunkGroupIterable(this); for (const [m, chunkGroup] of entryModules) { hash.update( `entry${chunkGraph.getModuleId(m)}${ /** @type {ChunkGroup} */ (chunkGroup).id }` ); } } /** * @returns {Set<Chunk>} a set of all the async chunks */ getAllAsyncChunks() { const queue = new Set(); const chunks = new Set(); const initialChunks = intersect( Array.from(this.groupsIterable, g => new Set(g.chunks)) ); const initialQueue = new Set(this.groupsIterable); for (const chunkGroup of initialQueue) { for (const child of chunkGroup.childrenIterable) { if (child instanceof Entrypoint) { initialQueue.add(child); } else { queue.add(child); } } } for (const chunkGroup of queue) { for (const chunk of chunkGroup.chunks) { if (!initialChunks.has(chunk)) { chunks.add(chunk); } } for (const child of chunkGroup.childrenIterable) { queue.add(child); } } return chunks; } /** * @returns {Set<Chunk>} a set of all the initial chunks (including itself) */ getAllInitialChunks() { const chunks = new Set(); const queue = new Set(this.groupsIterable); for (const group of queue) { if (group.isInitial()) { for (const c of group.chunks) chunks.add(c); for (const g of group.childrenIterable) queue.add(g); } } return chunks; } /** * @returns {Set<Chunk>} a set of all the referenced chunks (including itself) */ getAllReferencedChunks() { const queue = new Set(this.groupsIterable); const chunks = new Set(); for (const chunkGroup of queue) { for (const chunk of chunkGroup.chunks) { chunks.add(chunk); } for (const child of chunkGroup.childrenIterable) { queue.add(child); } } return chunks; } /** * @returns {Set<Entrypoint>} a set of all the referenced entrypoints */ getAllReferencedAsyncEntrypoints() { const queue = new Set(this.groupsIterable); const entrypoints = new Set(); for (const chunkGroup of queue) { for (const entrypoint of chunkGroup.asyncEntrypointsIterable) { entrypoints.add(entrypoint); } for (const child of chunkGroup.childrenIterable) { queue.add(child); } } return entrypoints; } /** * @returns {boolean} true, if the chunk references async chunks */ hasAsyncChunks() { const queue = new Set(); const initialChunks = intersect( Array.from(this.groupsIterable, g => new Set(g.chunks)) ); for (const chunkGroup of this.groupsIterable) { for (const child of chunkGroup.childrenIterable) { queue.add(child); } } for (const chunkGroup of queue) { for (const chunk of chunkGroup.chunks) { if (!initialChunks.has(chunk)) { return true; } } for (const child of chunkGroup.childrenIterable) { queue.add(child); } } return false; } /** * @param {ChunkGraph} chunkGraph the chunk graph * @param {ChunkFilterPredicate=} filterFn function used to filter chunks * @returns {Record<string, (string | number)[]>} a record object of names to lists of child ids(?) */ getChildIdsByOrders(chunkGraph, filterFn) { /** @type {Map<string, {order: number, group: ChunkGroup}[]>} */ const lists = new Map(); for (const group of this.groupsIterable) { if (group.chunks[group.chunks.length - 1] === this) { for (const childGroup of group.childrenIterable) { for (const key of Object.keys(childGroup.options)) { if (key.endsWith("Order")) { const name = key.slice(0, key.length - "Order".length); let list = lists.get(name); if (list === undefined) { list = []; lists.set(name, list); } list.push({ order: /** @type {number} */ ( childGroup.options[ /** @type {keyof ChunkGroupOptions} */ (key) ] ), group: childGroup }); } } } } } /** @type {Record<string, (string | number)[]>} */ const result = Object.create(null); for (const [name, list] of lists) { list.sort((a, b) => { const cmp = b.order - a.order; if (cmp !== 0) return cmp; return a.group.compareTo(chunkGraph, b.group); }); /** @type {Set<string | number>} */ const chunkIdSet = new Set(); for (const item of list) { for (const chunk of item.group.chunks) { if (filterFn && !filterFn(chunk, chunkGraph)) continue; chunkIdSet.add(/** @type {ChunkId} */ (chunk.id)); } } if (chunkIdSet.size > 0) { result[name] = Array.from(chunkIdSet); } } return result; } /** * @param {ChunkGraph} chunkGraph the chunk graph * @param {string} type option name * @returns {{ onChunks: Chunk[], chunks: Set<Chunk> }[] | undefined} referenced chunks for a specific type */ getChildrenOfTypeInOrder(chunkGraph, type) { const list = []; for (const group of this.groupsIterable) { for (const childGroup of group.childrenIterable) { const order = childGroup.options[/** @type {keyof ChunkGroupOptions} */ (type)]; if (order === undefined) continue; list.push({ order, group, childGroup }); } } if (list.length === 0) return; list.sort((a, b) => { const cmp = /** @type {number} */ (b.order) - /** @type {number} */ (a.order); if (cmp !== 0) return cmp; return a.group.compareTo(chunkGraph, b.group); }); const result = []; let lastEntry; for (const { group, childGroup } of list) { if (lastEntry && lastEntry.onChunks === group.chunks) { for (const chunk of childGroup.chunks) { lastEntry.chunks.add(chunk); } } else { result.push( (lastEntry = { onChunks: group.chunks, chunks: new Set(childGroup.chunks) }) ); } } return result; } /** * @param {ChunkGraph} chunkGraph the chunk graph * @param {boolean=} includeDirectChildren include direct children (by default only children of async children are included) * @param {ChunkFilterPredicate=} filterFn function used to filter chunks * @returns {Record<string|number, Record<string, (string | number)[]>>} a record object of names to lists of child ids(?) by chunk id */ getChildIdsByOrdersMap(chunkGraph, includeDirectChildren, filterFn) { /** @type {Record<string|number, Record<string, (string | number)[]>>} */ const chunkMaps = Object.create(null); /** * @param {Chunk} chunk a chunk * @returns {void} */ const addChildIdsByOrdersToMap = chunk => { const data = chunk.getChildIdsByOrders(chunkGraph, filterFn); for (const key of Object.keys(data)) { let chunkMap = chunkMaps[key]; if (chunkMap === undefined) { chunkMaps[key] = chunkMap = Object.create(null); } chunkMap[/** @type {ChunkId} */ (chunk.id)] = data[key]; } }; if (includeDirectChildren) { /** @type {Set<Chunk>} */ const chunks = new Set(); for (const chunkGroup of this.groupsIterable) { for (const chunk of chunkGroup.chunks) { chunks.add(chunk); } } for (const chunk of chunks) { addChildIdsByOrdersToMap(chunk); } } for (const chunk of this.getAllAsyncChunks()) { addChildIdsByOrdersToMap(chunk); } return chunkMaps; } /** * @param {ChunkGraph} chunkGraph the chunk graph * @param {string} type option name * @param {boolean=} includeDirectChildren include direct children (by default only children of async children are included) * @param {ChunkFilterPredicate=} filterFn function used to filter chunks * @returns {boolean} true when the child is of type order, otherwise false */ hasChildByOrder(chunkGraph, type, includeDirectChildren, filterFn) { if (includeDirectChildren) { /** @type {Set<Chunk>} */ const chunks = new Set(); for (const chunkGroup of this.groupsIterable) { for (const chunk of chunkGroup.chunks) { chunks.add(chunk); } } for (const chunk of chunks) { const data = chunk.getChildIdsByOrders(chunkGraph, filterFn); if (data[type] !== undefined) return true; } } for (const chunk of this.getAllAsyncChunks()) { const data = chunk.getChildIdsByOrders(chunkGraph, filterFn); if (data[type] !== undefined) return true; } return false; } } module.exports = Chunk;
Close