* Processes the provided file. * @private * @param {string} file file name * @param {AssetInfo=} newInfo new asset information * @param {AssetInfo=} oldInfo old asset information
(file, newInfo, oldInfo = this.assetsInfo.get(file))
| 5163 | * @param {AssetInfo=} oldInfo old asset information |
| 5164 | */ |
| 5165 | _setAssetInfo(file, newInfo, oldInfo = this.assetsInfo.get(file)) { |
| 5166 | if (newInfo === undefined) { |
| 5167 | this.assetsInfo.delete(file); |
| 5168 | } else { |
| 5169 | this.assetsInfo.set(file, newInfo); |
| 5170 | } |
| 5171 | const oldRelated = oldInfo && oldInfo.related; |
| 5172 | const newRelated = newInfo && newInfo.related; |
| 5173 | if (oldRelated) { |
| 5174 | for (const key of Object.keys(oldRelated)) { |
| 5175 | /** |
| 5176 | * Processes the provided name. |
| 5177 | * @param {string} name name |
| 5178 | */ |
| 5179 | const remove = (name) => { |
| 5180 | const relatedIn = this._assetsRelatedIn.get(name); |
| 5181 | if (relatedIn === undefined) return; |
| 5182 | const entry = relatedIn.get(key); |
| 5183 | if (entry === undefined) return; |
| 5184 | entry.delete(file); |
| 5185 | if (entry.size !== 0) return; |
| 5186 | relatedIn.delete(key); |
| 5187 | if (relatedIn.size === 0) this._assetsRelatedIn.delete(name); |
| 5188 | }; |
| 5189 | const entry = oldRelated[key]; |
| 5190 | if (Array.isArray(entry)) { |
| 5191 | for (const name of entry) { |
| 5192 | remove(name); |
| 5193 | } |
| 5194 | } else if (entry) { |
| 5195 | remove(entry); |
| 5196 | } |
| 5197 | } |
| 5198 | } |
| 5199 | if (newRelated) { |
| 5200 | for (const key of Object.keys(newRelated)) { |
| 5201 | /** |
| 5202 | * Processes the provided name. |
| 5203 | * @param {string} name name |
| 5204 | */ |
| 5205 | const add = (name) => { |
| 5206 | let relatedIn = this._assetsRelatedIn.get(name); |
| 5207 | if (relatedIn === undefined) { |
| 5208 | this._assetsRelatedIn.set(name, (relatedIn = new Map())); |
| 5209 | } |
| 5210 | let entry = relatedIn.get(key); |
| 5211 | if (entry === undefined) { |
| 5212 | relatedIn.set(key, (entry = new Set())); |
| 5213 | } |
| 5214 | entry.add(file); |
| 5215 | }; |
| 5216 | const entry = newRelated[key]; |
| 5217 | if (Array.isArray(entry)) { |
| 5218 | for (const name of entry) { |
| 5219 | add(name); |
| 5220 | } |
| 5221 | } else if (entry) { |
| 5222 | add(entry); |
no test coverage detected