UNPKG

cdn-resolve

Version:

Resolves import paths to their CDN equivalents

19 lines (17 loc) 1.23 kB
import { n as buildESMUrl, r as resolveESMTypes, t as ESMOptions } from "./esm-BUEw2sO9.cjs"; import { n as buildUnpkgUrl, t as UnpkgOptions } from "./unpkg-atALq6Ge.cjs"; import { t as buildJSDelivrUrl } from "./jsdelivr-D3QorCL5.cjs"; import { n as parsePackage, t as ParsedPackage } from "./parse-CRHBhVcI.cjs"; //#region src/index.d.ts declare const CDN_URLS: { readonly esm: "https://esm.sh"; readonly unpkg: "https://unpkg.com"; readonly jsdelivr: "https://cdn.jsdelivr.net/npm"; }; type SupportedCDNS = "esm" | "unpkg" | "jsdelivr"; declare function normalizeCdnUrl(cdn: SupportedCDNS, module: string): string; type Options<TCDN extends Exclude<SupportedCDNS, "jsdelivr">> = TCDN extends "esm" ? ESMOptions : UnpkgOptions; type Builder<TCDN extends SupportedCDNS> = TCDN extends "jsdelivr" ? (module: string) => URL | undefined : (module: string, options?: Options<Exclude<TCDN, "jsdelivr">>) => URL | undefined; declare function buildCDNUrl<TCDN extends SupportedCDNS>(cdn: TCDN): Builder<TCDN>; //#endregion export { Builder, CDN_URLS, type ESMOptions, type ParsedPackage, SupportedCDNS, type UnpkgOptions, buildCDNUrl, buildESMUrl, buildJSDelivrUrl, buildUnpkgUrl, normalizeCdnUrl, parsePackage, resolveESMTypes };