(content: string)
| 33 | } |
| 34 | |
| 35 | function parsePackageJson(content: string): string[] { |
| 36 | const result: string[] = []; |
| 37 | let pkg: { |
| 38 | dependencies?: Record<string, unknown>; |
| 39 | devDependencies?: Record<string, unknown>; |
| 40 | }; |
| 41 | try { |
| 42 | pkg = JSON.parse(content); |
| 43 | } catch { |
| 44 | return result; |
| 45 | } |
| 46 | for (const deps of [pkg.dependencies, pkg.devDependencies]) { |
| 47 | if (deps && typeof deps === 'object') { |
| 48 | for (const name of Object.keys(deps)) { |
| 49 | const normalized = normalizeNpmPackageName(name); |
| 50 | if (!shouldSkipPackage(normalized)) result.push(normalized); |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | return result; |
| 55 | } |
| 56 | |
| 57 | /** Parse [dependencies] section from Cargo.toml. Keys only, no external deps. */ |
| 58 | function parseCargoToml(content: string): string[] { |
no test coverage detected
searching dependent graphs…