@takumi-rs/core 2.0.0-rc.8 → 2.0.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.
- 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);
|
|
@@ -60,7 +59,7 @@ function requireNative() {
|
|
|
60
59
|
try {
|
|
61
60
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-android-arm64/core.android-arm64.node");
|
|
62
61
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-android-arm64/package.json").version;
|
|
63
|
-
if (bindingPackageVersion !== "2.0.0
|
|
62
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
64
63
|
return binding;
|
|
65
64
|
} catch (e) {
|
|
66
65
|
loadErrors.push(e);
|
|
@@ -74,7 +73,7 @@ function requireNative() {
|
|
|
74
73
|
try {
|
|
75
74
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-android-arm-eabi/core.android-arm-eabi.node");
|
|
76
75
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-android-arm-eabi/package.json").version;
|
|
77
|
-
if (bindingPackageVersion !== "2.0.0
|
|
76
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
78
77
|
return binding;
|
|
79
78
|
} catch (e) {
|
|
80
79
|
loadErrors.push(e);
|
|
@@ -89,7 +88,7 @@ function requireNative() {
|
|
|
89
88
|
try {
|
|
90
89
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-gnu/core.win32-x64-gnu.node");
|
|
91
90
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-gnu/package.json").version;
|
|
92
|
-
if (bindingPackageVersion !== "2.0.0
|
|
91
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
93
92
|
return binding;
|
|
94
93
|
} catch (e) {
|
|
95
94
|
loadErrors.push(e);
|
|
@@ -103,7 +102,7 @@ function requireNative() {
|
|
|
103
102
|
try {
|
|
104
103
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-msvc/core.win32-x64-msvc.node");
|
|
105
104
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-msvc/package.json").version;
|
|
106
|
-
if (bindingPackageVersion !== "2.0.0
|
|
105
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
107
106
|
return binding;
|
|
108
107
|
} catch (e) {
|
|
109
108
|
loadErrors.push(e);
|
|
@@ -118,7 +117,7 @@ function requireNative() {
|
|
|
118
117
|
try {
|
|
119
118
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-ia32-msvc/core.win32-ia32-msvc.node");
|
|
120
119
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-ia32-msvc/package.json").version;
|
|
121
|
-
if (bindingPackageVersion !== "2.0.0
|
|
120
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
122
121
|
return binding;
|
|
123
122
|
} catch (e) {
|
|
124
123
|
loadErrors.push(e);
|
|
@@ -132,7 +131,7 @@ function requireNative() {
|
|
|
132
131
|
try {
|
|
133
132
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-arm64-msvc/core.win32-arm64-msvc.node");
|
|
134
133
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-arm64-msvc/package.json").version;
|
|
135
|
-
if (bindingPackageVersion !== "2.0.0
|
|
134
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
136
135
|
return binding;
|
|
137
136
|
} catch (e) {
|
|
138
137
|
loadErrors.push(e);
|
|
@@ -147,7 +146,7 @@ function requireNative() {
|
|
|
147
146
|
try {
|
|
148
147
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-universal/core.darwin-universal.node");
|
|
149
148
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-universal/package.json").version;
|
|
150
|
-
if (bindingPackageVersion !== "2.0.0
|
|
149
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
151
150
|
return binding;
|
|
152
151
|
} catch (e) {
|
|
153
152
|
loadErrors.push(e);
|
|
@@ -161,7 +160,7 @@ function requireNative() {
|
|
|
161
160
|
try {
|
|
162
161
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-x64/core.darwin-x64.node");
|
|
163
162
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-x64/package.json").version;
|
|
164
|
-
if (bindingPackageVersion !== "2.0.0
|
|
163
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
165
164
|
return binding;
|
|
166
165
|
} catch (e) {
|
|
167
166
|
loadErrors.push(e);
|
|
@@ -175,7 +174,7 @@ function requireNative() {
|
|
|
175
174
|
try {
|
|
176
175
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-arm64/core.darwin-arm64.node");
|
|
177
176
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-arm64/package.json").version;
|
|
178
|
-
if (bindingPackageVersion !== "2.0.0
|
|
177
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
179
178
|
return binding;
|
|
180
179
|
} catch (e) {
|
|
181
180
|
loadErrors.push(e);
|
|
@@ -190,7 +189,7 @@ function requireNative() {
|
|
|
190
189
|
try {
|
|
191
190
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-x64/core.freebsd-x64.node");
|
|
192
191
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-x64/package.json").version;
|
|
193
|
-
if (bindingPackageVersion !== "2.0.0
|
|
192
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
194
193
|
return binding;
|
|
195
194
|
} catch (e) {
|
|
196
195
|
loadErrors.push(e);
|
|
@@ -204,7 +203,7 @@ function requireNative() {
|
|
|
204
203
|
try {
|
|
205
204
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-arm64/core.freebsd-arm64.node");
|
|
206
205
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-arm64/package.json").version;
|
|
207
|
-
if (bindingPackageVersion !== "2.0.0
|
|
206
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
208
207
|
return binding;
|
|
209
208
|
} catch (e) {
|
|
210
209
|
loadErrors.push(e);
|
|
@@ -219,7 +218,7 @@ function requireNative() {
|
|
|
219
218
|
try {
|
|
220
219
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-musl/core.linux-x64-musl.node");
|
|
221
220
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-musl/package.json").version;
|
|
222
|
-
if (bindingPackageVersion !== "2.0.0
|
|
221
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
223
222
|
return binding;
|
|
224
223
|
} catch (e) {
|
|
225
224
|
loadErrors.push(e);
|
|
@@ -233,7 +232,7 @@ function requireNative() {
|
|
|
233
232
|
try {
|
|
234
233
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-gnu/core.linux-x64-gnu.node");
|
|
235
234
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-gnu/package.json").version;
|
|
236
|
-
if (bindingPackageVersion !== "2.0.0
|
|
235
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
237
236
|
return binding;
|
|
238
237
|
} catch (e) {
|
|
239
238
|
loadErrors.push(e);
|
|
@@ -248,7 +247,7 @@ function requireNative() {
|
|
|
248
247
|
try {
|
|
249
248
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-musl/core.linux-arm64-musl.node");
|
|
250
249
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-musl/package.json").version;
|
|
251
|
-
if (bindingPackageVersion !== "2.0.0
|
|
250
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
252
251
|
return binding;
|
|
253
252
|
} catch (e) {
|
|
254
253
|
loadErrors.push(e);
|
|
@@ -262,7 +261,7 @@ function requireNative() {
|
|
|
262
261
|
try {
|
|
263
262
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-gnu/core.linux-arm64-gnu.node");
|
|
264
263
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-gnu/package.json").version;
|
|
265
|
-
if (bindingPackageVersion !== "2.0.0
|
|
264
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
266
265
|
return binding;
|
|
267
266
|
} catch (e) {
|
|
268
267
|
loadErrors.push(e);
|
|
@@ -277,7 +276,7 @@ function requireNative() {
|
|
|
277
276
|
try {
|
|
278
277
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-musleabihf/core.linux-arm-musleabihf.node");
|
|
279
278
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-musleabihf/package.json").version;
|
|
280
|
-
if (bindingPackageVersion !== "2.0.0
|
|
279
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
281
280
|
return binding;
|
|
282
281
|
} catch (e) {
|
|
283
282
|
loadErrors.push(e);
|
|
@@ -291,7 +290,7 @@ function requireNative() {
|
|
|
291
290
|
try {
|
|
292
291
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-gnueabihf/core.linux-arm-gnueabihf.node");
|
|
293
292
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-gnueabihf/package.json").version;
|
|
294
|
-
if (bindingPackageVersion !== "2.0.0
|
|
293
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
295
294
|
return binding;
|
|
296
295
|
} catch (e) {
|
|
297
296
|
loadErrors.push(e);
|
|
@@ -306,7 +305,7 @@ function requireNative() {
|
|
|
306
305
|
try {
|
|
307
306
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-musl/core.linux-loong64-musl.node");
|
|
308
307
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-musl/package.json").version;
|
|
309
|
-
if (bindingPackageVersion !== "2.0.0
|
|
308
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
310
309
|
return binding;
|
|
311
310
|
} catch (e) {
|
|
312
311
|
loadErrors.push(e);
|
|
@@ -320,7 +319,7 @@ function requireNative() {
|
|
|
320
319
|
try {
|
|
321
320
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-gnu/core.linux-loong64-gnu.node");
|
|
322
321
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-gnu/package.json").version;
|
|
323
|
-
if (bindingPackageVersion !== "2.0.0
|
|
322
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
324
323
|
return binding;
|
|
325
324
|
} catch (e) {
|
|
326
325
|
loadErrors.push(e);
|
|
@@ -335,7 +334,7 @@ function requireNative() {
|
|
|
335
334
|
try {
|
|
336
335
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-musl/core.linux-riscv64-musl.node");
|
|
337
336
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-musl/package.json").version;
|
|
338
|
-
if (bindingPackageVersion !== "2.0.0
|
|
337
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
339
338
|
return binding;
|
|
340
339
|
} catch (e) {
|
|
341
340
|
loadErrors.push(e);
|
|
@@ -349,7 +348,7 @@ function requireNative() {
|
|
|
349
348
|
try {
|
|
350
349
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-gnu/core.linux-riscv64-gnu.node");
|
|
351
350
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-gnu/package.json").version;
|
|
352
|
-
if (bindingPackageVersion !== "2.0.0
|
|
351
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
353
352
|
return binding;
|
|
354
353
|
} catch (e) {
|
|
355
354
|
loadErrors.push(e);
|
|
@@ -364,7 +363,7 @@ function requireNative() {
|
|
|
364
363
|
try {
|
|
365
364
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-ppc64-gnu/core.linux-ppc64-gnu.node");
|
|
366
365
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-ppc64-gnu/package.json").version;
|
|
367
|
-
if (bindingPackageVersion !== "2.0.0
|
|
366
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
368
367
|
return binding;
|
|
369
368
|
} catch (e) {
|
|
370
369
|
loadErrors.push(e);
|
|
@@ -378,7 +377,7 @@ function requireNative() {
|
|
|
378
377
|
try {
|
|
379
378
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-s390x-gnu/core.linux-s390x-gnu.node");
|
|
380
379
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-s390x-gnu/package.json").version;
|
|
381
|
-
if (bindingPackageVersion !== "2.0.0
|
|
380
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
382
381
|
return binding;
|
|
383
382
|
} catch (e) {
|
|
384
383
|
loadErrors.push(e);
|
|
@@ -393,7 +392,7 @@ function requireNative() {
|
|
|
393
392
|
try {
|
|
394
393
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm64/core.openharmony-arm64.node");
|
|
395
394
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm64/package.json").version;
|
|
396
|
-
if (bindingPackageVersion !== "2.0.0
|
|
395
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
397
396
|
return binding;
|
|
398
397
|
} catch (e) {
|
|
399
398
|
loadErrors.push(e);
|
|
@@ -407,7 +406,7 @@ function requireNative() {
|
|
|
407
406
|
try {
|
|
408
407
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-x64/core.openharmony-x64.node");
|
|
409
408
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-x64/package.json").version;
|
|
410
|
-
if (bindingPackageVersion !== "2.0.0
|
|
409
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
411
410
|
return binding;
|
|
412
411
|
} catch (e) {
|
|
413
412
|
loadErrors.push(e);
|
|
@@ -421,7 +420,7 @@ function requireNative() {
|
|
|
421
420
|
try {
|
|
422
421
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm/core.openharmony-arm.node");
|
|
423
422
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm/package.json").version;
|
|
424
|
-
if (bindingPackageVersion !== "2.0.0
|
|
423
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
425
424
|
return binding;
|
|
426
425
|
} catch (e) {
|
|
427
426
|
loadErrors.push(e);
|
|
@@ -474,49 +473,21 @@ var Renderer = class {
|
|
|
474
473
|
inner = new Renderer$1();
|
|
475
474
|
fonts = new _takumi_rs_helpers_renderer.FontRegistry((font) => this.inner.registerFont(font));
|
|
476
475
|
async render(node, options) {
|
|
477
|
-
const {
|
|
478
|
-
|
|
479
|
-
fonts,
|
|
480
|
-
source: node
|
|
481
|
-
}), images, fontFamilies);
|
|
482
|
-
return this.inner.render(node, {
|
|
483
|
-
...rest,
|
|
484
|
-
...resolved
|
|
485
|
-
}, signal);
|
|
476
|
+
const { options: opts, signal } = await (0, _takumi_rs_helpers_renderer.prepareRenderInput)(this.fonts, options ?? {}, node);
|
|
477
|
+
return this.inner.render(node, opts, signal);
|
|
486
478
|
}
|
|
487
479
|
async renderSvg(node, options) {
|
|
488
|
-
const {
|
|
489
|
-
|
|
490
|
-
fonts,
|
|
491
|
-
source: node
|
|
492
|
-
}), images, fontFamilies);
|
|
493
|
-
return this.inner.renderSvg(node, {
|
|
494
|
-
...rest,
|
|
495
|
-
...resolved
|
|
496
|
-
}, signal);
|
|
480
|
+
const { options: opts, signal } = await (0, _takumi_rs_helpers_renderer.prepareRenderInput)(this.fonts, options ?? {}, node);
|
|
481
|
+
return this.inner.renderSvg(node, opts, signal);
|
|
497
482
|
}
|
|
498
483
|
async measure(node, options) {
|
|
499
|
-
const {
|
|
500
|
-
|
|
501
|
-
fonts,
|
|
502
|
-
source: node
|
|
503
|
-
}), images, fontFamilies);
|
|
504
|
-
return this.inner.measure(node, {
|
|
505
|
-
...rest,
|
|
506
|
-
...resolved
|
|
507
|
-
}, signal);
|
|
484
|
+
const { options: opts, signal } = await (0, _takumi_rs_helpers_renderer.prepareRenderInput)(this.fonts, options ?? {}, node);
|
|
485
|
+
return this.inner.measure(node, opts, signal);
|
|
508
486
|
}
|
|
509
487
|
async renderAnimation(options) {
|
|
510
|
-
const { fonts, fontFamilies, signal, images, ...rest } = options;
|
|
511
488
|
const nodes = options.scenes.map((scene) => scene.node);
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
source: nodes
|
|
515
|
-
}), images, fontFamilies);
|
|
516
|
-
return this.inner.renderAnimation({
|
|
517
|
-
...rest,
|
|
518
|
-
...resolved
|
|
519
|
-
}, signal);
|
|
489
|
+
const { options: opts, signal } = await (0, _takumi_rs_helpers_renderer.prepareRenderInput)(this.fonts, options, nodes);
|
|
490
|
+
return this.inner.renderAnimation(opts, signal);
|
|
520
491
|
}
|
|
521
492
|
registerFont(font) {
|
|
522
493
|
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");
|
|
@@ -58,7 +57,7 @@ function requireNative() {
|
|
|
58
57
|
try {
|
|
59
58
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-android-arm64/core.android-arm64.node");
|
|
60
59
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-android-arm64/package.json").version;
|
|
61
|
-
if (bindingPackageVersion !== "2.0.0
|
|
60
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
62
61
|
return binding;
|
|
63
62
|
} catch (e) {
|
|
64
63
|
loadErrors.push(e);
|
|
@@ -72,7 +71,7 @@ function requireNative() {
|
|
|
72
71
|
try {
|
|
73
72
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-android-arm-eabi/core.android-arm-eabi.node");
|
|
74
73
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-android-arm-eabi/package.json").version;
|
|
75
|
-
if (bindingPackageVersion !== "2.0.0
|
|
74
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
76
75
|
return binding;
|
|
77
76
|
} catch (e) {
|
|
78
77
|
loadErrors.push(e);
|
|
@@ -87,7 +86,7 @@ function requireNative() {
|
|
|
87
86
|
try {
|
|
88
87
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-gnu/core.win32-x64-gnu.node");
|
|
89
88
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-gnu/package.json").version;
|
|
90
|
-
if (bindingPackageVersion !== "2.0.0
|
|
89
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
91
90
|
return binding;
|
|
92
91
|
} catch (e) {
|
|
93
92
|
loadErrors.push(e);
|
|
@@ -101,7 +100,7 @@ function requireNative() {
|
|
|
101
100
|
try {
|
|
102
101
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-msvc/core.win32-x64-msvc.node");
|
|
103
102
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-msvc/package.json").version;
|
|
104
|
-
if (bindingPackageVersion !== "2.0.0
|
|
103
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
105
104
|
return binding;
|
|
106
105
|
} catch (e) {
|
|
107
106
|
loadErrors.push(e);
|
|
@@ -116,7 +115,7 @@ function requireNative() {
|
|
|
116
115
|
try {
|
|
117
116
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-ia32-msvc/core.win32-ia32-msvc.node");
|
|
118
117
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-ia32-msvc/package.json").version;
|
|
119
|
-
if (bindingPackageVersion !== "2.0.0
|
|
118
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
120
119
|
return binding;
|
|
121
120
|
} catch (e) {
|
|
122
121
|
loadErrors.push(e);
|
|
@@ -130,7 +129,7 @@ function requireNative() {
|
|
|
130
129
|
try {
|
|
131
130
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-arm64-msvc/core.win32-arm64-msvc.node");
|
|
132
131
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-arm64-msvc/package.json").version;
|
|
133
|
-
if (bindingPackageVersion !== "2.0.0
|
|
132
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
134
133
|
return binding;
|
|
135
134
|
} catch (e) {
|
|
136
135
|
loadErrors.push(e);
|
|
@@ -145,7 +144,7 @@ function requireNative() {
|
|
|
145
144
|
try {
|
|
146
145
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-darwin-universal/core.darwin-universal.node");
|
|
147
146
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-darwin-universal/package.json").version;
|
|
148
|
-
if (bindingPackageVersion !== "2.0.0
|
|
147
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
149
148
|
return binding;
|
|
150
149
|
} catch (e) {
|
|
151
150
|
loadErrors.push(e);
|
|
@@ -159,7 +158,7 @@ function requireNative() {
|
|
|
159
158
|
try {
|
|
160
159
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-darwin-x64/core.darwin-x64.node");
|
|
161
160
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-darwin-x64/package.json").version;
|
|
162
|
-
if (bindingPackageVersion !== "2.0.0
|
|
161
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
163
162
|
return binding;
|
|
164
163
|
} catch (e) {
|
|
165
164
|
loadErrors.push(e);
|
|
@@ -173,7 +172,7 @@ function requireNative() {
|
|
|
173
172
|
try {
|
|
174
173
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-darwin-arm64/core.darwin-arm64.node");
|
|
175
174
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-darwin-arm64/package.json").version;
|
|
176
|
-
if (bindingPackageVersion !== "2.0.0
|
|
175
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
177
176
|
return binding;
|
|
178
177
|
} catch (e) {
|
|
179
178
|
loadErrors.push(e);
|
|
@@ -188,7 +187,7 @@ function requireNative() {
|
|
|
188
187
|
try {
|
|
189
188
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-x64/core.freebsd-x64.node");
|
|
190
189
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-x64/package.json").version;
|
|
191
|
-
if (bindingPackageVersion !== "2.0.0
|
|
190
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
192
191
|
return binding;
|
|
193
192
|
} catch (e) {
|
|
194
193
|
loadErrors.push(e);
|
|
@@ -202,7 +201,7 @@ function requireNative() {
|
|
|
202
201
|
try {
|
|
203
202
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-arm64/core.freebsd-arm64.node");
|
|
204
203
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-arm64/package.json").version;
|
|
205
|
-
if (bindingPackageVersion !== "2.0.0
|
|
204
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
206
205
|
return binding;
|
|
207
206
|
} catch (e) {
|
|
208
207
|
loadErrors.push(e);
|
|
@@ -217,7 +216,7 @@ function requireNative() {
|
|
|
217
216
|
try {
|
|
218
217
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-musl/core.linux-x64-musl.node");
|
|
219
218
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-musl/package.json").version;
|
|
220
|
-
if (bindingPackageVersion !== "2.0.0
|
|
219
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
221
220
|
return binding;
|
|
222
221
|
} catch (e) {
|
|
223
222
|
loadErrors.push(e);
|
|
@@ -231,7 +230,7 @@ function requireNative() {
|
|
|
231
230
|
try {
|
|
232
231
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-gnu/core.linux-x64-gnu.node");
|
|
233
232
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-gnu/package.json").version;
|
|
234
|
-
if (bindingPackageVersion !== "2.0.0
|
|
233
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
235
234
|
return binding;
|
|
236
235
|
} catch (e) {
|
|
237
236
|
loadErrors.push(e);
|
|
@@ -246,7 +245,7 @@ function requireNative() {
|
|
|
246
245
|
try {
|
|
247
246
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-musl/core.linux-arm64-musl.node");
|
|
248
247
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-musl/package.json").version;
|
|
249
|
-
if (bindingPackageVersion !== "2.0.0
|
|
248
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
250
249
|
return binding;
|
|
251
250
|
} catch (e) {
|
|
252
251
|
loadErrors.push(e);
|
|
@@ -260,7 +259,7 @@ function requireNative() {
|
|
|
260
259
|
try {
|
|
261
260
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-gnu/core.linux-arm64-gnu.node");
|
|
262
261
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-gnu/package.json").version;
|
|
263
|
-
if (bindingPackageVersion !== "2.0.0
|
|
262
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
264
263
|
return binding;
|
|
265
264
|
} catch (e) {
|
|
266
265
|
loadErrors.push(e);
|
|
@@ -275,7 +274,7 @@ function requireNative() {
|
|
|
275
274
|
try {
|
|
276
275
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-musleabihf/core.linux-arm-musleabihf.node");
|
|
277
276
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-musleabihf/package.json").version;
|
|
278
|
-
if (bindingPackageVersion !== "2.0.0
|
|
277
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
279
278
|
return binding;
|
|
280
279
|
} catch (e) {
|
|
281
280
|
loadErrors.push(e);
|
|
@@ -289,7 +288,7 @@ function requireNative() {
|
|
|
289
288
|
try {
|
|
290
289
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-gnueabihf/core.linux-arm-gnueabihf.node");
|
|
291
290
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-gnueabihf/package.json").version;
|
|
292
|
-
if (bindingPackageVersion !== "2.0.0
|
|
291
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
293
292
|
return binding;
|
|
294
293
|
} catch (e) {
|
|
295
294
|
loadErrors.push(e);
|
|
@@ -304,7 +303,7 @@ function requireNative() {
|
|
|
304
303
|
try {
|
|
305
304
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-musl/core.linux-loong64-musl.node");
|
|
306
305
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-musl/package.json").version;
|
|
307
|
-
if (bindingPackageVersion !== "2.0.0
|
|
306
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
308
307
|
return binding;
|
|
309
308
|
} catch (e) {
|
|
310
309
|
loadErrors.push(e);
|
|
@@ -318,7 +317,7 @@ function requireNative() {
|
|
|
318
317
|
try {
|
|
319
318
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-gnu/core.linux-loong64-gnu.node");
|
|
320
319
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-gnu/package.json").version;
|
|
321
|
-
if (bindingPackageVersion !== "2.0.0
|
|
320
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
322
321
|
return binding;
|
|
323
322
|
} catch (e) {
|
|
324
323
|
loadErrors.push(e);
|
|
@@ -333,7 +332,7 @@ function requireNative() {
|
|
|
333
332
|
try {
|
|
334
333
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-musl/core.linux-riscv64-musl.node");
|
|
335
334
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-musl/package.json").version;
|
|
336
|
-
if (bindingPackageVersion !== "2.0.0
|
|
335
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
337
336
|
return binding;
|
|
338
337
|
} catch (e) {
|
|
339
338
|
loadErrors.push(e);
|
|
@@ -347,7 +346,7 @@ function requireNative() {
|
|
|
347
346
|
try {
|
|
348
347
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-gnu/core.linux-riscv64-gnu.node");
|
|
349
348
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-gnu/package.json").version;
|
|
350
|
-
if (bindingPackageVersion !== "2.0.0
|
|
349
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
351
350
|
return binding;
|
|
352
351
|
} catch (e) {
|
|
353
352
|
loadErrors.push(e);
|
|
@@ -362,7 +361,7 @@ function requireNative() {
|
|
|
362
361
|
try {
|
|
363
362
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-ppc64-gnu/core.linux-ppc64-gnu.node");
|
|
364
363
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-ppc64-gnu/package.json").version;
|
|
365
|
-
if (bindingPackageVersion !== "2.0.0
|
|
364
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
366
365
|
return binding;
|
|
367
366
|
} catch (e) {
|
|
368
367
|
loadErrors.push(e);
|
|
@@ -376,7 +375,7 @@ function requireNative() {
|
|
|
376
375
|
try {
|
|
377
376
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-s390x-gnu/core.linux-s390x-gnu.node");
|
|
378
377
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-s390x-gnu/package.json").version;
|
|
379
|
-
if (bindingPackageVersion !== "2.0.0
|
|
378
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
380
379
|
return binding;
|
|
381
380
|
} catch (e) {
|
|
382
381
|
loadErrors.push(e);
|
|
@@ -391,7 +390,7 @@ function requireNative() {
|
|
|
391
390
|
try {
|
|
392
391
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm64/core.openharmony-arm64.node");
|
|
393
392
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm64/package.json").version;
|
|
394
|
-
if (bindingPackageVersion !== "2.0.0
|
|
393
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
395
394
|
return binding;
|
|
396
395
|
} catch (e) {
|
|
397
396
|
loadErrors.push(e);
|
|
@@ -405,7 +404,7 @@ function requireNative() {
|
|
|
405
404
|
try {
|
|
406
405
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-x64/core.openharmony-x64.node");
|
|
407
406
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-x64/package.json").version;
|
|
408
|
-
if (bindingPackageVersion !== "2.0.0
|
|
407
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
409
408
|
return binding;
|
|
410
409
|
} catch (e) {
|
|
411
410
|
loadErrors.push(e);
|
|
@@ -419,7 +418,7 @@ function requireNative() {
|
|
|
419
418
|
try {
|
|
420
419
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm/core.openharmony-arm.node");
|
|
421
420
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm/package.json").version;
|
|
422
|
-
if (bindingPackageVersion !== "2.0.0
|
|
421
|
+
if (bindingPackageVersion !== "2.0.0" && 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 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
423
422
|
return binding;
|
|
424
423
|
} catch (e) {
|
|
425
424
|
loadErrors.push(e);
|
|
@@ -472,49 +471,21 @@ var Renderer = class {
|
|
|
472
471
|
inner = new Renderer$1();
|
|
473
472
|
fonts = new FontRegistry((font) => this.inner.registerFont(font));
|
|
474
473
|
async render(node, options) {
|
|
475
|
-
const {
|
|
476
|
-
|
|
477
|
-
fonts,
|
|
478
|
-
source: node
|
|
479
|
-
}), images, fontFamilies);
|
|
480
|
-
return this.inner.render(node, {
|
|
481
|
-
...rest,
|
|
482
|
-
...resolved
|
|
483
|
-
}, signal);
|
|
474
|
+
const { options: opts, signal } = await prepareRenderInput(this.fonts, options ?? {}, node);
|
|
475
|
+
return this.inner.render(node, opts, signal);
|
|
484
476
|
}
|
|
485
477
|
async renderSvg(node, options) {
|
|
486
|
-
const {
|
|
487
|
-
|
|
488
|
-
fonts,
|
|
489
|
-
source: node
|
|
490
|
-
}), images, fontFamilies);
|
|
491
|
-
return this.inner.renderSvg(node, {
|
|
492
|
-
...rest,
|
|
493
|
-
...resolved
|
|
494
|
-
}, signal);
|
|
478
|
+
const { options: opts, signal } = await prepareRenderInput(this.fonts, options ?? {}, node);
|
|
479
|
+
return this.inner.renderSvg(node, opts, signal);
|
|
495
480
|
}
|
|
496
481
|
async measure(node, options) {
|
|
497
|
-
const {
|
|
498
|
-
|
|
499
|
-
fonts,
|
|
500
|
-
source: node
|
|
501
|
-
}), images, fontFamilies);
|
|
502
|
-
return this.inner.measure(node, {
|
|
503
|
-
...rest,
|
|
504
|
-
...resolved
|
|
505
|
-
}, signal);
|
|
482
|
+
const { options: opts, signal } = await prepareRenderInput(this.fonts, options ?? {}, node);
|
|
483
|
+
return this.inner.measure(node, opts, signal);
|
|
506
484
|
}
|
|
507
485
|
async renderAnimation(options) {
|
|
508
|
-
const { fonts, fontFamilies, signal, images, ...rest } = options;
|
|
509
486
|
const nodes = options.scenes.map((scene) => scene.node);
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
source: nodes
|
|
513
|
-
}), images, fontFamilies);
|
|
514
|
-
return this.inner.renderAnimation({
|
|
515
|
-
...rest,
|
|
516
|
-
...resolved
|
|
517
|
-
}, signal);
|
|
487
|
+
const { options: opts, signal } = await prepareRenderInput(this.fonts, options, nodes);
|
|
488
|
+
return this.inner.renderAnimation(opts, signal);
|
|
518
489
|
}
|
|
519
490
|
registerFont(font) {
|
|
520
491
|
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
|
|
3
|
+
"version": "2.0.0",
|
|
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
|
|
74
|
-
"csstype": "^3.2.3"
|
|
73
|
+
"@takumi-rs/helpers": "2.0.0"
|
|
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
|
|
106
|
-
"@takumi-rs/core-darwin-arm64": "2.0.0
|
|
107
|
-
"@takumi-rs/core-linux-arm64-gnu": "2.0.0
|
|
108
|
-
"@takumi-rs/core-linux-arm64-musl": "2.0.0
|
|
109
|
-
"@takumi-rs/core-win32-arm64-msvc": "2.0.0
|
|
110
|
-
"@takumi-rs/core-linux-x64-gnu": "2.0.0
|
|
111
|
-
"@takumi-rs/core-linux-x64-musl": "2.0.0
|
|
112
|
-
"@takumi-rs/core-win32-x64-msvc": "2.0.0
|
|
113
|
+
"@takumi-rs/core-darwin-x64": "2.0.0",
|
|
114
|
+
"@takumi-rs/core-darwin-arm64": "2.0.0",
|
|
115
|
+
"@takumi-rs/core-linux-arm64-gnu": "2.0.0",
|
|
116
|
+
"@takumi-rs/core-linux-arm64-musl": "2.0.0",
|
|
117
|
+
"@takumi-rs/core-win32-arm64-msvc": "2.0.0",
|
|
118
|
+
"@takumi-rs/core-linux-x64-gnu": "2.0.0",
|
|
119
|
+
"@takumi-rs/core-linux-x64-musl": "2.0.0",
|
|
120
|
+
"@takumi-rs/core-win32-x64-msvc": "2.0.0"
|
|
113
121
|
}
|
|
114
122
|
}
|