MCPcopy Index your code
hub / github.com/nodejs/node / resolveExpansion

Function resolveExpansion

lib/internal/modules/cjs/loader.js:719–732  ·  view source on GitHub ↗
(expansion, pkgJsonPath, pkgData, parentPath, conditions)

Source from the content-addressed store, hash-verified

717}
718
719function resolveExpansion(expansion, pkgJsonPath, pkgData, parentPath, conditions) {
720 const pkgPath = path.dirname(pkgJsonPath);
721 try {
722 const { packageExportsResolve } = require('internal/modules/esm/resolve');
723 return finalizeEsmResolution(packageExportsResolve(
724 pathToFileURL(pkgJsonPath), expansion, pkgData,
725 pathToFileURL(parentPath), conditions), parentPath, pkgPath);
726 } catch (e) {
727 if (e.code === 'ERR_MODULE_NOT_FOUND') {
728 throw createEsmNotFoundErr(expansion, pkgPath);
729 }
730 throw e;
731 }
732}
733
734/**
735 * This only applies to requests of a specific form:

Callers 2

trySelfFunction · 0.85
tryPackageMapResolveCJSFunction · 0.85

Calls 5

finalizeEsmResolutionFunction · 0.85
packageExportsResolveFunction · 0.85
createEsmNotFoundErrFunction · 0.85
requireFunction · 0.50
pathToFileURLFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…