* Removes and returns the groups needed to provide the requested export names. * @param {Set<string> | true} forwardedIds requested export names, true for all * @returns {DependencyGroup[]} groups that must be processed now
(forwardedIds)
| 141 | * @returns {DependencyGroup[]} groups that must be processed now |
| 142 | */ |
| 143 | request(forwardedIds) { |
| 144 | /** @type {DependencyGroup[]} */ |
| 145 | const result = []; |
| 146 | /** |
| 147 | * @param {DependencyGroup} group taken group |
| 148 | */ |
| 149 | const unlazy = (group) => { |
| 150 | for (const dependency of group.dependencies) { |
| 151 | dependency.setLazy(false); |
| 152 | } |
| 153 | result.push(group); |
| 154 | }; |
| 155 | if (forwardedIds === true) { |
| 156 | for (const group of this._requestToDepGroup.values()) unlazy(group); |
| 157 | this._requestToDepGroup.clear(); |
| 158 | this._release(); |
| 159 | return result; |
| 160 | } |
| 161 | /** |
| 162 | * @param {string} requestKey request key to take |
| 163 | */ |
| 164 | const take = (requestKey) => { |
| 165 | const group = this._requestToDepGroup.get(requestKey); |
| 166 | if (group === undefined) return; |
| 167 | this._requestToDepGroup.delete(requestKey); |
| 168 | unlazy(group); |
| 169 | }; |
| 170 | for (const id of forwardedIds) { |
| 171 | if (this._terminalIds !== undefined && this._terminalIds.has(id)) { |
| 172 | continue; |
| 173 | } |
| 174 | const requestKey = this._forwardIdToRequest.get(id); |
| 175 | if (requestKey !== undefined) { |
| 176 | take(requestKey); |
| 177 | } else if (this._fallbackRequests !== undefined) { |
| 178 | // unknown name: any star re-export may provide it |
| 179 | for (const fallbackKey of this._fallbackRequests) take(fallbackKey); |
| 180 | } |
| 181 | } |
| 182 | if (this._requestToDepGroup.size === 0) this._release(); |
| 183 | return result; |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | const esmDependencyCategory = "esm"; |
no test coverage detected