MCPcopy
hub / github.com/rollup/rollup / fetchResolvedDependency

Method fetchResolvedDependency

src/ModuleLoader.ts:477–511  ·  view source on GitHub ↗
(
		source: string,
		importer: string,
		resolvedId: ResolvedId
	)

Source from the content-addressed store, hash-verified

475 }
476
477 private fetchResolvedDependency(
478 source: string,
479 importer: string,
480 resolvedId: ResolvedId
481 ): Promise<Module | ExternalModule> {
482 if (resolvedId.external) {
483 const { attributes, external, id, moduleSideEffects, meta } = resolvedId;
484 let externalModule = this.modulesById.get(id);
485 if (!externalModule) {
486 externalModule = new ExternalModule(
487 this.options,
488 id,
489 moduleSideEffects,
490 meta,
491 external !== 'absolute' && isAbsolute(id),
492 attributes
493 );
494 this.modulesById.set(id, externalModule);
495 } else if (!(externalModule instanceof ExternalModule)) {
496 return error(logInternalIdCannotBeExternal(source, importer));
497 } else if (doAttributesDiffer(externalModule.info.attributes, attributes)) {
498 this.options.onLog(
499 LOGLEVEL_WARN,
500 logInconsistentImportAttributes(
501 externalModule.info.attributes,
502 attributes,
503 source,
504 importer
505 )
506 );
507 }
508 return Promise.resolve(externalModule);
509 }
510 return this.fetchModule(resolvedId, importer, false, false);
511 }
512
513 private async fetchStaticDependencies(
514 module: Module,

Callers 2

Calls 8

fetchModuleMethod · 0.95
isAbsoluteFunction · 0.90
errorFunction · 0.90
doAttributesDifferFunction · 0.90
getMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected