MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / isProjectPackageCopy

Method isProjectPackageCopy

src/resolution/index.ts:5002–5013  ·  view source on GitHub ↗

* Is the package `name` installed in `modules` a copy of one of the * project's own packages? It is when a project manifest names it (see * projectPackageNames), under the name it is imported by or under the name * its own package.json gives, which differs when an install put it under *

(modules: string, name: string)

Source from the content-addressed store, hash-verified

5000 * another name (`"kit": "file:../libs/lib"`).
5001 */
5002 private isProjectPackageCopy(modules: string, name: string): boolean {
5003 const own = this.projectPackageNames();
5004 if (own.has(name)) return true;
5005 const key = modules + '\0' + name;
5006 let installedAs = this.installedNames.get(key);
5007 if (installedAs === undefined) {
5008 const json = readPackageJson(path.join(modules, name, 'package.json'));
5009 installedAs = typeof json?.name === 'string' ? json.name : '';
5010 this.installedNames.set(key, installedAs);
5011 }
5012 return installedAs !== '' && own.has(installedAs);
5013 }
5014
5015 /**
5016 * The names of the project's own packages: the `name` of every package.json

Callers 1

isInstalledPackageMethod · 0.95

Calls 6

projectPackageNamesMethod · 0.95
readPackageJsonFunction · 0.85
hasMethod · 0.80
getMethod · 0.65
joinMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected