@takumi-rs/core 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +8 -3
  2. package/index.d.ts +6 -4
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -3,15 +3,20 @@
3
3
  ## Usage
4
4
 
5
5
  ```ts
6
- import { Renderer } from "@takumi-rs/core";
6
+ import { Renderer, OutputFormat } from "@takumi-rs/core";
7
7
  import { container, image } from "@takumi-rs/helpers";
8
8
  import { writeFile } from "fs/promises";
9
9
 
10
10
  const render = new Renderer();
11
11
 
12
+ const logoUrl = "https://yeecord.com/img/logo.png";
13
+ const logo = await fetch("https://yeecord.com/img/logo.png").then((r) =>
14
+ r.arrayBuffer()
15
+ );
16
+
12
17
  const node = container({
13
18
  children: [
14
- image("https://yeecord.com/img/logo.png", {
19
+ image(logoUrl, {
15
20
  width: 128,
16
21
  height: 128,
17
22
  }),
@@ -24,6 +29,6 @@ const node = container({
24
29
  const buffer = await render.renderAsync(node, {
25
30
  width: 1200,
26
31
  height: 630,
27
- format: "webp"
32
+ format: OutputFormat.WebP,
28
33
  });
29
34
  ```
package/index.d.ts CHANGED
@@ -1,16 +1,18 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
3
  export declare class Renderer {
4
- constructor()
5
- loadLocalImageAsync(key: string, data: ArrayBuffer, signal?: AbortSignal | undefined | null): Promise<void>
4
+ constructor(options?: ConstructRendererOptions | undefined | null)
5
+ putPersistentImageAsync(src: string, data: ArrayBuffer, signal?: AbortSignal | undefined | null): Promise<void>
6
6
  loadFontAsync(data: ArrayBuffer, signal?: AbortSignal | undefined | null): Promise<number>
7
7
  loadFontsAsync(fonts: Array<ArrayBuffer>, signal?: AbortSignal | undefined | null): Promise<number>
8
8
  clearImageStore(): void
9
- clearLocalImageStore(): void
10
- preloadImageAsync(url: string, signal?: AbortSignal | undefined | null): Promise<void>
11
9
  renderAsync(source: { type: string }, options: RenderOptions, signal?: AbortSignal): Promise<Buffer>
12
10
  }
13
11
 
12
+ export interface ConstructRendererOptions {
13
+ debug?: boolean
14
+ }
15
+
14
16
  export declare const enum OutputFormat {
15
17
  WebP = 'WebP',
16
18
  Png = 'Png',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/core",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "author": {
5
5
  "email": "me@kane.tw",
6
6
  "name": "Kane Wang",
@@ -41,10 +41,10 @@
41
41
  "type": "commonjs",
42
42
  "types": "index.d.ts",
43
43
  "optionalDependencies": {
44
- "@takumi-rs/core-darwin-arm64": "0.8.0",
45
- "@takumi-rs/core-linux-arm64-gnu": "0.8.0",
46
- "@takumi-rs/core-linux-arm64-musl": "0.8.0",
47
- "@takumi-rs/core-linux-x64-gnu": "0.8.0",
48
- "@takumi-rs/core-linux-x64-musl": "0.8.0"
44
+ "@takumi-rs/core-darwin-arm64": "0.10.0",
45
+ "@takumi-rs/core-linux-arm64-gnu": "0.10.0",
46
+ "@takumi-rs/core-linux-arm64-musl": "0.10.0",
47
+ "@takumi-rs/core-linux-x64-gnu": "0.10.0",
48
+ "@takumi-rs/core-linux-x64-musl": "0.10.0"
49
49
  }
50
50
  }