UNPKG

@roots/bud-extensions

Version:

bud.js core module

60 lines (59 loc) 1.72 kB
import type { Bud } from '@roots/bud-framework'; import { Extension, type ExtensionApi } from '@roots/bud-framework/extension'; /** * Http modules configuration options */ export type Options = { allowedUris?: Set<((uri: string) => boolean) | RegExp | string>; cacheLocation: false | string; frozen: boolean; lockfileLocation: string; proxy: false | string; upgrade: boolean; }; type Api = ExtensionApi<Cdn, Options>; /** * Http modules configuration */ export default class Cdn extends Extension<Options> implements Api { allowedUris: Api['allowedUris']; /** * Whether to cache modules locally */ cacheEnabled: boolean; cacheLocation: Api['cacheLocation']; frozen: Api['frozen']; getAllowedUris: Api['getAllowedUris']; getCacheLocation: Api['getCacheLocation']; getFrozen: Api['getFrozen']; getLockfileLocation: Api['getLockfileLocation']; getProxy: Api['getProxy']; getUpgrade: Api['getUpgrade']; lockfileLocation: Api['lockfileLocation']; proxy: Api['proxy']; setAllowedUris: Api['setAllowedUris']; setCacheLocation: Api['setCacheLocation']; setFrozen: Api['setFrozen']; setLockfileLocation: Api['setLockfileLocation']; setProxy: Api['setProxy']; setUpgrade: Api['setUpgrade']; /** * CDN key to URL mapping */ sources: Map<string, string>; upgrade: Api['upgrade']; /** * {@link Extension.buildBefore} */ buildBefore(bud: Bud): Promise<void>; disableCache(): this; /** * Enable cache */ enableCache(enabled?: boolean): this; /** * Prevent bud from fetching updated modules */ freeze(value?: boolean): this; } export {};