123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- "use strict";
- const ChunkGroup = require("./ChunkGroup");
- class Entrypoint extends ChunkGroup {
-
- constructor(entryOptions, initial = true) {
- if (typeof entryOptions === "string") {
- entryOptions = { name: entryOptions };
- }
- super({
- name: entryOptions.name
- });
- this.options = entryOptions;
-
- this._runtimeChunk = undefined;
-
- this._entrypointChunk = undefined;
-
- this._initial = initial;
- }
-
- isInitial() {
- return this._initial;
- }
-
- setRuntimeChunk(chunk) {
- this._runtimeChunk = chunk;
- }
-
- getRuntimeChunk() {
- if (this._runtimeChunk) return this._runtimeChunk;
- for (const parent of this.parentsIterable) {
- if (parent instanceof Entrypoint) return parent.getRuntimeChunk();
- }
- return null;
- }
-
- setEntrypointChunk(chunk) {
- this._entrypointChunk = chunk;
- }
-
- getEntrypointChunk() {
- return (this._entrypointChunk);
- }
-
- replaceChunk(oldChunk, newChunk) {
- if (this._runtimeChunk === oldChunk) this._runtimeChunk = newChunk;
- if (this._entrypointChunk === oldChunk) this._entrypointChunk = newChunk;
- return super.replaceChunk(oldChunk, newChunk);
- }
- }
- module.exports = Entrypoint;
|