UNPKG

vite-plugin-mkcert

Version:

Provide certificates for vite's https dev service

94 lines (93 loc) 2.12 kB
import debug from "debug"; import { PluginOption } from "vite"; //#region src/mkcert/source.d.ts type SourceInfo = { version: string; downloadUrl: string; }; declare abstract class BaseSource { abstract getSourceInfo(): Promise<SourceInfo | undefined>; protected getPlatformIdentifier(): string; } //#endregion //#region src/mkcert/index.d.ts type SourceType = 'github' | 'coding' | BaseSource; type MkcertBaseOptions = { /** * Whether to force generate */ force?: boolean; /** * Automatically upgrade mkcert * * @default false */ autoUpgrade?: boolean; /** * Specify mkcert download source * * @default github */ source?: SourceType; /** * If your network is restricted, you can specify a local binary file instead of downloading, it should be an absolute path * * @default none */ mkcertPath?: string; /** * Proxy used when downloading mkcert binary. * * @example http://127.0.0.1:7890 */ proxy?: string; /** * Whether to print download progress logs when fetching mkcert binary. * * @default true */ downloadProgress?: boolean; /** * The location to save the files, such as key and cert files */ savePath?: string; /** * The name of private key file generated by mkcert */ keyFileName?: string; /** * The name of cert file generated by mkcert */ certFileName?: string; }; //#endregion //#region src/utils/logger.d.ts type LogLevel = 'info' | 'warn' | 'error' | 'silent'; //#endregion //#region src/index.d.ts type MkcertPluginOptions = MkcertBaseOptions & { /** * Restrict when the plugin is applied. * * @default 'serve' */ apply?: 'serve' | 'build'; /** * The hosts that needs to generate the certificate. */ hosts?: string[]; /** * Log level used by the plugin logger. * * If omitted, Vite's log level is used. */ logLevel?: LogLevel; }; declare const plugin: ({ apply, hosts, logLevel, ...mkcertOptions }?: MkcertPluginOptions) => PluginOption; //#endregion export { BaseSource, MkcertPluginOptions, type SourceInfo, plugin as default };