0rui-SoybeanAdmin/src/typings/vite-env.d.ts

117 lines
3.7 KiB
TypeScript
Raw Normal View History

2025-04-27 15:09:45 +08:00
/**
* Namespace Env
*
* It is used to declare the type of the import.meta object
*/
declare namespace Env {
/** The router history mode */
type RouterHistoryMode = 'hash' | 'history' | 'memory';
/** Interface for import.meta */
// eslint-disable-next-line @typescript-eslint/no-shadow
interface ImportMeta extends ImportMetaEnv {
/** The base url of the application */
readonly VITE_BASE_URL: string;
/** The title of the application */
readonly VITE_APP_TITLE: string;
/** The description of the application */
readonly VITE_APP_DESC: string;
/** The router history mode */
readonly VITE_ROUTER_HISTORY_MODE?: RouterHistoryMode;
/** The prefix of the iconify icon */
readonly VITE_ICON_PREFIX: 'icon';
/**
* The prefix of the local icon
*
* This prefix is start with the icon prefix
*/
readonly VITE_ICON_LOCAL_PREFIX: 'local-icon';
/** backend service base url */
readonly VITE_SERVICE_BASE_URL: string;
/**
* success code of backend service
*
* when the code is received, the request is successful
*/
readonly VITE_SERVICE_SUCCESS_CODE: string;
/**
* logout codes of backend service
*
* when the code is received, the user will be logged out and redirected to login page
*
* use "," to separate multiple codes
*/
readonly VITE_SERVICE_LOGOUT_CODES: string;
/**
* modal logout codes of backend service
*
* when the code is received, the user will be logged out by displaying a modal
*
* use "," to separate multiple codes
*/
readonly VITE_SERVICE_MODAL_LOGOUT_CODES: string;
/**
* token expired codes of backend service
*
* when the code is received, it will refresh the token and resend the request
*
* use "," to separate multiple codes
*/
readonly VITE_SERVICE_EXPIRED_TOKEN_CODES: string;
/** when the route mode is static, the defined super role */
readonly VITE_STATIC_SUPER_ROLE: string;
/**
* other backend service base url
*
* the value is a json
*/
readonly VITE_OTHER_SERVICE_BASE_URL: string;
/**
* Whether to enable the http proxy
*
* Only valid in the development environment
*/
readonly VITE_HTTP_PROXY?: CommonType.YesOrNo;
/**
* The auth route mode
*
* - Static: the auth routes is generated in front-end
* - Dynamic: the auth routes is generated in back-end
*/
readonly VITE_AUTH_ROUTE_MODE: 'static' | 'dynamic';
/**
* The home route key
*
* It only has effect when the auth route mode is static, if the route mode is dynamic, the home route key is
* defined in the back-end
*/
readonly VITE_ROUTE_HOME: import('@elegant-router/types').LastLevelRouteKey;
/**
* Default menu icon if menu icon is not set
*
* Iconify icon name
*/
readonly VITE_MENU_ICON: string;
/** Whether to build with sourcemap */
readonly VITE_SOURCE_MAP?: CommonType.YesOrNo;
/**
* Iconify api provider url
*
* If the project is deployed in intranet, you can set the api provider url to the local iconify server
*
* @link https://docs.iconify.design/api/providers.html
*/
readonly VITE_ICONIFY_URL?: string;
/** Used to differentiate storage across different domains */
readonly VITE_STORAGE_PREFIX?: string;
/** Whether to automatically detect updates after configuring application packaging */
readonly VITE_AUTOMATICALLY_DETECT_UPDATE?: CommonType.YesOrNo;
/** show proxy url log in terminal */
readonly VITE_PROXY_LOG?: CommonType.YesOrNo;
}
}
interface ImportMeta {
readonly env: Env.ImportMeta;
}