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

Function pinsNextBefore16

src/resolution/frameworks/next-proxy.ts:40–54  ·  view source on GitHub ↗

Whether the app's manifest, or failing that the repository's, pins `next` below 16, where `proxy` isn't a convention yet.

(context: ResolutionContext, root: string)

Source from the content-addressed store, hash-verified

38
39/** Whether the app's manifest, or failing that the repository's, pins `next` below 16, where `proxy` isn't a convention yet. */
40function pinsNextBefore16(context: ResolutionContext, root: string): boolean {
41 for (const manifest of new Set([`${root}package.json`, 'package.json'])) {
42 let pkg: Record<string, Record<string, unknown> | undefined> | null;
43 try {
44 pkg = JSON.parse(context.readFile(manifest) ?? 'null');
45 } catch {
46 continue;
47 }
48 const range = pkg?.dependencies?.next ?? pkg?.devDependencies?.next ?? pkg?.peerDependencies?.next;
49 if (typeof range !== 'string') continue;
50 const major = /^[\s^~>=v]*(\d+)/.exec(range);
51 return major !== null && Number(major[1]) < 16;
52 }
53 return false;
54}
55
56export interface NextProxy {
57 file: string;

Callers 1

nextProxyForFunction · 0.85

Calls 4

NumberInterface · 0.85
parseMethod · 0.80
readFileMethod · 0.65
execMethod · 0.65

Tested by

no test coverage detected