vite-version-plugin/dist/index.d.ts
autocommit 82755ccc82 chore: initial package split from monorepo
Package: @lilith/vite-version-plugin
Split from: lilith/ui.git or lilith/build.git
Publish workflow: calls lilith/workflows/.forgejo/workflows/publish-npm.yml@main
2026-04-20 01:11:53 -07:00

49 lines
1.7 KiB
TypeScript

import { Plugin } from 'vite';
interface VersionPluginOptions {
/**
* App name for console banner and build-info.json
*/
appName: string;
/**
* Path to VERSION.txt file (relative to project root or absolute)
* Can also be VERSION.json - will be auto-detected
* @default looks for VERSION.txt in project root, then monorepo root
*/
versionFile?: string;
/**
* Whether to generate build-info.json in output directory
* @default true
*/
generateBuildInfo?: boolean;
/**
* Custom fallback version if VERSION file is not found
* @default '0.0.0-dev'
*/
fallbackVersion?: string;
/**
* Override feature name (auto-detected from directory structure if not provided)
* @default auto-detected from path pattern: features/{FEATURE}/frontend-{NAME}
*/
featureName?: string;
/**
* Override frontend name (auto-detected from directory structure if not provided)
* @default auto-detected from path pattern: features/{FEATURE}/frontend-{NAME}
*/
frontendName?: string;
}
/**
* Vite plugin that injects version info at build time.
*
* Defines these globals:
* - `__APP_VERSION__` — Version from VERSION.txt/VERSION.json
* - `__BUILD_TIME__` — ISO timestamp of build
* - `__GIT_COMMIT__` — Short git commit hash
* - `__GIT_BRANCH__` — Git branch name
* - `__APP_NAME__` — App name from options
* - `__FEATURE_NAME__` — Auto-detected feature name
* - `__FRONTEND_NAME__` — Auto-detected frontend name
*/
declare function versionPlugin(options: VersionPluginOptions): Plugin;
export { type VersionPluginOptions, versionPlugin as default, versionPlugin };