MCPcopy
hub / github.com/vitejs/vite / findNearestPackagePath

Function findNearestPackagePath

packages/vite/src/node/plugins/resolve.ts:1190–1199  ·  view source on GitHub ↗
(
  file: string,
  legacyInconsistentCjsInterop: boolean | undefined,
  packageCache: PackageCache | undefined,
  isBuild: boolean,
)

Source from the content-addressed store, hash-verified

1188}
1189
1190function findNearestPackagePath(
1191 file: string,
1192 legacyInconsistentCjsInterop: boolean | undefined,
1193 packageCache: PackageCache | undefined,
1194 isBuild: boolean,
1195) {
1196 if (!isBuild || legacyInconsistentCjsInterop) return
1197 const pkgData = findNearestPackageData(file, packageCache)
1198 return pkgData ? path.join(pkgData.dir, 'package.json') : null
1199}

Callers 1

tryNodeResolveFunction · 0.85

Calls 1

findNearestPackageDataFunction · 0.90

Tested by

no test coverage detected