vite-plugin-lib
Version:
Vite plugin for build configuration, automatic aliases, and type declarations.
49 lines (48 loc) • 2.06 kB
text/typescript
import * as dts from "vite-plugin-dts";
import { LibraryFormats, Plugin } from "vite";
//#region src/index.d.ts
interface CommonOptions {
verbose: boolean;
}
interface TSConfigPathsOptions extends CommonOptions {
/** Path to the tsconfig file (relative to the project root). Defaults to `./tsconfig.json` */
tsconfig: string;
}
interface BundleOptions {
/** If `false`, all builtin modules will be externalized. Defaults to `false`. */
builtin: boolean;
/** If `false`, all dependencies will be externalized. Defaults to `false`. */
dependencies: boolean;
/** If `false`, all devDependencies will be externalized. Defaults to `true`. */
devDependencies: boolean;
/** If `false`, all dependencies will be externalized. Defaults to `false`. */
peerDependencies: boolean;
/** List of packages or modules to externalize. Defaults to `[]`. */
exclude: (string | RegExp)[];
/** List of packages or modules to bundle. Acts as an override and defaults to `[]`. */
include: (string | RegExp)[];
/** If `false`, all direct imports from `node_modules` will be externalized. Defaults to `false`. */
nodeModules: boolean;
}
interface LibraryOptions extends TSConfigPathsOptions {
/** Defaults to `src/index.ts`. */
entry: string;
/** Bundle configuration for packages and modules. See {@link BundleOptions} for defaults. */
bundle: Partial<BundleOptions>;
/** Defaults to `['es']`. */
formats: LibraryFormats[];
/** Defaults to `package.json`. */
manifest: string;
name?: string;
/** Remove any temporary build files. Defaults to `true`. */
cleanup: boolean;
}
declare function tsconfigPaths(options?: Partial<TSConfigPathsOptions>): Plugin;
declare function library(options?: Partial<LibraryOptions>): Plugin[];
/**
* Remove any temporary `vite.config.ts.timestamp-*` files.
*/
declare function cleanup(options?: Partial<CommonOptions>): Plugin;
//#endregion
export { BundleOptions, CommonOptions, LibraryOptions, TSConfigPathsOptions, cleanup, dts, library, tsconfigPaths };
//# sourceMappingURL=index.d.mts.map