vite-env.d.ts 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /**
  2. * Namespace Env
  3. *
  4. * It is used to declare the type of the import.meta object
  5. */
  6. declare namespace Env {
  7. /** The router history mode */
  8. type RouterHistoryMode = 'hash' | 'history' | 'memory';
  9. /** Interface for import.meta */
  10. // eslint-disable-next-line @typescript-eslint/no-shadow
  11. interface ImportMeta extends ImportMetaEnv {
  12. /** The environment */
  13. readonly VITE_OSS_BASE_URL: string;
  14. /** The base url of the application */
  15. readonly VITE_BASE_URL: string;
  16. /** The title of the application */
  17. readonly VITE_APP_TITLE: string;
  18. /** The description of the application */
  19. readonly VITE_APP_DESC: string;
  20. /** The router history mode */
  21. readonly VITE_ROUTER_HISTORY_MODE?: RouterHistoryMode;
  22. /** The prefix of the iconify icon */
  23. readonly VITE_ICON_PREFIX: 'icon';
  24. /**
  25. * The prefix of the local icon
  26. *
  27. * This prefix is start with the icon prefix
  28. */
  29. readonly VITE_ICON_LOCAL_PREFIX: 'icon-local';
  30. /** backend service base url */
  31. readonly VITE_SERVICE_BASE_URL: string;
  32. /**
  33. * success code of backend service
  34. *
  35. * when the code is received, the request is successful
  36. */
  37. readonly VITE_SERVICE_SUCCESS_CODE: string;
  38. /**
  39. * logout codes of backend service
  40. *
  41. * when the code is received, the user will be logged out and redirected to login page
  42. *
  43. * use "," to separate multiple codes
  44. */
  45. readonly VITE_SERVICE_LOGOUT_CODES: string;
  46. /**
  47. * modal logout codes of backend service
  48. *
  49. * when the code is received, the user will be logged out by displaying a modal
  50. *
  51. * use "," to separate multiple codes
  52. */
  53. readonly VITE_SERVICE_MODAL_LOGOUT_CODES: string;
  54. /**
  55. * token expired codes of backend service
  56. *
  57. * when the code is received, it will refresh the token and resend the request
  58. *
  59. * use "," to separate multiple codes
  60. */
  61. readonly VITE_SERVICE_EXPIRED_TOKEN_CODES: string;
  62. /** when the route mode is static, the defined super role */
  63. readonly VITE_STATIC_SUPER_ROLE: string;
  64. /**
  65. * other backend service base url
  66. *
  67. * the value is a json
  68. */
  69. readonly VITE_OTHER_SERVICE_BASE_URL: string;
  70. /**
  71. * Whether to enable the http proxy
  72. *
  73. * Only valid in the development environment
  74. */
  75. readonly VITE_HTTP_PROXY?: CommonType.YesOrNo;
  76. /**
  77. * The auth route mode
  78. *
  79. * - Static: the auth routes is generated in front-end
  80. * - Dynamic: the auth routes is generated in back-end
  81. */
  82. readonly VITE_AUTH_ROUTE_MODE: 'static' | 'dynamic';
  83. /**
  84. * The home route key
  85. *
  86. * It only has effect when the auth route mode is static, if the route mode is dynamic, the home route key is
  87. * defined in the back-end
  88. */
  89. readonly VITE_ROUTE_HOME: import('@elegant-router/types').LastLevelRouteKey;
  90. /**
  91. * Default menu icon if menu icon is not set
  92. *
  93. * Iconify icon name
  94. */
  95. readonly VITE_MENU_ICON: string;
  96. /** Whether to build with sourcemap */
  97. readonly VITE_SOURCE_MAP?: CommonType.YesOrNo;
  98. /**
  99. * Iconify api provider url
  100. *
  101. * If the project is deployed in intranet, you can set the api provider url to the local iconify server
  102. *
  103. * @link https://docs.iconify.design/api/providers.html
  104. */
  105. readonly VITE_ICONIFY_URL?: string;
  106. /** Used to differentiate storage across different domains */
  107. readonly VITE_STORAGE_PREFIX?: string;
  108. /** Whether to automatically detect updates after configuring application packaging */
  109. readonly VITE_AUTOMATICALLY_DETECT_UPDATE?: CommonType.YesOrNo;
  110. /** show proxy url log in terminal */
  111. readonly VITE_PROXY_LOG?: CommonType.YesOrNo;
  112. /** The launch editor */
  113. readonly VITE_DEVTOOLS_LAUNCH_EDITOR?: import('vite-plugin-vue-devtools').VitePluginVueDevToolsOptions['launchEditor'];
  114. }
  115. }
  116. interface ImportMeta {
  117. readonly env: Env.ImportMeta;
  118. }