Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
37 lines
1.6 KiB
TypeScript
37 lines
1.6 KiB
TypeScript
import type { RequestHeaders } from './fetch-server-response';
|
|
/**
|
|
* Mutates the provided URL by adding a cache-busting search parameter for CDNs that don't
|
|
* support custom headers. This helps avoid caching conflicts by making each request unique.
|
|
*
|
|
* Rather than relying on the Vary header which some CDNs ignore, we append a search param
|
|
* to create a unique URL that forces a fresh request.
|
|
*
|
|
* Example:
|
|
* URL before: https://example.com/path?query=1
|
|
* URL after: https://example.com/path?query=1&_rsc=abc123
|
|
*
|
|
* Note: This function mutates the input URL directly and resolves once the
|
|
* cache-busting value has been computed and applied.
|
|
*
|
|
* TODO: Since we need to use a search param anyway, we could simplify by removing the custom
|
|
* headers approach entirely and just use search params.
|
|
*/
|
|
export declare const setCacheBustingSearchParam: (url: URL, headers: RequestHeaders) => Promise<void>;
|
|
/**
|
|
* Sets a cache-busting search parameter on a URL using a provided hash value.
|
|
*
|
|
* This function performs the same logic as `setCacheBustingSearchParam` but accepts
|
|
* a pre-computed hash instead of computing it from headers.
|
|
*
|
|
* Example:
|
|
* URL before: https://example.com/path?query=1
|
|
* hash: "abc123"
|
|
* URL after: https://example.com/path?query=1&_rsc=abc123
|
|
*
|
|
* If the hash is empty, we will set `_rsc` search param without a value.
|
|
* Like this: https://example.com/path?query=1&_rsc
|
|
*
|
|
* Note: This function mutates the input URL directly and does not return anything.
|
|
*/
|
|
export declare const setCacheBustingSearchParamWithHash: (url: URL, hash: string) => void;
|