UNPKG

vite-intlayer

Version:

A Vite plugin for seamless internationalization (i18n), providing locale detection, redirection, and environment-based configuration

61 lines (59 loc) 2 kB
import { GetConfigurationOptions } from "@intlayer/config"; import { Plugin } from "vite"; import { IncomingMessage } from "node:http"; //#region src/intlayerProxyPlugin.d.ts type IntlayerProxyPluginOptions = { /** * A function that allows you to ignore specific requests from the intlayer proxy. * * @example * ```ts * export default defineConfig({ * plugins: [ intlayerProxyPlugin({ ignore: (req) => req.url?.startsWith('/api') }) ], * }); * ``` * * @param req - The incoming request. * @returns A boolean value indicating whether to ignore the request. */ ignore?: (req: IncomingMessage) => boolean; }; /** * * A Vite plugin that integrates a logic similar to the Next.js intlayer middleware. * * // Example usage of the plugin in a Vite configuration * export default defineConfig({ * plugins: [ intlayerProxyPlugin() ], * }); * */ declare const intlayerProxy: (configOptions?: GetConfigurationOptions, options?: IntlayerProxyPluginOptions) => Plugin; /** * @deprecated Rename to intlayerProxy instead * * A Vite plugin that integrates a logic similar to the Next.js intlayer middleware. * * ```ts * // Example usage of the plugin in a Vite configuration * export default defineConfig({ * plugins: [ intlayerMiddleware() ], * }); * ``` */ declare const intlayerMiddleware: (configOptions?: GetConfigurationOptions, options?: IntlayerProxyPluginOptions) => Plugin; /** * @deprecated Rename to intlayerProxy instead * * A Vite plugin that integrates a logic similar to the Next.js intlayer middleware. * ```ts * // Example usage of the plugin in a Vite configuration * export default defineConfig({ * plugins: [ intlayerMiddleware() ], * }); * ``` */ declare const intLayerMiddlewarePlugin: (configOptions?: GetConfigurationOptions, options?: IntlayerProxyPluginOptions) => Plugin; //#endregion export { intLayerMiddlewarePlugin, intlayerMiddleware, intlayerProxy }; //# sourceMappingURL=intlayerProxyPlugin.d.ts.map