forked from
npmx.dev/npmx.dev
[READ-ONLY]
a fast, modern browser for the npm registry
1/**
2 * Shared composable for dependency analysis data (vulnerabilities, deprecated packages).
3 * Fetches once and caches the result so multiple components can use it.
4 * Before: useVulnerabilityTree - but now we use this for both vulnerabilities and deprecated packages.
5 */
6export function useDependencyAnalysis(
7 packageName: MaybeRefOrGetter<string>,
8 version: MaybeRefOrGetter<string>,
9) {
10 return useFetch(
11 () =>
12 `/api/registry/vulnerabilities/${encodePackageName(toValue(packageName))}/v/${toValue(version)}`,
13 )
14}