diff --git a/packages/client/client/context.ts b/packages/client/client/context.ts index d93ef450..05b28184 100644 --- a/packages/client/client/context.ts +++ b/packages/client/client/context.ts @@ -10,6 +10,21 @@ import { SlotOptions } from './components' import { useColorMode, useConfig } from './config' import { ActionContext } from '.' +export type Plugin = cordis.Plugin + +export namespace Plugin { + export type Function = cordis.Plugin.Function + export type Constructor = cordis.Plugin.Constructor + export type Object = cordis.Plugin.Object +} + +export type EffectScope = cordis.EffectScope +export type ForkScope = cordis.ForkScope +export type MainScope = cordis.MainScope +export type Service = cordis.Service + +export const Service = cordis.Service + const config = useConfig() const mode = useColorMode() diff --git a/packages/client/client/data.ts b/packages/client/client/data.ts index 175beda3..6250a09f 100644 --- a/packages/client/client/data.ts +++ b/packages/client/client/data.ts @@ -17,6 +17,7 @@ const responseHooks: Record = {} export function send(type: T, ...args: Parameters): Promisify> export function send(type: string, ...args: any[]) { if (!socket.value) return + console.debug('↑%c', 'color:brown', type, args) const id = Math.random().toString(36).slice(2, 9) socket.value.send(JSON.stringify({ id, type, args })) return new Promise((resolve, reject) => { @@ -84,7 +85,7 @@ export function connect(callback: () => AbstractWebSocket) { value.addEventListener('message', (ev) => { refresh() const data = JSON.parse(ev.data) - console.debug('%c', 'color:purple', data.type, data.body) + console.debug('↓%c', 'color:purple', data.type, data.body) if (data.type in listeners) { listeners[data.type](data.body) } diff --git a/plugins/commands/src/service.ts b/plugins/commands/src/service.ts index 5f8d2382..6c4dfc50 100644 --- a/plugins/commands/src/service.ts +++ b/plugins/commands/src/service.ts @@ -50,8 +50,6 @@ function findAncestors(scope: EffectScope, suffix: string[] = []): string[] { } export default class CommandProvider extends DataService { - static using = ['console'] as const - cached: CommandData[] update = debounce(0, () => this.refresh()) diff --git a/plugins/console/src/node/index.ts b/plugins/console/src/node/index.ts index f11d24e8..7dcc347b 100644 --- a/plugins/console/src/node/index.ts +++ b/plugins/console/src/node/index.ts @@ -218,7 +218,7 @@ namespace NodeConsole { timeout: Schema.number().default(Time.minute), }), devMode: Schema.boolean().default(process.env.NODE_ENV === 'development').hidden(), - cacheDir: Schema.string().default('.vite').hidden(), + cacheDir: Schema.string().default('cache/vite').hidden(), }).i18n({ 'zh-CN': require('./locales/zh-CN'), }) diff --git a/plugins/console/src/shared/service.ts b/plugins/console/src/shared/service.ts index 1f52986b..27a50533 100644 --- a/plugins/console/src/shared/service.ts +++ b/plugins/console/src/shared/service.ts @@ -10,8 +10,8 @@ export namespace DataService { export abstract class DataService extends Service { static filter = false - static keys = new Set() + static using = ['console'] static define(name: keyof Console.Services) { this.keys.add(name) diff --git a/plugins/locales/client/locales.vue b/plugins/locales/client/locales.vue index df048104..9110242d 100644 --- a/plugins/locales/client/locales.vue +++ b/plugins/locales/client/locales.vue @@ -50,8 +50,8 @@ diff --git a/plugins/logger/src/index.ts b/plugins/logger/src/index.ts index e1b0a2ee..87fde3cd 100644 --- a/plugins/logger/src/index.ts +++ b/plugins/logger/src/index.ts @@ -15,8 +15,6 @@ declare module '@koishijs/plugin-console' { } class LogProvider extends DataService { - static using = ['console'] as const - root: string date: string files: number[] = [] diff --git a/plugins/status/src/envinfo.ts b/plugins/status/src/envinfo.ts index 20118f5e..20d14101 100644 --- a/plugins/status/src/envinfo.ts +++ b/plugins/status/src/envinfo.ts @@ -4,8 +4,6 @@ import { helpers } from 'envinfo' import which from 'which-pm-runs' class EnvInfoProvider extends DataService>> { - static using = ['console'] as const - private task: Promise>> constructor(ctx: Context, public config: EnvInfoProvider.Config) {