Bilibili-Evolved/registry/lib/components/utils/dev-client/options.ts
2022-05-22 17:05:12 +08:00

43 lines
1.3 KiB
TypeScript

import type { AutoUpdateOptions } from '@/components/auto-update'
import { defineOptionsMetadata } from '@/components/define'
import { getComponentSettings } from '@/core/settings'
import { getNumberValidator } from '@/core/utils'
import { RefreshMethod, HotReloadMethod } from './update-method'
export const { options: autoUpdateOptions } = getComponentSettings<AutoUpdateOptions>('autoUpdate')
export interface DevRecord {
name: string
originalUrl: string
}
export const devClientOptionsMetadata = defineOptionsMetadata({
port: {
defaultValue: 23333,
displayName: '端口',
validator: getNumberValidator(1024, 65535),
},
autoConnect: {
defaultValue: true,
displayName: '自动连接',
},
coreRefreshMethod: {
defaultValue: RefreshMethod.AlwaysReload,
displayName: '本体刷新策略',
dropdownEnum: RefreshMethod,
},
registryRefreshMethod: {
defaultValue: RefreshMethod.AlwaysReload,
displayName: '功能刷新策略',
dropdownEnum: RefreshMethod,
},
registryReloadMethod: {
defaultValue: HotReloadMethod.Enabled,
displayName: '功能热重载策略',
dropdownEnum: HotReloadMethod,
},
devRecords: {
defaultValue: {} as Record<string, DevRecord>,
displayName: '调试模式临时存储',
hidden: true,
},
})