* Gets child ids by orders map. * @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 {Ch
(chunkGraph, includeDirectChildren, filterFn)
| 896 | * @returns {ChunkChildIdsByOrdersMapByData} a record object of names to lists of child ids(?) by chunk id |
| 897 | */ |
| 898 | getChildIdsByOrdersMap(chunkGraph, includeDirectChildren, filterFn) { |
| 899 | /** @type {ChunkChildIdsByOrdersMapByData} */ |
| 900 | const chunkMaps = Object.create(null); |
| 901 | |
| 902 | /** |
| 903 | * Adds child ids by orders to map. |
| 904 | * @param {Chunk} chunk a chunk |
| 905 | * @returns {void} |
| 906 | */ |
| 907 | const addChildIdsByOrdersToMap = (chunk) => { |
| 908 | const data = chunk.getChildIdsByOrders(chunkGraph, filterFn); |
| 909 | for (const key of Object.keys(data)) { |
| 910 | let chunkMap = chunkMaps[key]; |
| 911 | if (chunkMap === undefined) { |
| 912 | chunkMaps[key] = chunkMap = Object.create(null); |
| 913 | } |
| 914 | chunkMap[/** @type {ChunkId} */ (chunk.id)] = data[key]; |
| 915 | } |
| 916 | }; |
| 917 | |
| 918 | if (includeDirectChildren) { |
| 919 | /** @type {Chunks} */ |
| 920 | const chunks = new Set(); |
| 921 | for (const chunkGroup of this.groupsIterable) { |
| 922 | for (const chunk of chunkGroup.chunks) { |
| 923 | chunks.add(chunk); |
| 924 | } |
| 925 | } |
| 926 | for (const chunk of chunks) { |
| 927 | addChildIdsByOrdersToMap(chunk); |
| 928 | } |
| 929 | } |
| 930 | |
| 931 | for (const chunk of this.getAllAsyncChunks()) { |
| 932 | addChildIdsByOrdersToMap(chunk); |
| 933 | } |
| 934 | |
| 935 | return chunkMaps; |
| 936 | } |
| 937 | |
| 938 | /** |
| 939 | * Checks whether this chunk contains the chunk graph. |
no test coverage detected