@takumi-rs/core 2.0.0-rc.12 → 2.0.0-rc.14
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.
- package/README.md +38 -12
- package/dist/export.cjs +34 -63
- package/dist/export.d.cts +4 -16
- package/dist/export.d.mts +4 -16
- package/dist/export.mjs +35 -64
- package/package.json +19 -11
package/README.md
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://takumi.kane.tw/logo.svg" alt="Takumi" width="64" />
|
|
3
|
+
|
|
1
4
|
# @takumi-rs/core
|
|
2
5
|
|
|
3
|
-
Native Node.js bindings for [Takumi](https://github.com/kane50613/takumi),
|
|
6
|
+
**Native Node.js bindings for [Takumi](https://github.com/kane50613/takumi), a Rust image rendering engine.**
|
|
7
|
+
The high-performance N-API runtime that turns node trees into OG cards, banners, and animations, no headless browser required.
|
|
8
|
+
|
|
9
|
+
[Documentation](https://takumi.kane.tw/docs/) · [Playground](https://takumi.kane.tw/playground)
|
|
4
10
|
|
|
5
|
-
|
|
11
|
+
</div>
|
|
6
12
|
|
|
7
13
|
## Install
|
|
8
14
|
|
|
@@ -10,26 +16,46 @@ This package ships the high-performance N-API runtime used by Takumi on Node.js
|
|
|
10
16
|
npm install @takumi-rs/core
|
|
11
17
|
```
|
|
12
18
|
|
|
13
|
-
##
|
|
19
|
+
## Quick start
|
|
14
20
|
|
|
15
21
|
```ts
|
|
16
22
|
import { Renderer } from "@takumi-rs/core";
|
|
17
23
|
|
|
18
24
|
const renderer = new Renderer();
|
|
25
|
+
|
|
19
26
|
const png = await renderer.render(
|
|
20
27
|
{
|
|
21
|
-
type: "
|
|
22
|
-
|
|
23
|
-
children: [{ type: "Text", value: "Hello from Takumi" }],
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
width: 1200,
|
|
27
|
-
height: 630,
|
|
28
|
+
type: "container",
|
|
29
|
+
children: [{ type: "text", text: "Hello from Takumi" }],
|
|
28
30
|
},
|
|
31
|
+
{ width: 1200, height: 630 },
|
|
29
32
|
);
|
|
30
33
|
```
|
|
31
34
|
|
|
32
|
-
|
|
35
|
+
`render` takes a node tree and returns a PNG `Buffer`. Build the tree by hand, or generate it from JSX and HTML with [`@takumi-rs/helpers`](https://npmjs.com/package/@takumi-rs/helpers).
|
|
36
|
+
|
|
37
|
+
## Fonts
|
|
38
|
+
|
|
39
|
+
Pass fonts on the render options, no separate registration step:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { readFile } from "node:fs/promises";
|
|
43
|
+
|
|
44
|
+
const png = await renderer.render(node, {
|
|
45
|
+
width: 1200,
|
|
46
|
+
height: 630,
|
|
47
|
+
fonts: [await readFile("./Inter.ttf")],
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Renderer
|
|
52
|
+
|
|
53
|
+
| Method | Returns | Description |
|
|
54
|
+
| :----------------------- | :---------------- | :-------------------------------- |
|
|
55
|
+
| `render(node, opts?)` | `Promise<Buffer>` | Raster image (PNG, JPEG, WebP, …) |
|
|
56
|
+
| `renderSvg(node, opts?)` | `Promise<string>` | Vector SVG document |
|
|
57
|
+
| `renderAnimation(opts)` | `Promise<Buffer>` | Animated WebP, APNG, or GIF |
|
|
58
|
+
| `measure(node, opts?)` | `Promise<...>` | Layout without rasterizing |
|
|
33
59
|
|
|
34
60
|
## Documentation
|
|
35
61
|
|
|
@@ -37,7 +63,7 @@ For JSX and HTML conversion helpers, use [`@takumi-rs/helpers`](https://npmjs.co
|
|
|
37
63
|
- API reference: <https://takumi.kane.tw/docs/api-reference>
|
|
38
64
|
- Repository: <https://github.com/kane50613/takumi>
|
|
39
65
|
|
|
40
|
-
|
|
66
|
+
For WebAssembly runtimes (Cloudflare Workers, browsers, edge), use [@takumi-rs/wasm](https://npmjs.com/package/@takumi-rs/wasm).
|
|
41
67
|
|
|
42
68
|
## License
|
|
43
69
|
|
package/dist/export.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let module$1 = require(/* turbopackOptional: true */ "module");
|
|
3
|
-
let _takumi_rs_helpers = require(/* turbopackOptional: true */ "@takumi-rs/helpers");
|
|
4
3
|
let _takumi_rs_helpers_renderer = require(/* turbopackOptional: true */ "@takumi-rs/helpers/renderer");
|
|
5
4
|
//#region index.js
|
|
6
5
|
const require$1 = (0, module$1.createRequire)(require(/* turbopackOptional: true */ "url").pathToFileURL(__filename).href);
|
|
@@ -59,7 +58,7 @@ function requireNative() {
|
|
|
59
58
|
}
|
|
60
59
|
try {
|
|
61
60
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-android-arm64', 'core.android-arm64.node', require$1);
|
|
62
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
61
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
63
62
|
return binding;
|
|
64
63
|
} catch (e) {
|
|
65
64
|
loadErrors.push(e);
|
|
@@ -72,7 +71,7 @@ function requireNative() {
|
|
|
72
71
|
}
|
|
73
72
|
try {
|
|
74
73
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-android-arm-eabi', 'core.android-arm-eabi.node', require$1);
|
|
75
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
74
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
76
75
|
return binding;
|
|
77
76
|
} catch (e) {
|
|
78
77
|
loadErrors.push(e);
|
|
@@ -86,7 +85,7 @@ function requireNative() {
|
|
|
86
85
|
}
|
|
87
86
|
try {
|
|
88
87
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-win32-x64-gnu', 'core.win32-x64-gnu.node', require$1);
|
|
89
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
88
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
90
89
|
return binding;
|
|
91
90
|
} catch (e) {
|
|
92
91
|
loadErrors.push(e);
|
|
@@ -99,7 +98,7 @@ function requireNative() {
|
|
|
99
98
|
}
|
|
100
99
|
try {
|
|
101
100
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-win32-x64-msvc', 'core.win32-x64-msvc.node', require$1);
|
|
102
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
101
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
103
102
|
return binding;
|
|
104
103
|
} catch (e) {
|
|
105
104
|
loadErrors.push(e);
|
|
@@ -113,7 +112,7 @@ function requireNative() {
|
|
|
113
112
|
}
|
|
114
113
|
try {
|
|
115
114
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-win32-ia32-msvc', 'core.win32-ia32-msvc.node', require$1);
|
|
116
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
115
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
117
116
|
return binding;
|
|
118
117
|
} catch (e) {
|
|
119
118
|
loadErrors.push(e);
|
|
@@ -126,7 +125,7 @@ function requireNative() {
|
|
|
126
125
|
}
|
|
127
126
|
try {
|
|
128
127
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-win32-arm64-msvc', 'core.win32-arm64-msvc.node', require$1);
|
|
129
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
128
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
130
129
|
return binding;
|
|
131
130
|
} catch (e) {
|
|
132
131
|
loadErrors.push(e);
|
|
@@ -140,7 +139,7 @@ function requireNative() {
|
|
|
140
139
|
}
|
|
141
140
|
try {
|
|
142
141
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-darwin-universal', 'core.darwin-universal.node', require$1);
|
|
143
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
142
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
144
143
|
return binding;
|
|
145
144
|
} catch (e) {
|
|
146
145
|
loadErrors.push(e);
|
|
@@ -153,7 +152,7 @@ function requireNative() {
|
|
|
153
152
|
}
|
|
154
153
|
try {
|
|
155
154
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-darwin-x64', 'core.darwin-x64.node', require$1);
|
|
156
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
155
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
157
156
|
return binding;
|
|
158
157
|
} catch (e) {
|
|
159
158
|
loadErrors.push(e);
|
|
@@ -166,7 +165,7 @@ function requireNative() {
|
|
|
166
165
|
}
|
|
167
166
|
try {
|
|
168
167
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-darwin-arm64', 'core.darwin-arm64.node', require$1);
|
|
169
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
168
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
170
169
|
return binding;
|
|
171
170
|
} catch (e) {
|
|
172
171
|
loadErrors.push(e);
|
|
@@ -180,7 +179,7 @@ function requireNative() {
|
|
|
180
179
|
}
|
|
181
180
|
try {
|
|
182
181
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-freebsd-x64', 'core.freebsd-x64.node', require$1);
|
|
183
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
182
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
184
183
|
return binding;
|
|
185
184
|
} catch (e) {
|
|
186
185
|
loadErrors.push(e);
|
|
@@ -193,7 +192,7 @@ function requireNative() {
|
|
|
193
192
|
}
|
|
194
193
|
try {
|
|
195
194
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-freebsd-arm64', 'core.freebsd-arm64.node', require$1);
|
|
196
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
195
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
197
196
|
return binding;
|
|
198
197
|
} catch (e) {
|
|
199
198
|
loadErrors.push(e);
|
|
@@ -207,7 +206,7 @@ function requireNative() {
|
|
|
207
206
|
}
|
|
208
207
|
try {
|
|
209
208
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-x64-musl', 'core.linux-x64-musl.node', require$1);
|
|
210
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
209
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
211
210
|
return binding;
|
|
212
211
|
} catch (e) {
|
|
213
212
|
loadErrors.push(e);
|
|
@@ -220,7 +219,7 @@ function requireNative() {
|
|
|
220
219
|
}
|
|
221
220
|
try {
|
|
222
221
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-x64-gnu', 'core.linux-x64-gnu.node', require$1);
|
|
223
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
222
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
224
223
|
return binding;
|
|
225
224
|
} catch (e) {
|
|
226
225
|
loadErrors.push(e);
|
|
@@ -234,7 +233,7 @@ function requireNative() {
|
|
|
234
233
|
}
|
|
235
234
|
try {
|
|
236
235
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-arm64-musl', 'core.linux-arm64-musl.node', require$1);
|
|
237
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
236
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
238
237
|
return binding;
|
|
239
238
|
} catch (e) {
|
|
240
239
|
loadErrors.push(e);
|
|
@@ -247,7 +246,7 @@ function requireNative() {
|
|
|
247
246
|
}
|
|
248
247
|
try {
|
|
249
248
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-arm64-gnu', 'core.linux-arm64-gnu.node', require$1);
|
|
250
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
249
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
251
250
|
return binding;
|
|
252
251
|
} catch (e) {
|
|
253
252
|
loadErrors.push(e);
|
|
@@ -261,7 +260,7 @@ function requireNative() {
|
|
|
261
260
|
}
|
|
262
261
|
try {
|
|
263
262
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-arm-musleabihf', 'core.linux-arm-musleabihf.node', require$1);
|
|
264
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
263
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
265
264
|
return binding;
|
|
266
265
|
} catch (e) {
|
|
267
266
|
loadErrors.push(e);
|
|
@@ -274,7 +273,7 @@ function requireNative() {
|
|
|
274
273
|
}
|
|
275
274
|
try {
|
|
276
275
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-arm-gnueabihf', 'core.linux-arm-gnueabihf.node', require$1);
|
|
277
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
276
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
278
277
|
return binding;
|
|
279
278
|
} catch (e) {
|
|
280
279
|
loadErrors.push(e);
|
|
@@ -288,7 +287,7 @@ function requireNative() {
|
|
|
288
287
|
}
|
|
289
288
|
try {
|
|
290
289
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-loong64-musl', 'core.linux-loong64-musl.node', require$1);
|
|
291
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
290
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
292
291
|
return binding;
|
|
293
292
|
} catch (e) {
|
|
294
293
|
loadErrors.push(e);
|
|
@@ -301,7 +300,7 @@ function requireNative() {
|
|
|
301
300
|
}
|
|
302
301
|
try {
|
|
303
302
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-loong64-gnu', 'core.linux-loong64-gnu.node', require$1);
|
|
304
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
303
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
305
304
|
return binding;
|
|
306
305
|
} catch (e) {
|
|
307
306
|
loadErrors.push(e);
|
|
@@ -315,7 +314,7 @@ function requireNative() {
|
|
|
315
314
|
}
|
|
316
315
|
try {
|
|
317
316
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-riscv64-musl', 'core.linux-riscv64-musl.node', require$1);
|
|
318
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
317
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
319
318
|
return binding;
|
|
320
319
|
} catch (e) {
|
|
321
320
|
loadErrors.push(e);
|
|
@@ -328,7 +327,7 @@ function requireNative() {
|
|
|
328
327
|
}
|
|
329
328
|
try {
|
|
330
329
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-riscv64-gnu', 'core.linux-riscv64-gnu.node', require$1);
|
|
331
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
330
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
332
331
|
return binding;
|
|
333
332
|
} catch (e) {
|
|
334
333
|
loadErrors.push(e);
|
|
@@ -342,7 +341,7 @@ function requireNative() {
|
|
|
342
341
|
}
|
|
343
342
|
try {
|
|
344
343
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-ppc64-gnu', 'core.linux-ppc64-gnu.node', require$1);
|
|
345
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
344
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
346
345
|
return binding;
|
|
347
346
|
} catch (e) {
|
|
348
347
|
loadErrors.push(e);
|
|
@@ -355,7 +354,7 @@ function requireNative() {
|
|
|
355
354
|
}
|
|
356
355
|
try {
|
|
357
356
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-s390x-gnu', 'core.linux-s390x-gnu.node', require$1);
|
|
358
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
357
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
359
358
|
return binding;
|
|
360
359
|
} catch (e) {
|
|
361
360
|
loadErrors.push(e);
|
|
@@ -369,7 +368,7 @@ function requireNative() {
|
|
|
369
368
|
}
|
|
370
369
|
try {
|
|
371
370
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-openharmony-arm64', 'core.openharmony-arm64.node', require$1);
|
|
372
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
371
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
373
372
|
return binding;
|
|
374
373
|
} catch (e) {
|
|
375
374
|
loadErrors.push(e);
|
|
@@ -382,7 +381,7 @@ function requireNative() {
|
|
|
382
381
|
}
|
|
383
382
|
try {
|
|
384
383
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-openharmony-x64', 'core.openharmony-x64.node', require$1);
|
|
385
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
384
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
386
385
|
return binding;
|
|
387
386
|
} catch (e) {
|
|
388
387
|
loadErrors.push(e);
|
|
@@ -395,7 +394,7 @@ function requireNative() {
|
|
|
395
394
|
}
|
|
396
395
|
try {
|
|
397
396
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-openharmony-arm', 'core.openharmony-arm.node', require$1);
|
|
398
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
397
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
399
398
|
return binding;
|
|
400
399
|
} catch (e) {
|
|
401
400
|
loadErrors.push(e);
|
|
@@ -448,49 +447,21 @@ var Renderer = class {
|
|
|
448
447
|
inner = new Renderer$1();
|
|
449
448
|
fonts = new _takumi_rs_helpers_renderer.FontRegistry((font) => this.inner.registerFont(font));
|
|
450
449
|
async render(node, options) {
|
|
451
|
-
const {
|
|
452
|
-
|
|
453
|
-
fonts,
|
|
454
|
-
source: node
|
|
455
|
-
}), images, fontFamilies);
|
|
456
|
-
return this.inner.render(node, {
|
|
457
|
-
...rest,
|
|
458
|
-
...resolved
|
|
459
|
-
}, signal);
|
|
450
|
+
const { options: opts, signal } = await (0, _takumi_rs_helpers_renderer.prepareRenderInput)(this.fonts, options ?? {}, node);
|
|
451
|
+
return this.inner.render(node, opts, signal);
|
|
460
452
|
}
|
|
461
453
|
async renderSvg(node, options) {
|
|
462
|
-
const {
|
|
463
|
-
|
|
464
|
-
fonts,
|
|
465
|
-
source: node
|
|
466
|
-
}), images, fontFamilies);
|
|
467
|
-
return this.inner.renderSvg(node, {
|
|
468
|
-
...rest,
|
|
469
|
-
...resolved
|
|
470
|
-
}, signal);
|
|
454
|
+
const { options: opts, signal } = await (0, _takumi_rs_helpers_renderer.prepareRenderInput)(this.fonts, options ?? {}, node);
|
|
455
|
+
return this.inner.renderSvg(node, opts, signal);
|
|
471
456
|
}
|
|
472
457
|
async measure(node, options) {
|
|
473
|
-
const {
|
|
474
|
-
|
|
475
|
-
fonts,
|
|
476
|
-
source: node
|
|
477
|
-
}), images, fontFamilies);
|
|
478
|
-
return this.inner.measure(node, {
|
|
479
|
-
...rest,
|
|
480
|
-
...resolved
|
|
481
|
-
}, signal);
|
|
458
|
+
const { options: opts, signal } = await (0, _takumi_rs_helpers_renderer.prepareRenderInput)(this.fonts, options ?? {}, node);
|
|
459
|
+
return this.inner.measure(node, opts, signal);
|
|
482
460
|
}
|
|
483
461
|
async renderAnimation(options) {
|
|
484
|
-
const { fonts, fontFamilies, signal, images, ...rest } = options;
|
|
485
462
|
const nodes = options.scenes.map((scene) => scene.node);
|
|
486
|
-
const
|
|
487
|
-
|
|
488
|
-
source: nodes
|
|
489
|
-
}), images, fontFamilies);
|
|
490
|
-
return this.inner.renderAnimation({
|
|
491
|
-
...rest,
|
|
492
|
-
...resolved
|
|
493
|
-
}, signal);
|
|
463
|
+
const { options: opts, signal } = await (0, _takumi_rs_helpers_renderer.prepareRenderInput)(this.fonts, options, nodes);
|
|
464
|
+
return this.inner.renderAnimation(opts, signal);
|
|
494
465
|
}
|
|
495
466
|
registerFont(font) {
|
|
496
467
|
return this.fonts.register(font);
|
package/dist/export.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContainerNode, ImageNode, Node, NodeMetadata, TextNode } from "@takumi-rs/helpers";
|
|
2
2
|
import { Properties } from "csstype";
|
|
3
|
-
import { AnimationOutputFormatOptions,
|
|
3
|
+
import { AnimationOutputFormatOptions, BackendAnimationOptions, BackendRenderOptions, BackendSvgOptions, FontLoader, FontLoader as FontLoader$1, ImageLoader, ImagesInput, OutputFormatOptions } from "@takumi-rs/helpers/renderer";
|
|
4
4
|
|
|
5
5
|
//#region index.d.ts
|
|
6
6
|
type ByteBuf = Uint8Array | ArrayBuffer | Buffer;
|
|
@@ -219,21 +219,9 @@ interface SvgRenderOptions$1 {
|
|
|
219
219
|
}
|
|
220
220
|
//#endregion
|
|
221
221
|
//#region src/export.d.ts
|
|
222
|
-
type RenderOptions =
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
images?: ImagesInput$1;
|
|
226
|
-
};
|
|
227
|
-
type RenderAnimationOptions = Omit<RenderAnimationOptions$1, "images" | "format" | "quality" | "lossless"> & AnimationOutputFormatOptions$1 & {
|
|
228
|
-
fonts?: FontLoader$1[];
|
|
229
|
-
signal?: AbortSignal;
|
|
230
|
-
images?: ImagesInput$1;
|
|
231
|
-
};
|
|
232
|
-
type SvgRenderOptions = Omit<SvgRenderOptions$1, "images"> & {
|
|
233
|
-
fonts?: FontLoader$1[];
|
|
234
|
-
signal?: AbortSignal;
|
|
235
|
-
images?: ImagesInput$1;
|
|
236
|
-
};
|
|
222
|
+
type RenderOptions = BackendRenderOptions<RenderOptions$1>;
|
|
223
|
+
type RenderAnimationOptions = BackendAnimationOptions<RenderAnimationOptions$1>;
|
|
224
|
+
type SvgRenderOptions = BackendSvgOptions<SvgRenderOptions$1>;
|
|
237
225
|
declare class Renderer {
|
|
238
226
|
private inner;
|
|
239
227
|
private fonts;
|
package/dist/export.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { AnimationOutputFormatOptions, BackendAnimationOptions, BackendRenderOptions, BackendSvgOptions, FontLoader, FontLoader as FontLoader$1, ImageLoader, ImagesInput, OutputFormatOptions } from "@takumi-rs/helpers/renderer";
|
|
1
2
|
import { ContainerNode, ImageNode, Node, NodeMetadata, TextNode } from "@takumi-rs/helpers";
|
|
2
|
-
import { AnimationOutputFormatOptions, AnimationOutputFormatOptions as AnimationOutputFormatOptions$1, FontLoader, FontLoader as FontLoader$1, ImageLoader, ImagesInput, ImagesInput as ImagesInput$1, OutputFormatOptions, OutputFormatOptions as OutputFormatOptions$1 } from "@takumi-rs/helpers/renderer";
|
|
3
3
|
import { Properties } from "csstype";
|
|
4
4
|
|
|
5
5
|
//#region index.d.ts
|
|
@@ -219,21 +219,9 @@ interface SvgRenderOptions$1 {
|
|
|
219
219
|
}
|
|
220
220
|
//#endregion
|
|
221
221
|
//#region src/export.d.ts
|
|
222
|
-
type RenderOptions =
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
images?: ImagesInput$1;
|
|
226
|
-
};
|
|
227
|
-
type RenderAnimationOptions = Omit<RenderAnimationOptions$1, "images" | "format" | "quality" | "lossless"> & AnimationOutputFormatOptions$1 & {
|
|
228
|
-
fonts?: FontLoader$1[];
|
|
229
|
-
signal?: AbortSignal;
|
|
230
|
-
images?: ImagesInput$1;
|
|
231
|
-
};
|
|
232
|
-
type SvgRenderOptions = Omit<SvgRenderOptions$1, "images"> & {
|
|
233
|
-
fonts?: FontLoader$1[];
|
|
234
|
-
signal?: AbortSignal;
|
|
235
|
-
images?: ImagesInput$1;
|
|
236
|
-
};
|
|
222
|
+
type RenderOptions = BackendRenderOptions<RenderOptions$1>;
|
|
223
|
+
type RenderAnimationOptions = BackendAnimationOptions<RenderAnimationOptions$1>;
|
|
224
|
+
type SvgRenderOptions = BackendSvgOptions<SvgRenderOptions$1>;
|
|
237
225
|
declare class Renderer {
|
|
238
226
|
private inner;
|
|
239
227
|
private fonts;
|
package/dist/export.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "module";
|
|
2
|
-
import {
|
|
3
|
-
import { FontRegistry } from "@takumi-rs/helpers/renderer";
|
|
2
|
+
import { FontRegistry, prepareRenderInput } from "@takumi-rs/helpers/renderer";
|
|
4
3
|
//#region index.js
|
|
5
4
|
const require = createRequire(import.meta.url);
|
|
6
5
|
const { readFileSync } = require(/* turbopackOptional: true */ "fs");
|
|
@@ -57,7 +56,7 @@ function requireNative() {
|
|
|
57
56
|
}
|
|
58
57
|
try {
|
|
59
58
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-android-arm64', 'core.android-arm64.node', require);
|
|
60
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
59
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
61
60
|
return binding;
|
|
62
61
|
} catch (e) {
|
|
63
62
|
loadErrors.push(e);
|
|
@@ -70,7 +69,7 @@ function requireNative() {
|
|
|
70
69
|
}
|
|
71
70
|
try {
|
|
72
71
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-android-arm-eabi', 'core.android-arm-eabi.node', require);
|
|
73
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
72
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
74
73
|
return binding;
|
|
75
74
|
} catch (e) {
|
|
76
75
|
loadErrors.push(e);
|
|
@@ -84,7 +83,7 @@ function requireNative() {
|
|
|
84
83
|
}
|
|
85
84
|
try {
|
|
86
85
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-win32-x64-gnu', 'core.win32-x64-gnu.node', require);
|
|
87
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
86
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
88
87
|
return binding;
|
|
89
88
|
} catch (e) {
|
|
90
89
|
loadErrors.push(e);
|
|
@@ -97,7 +96,7 @@ function requireNative() {
|
|
|
97
96
|
}
|
|
98
97
|
try {
|
|
99
98
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-win32-x64-msvc', 'core.win32-x64-msvc.node', require);
|
|
100
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
99
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
101
100
|
return binding;
|
|
102
101
|
} catch (e) {
|
|
103
102
|
loadErrors.push(e);
|
|
@@ -111,7 +110,7 @@ function requireNative() {
|
|
|
111
110
|
}
|
|
112
111
|
try {
|
|
113
112
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-win32-ia32-msvc', 'core.win32-ia32-msvc.node', require);
|
|
114
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
113
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
115
114
|
return binding;
|
|
116
115
|
} catch (e) {
|
|
117
116
|
loadErrors.push(e);
|
|
@@ -124,7 +123,7 @@ function requireNative() {
|
|
|
124
123
|
}
|
|
125
124
|
try {
|
|
126
125
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-win32-arm64-msvc', 'core.win32-arm64-msvc.node', require);
|
|
127
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
126
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
128
127
|
return binding;
|
|
129
128
|
} catch (e) {
|
|
130
129
|
loadErrors.push(e);
|
|
@@ -138,7 +137,7 @@ function requireNative() {
|
|
|
138
137
|
}
|
|
139
138
|
try {
|
|
140
139
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-darwin-universal', 'core.darwin-universal.node', require);
|
|
141
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
140
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
142
141
|
return binding;
|
|
143
142
|
} catch (e) {
|
|
144
143
|
loadErrors.push(e);
|
|
@@ -151,7 +150,7 @@ function requireNative() {
|
|
|
151
150
|
}
|
|
152
151
|
try {
|
|
153
152
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-darwin-x64', 'core.darwin-x64.node', require);
|
|
154
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
153
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
155
154
|
return binding;
|
|
156
155
|
} catch (e) {
|
|
157
156
|
loadErrors.push(e);
|
|
@@ -164,7 +163,7 @@ function requireNative() {
|
|
|
164
163
|
}
|
|
165
164
|
try {
|
|
166
165
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-darwin-arm64', 'core.darwin-arm64.node', require);
|
|
167
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
166
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
168
167
|
return binding;
|
|
169
168
|
} catch (e) {
|
|
170
169
|
loadErrors.push(e);
|
|
@@ -178,7 +177,7 @@ function requireNative() {
|
|
|
178
177
|
}
|
|
179
178
|
try {
|
|
180
179
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-freebsd-x64', 'core.freebsd-x64.node', require);
|
|
181
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
180
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
182
181
|
return binding;
|
|
183
182
|
} catch (e) {
|
|
184
183
|
loadErrors.push(e);
|
|
@@ -191,7 +190,7 @@ function requireNative() {
|
|
|
191
190
|
}
|
|
192
191
|
try {
|
|
193
192
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-freebsd-arm64', 'core.freebsd-arm64.node', require);
|
|
194
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
193
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
195
194
|
return binding;
|
|
196
195
|
} catch (e) {
|
|
197
196
|
loadErrors.push(e);
|
|
@@ -205,7 +204,7 @@ function requireNative() {
|
|
|
205
204
|
}
|
|
206
205
|
try {
|
|
207
206
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-x64-musl', 'core.linux-x64-musl.node', require);
|
|
208
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
207
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
209
208
|
return binding;
|
|
210
209
|
} catch (e) {
|
|
211
210
|
loadErrors.push(e);
|
|
@@ -218,7 +217,7 @@ function requireNative() {
|
|
|
218
217
|
}
|
|
219
218
|
try {
|
|
220
219
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-x64-gnu', 'core.linux-x64-gnu.node', require);
|
|
221
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
220
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
222
221
|
return binding;
|
|
223
222
|
} catch (e) {
|
|
224
223
|
loadErrors.push(e);
|
|
@@ -232,7 +231,7 @@ function requireNative() {
|
|
|
232
231
|
}
|
|
233
232
|
try {
|
|
234
233
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-arm64-musl', 'core.linux-arm64-musl.node', require);
|
|
235
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
234
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
236
235
|
return binding;
|
|
237
236
|
} catch (e) {
|
|
238
237
|
loadErrors.push(e);
|
|
@@ -245,7 +244,7 @@ function requireNative() {
|
|
|
245
244
|
}
|
|
246
245
|
try {
|
|
247
246
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-arm64-gnu', 'core.linux-arm64-gnu.node', require);
|
|
248
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
247
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
249
248
|
return binding;
|
|
250
249
|
} catch (e) {
|
|
251
250
|
loadErrors.push(e);
|
|
@@ -259,7 +258,7 @@ function requireNative() {
|
|
|
259
258
|
}
|
|
260
259
|
try {
|
|
261
260
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-arm-musleabihf', 'core.linux-arm-musleabihf.node', require);
|
|
262
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
261
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
263
262
|
return binding;
|
|
264
263
|
} catch (e) {
|
|
265
264
|
loadErrors.push(e);
|
|
@@ -272,7 +271,7 @@ function requireNative() {
|
|
|
272
271
|
}
|
|
273
272
|
try {
|
|
274
273
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-arm-gnueabihf', 'core.linux-arm-gnueabihf.node', require);
|
|
275
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
274
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
276
275
|
return binding;
|
|
277
276
|
} catch (e) {
|
|
278
277
|
loadErrors.push(e);
|
|
@@ -286,7 +285,7 @@ function requireNative() {
|
|
|
286
285
|
}
|
|
287
286
|
try {
|
|
288
287
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-loong64-musl', 'core.linux-loong64-musl.node', require);
|
|
289
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
288
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
290
289
|
return binding;
|
|
291
290
|
} catch (e) {
|
|
292
291
|
loadErrors.push(e);
|
|
@@ -299,7 +298,7 @@ function requireNative() {
|
|
|
299
298
|
}
|
|
300
299
|
try {
|
|
301
300
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-loong64-gnu', 'core.linux-loong64-gnu.node', require);
|
|
302
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
301
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
303
302
|
return binding;
|
|
304
303
|
} catch (e) {
|
|
305
304
|
loadErrors.push(e);
|
|
@@ -313,7 +312,7 @@ function requireNative() {
|
|
|
313
312
|
}
|
|
314
313
|
try {
|
|
315
314
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-riscv64-musl', 'core.linux-riscv64-musl.node', require);
|
|
316
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
315
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
317
316
|
return binding;
|
|
318
317
|
} catch (e) {
|
|
319
318
|
loadErrors.push(e);
|
|
@@ -326,7 +325,7 @@ function requireNative() {
|
|
|
326
325
|
}
|
|
327
326
|
try {
|
|
328
327
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-riscv64-gnu', 'core.linux-riscv64-gnu.node', require);
|
|
329
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
328
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
330
329
|
return binding;
|
|
331
330
|
} catch (e) {
|
|
332
331
|
loadErrors.push(e);
|
|
@@ -340,7 +339,7 @@ function requireNative() {
|
|
|
340
339
|
}
|
|
341
340
|
try {
|
|
342
341
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-ppc64-gnu', 'core.linux-ppc64-gnu.node', require);
|
|
343
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
342
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
344
343
|
return binding;
|
|
345
344
|
} catch (e) {
|
|
346
345
|
loadErrors.push(e);
|
|
@@ -353,7 +352,7 @@ function requireNative() {
|
|
|
353
352
|
}
|
|
354
353
|
try {
|
|
355
354
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-linux-s390x-gnu', 'core.linux-s390x-gnu.node', require);
|
|
356
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
355
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
357
356
|
return binding;
|
|
358
357
|
} catch (e) {
|
|
359
358
|
loadErrors.push(e);
|
|
@@ -367,7 +366,7 @@ function requireNative() {
|
|
|
367
366
|
}
|
|
368
367
|
try {
|
|
369
368
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-openharmony-arm64', 'core.openharmony-arm64.node', require);
|
|
370
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
369
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
371
370
|
return binding;
|
|
372
371
|
} catch (e) {
|
|
373
372
|
loadErrors.push(e);
|
|
@@ -380,7 +379,7 @@ function requireNative() {
|
|
|
380
379
|
}
|
|
381
380
|
try {
|
|
382
381
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-openharmony-x64', 'core.openharmony-x64.node', require);
|
|
383
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
382
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
384
383
|
return binding;
|
|
385
384
|
} catch (e) {
|
|
386
385
|
loadErrors.push(e);
|
|
@@ -393,7 +392,7 @@ function requireNative() {
|
|
|
393
392
|
}
|
|
394
393
|
try {
|
|
395
394
|
const { binding, version: bindingPackageVersion } = loadNativePackage('@takumi-rs/core-openharmony-arm', 'core.openharmony-arm.node', require);
|
|
396
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
395
|
+
if (bindingPackageVersion !== "2.0.0-rc.14" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 2.0.0-rc.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
397
396
|
return binding;
|
|
398
397
|
} catch (e) {
|
|
399
398
|
loadErrors.push(e);
|
|
@@ -446,49 +445,21 @@ var Renderer = class {
|
|
|
446
445
|
inner = new Renderer$1();
|
|
447
446
|
fonts = new FontRegistry((font) => this.inner.registerFont(font));
|
|
448
447
|
async render(node, options) {
|
|
449
|
-
const {
|
|
450
|
-
|
|
451
|
-
fonts,
|
|
452
|
-
source: node
|
|
453
|
-
}), images, fontFamilies);
|
|
454
|
-
return this.inner.render(node, {
|
|
455
|
-
...rest,
|
|
456
|
-
...resolved
|
|
457
|
-
}, signal);
|
|
448
|
+
const { options: opts, signal } = await prepareRenderInput(this.fonts, options ?? {}, node);
|
|
449
|
+
return this.inner.render(node, opts, signal);
|
|
458
450
|
}
|
|
459
451
|
async renderSvg(node, options) {
|
|
460
|
-
const {
|
|
461
|
-
|
|
462
|
-
fonts,
|
|
463
|
-
source: node
|
|
464
|
-
}), images, fontFamilies);
|
|
465
|
-
return this.inner.renderSvg(node, {
|
|
466
|
-
...rest,
|
|
467
|
-
...resolved
|
|
468
|
-
}, signal);
|
|
452
|
+
const { options: opts, signal } = await prepareRenderInput(this.fonts, options ?? {}, node);
|
|
453
|
+
return this.inner.renderSvg(node, opts, signal);
|
|
469
454
|
}
|
|
470
455
|
async measure(node, options) {
|
|
471
|
-
const {
|
|
472
|
-
|
|
473
|
-
fonts,
|
|
474
|
-
source: node
|
|
475
|
-
}), images, fontFamilies);
|
|
476
|
-
return this.inner.measure(node, {
|
|
477
|
-
...rest,
|
|
478
|
-
...resolved
|
|
479
|
-
}, signal);
|
|
456
|
+
const { options: opts, signal } = await prepareRenderInput(this.fonts, options ?? {}, node);
|
|
457
|
+
return this.inner.measure(node, opts, signal);
|
|
480
458
|
}
|
|
481
459
|
async renderAnimation(options) {
|
|
482
|
-
const { fonts, fontFamilies, signal, images, ...rest } = options;
|
|
483
460
|
const nodes = options.scenes.map((scene) => scene.node);
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
source: nodes
|
|
487
|
-
}), images, fontFamilies);
|
|
488
|
-
return this.inner.renderAnimation({
|
|
489
|
-
...rest,
|
|
490
|
-
...resolved
|
|
491
|
-
}, signal);
|
|
461
|
+
const { options: opts, signal } = await prepareRenderInput(this.fonts, options, nodes);
|
|
462
|
+
return this.inner.renderAnimation(opts, signal);
|
|
492
463
|
}
|
|
493
464
|
registerFont(font) {
|
|
494
465
|
return this.fonts.register(font);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takumi-rs/core",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.14",
|
|
4
4
|
"description": "Native Node.js bindings for the Takumi Rust image rendering engine.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -70,20 +70,28 @@
|
|
|
70
70
|
"publish-lint": "attw --pack . && publint --strict ."
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@takumi-rs/helpers": "2.0.0-rc.
|
|
74
|
-
"csstype": "^3.2.3"
|
|
73
|
+
"@takumi-rs/helpers": "2.0.0-rc.14"
|
|
75
74
|
},
|
|
76
75
|
"devDependencies": {
|
|
77
76
|
"@napi-rs/cli": "3.7.2",
|
|
78
77
|
"@types/bun": "^1.3.14",
|
|
79
78
|
"@types/react": "19.2.17",
|
|
80
79
|
"@types/react-dom": "^19.2.3",
|
|
80
|
+
"csstype": "^3.2.3",
|
|
81
81
|
"lucide-react": "^1.23.0",
|
|
82
82
|
"mitata": "^1.0.34",
|
|
83
83
|
"react": "^19.2.7",
|
|
84
84
|
"tsdown": "^0.22.3",
|
|
85
85
|
"unrun": "^0.3.1"
|
|
86
86
|
},
|
|
87
|
+
"peerDependencies": {
|
|
88
|
+
"csstype": "*"
|
|
89
|
+
},
|
|
90
|
+
"peerDependenciesMeta": {
|
|
91
|
+
"csstype": {
|
|
92
|
+
"optional": true
|
|
93
|
+
}
|
|
94
|
+
},
|
|
87
95
|
"napi": {
|
|
88
96
|
"binaryName": "core",
|
|
89
97
|
"dtsHeaderFile": "./src/dts-header.d.ts",
|
|
@@ -102,13 +110,13 @@
|
|
|
102
110
|
"node": ">=18"
|
|
103
111
|
},
|
|
104
112
|
"optionalDependencies": {
|
|
105
|
-
"@takumi-rs/core-darwin-x64": "2.0.0-rc.
|
|
106
|
-
"@takumi-rs/core-darwin-arm64": "2.0.0-rc.
|
|
107
|
-
"@takumi-rs/core-linux-arm64-gnu": "2.0.0-rc.
|
|
108
|
-
"@takumi-rs/core-linux-arm64-musl": "2.0.0-rc.
|
|
109
|
-
"@takumi-rs/core-win32-arm64-msvc": "2.0.0-rc.
|
|
110
|
-
"@takumi-rs/core-linux-x64-gnu": "2.0.0-rc.
|
|
111
|
-
"@takumi-rs/core-linux-x64-musl": "2.0.0-rc.
|
|
112
|
-
"@takumi-rs/core-win32-x64-msvc": "2.0.0-rc.
|
|
113
|
+
"@takumi-rs/core-darwin-x64": "2.0.0-rc.14",
|
|
114
|
+
"@takumi-rs/core-darwin-arm64": "2.0.0-rc.14",
|
|
115
|
+
"@takumi-rs/core-linux-arm64-gnu": "2.0.0-rc.14",
|
|
116
|
+
"@takumi-rs/core-linux-arm64-musl": "2.0.0-rc.14",
|
|
117
|
+
"@takumi-rs/core-win32-arm64-msvc": "2.0.0-rc.14",
|
|
118
|
+
"@takumi-rs/core-linux-x64-gnu": "2.0.0-rc.14",
|
|
119
|
+
"@takumi-rs/core-linux-x64-musl": "2.0.0-rc.14",
|
|
120
|
+
"@takumi-rs/core-win32-x64-msvc": "2.0.0-rc.14"
|
|
113
121
|
}
|
|
114
122
|
}
|