UNPKG

@roots/bud-api

Version:

bud.js core module

60 lines (59 loc) 2.18 kB
import type { Bud } from '@roots/bud-framework'; import type * as Server from '@roots/bud-framework/services/server'; import type { Options } from './proxy.types.js'; export declare const fallbackUrl: URL; export declare const maybeEnable: (bud: Bud, input: unknown) => void; /** * Assign port * * @param bud * @param port */ export declare const assignPort: (bud: Bud, port: number) => void; /** * Assign a URL or a string to `proxy.options.target` * * @param bud * @param maybeURL */ export declare const assignUrl: (bud: Bud, maybeURL: string | URL) => void; /** * Assign a callback function `proxy.options` * * @param bud - bud instance * @param optionsFn - options callback */ export declare const assignOptionsCallback: (bud: Bud, value: ((options: Partial<Options> | undefined) => Partial<Options>) | Partial<Options>) => void; /** * Assign replacements * * @param bud - bud instance * @param replacements - replacement tuples */ export declare const assignReplacements: (bud: Bud, replacements: Options["replacements"]) => void; /** * Enables proxy middleware * * @remarks * Callback for the `dev.middleware.enabled` hook * If proxy middleware is already enabled it will be removed before it is re-added */ export declare const enableMiddleware: (middleware?: Array<keyof Server.Middleware.Available> | undefined) => Array<keyof Server.Middleware.Available>; /** * Disable proxy middleware * * @remarks * Callback for the `dev.middleware.enabled` hook * If proxy middleware is already enabled it will be removed before it is re-added */ export declare const disableMiddleware: (middleware?: Array<keyof Server.Middleware.Available> | undefined) => Array<keyof Server.Middleware.Available>; export declare const isUrl: (obj: unknown) => obj is URL; export declare const isFalse: (obj: unknown) => obj is false; export declare const isOptionsObject: (obj: Array<[string, string]> | boolean | CallableFunction | number | Partial<Options> | string | undefined | URL) => obj is Partial<Options>; /** * Map options object * * @param bud * @param options */ export declare const assignOptions: (bud: Bud, options: Partial<Options>) => void;