diff --git a/package.json b/package.json index dd91d78..4dfb608 100644 --- a/package.json +++ b/package.json @@ -29,9 +29,9 @@ "draw" ], "peerDependencies": { - "koishi": "^4.15.0" + "koishi": "^4.18.7" }, "devDependencies": { - "koishi": "^4.15.0" + "koishi": "^4.18.7" } } diff --git a/src/index.ts b/src/index.ts index ad76984..8d841da 100644 --- a/src/index.ts +++ b/src/index.ts @@ -43,10 +43,25 @@ abstract class CanvasService extends Service { super(ctx, 'canvas') } - abstract createCanvas(width: number, height: number): Promise + abstract createCanvas( + width: number, + height: number, + options?: { + families: string[] + text?: string + }, + ): Promise abstract loadImage(source: string | URL | Buffer | ArrayBufferLike): Promise - async render(width: number, height: number, callback: (ctx: CanvasRenderingContext2D) => Awaitable) { + async render( + width: number, + height: number, + callback: (ctx: CanvasRenderingContext2D) => Awaitable, + options?: { + families: string[], + text?: string, + } + ) { const canvas = await this.createCanvas(width, height) try { await callback(canvas.getContext('2d')) diff --git a/tsconfig.json b/tsconfig.json index 648bc04..af3fd32 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,16 +2,17 @@ "compilerOptions": { "rootDir": "src", "outDir": "lib", - "target": "es2019", - "module": "commonjs", - "emitDeclarationOnly": true, + "target": "es2022", + "module": "esnext", + "sourceMap": true, + "declaration": true, "composite": true, "incremental": true, "skipLibCheck": true, "esModuleInterop": true, - "moduleResolution": "node" + "emitDeclarationOnly": true, + "moduleResolution": "bundler", + "strictBindCallApply": true, }, - "include": [ - "src" - ] -} \ No newline at end of file + "include": ["src"] +}