vite-plugin-browser-sync
Version:
Add BrowserSync in your Vite project
92 lines (87 loc) • 1.95 kB
TypeScript
import { Plugin } from 'vite';
import { Options as Options$1 } from 'browser-sync';
type BsMode = 'snippet' | 'proxy';
type BsOptions = Options$1;
interface PartOptions {
/**
* Activate BrowserSync
* @default false
*/
enable?: boolean;
/**
* BrowserSync options
* @see https://browsersync.io/docs/options
*/
bs?: BsOptions;
}
interface PartOptionsMode {
/**
* proxy (default): Browsersync will wrap your vhost with a proxy URL to view your site.
* snippet: Inject Browsersync inside your html page
*/
mode?: BsMode;
}
interface OptionsBuildWatch extends PartOptions, PartOptionsMode {
/**
* Activate BrowserSync
* @default true
*/
enable?: boolean;
}
interface OptionsDev extends PartOptions, PartOptionsMode {
/**
* Activate BrowserSync
* @default true
*/
enable?: boolean;
}
interface OptionsPreview extends PartOptions {
}
interface Options {
dev?: OptionsDev;
buildWatch?: OptionsBuildWatch;
preview?: OptionsPreview;
/**
* @deprecated since version 3.0
*/
bs?: BsOptions;
}
/**
* This entry file is for the plugin.
* @module
*/
/**
* Vite plugin
*
* @example <caption>Basic Usage</caption>
* ```ts
* // vite.config.js / vite.config.ts
* import VitePluginBrowserSync from 'vite-plugin-browser-sync'
*
* export default {
* plugins: [VitePluginBrowserSync()]
* }
* ```
* @example <caption>With options</caption>
* ```ts
* // vite.config.js / vite.config.ts
* import VitePluginBrowserSync from 'vite-plugin-browser-sync'
*
* export default {
* plugins: [
* VitePluginBrowserSync({
* dev: {
* bs: {
* ui: {
* port: 8080
* },
* notify: false
* }
* }
* })
* ]
* }
* ```
*/
declare function VitePluginBrowserSync(options?: Options): Plugin;
export { VitePluginBrowserSync as default };