From 2bbb7e7e6776af35e376c78ed21d923f0e9618e5 Mon Sep 17 00:00:00 2001 From: Okiki Ojo Date: Sun, 25 Jan 2026 19:35:12 -0500 Subject: [PATCH] docs: detail how fetch and cache work with redirects in tsdocs Signed-off-by: Okiki Ojo --- utils/fetch-and-cache.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/utils/fetch-and-cache.ts b/utils/fetch-and-cache.ts index 4baecee..a16cdd2 100644 --- a/utils/fetch-and-cache.ts +++ b/utils/fetch-and-cache.ts @@ -13,6 +13,23 @@ import { LruCache } from "./lru.ts"; * * For efficiency, we also maintain a redirect map so requests to aliased URLs * can find cached content without re-fetching. + * + * @example How Redirects Now Work + * ``` + * Request: https://esm.sh/lodash@latest + * ↓ + * fetch-and-cache: fetch with redirect:'follow' + * ↓ + * Response.url: https://esm.sh/lodash@4.17.21 + * ↓ + * Cache: stores under final URL + records redirect mapping + * ↓ + * http.ts: receives { url: "https://esm.sh/lodash@4.17.21", content, ... } + * ↓ + * pluginData.url = final URL + * ↓ + * Relative import "./debounce" resolves against final URL ✓ + * ``` */ // ============================================================================ -- 2.51.2