From 0226b6da15233fb68eeab5c8a6ece0edbe8b6615 Mon Sep 17 00:00:00 2001 From: Okiki Ojo Date: Sat, 14 Feb 2026 04:51:40 -0500 Subject: [PATCH] fix(fetch): add options parameter to getPackageOfVersion for improved fetch control Signed-off-by: Okiki Ojo --- utils/npm-search.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/utils/npm-search.ts b/utils/npm-search.ts index 47a6402..ef336b7 100644 --- a/utils/npm-search.ts +++ b/utils/npm-search.ts @@ -21,6 +21,7 @@ * ``` */ +import type { FetchOptions } from "./fetch-and-cache.ts"; import type { FullPackage, FullPackageVersion, @@ -344,12 +345,16 @@ export async function getPackage( */ export async function getPackageOfVersion( input: string, - registry?: string + registry?: string, + opts: Pick = {}, ): Promise { const { packageVersionURL, name, version } = getRegistryURL(input, registry); try { - const { response } = await fetchWithCache(packageVersionURL); + const { response } = await fetchWithCache(packageVersionURL, { + signal: opts.signal, + scope: opts.scope, + }); if (!response.ok) { if (response.status === 404) { -- knotmirror 0.0.1