ChunkGroup.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const util = require("util");
  7. const SortableSet = require("./util/SortableSet");
  8. const {
  9. compareChunks,
  10. compareIterables,
  11. compareLocations
  12. } = require("./util/comparators");
  13. /** @import AsyncDependenciesBlock from "./AsyncDependenciesBlock" */
  14. /** @import Chunk from "./Chunk" */
  15. /** @import ChunkGraph from "./ChunkGraph" */
  16. /** @import { DependencyLocation } from "./Dependency" */
  17. /** @import Entrypoint from "./Entrypoint" */
  18. /** @import Module from "./Module" */
  19. /** @import ModuleGraph from "./ModuleGraph" */
  20. /** @typedef {{ module: Module | null, loc: DependencyLocation, request: string }} OriginRecord */
  21. /**
  22. * Describes the scheduling hints that can be attached to a chunk group.
  23. * These values influence how child groups are ordered for preload/prefetch
  24. * and how their fetch priority is exposed to runtime code.
  25. * @typedef {object} RawChunkGroupOptions
  26. * @property {number=} preloadOrder
  27. * @property {number=} prefetchOrder
  28. * @property {number=} cssPreloadOrder preload only the chunk's CSS (`as="style"`), not its JS
  29. * @property {("low" | "high" | "auto")=} fetchPriority
  30. */
  31. /** @typedef {RawChunkGroupOptions & { name?: string | null }} ChunkGroupOptions */
  32. let debugId = 5000;
  33. /**
  34. * Materializes a sortable set as an array without changing its current order.
  35. * Used with `SortableSet` caches that expect a stable array result.
  36. * @template T
  37. * @param {SortableSet<T>} set set to convert to array.
  38. * @returns {T[]} the array format of existing set
  39. */
  40. const getArray = (set) => [...set];
  41. /**
  42. * A convenience method used to sort chunks based on their id's
  43. * @param {ChunkGroup} a first sorting comparator
  44. * @param {ChunkGroup} b second sorting comparator
  45. * @returns {1 | 0 | -1} a sorting index to determine order
  46. */
  47. const sortById = (a, b) => {
  48. if (a.id < b.id) return -1;
  49. if (b.id < a.id) return 1;
  50. return 0;
  51. };
  52. /**
  53. * Orders origin records by referencing module and then by source location.
  54. * This keeps origin metadata deterministic for hashing and diagnostics.
  55. * @param {OriginRecord} a the first comparator in sort
  56. * @param {OriginRecord} b the second comparator in sort
  57. * @returns {1 | -1 | 0} returns sorting order as index
  58. */
  59. const sortOrigin = (a, b) => {
  60. const aIdent = a.module ? a.module.identifier() : "";
  61. const bIdent = b.module ? b.module.identifier() : "";
  62. if (aIdent < bIdent) return -1;
  63. if (aIdent > bIdent) return 1;
  64. return compareLocations(a.loc, b.loc);
  65. };
  66. /**
  67. * Represents a connected group of chunks along with the parent/child
  68. * relationships, async blocks, and traversal metadata webpack tracks for it.
  69. */
  70. class ChunkGroup {
  71. /**
  72. * Creates a chunk group and initializes the relationship sets and ordering
  73. * metadata used while building and optimizing the chunk graph.
  74. * @param {string | ChunkGroupOptions=} options chunk group options passed to chunkGroup
  75. */
  76. constructor(options) {
  77. if (typeof options === "string") {
  78. options = { name: options };
  79. } else if (!options) {
  80. options = { name: undefined };
  81. }
  82. /** @type {number} */
  83. this.groupDebugId = debugId++;
  84. /** @type {ChunkGroupOptions} */
  85. this.options = options;
  86. /** @type {SortableSet<ChunkGroup>} */
  87. this._children = new SortableSet(undefined, sortById);
  88. /** @type {SortableSet<ChunkGroup>} */
  89. this._parents = new SortableSet(undefined, sortById);
  90. /** @type {SortableSet<ChunkGroup>} */
  91. this._asyncEntrypoints = new SortableSet(undefined, sortById);
  92. /** @type {SortableSet<AsyncDependenciesBlock>} */
  93. this._blocks = new SortableSet();
  94. /** @type {Chunk[]} */
  95. this.chunks = [];
  96. /** @type {OriginRecord[]} */
  97. this.origins = [];
  98. /** @typedef {Map<Module, number>} OrderIndices */
  99. /** Indices in top-down order */
  100. /**
  101. * @private
  102. * @type {OrderIndices}
  103. */
  104. this._modulePreOrderIndices = new Map();
  105. /** Indices in bottom-up order */
  106. /**
  107. * @private
  108. * @type {OrderIndices}
  109. */
  110. this._modulePostOrderIndices = new Map();
  111. /** @type {number | undefined} */
  112. this.index = undefined;
  113. }
  114. /**
  115. * Merges additional options into the chunk group.
  116. * Order-based options are combined by taking the higher priority, while
  117. * unsupported conflicts surface as an explicit error.
  118. * @param {ChunkGroupOptions} options the chunkGroup options passed to addOptions
  119. * @returns {void}
  120. */
  121. addOptions(options) {
  122. for (const key of /** @type {(keyof ChunkGroupOptions)[]} */ (
  123. Object.keys(options)
  124. )) {
  125. if (this.options[key] === undefined) {
  126. /** @type {ChunkGroupOptions[keyof ChunkGroupOptions]} */
  127. (this.options[key]) = options[key];
  128. } else if (this.options[key] !== options[key]) {
  129. if (key.endsWith("Order")) {
  130. const orderKey =
  131. /** @type {Exclude<keyof ChunkGroupOptions, "name" | "fetchPriority">} */
  132. (key);
  133. this.options[orderKey] = Math.max(
  134. /** @type {number} */
  135. (this.options[orderKey]),
  136. /** @type {number} */
  137. (options[orderKey])
  138. );
  139. } else {
  140. throw new Error(
  141. `ChunkGroup.addOptions: No option merge strategy for ${key}`
  142. );
  143. }
  144. }
  145. }
  146. }
  147. /**
  148. * Returns the configured name of the chunk group, if one was assigned.
  149. * @returns {ChunkGroupOptions["name"]} returns the ChunkGroup name
  150. */
  151. get name() {
  152. return this.options.name;
  153. }
  154. /**
  155. * Updates the configured name of the chunk group.
  156. * @param {string | undefined} value the new name for ChunkGroup
  157. * @returns {void}
  158. */
  159. set name(value) {
  160. this.options.name = value;
  161. }
  162. /* istanbul ignore next */
  163. /**
  164. * Returns a debug-only identifier derived from the group's member chunk
  165. * debug ids. This is primarily useful in diagnostics and assertions.
  166. * @returns {string} a unique concatenation of chunk debugId's
  167. */
  168. get debugId() {
  169. return Array.from(this.chunks, (x) => x.debugId).join("+");
  170. }
  171. /**
  172. * Returns an identifier derived from the ids of the chunks currently in
  173. * the group.
  174. * @returns {string} a unique concatenation of chunk ids
  175. */
  176. get id() {
  177. return Array.from(this.chunks, (x) => x.id).join("+");
  178. }
  179. /**
  180. * Moves a chunk to the front of the group or inserts it when it is not
  181. * already present.
  182. * @param {Chunk} chunk chunk being unshifted
  183. * @returns {boolean} returns true if attempted chunk shift is accepted
  184. */
  185. unshiftChunk(chunk) {
  186. const oldIdx = this.chunks.indexOf(chunk);
  187. if (oldIdx > 0) {
  188. this.chunks.splice(oldIdx, 1);
  189. this.chunks.unshift(chunk);
  190. } else if (oldIdx < 0) {
  191. this.chunks.unshift(chunk);
  192. return true;
  193. }
  194. return false;
  195. }
  196. /**
  197. * Inserts a chunk directly before another chunk that already belongs to the
  198. * group, preserving the rest of the ordering.
  199. * @param {Chunk} chunk Chunk being inserted
  200. * @param {Chunk} before Placeholder/target chunk marking new chunk insertion point
  201. * @returns {boolean} return true if insertion was successful
  202. */
  203. insertChunk(chunk, before) {
  204. const oldIdx = this.chunks.indexOf(chunk);
  205. const idx = this.chunks.indexOf(before);
  206. if (idx < 0) {
  207. throw new Error("before chunk not found");
  208. }
  209. if (oldIdx >= 0 && oldIdx > idx) {
  210. this.chunks.splice(oldIdx, 1);
  211. this.chunks.splice(idx, 0, chunk);
  212. } else if (oldIdx < 0) {
  213. this.chunks.splice(idx, 0, chunk);
  214. return true;
  215. }
  216. return false;
  217. }
  218. /**
  219. * Appends a chunk to the group when it is not already a member.
  220. * @param {Chunk} chunk chunk being pushed into ChunkGroupS
  221. * @returns {boolean} returns true if chunk addition was successful.
  222. */
  223. pushChunk(chunk) {
  224. const oldIdx = this.chunks.indexOf(chunk);
  225. if (oldIdx >= 0) {
  226. return false;
  227. }
  228. this.chunks.push(chunk);
  229. return true;
  230. }
  231. /**
  232. * Replaces one member chunk with another while preserving the group's
  233. * ordering and avoiding duplicates.
  234. * @param {Chunk} oldChunk chunk to be replaced
  235. * @param {Chunk} newChunk New chunk that will be replaced with
  236. * @returns {boolean | undefined} returns true if the replacement was successful
  237. */
  238. replaceChunk(oldChunk, newChunk) {
  239. const oldIdx = this.chunks.indexOf(oldChunk);
  240. if (oldIdx < 0) return false;
  241. const newIdx = this.chunks.indexOf(newChunk);
  242. if (newIdx < 0) {
  243. this.chunks[oldIdx] = newChunk;
  244. return true;
  245. }
  246. if (newIdx < oldIdx) {
  247. this.chunks.splice(oldIdx, 1);
  248. return true;
  249. } else if (newIdx !== oldIdx) {
  250. this.chunks[oldIdx] = newChunk;
  251. this.chunks.splice(newIdx, 1);
  252. return true;
  253. }
  254. }
  255. /**
  256. * Removes a chunk from this group.
  257. * @param {Chunk} chunk chunk to remove
  258. * @returns {boolean} returns true if chunk was removed
  259. */
  260. removeChunk(chunk) {
  261. const idx = this.chunks.indexOf(chunk);
  262. if (idx >= 0) {
  263. this.chunks.splice(idx, 1);
  264. return true;
  265. }
  266. return false;
  267. }
  268. /**
  269. * Indicates whether this chunk group is loaded as part of the initial page
  270. * load instead of being created lazily.
  271. * @returns {boolean} true, when this chunk group will be loaded on initial page load
  272. */
  273. isInitial() {
  274. return false;
  275. }
  276. /**
  277. * Adds a child chunk group to the current group.
  278. * @param {ChunkGroup} group chunk group to add
  279. * @returns {boolean} returns true if chunk group was added
  280. */
  281. addChild(group) {
  282. const size = this._children.size;
  283. this._children.add(group);
  284. return size !== this._children.size;
  285. }
  286. /**
  287. * Returns the child chunk groups reachable from this group.
  288. * @returns {ChunkGroup[]} returns the children of this group
  289. */
  290. getChildren() {
  291. return this._children.getFromCache(getArray);
  292. }
  293. getNumberOfChildren() {
  294. return this._children.size;
  295. }
  296. get childrenIterable() {
  297. return this._children;
  298. }
  299. /**
  300. * Removes a child chunk group and clears the corresponding parent link on
  301. * the removed child.
  302. * @param {ChunkGroup} group the chunk group to remove
  303. * @returns {boolean} returns true if the chunk group was removed
  304. */
  305. removeChild(group) {
  306. if (!this._children.has(group)) {
  307. return false;
  308. }
  309. this._children.delete(group);
  310. group.removeParent(this);
  311. return true;
  312. }
  313. /**
  314. * Records a parent chunk group relationship.
  315. * @param {ChunkGroup} parentChunk the parent group to be added into
  316. * @returns {boolean} returns true if this chunk group was added to the parent group
  317. */
  318. addParent(parentChunk) {
  319. if (!this._parents.has(parentChunk)) {
  320. this._parents.add(parentChunk);
  321. return true;
  322. }
  323. return false;
  324. }
  325. /**
  326. * Returns the parent chunk groups that can lead to this group.
  327. * @returns {ChunkGroup[]} returns the parents of this group
  328. */
  329. getParents() {
  330. return this._parents.getFromCache(getArray);
  331. }
  332. getNumberOfParents() {
  333. return this._parents.size;
  334. }
  335. /**
  336. * Checks whether the provided group is registered as a parent.
  337. * @param {ChunkGroup} parent the parent group
  338. * @returns {boolean} returns true if the parent group contains this group
  339. */
  340. hasParent(parent) {
  341. return this._parents.has(parent);
  342. }
  343. get parentsIterable() {
  344. return this._parents;
  345. }
  346. /**
  347. * Removes a parent chunk group and clears the reverse child relationship.
  348. * @param {ChunkGroup} chunkGroup the parent group
  349. * @returns {boolean} returns true if this group has been removed from the parent
  350. */
  351. removeParent(chunkGroup) {
  352. if (this._parents.delete(chunkGroup)) {
  353. chunkGroup.removeChild(this);
  354. return true;
  355. }
  356. return false;
  357. }
  358. /**
  359. * Registers an async entrypoint that is rooted in this chunk group.
  360. * @param {Entrypoint} entrypoint entrypoint to add
  361. * @returns {boolean} returns true if entrypoint was added
  362. */
  363. addAsyncEntrypoint(entrypoint) {
  364. const size = this._asyncEntrypoints.size;
  365. this._asyncEntrypoints.add(entrypoint);
  366. return size !== this._asyncEntrypoints.size;
  367. }
  368. get asyncEntrypointsIterable() {
  369. return this._asyncEntrypoints;
  370. }
  371. /**
  372. * Returns the async dependency blocks that create or reference this group.
  373. * @returns {AsyncDependenciesBlock[]} an array containing the blocks
  374. */
  375. getBlocks() {
  376. return this._blocks.getFromCache(getArray);
  377. }
  378. getNumberOfBlocks() {
  379. return this._blocks.size;
  380. }
  381. /**
  382. * Checks whether an async dependency block is associated with this group.
  383. * @param {AsyncDependenciesBlock} block block
  384. * @returns {boolean} true, if block exists
  385. */
  386. hasBlock(block) {
  387. return this._blocks.has(block);
  388. }
  389. /**
  390. * Exposes the group's async dependency blocks as an iterable.
  391. * @returns {Iterable<AsyncDependenciesBlock>} blocks
  392. */
  393. get blocksIterable() {
  394. return this._blocks;
  395. }
  396. /**
  397. * Associates an async dependency block with this chunk group.
  398. * @param {AsyncDependenciesBlock} block a block
  399. * @returns {boolean} false, if block was already added
  400. */
  401. addBlock(block) {
  402. if (!this._blocks.has(block)) {
  403. this._blocks.add(block);
  404. return true;
  405. }
  406. return false;
  407. }
  408. /**
  409. * Records where this chunk group originated from in user code.
  410. * The origin is used for diagnostics, ordering, and reporting.
  411. * @param {Module | null} module origin module
  412. * @param {DependencyLocation} loc location of the reference in the origin module
  413. * @param {string} request request name of the reference
  414. * @returns {void}
  415. */
  416. addOrigin(module, loc, request) {
  417. this.origins.push({
  418. module,
  419. loc,
  420. request
  421. });
  422. }
  423. /**
  424. * Collects the emitted files produced by every chunk in the group.
  425. * @returns {string[]} the files contained this chunk group
  426. */
  427. getFiles() {
  428. /** @type {Set<string>} */
  429. const files = new Set();
  430. for (const chunk of this.chunks) {
  431. for (const file of chunk.files) {
  432. files.add(file);
  433. }
  434. }
  435. return [...files];
  436. }
  437. /**
  438. * Disconnects this group from its parents, children, and chunks.
  439. * Child groups are reconnected to this group's parents so the surrounding
  440. * graph remains intact after removal.
  441. * @returns {void}
  442. */
  443. remove() {
  444. // cleanup parents
  445. for (const parentChunkGroup of this._parents) {
  446. // remove this chunk from its parents
  447. parentChunkGroup._children.delete(this);
  448. // cleanup "sub chunks"
  449. for (const chunkGroup of this._children) {
  450. /**
  451. * remove this chunk as "intermediary" and connect
  452. * it "sub chunks" and parents directly
  453. */
  454. // add parent to each "sub chunk"
  455. chunkGroup.addParent(parentChunkGroup);
  456. // add "sub chunk" to parent
  457. parentChunkGroup.addChild(chunkGroup);
  458. }
  459. }
  460. /**
  461. * we need to iterate again over the children
  462. * to remove this from the child's parents.
  463. * This can not be done in the above loop
  464. * as it is not guaranteed that `this._parents` contains anything.
  465. */
  466. for (const chunkGroup of this._children) {
  467. // remove this as parent of every "sub chunk"
  468. chunkGroup._parents.delete(this);
  469. }
  470. // remove chunks
  471. for (const chunk of this.chunks) {
  472. chunk.removeGroup(this);
  473. }
  474. }
  475. sortItems() {
  476. this.origins.sort(sortOrigin);
  477. }
  478. /**
  479. * Sorting predicate which allows current ChunkGroup to be compared against another.
  480. * Sorting values are based off of number of chunks in ChunkGroup.
  481. * @param {ChunkGraph} chunkGraph the chunk graph
  482. * @param {ChunkGroup} otherGroup the chunkGroup to compare this against
  483. * @returns {-1 | 0 | 1} sort position for comparison
  484. */
  485. compareTo(chunkGraph, otherGroup) {
  486. if (this.chunks.length > otherGroup.chunks.length) return -1;
  487. if (this.chunks.length < otherGroup.chunks.length) return 1;
  488. return compareIterables(compareChunks(chunkGraph))(
  489. this.chunks,
  490. otherGroup.chunks
  491. );
  492. }
  493. /**
  494. * Aggregates per-block `*Order` options for the blocks that bridge this
  495. * chunk group to the given child chunk group. `*Order` options are tied to
  496. * the originating `import()` call and must not be sourced from the child's
  497. * shared options, otherwise a webpackPrefetch/Preload directive from one
  498. * parent would leak into other parents that share the child by name.
  499. * @param {ChunkGroup} childGroup the child chunk group
  500. * @param {ChunkGraph} chunkGraph the chunk graph
  501. * @returns {Record<string, number>} merged `*Order` options for the edge from this group to `childGroup`
  502. */
  503. getChildOrderOptions(childGroup, chunkGraph) {
  504. /** @type {Record<string, number>} */
  505. const result = Object.create(null);
  506. let bridged = false;
  507. for (const block of childGroup.blocksIterable) {
  508. const rootModule = /** @type {Module} */ (block.getRootBlock());
  509. if (!chunkGraph.isModuleInChunkGroup(rootModule, this)) continue;
  510. bridged = true;
  511. const opts = block.groupOptions;
  512. if (!opts) continue;
  513. for (const key of Object.keys(opts)) {
  514. if (!key.endsWith("Order")) continue;
  515. const value =
  516. /** @type {number} */
  517. (opts[/** @type {keyof ChunkGroupOptions} */ (key)]);
  518. if (typeof value !== "number") continue;
  519. if (result[key] === undefined || value > result[key]) {
  520. result[key] = value;
  521. }
  522. }
  523. }
  524. // Fall back to the child's own options only when no block bridges
  525. // this edge (e.g. a chunk group created by APIs that don't go through
  526. // an AsyncDependenciesBlock). Otherwise we'd reintroduce the leak.
  527. if (!bridged) {
  528. for (const key of Object.keys(childGroup.options)) {
  529. if (!key.endsWith("Order")) continue;
  530. const value =
  531. childGroup.options[/** @type {keyof ChunkGroupOptions} */ (key)];
  532. if (typeof value === "number") {
  533. result[key] = value;
  534. }
  535. }
  536. }
  537. return result;
  538. }
  539. /**
  540. * Groups child chunk groups by their `*Order` options and sorts each group
  541. * by descending order and deterministic chunk-group comparison.
  542. * @param {ModuleGraph} moduleGraph the module graph
  543. * @param {ChunkGraph} chunkGraph the chunk graph
  544. * @returns {Record<string, ChunkGroup[]>} mapping from children type to ordered list of ChunkGroups
  545. */
  546. getChildrenByOrders(moduleGraph, chunkGraph) {
  547. /** @type {Map<string, { order: number, group: ChunkGroup }[]>} */
  548. const lists = new Map();
  549. for (const childGroup of this._children) {
  550. const edgeOptions = this.getChildOrderOptions(childGroup, chunkGraph);
  551. for (const key of Object.keys(edgeOptions)) {
  552. const name = key.slice(0, key.length - "Order".length);
  553. let list = lists.get(name);
  554. if (list === undefined) {
  555. lists.set(name, (list = []));
  556. }
  557. list.push({
  558. order: edgeOptions[key],
  559. group: childGroup
  560. });
  561. }
  562. }
  563. /** @type {Record<string, ChunkGroup[]>} */
  564. const result = Object.create(null);
  565. for (const [name, list] of lists) {
  566. list.sort((a, b) => {
  567. const cmp = b.order - a.order;
  568. if (cmp !== 0) return cmp;
  569. return a.group.compareTo(chunkGraph, b.group);
  570. });
  571. result[name] = list.map((i) => i.group);
  572. }
  573. return result;
  574. }
  575. /**
  576. * Stores the module's top-down traversal index within this group.
  577. * @param {Module} module module for which the index should be set
  578. * @param {number} index the index of the module
  579. * @returns {void}
  580. */
  581. setModulePreOrderIndex(module, index) {
  582. this._modulePreOrderIndices.set(module, index);
  583. }
  584. /**
  585. * Returns the module's top-down traversal index within this group.
  586. * @param {Module} module the module
  587. * @returns {number | undefined} index
  588. */
  589. getModulePreOrderIndex(module) {
  590. return this._modulePreOrderIndices.get(module);
  591. }
  592. /**
  593. * Stores the module's bottom-up traversal index within this group.
  594. * @param {Module} module module for which the index should be set
  595. * @param {number} index the index of the module
  596. * @returns {void}
  597. */
  598. setModulePostOrderIndex(module, index) {
  599. this._modulePostOrderIndices.set(module, index);
  600. }
  601. /**
  602. * Returns the module's bottom-up traversal index within this group.
  603. * @param {Module} module the module
  604. * @returns {number | undefined} index
  605. */
  606. getModulePostOrderIndex(module) {
  607. return this._modulePostOrderIndices.get(module);
  608. }
  609. /* istanbul ignore next */
  610. checkConstraints() {
  611. const chunk = this;
  612. for (const child of chunk._children) {
  613. if (!child._parents.has(chunk)) {
  614. throw new Error(
  615. `checkConstraints: child missing parent ${chunk.debugId} -> ${child.debugId}`
  616. );
  617. }
  618. }
  619. for (const parentChunk of chunk._parents) {
  620. if (!parentChunk._children.has(chunk)) {
  621. throw new Error(
  622. `checkConstraints: parent missing child ${parentChunk.debugId} <- ${chunk.debugId}`
  623. );
  624. }
  625. }
  626. }
  627. }
  628. ChunkGroup.prototype.getModuleIndex = util.deprecate(
  629. ChunkGroup.prototype.getModulePreOrderIndex,
  630. "ChunkGroup.getModuleIndex was renamed to getModulePreOrderIndex",
  631. "DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX"
  632. );
  633. ChunkGroup.prototype.getModuleIndex2 = util.deprecate(
  634. ChunkGroup.prototype.getModulePostOrderIndex,
  635. "ChunkGroup.getModuleIndex2 was renamed to getModulePostOrderIndex",
  636. "DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX_2"
  637. );
  638. module.exports = ChunkGroup;