MCPcopy
hub / github.com/webpack/webpack / hasChildByOrder

Method hasChildByOrder

lib/Chunk.js:946–967  ·  view source on GitHub ↗

* Checks whether this chunk contains the chunk graph. * @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

(chunkGraph, type, includeDirectChildren, filterFn)

Source from the content-addressed store, hash-verified

944 * @returns {boolean} true when the child is of type order, otherwise false
945 */
946 hasChildByOrder(chunkGraph, type, includeDirectChildren, filterFn) {
947 if (includeDirectChildren) {
948 /** @type {Chunks} */
949 const chunks = new Set();
950 for (const chunkGroup of this.groupsIterable) {
951 for (const chunk of chunkGroup.chunks) {
952 chunks.add(chunk);
953 }
954 }
955 for (const chunk of chunks) {
956 const data = chunk.getChildIdsByOrders(chunkGraph, filterFn);
957 if (data[type] !== undefined) return true;
958 }
959 }
960
961 for (const chunk of this.getAllAsyncChunks()) {
962 const data = chunk.getChildIdsByOrders(chunkGraph, filterFn);
963 if (data[type] !== undefined) return true;
964 }
965
966 return false;
967 }
968}
969
970module.exports = Chunk;

Callers 3

generateMethod · 0.80
generateMethod · 0.80
generateMethod · 0.80

Calls 3

getAllAsyncChunksMethod · 0.95
getChildIdsByOrdersMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected