()
| 309 | parsedDeclarations.push(...parsedURL); |
| 310 | }, |
| 311 | async OnceExit() { |
| 312 | if (parsedDeclarations.length === 0) { |
| 313 | return; |
| 314 | } |
| 315 | |
| 316 | const resolvedDeclarations = await Promise.all( |
| 317 | parsedDeclarations.map(async (parsedDeclaration) => { |
| 318 | const { url, needResolve } = parsedDeclaration; |
| 319 | |
| 320 | if (options.filter) { |
| 321 | const needKeep = await options.filter(url); |
| 322 | |
| 323 | if (!needKeep) { |
| 324 | // eslint-disable-next-line consistent-return |
| 325 | return; |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | if (!needResolve) { |
| 330 | // eslint-disable-next-line consistent-return |
| 331 | return parsedDeclaration; |
| 332 | } |
| 333 | |
| 334 | const splittedUrl = url.split(/(\?)?#/); |
| 335 | const [pathname, query, hashOrQuery] = splittedUrl; |
| 336 | |
| 337 | let hash = query ? "?" : ""; |
| 338 | hash += hashOrQuery ? `#${hashOrQuery}` : ""; |
| 339 | |
| 340 | const { resolver, rootContext } = options; |
| 341 | const request = requestify( |
| 342 | pathname, |
| 343 | rootContext, |
| 344 | Boolean(resolver), |
| 345 | ); |
| 346 | |
| 347 | if (!resolver) { |
| 348 | // eslint-disable-next-line consistent-return |
| 349 | return { ...parsedDeclaration, url: request, hash }; |
| 350 | } |
| 351 | |
| 352 | const resolvedURL = await resolveRequests( |
| 353 | resolver, |
| 354 | options.context, |
| 355 | [...new Set([request, url])], |
| 356 | ); |
| 357 | |
| 358 | if (!resolvedURL) { |
| 359 | // eslint-disable-next-line consistent-return |
| 360 | return; |
| 361 | } |
| 362 | |
| 363 | // eslint-disable-next-line consistent-return |
| 364 | return { ...parsedDeclaration, url: resolvedURL, hash }; |
| 365 | }), |
| 366 | ); |
| 367 | |
| 368 | const urlToNameMap = new Map(); |
nothing calls this directly
no test coverage detected
searching dependent graphs…