signalk-server
Version:
An implementation of a [Signal K](http://signalk.org) server for boats.
21 lines • 1.03 kB
TypeScript
export interface IconProbeCache {
get(pkg: string, version: string, declaredPath: string): string | null | undefined;
set(pkg: string, version: string, declaredPath: string, resolved: string | null): void;
invalidate(): void;
}
export declare function createIconProbeCache(cacheDir: string): IconProbeCache;
/**
* Given a plugin package@version and a declared signalk.* relative path,
* return a resolved CDN URL that is actually reachable.
*
* If the declared path HEADs 200, returns that URL.
* Otherwise tries a small list of alternative directories (./public,
* ./assets, ./img, ./docs, ./dist, ./src) with the basename of the
* declared path. Returns the first URL that responds 200, or null when
* nothing works.
*
* Absolute URLs (http, https, data:) are passed through untouched and
* are NOT probed (trusted as-declared).
*/
export declare function probeIconUrl(pkg: string, version: string, declaredPath: string, cache: IconProbeCache): Promise<string | null>;
//# sourceMappingURL=icon-probe.d.ts.map