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)
| 38 | |
| 39 | /** Whether the app's manifest, or failing that the repository's, pins `next` below 16, where `proxy` isn't a convention yet. */ |
| 40 | function 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 | |
| 56 | export interface NextProxy { |
| 57 | file: string; |
no test coverage detected