diff --git a/packages/client/client/context.ts b/packages/client/client/context.ts index 62f82a42..049f5b75 100644 --- a/packages/client/client/context.ts +++ b/packages/client/client/context.ts @@ -34,10 +34,6 @@ export function useRpc(): Ref { export interface Internal {} export class Context extends cordis.Context { - // workaround injection check - // eslint-disable-next-line @typescript-eslint/naming-convention - __v_isRef = undefined - app: App constructor() { diff --git a/packages/client/client/plugins/loader.ts b/packages/client/client/plugins/loader.ts index 136fbf08..d8e4a57c 100644 --- a/packages/client/client/plugins/loader.ts +++ b/packages/client/client/plugins/loader.ts @@ -83,7 +83,7 @@ export default class LoaderService extends Service { await Promise.all(Object.entries(rest).map(([key, { files, paths, data }]) => { if (this.extensions[key]) return - const scope = this.ctx.isolate(['extension']).plugin(() => {}) + const scope = this.ctx.isolate('extension').plugin(() => {}) scope.ctx.extension = this.extensions[key] = { done: ref(false), scope, paths, data: ref(data) } const task = Promise.all(files.map((url) => { for (const ext in loaders) { diff --git a/packages/client/client/utils.ts b/packages/client/client/utils.ts index dc752f76..9e337030 100644 --- a/packages/client/client/utils.ts +++ b/packages/client/client/utils.ts @@ -2,8 +2,7 @@ import { markRaw } from 'vue' import * as cordis from 'cordis' import { Context } from './context' -export type Service = cordis.Service -export const Service = cordis.Service +export abstract class Service extends cordis.Service {} export interface Ordered { order?: number diff --git a/packages/online/src/dev.ts b/packages/online/src/dev.ts index 0a5546a1..7fe09e49 100644 --- a/packages/online/src/dev.ts +++ b/packages/online/src/dev.ts @@ -166,7 +166,7 @@ async function createVite() { ...require.resolve('@root/minato/package.json') ? { '@minatojs/driver-sqlite': '@minatojs/driver-sqlite/src/index.ts', '@minatojs/sql-utils': '@minatojs/sql-utils/src/index.ts', - '@minatojs/core': '@minatojs/core/src/index.ts', + 'minato': 'minato/src/index.ts', } : {}, '@koishijs/plugin-console': '@koishijs/plugin-console/src/browser/index.ts', 'chokidar': '@koishijs/fs/src/index.ts', diff --git a/plugins/analytics/src/index.ts b/plugins/analytics/src/index.ts index 423321aa..179a22ed 100644 --- a/plugins/analytics/src/index.ts +++ b/plugins/analytics/src/index.ts @@ -35,7 +35,7 @@ class Analytics extends DataService { private messages: Analytics.Message[] = [] private commands: Analytics.Command[] = [] - constructor(ctx: Context, private config: Analytics.Config = {}) { + constructor(ctx: Context, public config: Analytics.Config = {}) { super(ctx, 'analytics') ctx.model.extend('analytics.message', { diff --git a/plugins/auth/src/index.ts b/plugins/auth/src/index.ts index 331e706a..c851f990 100644 --- a/plugins/auth/src/index.ts +++ b/plugins/auth/src/index.ts @@ -83,7 +83,7 @@ function toHash(password: string) { class AuthService extends Service { static inject = ['console', 'database'] - constructor(ctx: Context, private config: AuthService.Config) { + constructor(ctx: Context, public config: AuthService.Config) { super(ctx, 'auth') ctx.model.extend('user', { @@ -122,7 +122,7 @@ class AuthService extends Service { async start() { const { enabled, username, password } = this.config.admin if (!enabled) return - this.logger.info('creating admin account') + this.ctx.logger.info('creating admin account') await this.ctx.database.upsert('user', [{ id: 0, name: username, diff --git a/plugins/console/src/node/index.ts b/plugins/console/src/node/index.ts index 21794dfa..9dee21b9 100644 --- a/plugins/console/src/node/index.ts +++ b/plugins/console/src/node/index.ts @@ -64,6 +64,7 @@ class NodeConsole extends Console { : fileURLToPath(new URL('../../dist', base)) } + // @ts-ignore FIXME get config() { return this._config } @@ -95,7 +96,7 @@ class NodeConsole extends Console { if (this.config.open && !this.ctx.get('loader')?.envData.clientCount && !process.env.KOISHI_AGENT) { open(target) } - this.logger.info('webui is available at %c', target) + this.ctx.logger.info('webui is available at %c', target) }) } diff --git a/plugins/locales/src/index.ts b/plugins/locales/src/index.ts index d5e9ded0..a473405c 100644 --- a/plugins/locales/src/index.ts +++ b/plugins/locales/src/index.ts @@ -19,7 +19,7 @@ declare module '@koishijs/console' { const logger = new Logger('locales') class LocaleProvider extends DataService> { - constructor(ctx: Context, private config: Config) { + constructor(ctx: Context, public config: Config) { super(ctx, 'locales', { authority: 4 }) const update = ctx.debounce(() => this.refresh(), 0) diff --git a/plugins/market/src/node/market.ts b/plugins/market/src/node/market.ts index b655c2c7..c5cb07e5 100644 --- a/plugins/market/src/node/market.ts +++ b/plugins/market/src/node/market.ts @@ -54,7 +54,7 @@ class MarketProvider extends BaseMarketProvider { onFailure: (name, reason) => { this.failed.push(name) if (registry.config.endpoint.startsWith('https://registry.npmmirror.com')) { - if (Quester.isAxiosError(reason) && reason.response?.status === 404) { + if (Quester.Error.is(reason) && reason.response?.status === 404) { // ignore 404 error for npmmirror } } diff --git a/plugins/status/src/profile.ts b/plugins/status/src/profile.ts index bb224cc0..445dcda7 100644 --- a/plugins/status/src/profile.ts +++ b/plugins/status/src/profile.ts @@ -80,7 +80,7 @@ function updateCpuUsage() { class ProfileProvider extends DataService { cached: ProfileProvider.Payload - constructor(ctx: Context, private config: ProfileProvider.Config) { + constructor(ctx: Context, public config: ProfileProvider.Config) { super(ctx, 'status') ctx.i18n.define('zh-CN', zhCN)