MCPcopy
hub / github.com/webpack/webpack / request

Method request

lib/LazyBarrel.js:143–184  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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
187const esmDependencyCategory = "esm";

Callers 6

classifyMethod · 0.45
requestMethod · 0.45
proxyFetchFunction · 0.45
constructorMethod · 0.45

Calls 5

_releaseMethod · 0.95
valuesMethod · 0.45
clearMethod · 0.45
hasMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected