* Processes the provided callback. * @param {Callback} callback signals when the call finishes * @returns {void}
(callback)
| 3493 | * @returns {void} |
| 3494 | */ |
| 3495 | seal(callback) { |
| 3496 | /** |
| 3497 | * Processes the provided err. |
| 3498 | * @param {WebpackError=} err err |
| 3499 | * @returns {void} |
| 3500 | */ |
| 3501 | const finalCallback = (err) => { |
| 3502 | this.factorizeQueue.clear(); |
| 3503 | this.buildQueue.clear(); |
| 3504 | this.rebuildQueue.clear(); |
| 3505 | this.processDependenciesQueue.clear(); |
| 3506 | this.addModuleQueue.clear(); |
| 3507 | // lazy barrel only acts during make; release its bookkeeping now |
| 3508 | this._lazyBarrelController.clear(); |
| 3509 | return callback(err); |
| 3510 | }; |
| 3511 | |
| 3512 | if (this._backCompat) { |
| 3513 | for (const module of this.modules) { |
| 3514 | ChunkGraph.setChunkGraphForModule(module, this.chunkGraph); |
| 3515 | } |
| 3516 | } |
| 3517 | |
| 3518 | this.hooks.seal.call(); |
| 3519 | |
| 3520 | this.logger.time("optimize dependencies"); |
| 3521 | while (this.hooks.optimizeDependencies.call(this.modules)) { |
| 3522 | /* empty */ |
| 3523 | } |
| 3524 | this.hooks.afterOptimizeDependencies.call(this.modules); |
| 3525 | this.logger.timeEnd("optimize dependencies"); |
| 3526 | |
| 3527 | this.logger.time("create chunks"); |
| 3528 | this.hooks.beforeChunks.call(); |
| 3529 | this.moduleGraph.freeze("seal"); |
| 3530 | /** @type {Map<Entrypoint, Module[]>} */ |
| 3531 | const chunkGraphInit = new Map(); |
| 3532 | for (const [name, { dependencies, includeDependencies, options }] of this |
| 3533 | .entries) { |
| 3534 | const chunk = this.addChunk(name); |
| 3535 | if (options.filename) { |
| 3536 | chunk.filenameTemplate = options.filename; |
| 3537 | } |
| 3538 | const entrypoint = new Entrypoint(options); |
| 3539 | if (!options.dependOn && !options.runtime) { |
| 3540 | entrypoint.setRuntimeChunk(chunk); |
| 3541 | } |
| 3542 | entrypoint.setEntrypointChunk(chunk); |
| 3543 | this.namedChunkGroups.set(name, entrypoint); |
| 3544 | this.entrypoints.set(name, entrypoint); |
| 3545 | this.chunkGroups.push(entrypoint); |
| 3546 | |
| 3547 | if (entrypoint.pushChunk(chunk)) { |
| 3548 | chunk.addGroup(entrypoint); |
| 3549 | } |
| 3550 | |
| 3551 | /** @type {Set<Module>} */ |
| 3552 | const entryModules = new Set(); |
no test coverage detected