@takumi-rs/core 2.0.0-rc.4 → 2.0.0-rc.6
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/dist/export.cjs +34 -102
- package/dist/export.d.cts +12 -74
- package/dist/export.d.mts +12 -74
- package/dist/export.mjs +35 -103
- package/package.json +11 -11
package/dist/export.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let module$1 = require(/* turbopackOptional: true */ "module");
|
|
3
3
|
let _takumi_rs_helpers = require(/* turbopackOptional: true */ "@takumi-rs/helpers");
|
|
4
|
+
let _takumi_rs_helpers_renderer = require(/* turbopackOptional: true */ "@takumi-rs/helpers/renderer");
|
|
4
5
|
//#region index.js
|
|
5
6
|
const require$1 = (0, module$1.createRequire)(require(/* turbopackOptional: true */ "url").pathToFileURL(__filename).href);
|
|
6
7
|
new URL(".", require(/* turbopackOptional: true */ "url").pathToFileURL(__filename).href).pathname;
|
|
@@ -59,7 +60,7 @@ function requireNative() {
|
|
|
59
60
|
try {
|
|
60
61
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-android-arm64/core.android-arm64.node");
|
|
61
62
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-android-arm64/package.json").version;
|
|
62
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
63
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
63
64
|
return binding;
|
|
64
65
|
} catch (e) {
|
|
65
66
|
loadErrors.push(e);
|
|
@@ -73,7 +74,7 @@ function requireNative() {
|
|
|
73
74
|
try {
|
|
74
75
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-android-arm-eabi/core.android-arm-eabi.node");
|
|
75
76
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-android-arm-eabi/package.json").version;
|
|
76
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
77
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
77
78
|
return binding;
|
|
78
79
|
} catch (e) {
|
|
79
80
|
loadErrors.push(e);
|
|
@@ -88,7 +89,7 @@ function requireNative() {
|
|
|
88
89
|
try {
|
|
89
90
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-gnu/core.win32-x64-gnu.node");
|
|
90
91
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-gnu/package.json").version;
|
|
91
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
92
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
92
93
|
return binding;
|
|
93
94
|
} catch (e) {
|
|
94
95
|
loadErrors.push(e);
|
|
@@ -102,7 +103,7 @@ function requireNative() {
|
|
|
102
103
|
try {
|
|
103
104
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-msvc/core.win32-x64-msvc.node");
|
|
104
105
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-msvc/package.json").version;
|
|
105
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
106
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
106
107
|
return binding;
|
|
107
108
|
} catch (e) {
|
|
108
109
|
loadErrors.push(e);
|
|
@@ -117,7 +118,7 @@ function requireNative() {
|
|
|
117
118
|
try {
|
|
118
119
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-ia32-msvc/core.win32-ia32-msvc.node");
|
|
119
120
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-ia32-msvc/package.json").version;
|
|
120
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
121
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
121
122
|
return binding;
|
|
122
123
|
} catch (e) {
|
|
123
124
|
loadErrors.push(e);
|
|
@@ -131,7 +132,7 @@ function requireNative() {
|
|
|
131
132
|
try {
|
|
132
133
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-arm64-msvc/core.win32-arm64-msvc.node");
|
|
133
134
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-arm64-msvc/package.json").version;
|
|
134
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
135
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
135
136
|
return binding;
|
|
136
137
|
} catch (e) {
|
|
137
138
|
loadErrors.push(e);
|
|
@@ -146,7 +147,7 @@ function requireNative() {
|
|
|
146
147
|
try {
|
|
147
148
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-universal/core.darwin-universal.node");
|
|
148
149
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-universal/package.json").version;
|
|
149
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
150
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
150
151
|
return binding;
|
|
151
152
|
} catch (e) {
|
|
152
153
|
loadErrors.push(e);
|
|
@@ -160,7 +161,7 @@ function requireNative() {
|
|
|
160
161
|
try {
|
|
161
162
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-x64/core.darwin-x64.node");
|
|
162
163
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-x64/package.json").version;
|
|
163
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
164
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
164
165
|
return binding;
|
|
165
166
|
} catch (e) {
|
|
166
167
|
loadErrors.push(e);
|
|
@@ -174,7 +175,7 @@ function requireNative() {
|
|
|
174
175
|
try {
|
|
175
176
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-arm64/core.darwin-arm64.node");
|
|
176
177
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-arm64/package.json").version;
|
|
177
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
178
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
178
179
|
return binding;
|
|
179
180
|
} catch (e) {
|
|
180
181
|
loadErrors.push(e);
|
|
@@ -189,7 +190,7 @@ function requireNative() {
|
|
|
189
190
|
try {
|
|
190
191
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-x64/core.freebsd-x64.node");
|
|
191
192
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-x64/package.json").version;
|
|
192
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
193
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
193
194
|
return binding;
|
|
194
195
|
} catch (e) {
|
|
195
196
|
loadErrors.push(e);
|
|
@@ -203,7 +204,7 @@ function requireNative() {
|
|
|
203
204
|
try {
|
|
204
205
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-arm64/core.freebsd-arm64.node");
|
|
205
206
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-arm64/package.json").version;
|
|
206
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
207
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
207
208
|
return binding;
|
|
208
209
|
} catch (e) {
|
|
209
210
|
loadErrors.push(e);
|
|
@@ -218,7 +219,7 @@ function requireNative() {
|
|
|
218
219
|
try {
|
|
219
220
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-musl/core.linux-x64-musl.node");
|
|
220
221
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-musl/package.json").version;
|
|
221
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
222
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
222
223
|
return binding;
|
|
223
224
|
} catch (e) {
|
|
224
225
|
loadErrors.push(e);
|
|
@@ -232,7 +233,7 @@ function requireNative() {
|
|
|
232
233
|
try {
|
|
233
234
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-gnu/core.linux-x64-gnu.node");
|
|
234
235
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-gnu/package.json").version;
|
|
235
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
236
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
236
237
|
return binding;
|
|
237
238
|
} catch (e) {
|
|
238
239
|
loadErrors.push(e);
|
|
@@ -247,7 +248,7 @@ function requireNative() {
|
|
|
247
248
|
try {
|
|
248
249
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-musl/core.linux-arm64-musl.node");
|
|
249
250
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-musl/package.json").version;
|
|
250
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
251
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
251
252
|
return binding;
|
|
252
253
|
} catch (e) {
|
|
253
254
|
loadErrors.push(e);
|
|
@@ -261,7 +262,7 @@ function requireNative() {
|
|
|
261
262
|
try {
|
|
262
263
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-gnu/core.linux-arm64-gnu.node");
|
|
263
264
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-gnu/package.json").version;
|
|
264
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
265
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
265
266
|
return binding;
|
|
266
267
|
} catch (e) {
|
|
267
268
|
loadErrors.push(e);
|
|
@@ -276,7 +277,7 @@ function requireNative() {
|
|
|
276
277
|
try {
|
|
277
278
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-musleabihf/core.linux-arm-musleabihf.node");
|
|
278
279
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-musleabihf/package.json").version;
|
|
279
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
280
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
280
281
|
return binding;
|
|
281
282
|
} catch (e) {
|
|
282
283
|
loadErrors.push(e);
|
|
@@ -290,7 +291,7 @@ function requireNative() {
|
|
|
290
291
|
try {
|
|
291
292
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-gnueabihf/core.linux-arm-gnueabihf.node");
|
|
292
293
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-gnueabihf/package.json").version;
|
|
293
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
294
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
294
295
|
return binding;
|
|
295
296
|
} catch (e) {
|
|
296
297
|
loadErrors.push(e);
|
|
@@ -305,7 +306,7 @@ function requireNative() {
|
|
|
305
306
|
try {
|
|
306
307
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-musl/core.linux-loong64-musl.node");
|
|
307
308
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-musl/package.json").version;
|
|
308
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
309
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
309
310
|
return binding;
|
|
310
311
|
} catch (e) {
|
|
311
312
|
loadErrors.push(e);
|
|
@@ -319,7 +320,7 @@ function requireNative() {
|
|
|
319
320
|
try {
|
|
320
321
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-gnu/core.linux-loong64-gnu.node");
|
|
321
322
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-gnu/package.json").version;
|
|
322
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
323
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
323
324
|
return binding;
|
|
324
325
|
} catch (e) {
|
|
325
326
|
loadErrors.push(e);
|
|
@@ -334,7 +335,7 @@ function requireNative() {
|
|
|
334
335
|
try {
|
|
335
336
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-musl/core.linux-riscv64-musl.node");
|
|
336
337
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-musl/package.json").version;
|
|
337
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
338
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
338
339
|
return binding;
|
|
339
340
|
} catch (e) {
|
|
340
341
|
loadErrors.push(e);
|
|
@@ -348,7 +349,7 @@ function requireNative() {
|
|
|
348
349
|
try {
|
|
349
350
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-gnu/core.linux-riscv64-gnu.node");
|
|
350
351
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-gnu/package.json").version;
|
|
351
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
352
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
352
353
|
return binding;
|
|
353
354
|
} catch (e) {
|
|
354
355
|
loadErrors.push(e);
|
|
@@ -363,7 +364,7 @@ function requireNative() {
|
|
|
363
364
|
try {
|
|
364
365
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-ppc64-gnu/core.linux-ppc64-gnu.node");
|
|
365
366
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-ppc64-gnu/package.json").version;
|
|
366
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
367
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
367
368
|
return binding;
|
|
368
369
|
} catch (e) {
|
|
369
370
|
loadErrors.push(e);
|
|
@@ -377,7 +378,7 @@ function requireNative() {
|
|
|
377
378
|
try {
|
|
378
379
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-s390x-gnu/core.linux-s390x-gnu.node");
|
|
379
380
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-s390x-gnu/package.json").version;
|
|
380
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
381
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
381
382
|
return binding;
|
|
382
383
|
} catch (e) {
|
|
383
384
|
loadErrors.push(e);
|
|
@@ -392,7 +393,7 @@ function requireNative() {
|
|
|
392
393
|
try {
|
|
393
394
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm64/core.openharmony-arm64.node");
|
|
394
395
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm64/package.json").version;
|
|
395
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
396
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
396
397
|
return binding;
|
|
397
398
|
} catch (e) {
|
|
398
399
|
loadErrors.push(e);
|
|
@@ -406,7 +407,7 @@ function requireNative() {
|
|
|
406
407
|
try {
|
|
407
408
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-x64/core.openharmony-x64.node");
|
|
408
409
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-x64/package.json").version;
|
|
409
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
410
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
410
411
|
return binding;
|
|
411
412
|
} catch (e) {
|
|
412
413
|
loadErrors.push(e);
|
|
@@ -420,7 +421,7 @@ function requireNative() {
|
|
|
420
421
|
try {
|
|
421
422
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm/core.openharmony-arm.node");
|
|
422
423
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm/package.json").version;
|
|
423
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
424
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
424
425
|
return binding;
|
|
425
426
|
} catch (e) {
|
|
426
427
|
loadErrors.push(e);
|
|
@@ -469,48 +470,12 @@ if (!nativeBinding) {
|
|
|
469
470
|
const { Renderer: Renderer$1, AnimationOutputFormat, DitheringAlgorithm, ImageCacheMode, OutputFormat } = nativeBinding;
|
|
470
471
|
//#endregion
|
|
471
472
|
//#region src/export.ts
|
|
472
|
-
async function resolveImageLoaders(images) {
|
|
473
|
-
const { sources = [], cache } = Array.isArray(images) ? { sources: images } : images;
|
|
474
|
-
const bySrc = /* @__PURE__ */ new Map();
|
|
475
|
-
for (const image of sources) bySrc.set(image.src, image);
|
|
476
|
-
return Promise.all([...bySrc.values()].map(async ({ src, data, cache: own }) => ({
|
|
477
|
-
src,
|
|
478
|
-
data: typeof data === "function" ? await data() : data,
|
|
479
|
-
cache: own ?? cache
|
|
480
|
-
})));
|
|
481
|
-
}
|
|
482
473
|
var Renderer = class {
|
|
483
|
-
fontsByKey = /* @__PURE__ */ new Map();
|
|
484
|
-
fontsByData = /* @__PURE__ */ new WeakMap();
|
|
485
474
|
inner = new Renderer$1();
|
|
486
|
-
|
|
487
|
-
return typeof key === "string" ? this.fontsByKey.get(key) : this.fontsByData.get(key);
|
|
488
|
-
}
|
|
489
|
-
setFont(key, family) {
|
|
490
|
-
if (typeof key === "string") this.fontsByKey.set(key, family);
|
|
491
|
-
else this.fontsByData.set(key, family);
|
|
492
|
-
}
|
|
493
|
-
deleteFont(key) {
|
|
494
|
-
if (typeof key === "string") this.fontsByKey.delete(key);
|
|
495
|
-
else this.fontsByData.delete(key);
|
|
496
|
-
}
|
|
497
|
-
async prepareFonts(fonts) {
|
|
498
|
-
if (!fonts) return;
|
|
499
|
-
const families = await Promise.all(fonts.map(this.registerFont.bind(this)));
|
|
500
|
-
return [...new Set(families.flat().map((f) => f.name))];
|
|
501
|
-
}
|
|
502
|
-
/** Registers `fonts` and resolves lazy `images`, yielding the `images`/`fontFamilies`
|
|
503
|
-
* the napi binding expects. Explicit `fontFamilies` wins over the registered set. */
|
|
504
|
-
async resolveResources(fonts, images, fontFamilies) {
|
|
505
|
-
const registeredFamilies = await this.prepareFonts(fonts);
|
|
506
|
-
return {
|
|
507
|
-
images: images ? await resolveImageLoaders(images) : void 0,
|
|
508
|
-
fontFamilies: fontFamilies ?? registeredFamilies
|
|
509
|
-
};
|
|
510
|
-
}
|
|
475
|
+
fonts = new _takumi_rs_helpers_renderer.FontRegistry((font) => this.inner.registerFont(font));
|
|
511
476
|
async render(node, options) {
|
|
512
477
|
const { fonts, fontFamilies, signal, images, ...rest } = options ?? {};
|
|
513
|
-
const resolved = await this.resolveResources(fonts && (0, _takumi_rs_helpers.subsetFonts)({
|
|
478
|
+
const resolved = await this.fonts.resolveResources(fonts && (0, _takumi_rs_helpers.subsetFonts)({
|
|
514
479
|
fonts,
|
|
515
480
|
source: node
|
|
516
481
|
}), images, fontFamilies);
|
|
@@ -521,7 +486,7 @@ var Renderer = class {
|
|
|
521
486
|
}
|
|
522
487
|
async renderSvg(node, options) {
|
|
523
488
|
const { fonts, fontFamilies, signal, images, ...rest } = options ?? {};
|
|
524
|
-
const resolved = await this.resolveResources(fonts && (0, _takumi_rs_helpers.subsetFonts)({
|
|
489
|
+
const resolved = await this.fonts.resolveResources(fonts && (0, _takumi_rs_helpers.subsetFonts)({
|
|
525
490
|
fonts,
|
|
526
491
|
source: node
|
|
527
492
|
}), images, fontFamilies);
|
|
@@ -532,7 +497,7 @@ var Renderer = class {
|
|
|
532
497
|
}
|
|
533
498
|
async measure(node, options) {
|
|
534
499
|
const { fonts, fontFamilies, signal, images, ...rest } = options ?? {};
|
|
535
|
-
const resolved = await this.resolveResources(fonts && (0, _takumi_rs_helpers.subsetFonts)({
|
|
500
|
+
const resolved = await this.fonts.resolveResources(fonts && (0, _takumi_rs_helpers.subsetFonts)({
|
|
536
501
|
fonts,
|
|
537
502
|
source: node
|
|
538
503
|
}), images, fontFamilies);
|
|
@@ -544,7 +509,7 @@ var Renderer = class {
|
|
|
544
509
|
async renderAnimation(options) {
|
|
545
510
|
const { fonts, fontFamilies, signal, images, ...rest } = options;
|
|
546
511
|
const nodes = options.scenes.map((scene) => scene.node);
|
|
547
|
-
const resolved = await this.resolveResources(fonts && (0, _takumi_rs_helpers.subsetFonts)({
|
|
512
|
+
const resolved = await this.fonts.resolveResources(fonts && (0, _takumi_rs_helpers.subsetFonts)({
|
|
548
513
|
fonts,
|
|
549
514
|
source: nodes
|
|
550
515
|
}), images, fontFamilies);
|
|
@@ -553,42 +518,9 @@ var Renderer = class {
|
|
|
553
518
|
...resolved
|
|
554
519
|
}, signal);
|
|
555
520
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
const key = createFontKey(loader);
|
|
559
|
-
const cached = this.getFont(key);
|
|
560
|
-
if (cached) return cached;
|
|
561
|
-
const extracted = extractFontBuffer(loader);
|
|
562
|
-
const register = (data) => this.inner.registerFont(isBuffer(loader) ? data : {
|
|
563
|
-
...loader,
|
|
564
|
-
data
|
|
565
|
-
});
|
|
566
|
-
if (isBuffer(extracted)) {
|
|
567
|
-
const binded = register(extracted);
|
|
568
|
-
this.setFont(key, Promise.resolve(binded));
|
|
569
|
-
return binded;
|
|
570
|
-
}
|
|
571
|
-
const promise = extracted.then(register).catch((error) => {
|
|
572
|
-
this.deleteFont(key);
|
|
573
|
-
throw error;
|
|
574
|
-
});
|
|
575
|
-
this.setFont(key, promise);
|
|
576
|
-
return promise;
|
|
521
|
+
registerFont(font) {
|
|
522
|
+
return this.fonts.register(font);
|
|
577
523
|
}
|
|
578
524
|
};
|
|
579
|
-
function extractFontBuffer(font) {
|
|
580
|
-
if (isBuffer(font)) return font;
|
|
581
|
-
if (typeof font.data !== "function") return font.data;
|
|
582
|
-
return font.data();
|
|
583
|
-
}
|
|
584
|
-
function createFontKey(font) {
|
|
585
|
-
if (isBuffer(font)) return font;
|
|
586
|
-
if ("key" in font && font.key) return font.key;
|
|
587
|
-
if (typeof font.data === "function") return `${font.name ?? ""}:${font.weight ?? ""}:${font.style ?? ""}`;
|
|
588
|
-
return font.data;
|
|
589
|
-
}
|
|
590
|
-
function isBuffer(data) {
|
|
591
|
-
return data instanceof Uint8Array || data instanceof ArrayBuffer || typeof Buffer !== "undefined" && Buffer.isBuffer(data);
|
|
592
|
-
}
|
|
593
525
|
//#endregion
|
|
594
526
|
exports.Renderer = Renderer;
|
package/dist/export.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ContainerNode, ImageNode, Node, NodeMetadata, TextNode } from "@takumi-rs/helpers";
|
|
2
2
|
import { Properties } from "csstype";
|
|
3
|
+
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
4
|
|
|
4
5
|
//#region index.d.ts
|
|
5
6
|
type ByteBuf = Uint8Array | ArrayBuffer | Buffer;
|
|
@@ -216,92 +217,29 @@ interface SvgRenderOptions$1 {
|
|
|
216
217
|
}
|
|
217
218
|
//#endregion
|
|
218
219
|
//#region src/export.d.ts
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
* file), raw bytes, or a descriptor with a lazy `data()` loader.
|
|
222
|
-
*/
|
|
223
|
-
type FontLoader = string | Font | (Omit<FontDetails, "data"> & {
|
|
224
|
-
data: () => Promise<FontDetails["data"]> | FontDetails["data"]; /** Inclusive codepoint ranges this face covers; lets `render` skip it when unused. */
|
|
225
|
-
ranges?: [number, number][];
|
|
226
|
-
} & ({
|
|
227
|
-
key: string;
|
|
228
|
-
} | {
|
|
229
|
-
name: string;
|
|
230
|
-
}));
|
|
231
|
-
type ImageLoaderData = ImageSource["data"];
|
|
232
|
-
type ImageLoader = Omit<ImageSource, "data"> & {
|
|
233
|
-
data: ImageLoaderData | (() => ImageLoaderData | Promise<ImageLoaderData>);
|
|
234
|
-
};
|
|
235
|
-
/** Images for a render: pre-fetched entries, or a group with a decode-cache default. */
|
|
236
|
-
type ImagesInput = ImageLoader[] | {
|
|
237
|
-
/** Pre-fetched entries, same as the array form. */sources?: ImageLoader[]; /** Decode-cache default for every image this render; a source's own `cache` wins. */
|
|
238
|
-
cache?: NonNullable<ImageLoader["cache"]>;
|
|
239
|
-
};
|
|
240
|
-
/**
|
|
241
|
-
* Output format. Format-specific options live on the variant that supports them,
|
|
242
|
-
* so `quality` cannot be paired with PNG/ICO/raw, and `lossless` is WebP-only.
|
|
243
|
-
* For WebP, `lossless` takes precedence over `quality`; omitting both encodes
|
|
244
|
-
* losslessly.
|
|
245
|
-
*/
|
|
246
|
-
type OutputFormatOptions = {
|
|
247
|
-
format?: "png";
|
|
248
|
-
} | {
|
|
249
|
-
format: "jpeg";
|
|
250
|
-
quality?: number;
|
|
251
|
-
} | {
|
|
252
|
-
format: "webp";
|
|
253
|
-
quality?: number;
|
|
254
|
-
lossless?: boolean;
|
|
255
|
-
} | {
|
|
256
|
-
format: "ico";
|
|
257
|
-
} | {
|
|
258
|
-
format: "raw";
|
|
259
|
-
};
|
|
260
|
-
type RenderOptions = Omit<RenderOptions$1, "images" | "format" | "quality" | "lossless"> & OutputFormatOptions & {
|
|
261
|
-
fonts?: FontLoader[];
|
|
220
|
+
type RenderOptions = Omit<RenderOptions$1, "images" | "format" | "quality" | "lossless"> & OutputFormatOptions$1 & {
|
|
221
|
+
fonts?: FontLoader$1[];
|
|
262
222
|
signal?: AbortSignal;
|
|
263
|
-
images?: ImagesInput;
|
|
264
|
-
};
|
|
265
|
-
/**
|
|
266
|
-
* Animation output format. `quality` and `lossless` are WebP-only; for WebP,
|
|
267
|
-
* `lossless` takes precedence over `quality`, and omitting both encodes
|
|
268
|
-
* losslessly.
|
|
269
|
-
*/
|
|
270
|
-
type AnimationOutputFormatOptions = {
|
|
271
|
-
format?: "webp";
|
|
272
|
-
quality?: number;
|
|
273
|
-
lossless?: boolean;
|
|
274
|
-
} | {
|
|
275
|
-
format: "apng";
|
|
276
|
-
} | {
|
|
277
|
-
format: "gif";
|
|
223
|
+
images?: ImagesInput$1;
|
|
278
224
|
};
|
|
279
|
-
type RenderAnimationOptions = Omit<RenderAnimationOptions$1, "images" | "format" | "quality" | "lossless"> & AnimationOutputFormatOptions & {
|
|
280
|
-
fonts?: FontLoader[];
|
|
225
|
+
type RenderAnimationOptions = Omit<RenderAnimationOptions$1, "images" | "format" | "quality" | "lossless"> & AnimationOutputFormatOptions$1 & {
|
|
226
|
+
fonts?: FontLoader$1[];
|
|
281
227
|
signal?: AbortSignal;
|
|
282
|
-
images?: ImagesInput;
|
|
228
|
+
images?: ImagesInput$1;
|
|
283
229
|
};
|
|
284
230
|
type SvgRenderOptions = Omit<SvgRenderOptions$1, "images"> & {
|
|
285
|
-
fonts?: FontLoader[];
|
|
231
|
+
fonts?: FontLoader$1[];
|
|
286
232
|
signal?: AbortSignal;
|
|
287
|
-
images?: ImagesInput;
|
|
233
|
+
images?: ImagesInput$1;
|
|
288
234
|
};
|
|
289
235
|
declare class Renderer {
|
|
290
|
-
private fontsByKey;
|
|
291
|
-
private fontsByData;
|
|
292
236
|
private inner;
|
|
293
|
-
private
|
|
294
|
-
private setFont;
|
|
295
|
-
private deleteFont;
|
|
296
|
-
private prepareFonts;
|
|
297
|
-
/** Registers `fonts` and resolves lazy `images`, yielding the `images`/`fontFamilies`
|
|
298
|
-
* the napi binding expects. Explicit `fontFamilies` wins over the registered set. */
|
|
299
|
-
private resolveResources;
|
|
237
|
+
private fonts;
|
|
300
238
|
render(node: Node, options?: RenderOptions): Promise<Buffer>;
|
|
301
239
|
renderSvg(node: Node, options?: SvgRenderOptions): Promise<string>;
|
|
302
240
|
measure(node: Node, options?: RenderOptions): Promise<MeasuredNode>;
|
|
303
241
|
renderAnimation(options: RenderAnimationOptions): Promise<Buffer>;
|
|
304
|
-
registerFont(font: FontLoader): Promise<
|
|
242
|
+
registerFont(font: FontLoader$1): Promise<RegisteredFamily[]>;
|
|
305
243
|
}
|
|
306
244
|
//#endregion
|
|
307
|
-
export { type AnimationOutputFormat, AnimationOutputFormatOptions, type AnimationScene, type ByteBuf, type ContainerNode, type DitheringAlgorithm, type Font, type FontDetails, FontLoader, type ImageCacheMode, ImageLoader, type ImageNode, type ImageSource, ImagesInput, type Keyframes, type KeyframesMap, type KeyframesRuleList, type MeasuredNode, type MeasuredTextRun, type Node, type NodeMetadata, type OutputFormat, OutputFormatOptions, type RegisteredFace, type RegisteredFamily, RenderAnimationOptions, RenderOptions, Renderer, SvgRenderOptions, type TextNode };
|
|
245
|
+
export { type AnimationOutputFormat, type AnimationOutputFormatOptions, type AnimationScene, type ByteBuf, type ContainerNode, type DitheringAlgorithm, type Font, type FontDetails, type FontLoader, type ImageCacheMode, type ImageLoader, type ImageNode, type ImageSource, type ImagesInput, type Keyframes, type KeyframesMap, type KeyframesRuleList, type MeasuredNode, type MeasuredTextRun, type Node, type NodeMetadata, type OutputFormat, type OutputFormatOptions, type RegisteredFace, type RegisteredFamily, RenderAnimationOptions, RenderOptions, Renderer, SvgRenderOptions, type TextNode };
|
package/dist/export.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
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";
|
|
2
3
|
import { Properties } from "csstype";
|
|
3
4
|
|
|
4
5
|
//#region index.d.ts
|
|
@@ -216,92 +217,29 @@ interface SvgRenderOptions$1 {
|
|
|
216
217
|
}
|
|
217
218
|
//#endregion
|
|
218
219
|
//#region src/export.d.ts
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
* file), raw bytes, or a descriptor with a lazy `data()` loader.
|
|
222
|
-
*/
|
|
223
|
-
type FontLoader = string | Font | (Omit<FontDetails, "data"> & {
|
|
224
|
-
data: () => Promise<FontDetails["data"]> | FontDetails["data"]; /** Inclusive codepoint ranges this face covers; lets `render` skip it when unused. */
|
|
225
|
-
ranges?: [number, number][];
|
|
226
|
-
} & ({
|
|
227
|
-
key: string;
|
|
228
|
-
} | {
|
|
229
|
-
name: string;
|
|
230
|
-
}));
|
|
231
|
-
type ImageLoaderData = ImageSource["data"];
|
|
232
|
-
type ImageLoader = Omit<ImageSource, "data"> & {
|
|
233
|
-
data: ImageLoaderData | (() => ImageLoaderData | Promise<ImageLoaderData>);
|
|
234
|
-
};
|
|
235
|
-
/** Images for a render: pre-fetched entries, or a group with a decode-cache default. */
|
|
236
|
-
type ImagesInput = ImageLoader[] | {
|
|
237
|
-
/** Pre-fetched entries, same as the array form. */sources?: ImageLoader[]; /** Decode-cache default for every image this render; a source's own `cache` wins. */
|
|
238
|
-
cache?: NonNullable<ImageLoader["cache"]>;
|
|
239
|
-
};
|
|
240
|
-
/**
|
|
241
|
-
* Output format. Format-specific options live on the variant that supports them,
|
|
242
|
-
* so `quality` cannot be paired with PNG/ICO/raw, and `lossless` is WebP-only.
|
|
243
|
-
* For WebP, `lossless` takes precedence over `quality`; omitting both encodes
|
|
244
|
-
* losslessly.
|
|
245
|
-
*/
|
|
246
|
-
type OutputFormatOptions = {
|
|
247
|
-
format?: "png";
|
|
248
|
-
} | {
|
|
249
|
-
format: "jpeg";
|
|
250
|
-
quality?: number;
|
|
251
|
-
} | {
|
|
252
|
-
format: "webp";
|
|
253
|
-
quality?: number;
|
|
254
|
-
lossless?: boolean;
|
|
255
|
-
} | {
|
|
256
|
-
format: "ico";
|
|
257
|
-
} | {
|
|
258
|
-
format: "raw";
|
|
259
|
-
};
|
|
260
|
-
type RenderOptions = Omit<RenderOptions$1, "images" | "format" | "quality" | "lossless"> & OutputFormatOptions & {
|
|
261
|
-
fonts?: FontLoader[];
|
|
220
|
+
type RenderOptions = Omit<RenderOptions$1, "images" | "format" | "quality" | "lossless"> & OutputFormatOptions$1 & {
|
|
221
|
+
fonts?: FontLoader$1[];
|
|
262
222
|
signal?: AbortSignal;
|
|
263
|
-
images?: ImagesInput;
|
|
264
|
-
};
|
|
265
|
-
/**
|
|
266
|
-
* Animation output format. `quality` and `lossless` are WebP-only; for WebP,
|
|
267
|
-
* `lossless` takes precedence over `quality`, and omitting both encodes
|
|
268
|
-
* losslessly.
|
|
269
|
-
*/
|
|
270
|
-
type AnimationOutputFormatOptions = {
|
|
271
|
-
format?: "webp";
|
|
272
|
-
quality?: number;
|
|
273
|
-
lossless?: boolean;
|
|
274
|
-
} | {
|
|
275
|
-
format: "apng";
|
|
276
|
-
} | {
|
|
277
|
-
format: "gif";
|
|
223
|
+
images?: ImagesInput$1;
|
|
278
224
|
};
|
|
279
|
-
type RenderAnimationOptions = Omit<RenderAnimationOptions$1, "images" | "format" | "quality" | "lossless"> & AnimationOutputFormatOptions & {
|
|
280
|
-
fonts?: FontLoader[];
|
|
225
|
+
type RenderAnimationOptions = Omit<RenderAnimationOptions$1, "images" | "format" | "quality" | "lossless"> & AnimationOutputFormatOptions$1 & {
|
|
226
|
+
fonts?: FontLoader$1[];
|
|
281
227
|
signal?: AbortSignal;
|
|
282
|
-
images?: ImagesInput;
|
|
228
|
+
images?: ImagesInput$1;
|
|
283
229
|
};
|
|
284
230
|
type SvgRenderOptions = Omit<SvgRenderOptions$1, "images"> & {
|
|
285
|
-
fonts?: FontLoader[];
|
|
231
|
+
fonts?: FontLoader$1[];
|
|
286
232
|
signal?: AbortSignal;
|
|
287
|
-
images?: ImagesInput;
|
|
233
|
+
images?: ImagesInput$1;
|
|
288
234
|
};
|
|
289
235
|
declare class Renderer {
|
|
290
|
-
private fontsByKey;
|
|
291
|
-
private fontsByData;
|
|
292
236
|
private inner;
|
|
293
|
-
private
|
|
294
|
-
private setFont;
|
|
295
|
-
private deleteFont;
|
|
296
|
-
private prepareFonts;
|
|
297
|
-
/** Registers `fonts` and resolves lazy `images`, yielding the `images`/`fontFamilies`
|
|
298
|
-
* the napi binding expects. Explicit `fontFamilies` wins over the registered set. */
|
|
299
|
-
private resolveResources;
|
|
237
|
+
private fonts;
|
|
300
238
|
render(node: Node, options?: RenderOptions): Promise<Buffer>;
|
|
301
239
|
renderSvg(node: Node, options?: SvgRenderOptions): Promise<string>;
|
|
302
240
|
measure(node: Node, options?: RenderOptions): Promise<MeasuredNode>;
|
|
303
241
|
renderAnimation(options: RenderAnimationOptions): Promise<Buffer>;
|
|
304
|
-
registerFont(font: FontLoader): Promise<
|
|
242
|
+
registerFont(font: FontLoader$1): Promise<RegisteredFamily[]>;
|
|
305
243
|
}
|
|
306
244
|
//#endregion
|
|
307
|
-
export { type AnimationOutputFormat, AnimationOutputFormatOptions, type AnimationScene, type ByteBuf, type ContainerNode, type DitheringAlgorithm, type Font, type FontDetails, FontLoader, type ImageCacheMode, ImageLoader, type ImageNode, type ImageSource, ImagesInput, type Keyframes, type KeyframesMap, type KeyframesRuleList, type MeasuredNode, type MeasuredTextRun, type Node, type NodeMetadata, type OutputFormat, OutputFormatOptions, type RegisteredFace, type RegisteredFamily, RenderAnimationOptions, RenderOptions, Renderer, SvgRenderOptions, type TextNode };
|
|
245
|
+
export { type AnimationOutputFormat, type AnimationOutputFormatOptions, type AnimationScene, type ByteBuf, type ContainerNode, type DitheringAlgorithm, type Font, type FontDetails, type FontLoader, type ImageCacheMode, type ImageLoader, type ImageNode, type ImageSource, type ImagesInput, type Keyframes, type KeyframesMap, type KeyframesRuleList, type MeasuredNode, type MeasuredTextRun, type Node, type NodeMetadata, type OutputFormat, type OutputFormatOptions, type RegisteredFace, type RegisteredFamily, RenderAnimationOptions, RenderOptions, Renderer, SvgRenderOptions, type TextNode };
|
package/dist/export.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "module";
|
|
2
|
-
import {
|
|
2
|
+
import { subsetFonts } from "@takumi-rs/helpers";
|
|
3
|
+
import { FontRegistry } from "@takumi-rs/helpers/renderer";
|
|
3
4
|
//#region index.js
|
|
4
5
|
const require = createRequire(import.meta.url);
|
|
5
6
|
const { readFileSync } = require(/* turbopackOptional: true */ "fs");
|
|
@@ -57,7 +58,7 @@ function requireNative() {
|
|
|
57
58
|
try {
|
|
58
59
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-android-arm64/core.android-arm64.node");
|
|
59
60
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-android-arm64/package.json").version;
|
|
60
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
61
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
61
62
|
return binding;
|
|
62
63
|
} catch (e) {
|
|
63
64
|
loadErrors.push(e);
|
|
@@ -71,7 +72,7 @@ function requireNative() {
|
|
|
71
72
|
try {
|
|
72
73
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-android-arm-eabi/core.android-arm-eabi.node");
|
|
73
74
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-android-arm-eabi/package.json").version;
|
|
74
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
75
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
75
76
|
return binding;
|
|
76
77
|
} catch (e) {
|
|
77
78
|
loadErrors.push(e);
|
|
@@ -86,7 +87,7 @@ function requireNative() {
|
|
|
86
87
|
try {
|
|
87
88
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-gnu/core.win32-x64-gnu.node");
|
|
88
89
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-gnu/package.json").version;
|
|
89
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
90
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
90
91
|
return binding;
|
|
91
92
|
} catch (e) {
|
|
92
93
|
loadErrors.push(e);
|
|
@@ -100,7 +101,7 @@ function requireNative() {
|
|
|
100
101
|
try {
|
|
101
102
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-msvc/core.win32-x64-msvc.node");
|
|
102
103
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-msvc/package.json").version;
|
|
103
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
104
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
104
105
|
return binding;
|
|
105
106
|
} catch (e) {
|
|
106
107
|
loadErrors.push(e);
|
|
@@ -115,7 +116,7 @@ function requireNative() {
|
|
|
115
116
|
try {
|
|
116
117
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-ia32-msvc/core.win32-ia32-msvc.node");
|
|
117
118
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-ia32-msvc/package.json").version;
|
|
118
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
119
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
119
120
|
return binding;
|
|
120
121
|
} catch (e) {
|
|
121
122
|
loadErrors.push(e);
|
|
@@ -129,7 +130,7 @@ function requireNative() {
|
|
|
129
130
|
try {
|
|
130
131
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-arm64-msvc/core.win32-arm64-msvc.node");
|
|
131
132
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-win32-arm64-msvc/package.json").version;
|
|
132
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
133
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
133
134
|
return binding;
|
|
134
135
|
} catch (e) {
|
|
135
136
|
loadErrors.push(e);
|
|
@@ -144,7 +145,7 @@ function requireNative() {
|
|
|
144
145
|
try {
|
|
145
146
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-darwin-universal/core.darwin-universal.node");
|
|
146
147
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-darwin-universal/package.json").version;
|
|
147
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
148
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
148
149
|
return binding;
|
|
149
150
|
} catch (e) {
|
|
150
151
|
loadErrors.push(e);
|
|
@@ -158,7 +159,7 @@ function requireNative() {
|
|
|
158
159
|
try {
|
|
159
160
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-darwin-x64/core.darwin-x64.node");
|
|
160
161
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-darwin-x64/package.json").version;
|
|
161
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
162
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
162
163
|
return binding;
|
|
163
164
|
} catch (e) {
|
|
164
165
|
loadErrors.push(e);
|
|
@@ -172,7 +173,7 @@ function requireNative() {
|
|
|
172
173
|
try {
|
|
173
174
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-darwin-arm64/core.darwin-arm64.node");
|
|
174
175
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-darwin-arm64/package.json").version;
|
|
175
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
176
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
176
177
|
return binding;
|
|
177
178
|
} catch (e) {
|
|
178
179
|
loadErrors.push(e);
|
|
@@ -187,7 +188,7 @@ function requireNative() {
|
|
|
187
188
|
try {
|
|
188
189
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-x64/core.freebsd-x64.node");
|
|
189
190
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-x64/package.json").version;
|
|
190
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
191
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
191
192
|
return binding;
|
|
192
193
|
} catch (e) {
|
|
193
194
|
loadErrors.push(e);
|
|
@@ -201,7 +202,7 @@ function requireNative() {
|
|
|
201
202
|
try {
|
|
202
203
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-arm64/core.freebsd-arm64.node");
|
|
203
204
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-arm64/package.json").version;
|
|
204
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
205
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
205
206
|
return binding;
|
|
206
207
|
} catch (e) {
|
|
207
208
|
loadErrors.push(e);
|
|
@@ -216,7 +217,7 @@ function requireNative() {
|
|
|
216
217
|
try {
|
|
217
218
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-musl/core.linux-x64-musl.node");
|
|
218
219
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-musl/package.json").version;
|
|
219
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
220
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
220
221
|
return binding;
|
|
221
222
|
} catch (e) {
|
|
222
223
|
loadErrors.push(e);
|
|
@@ -230,7 +231,7 @@ function requireNative() {
|
|
|
230
231
|
try {
|
|
231
232
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-gnu/core.linux-x64-gnu.node");
|
|
232
233
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-gnu/package.json").version;
|
|
233
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
234
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
234
235
|
return binding;
|
|
235
236
|
} catch (e) {
|
|
236
237
|
loadErrors.push(e);
|
|
@@ -245,7 +246,7 @@ function requireNative() {
|
|
|
245
246
|
try {
|
|
246
247
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-musl/core.linux-arm64-musl.node");
|
|
247
248
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-musl/package.json").version;
|
|
248
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
249
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
249
250
|
return binding;
|
|
250
251
|
} catch (e) {
|
|
251
252
|
loadErrors.push(e);
|
|
@@ -259,7 +260,7 @@ function requireNative() {
|
|
|
259
260
|
try {
|
|
260
261
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-gnu/core.linux-arm64-gnu.node");
|
|
261
262
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-gnu/package.json").version;
|
|
262
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
263
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
263
264
|
return binding;
|
|
264
265
|
} catch (e) {
|
|
265
266
|
loadErrors.push(e);
|
|
@@ -274,7 +275,7 @@ function requireNative() {
|
|
|
274
275
|
try {
|
|
275
276
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-musleabihf/core.linux-arm-musleabihf.node");
|
|
276
277
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-musleabihf/package.json").version;
|
|
277
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
278
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
278
279
|
return binding;
|
|
279
280
|
} catch (e) {
|
|
280
281
|
loadErrors.push(e);
|
|
@@ -288,7 +289,7 @@ function requireNative() {
|
|
|
288
289
|
try {
|
|
289
290
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-gnueabihf/core.linux-arm-gnueabihf.node");
|
|
290
291
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-gnueabihf/package.json").version;
|
|
291
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
292
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
292
293
|
return binding;
|
|
293
294
|
} catch (e) {
|
|
294
295
|
loadErrors.push(e);
|
|
@@ -303,7 +304,7 @@ function requireNative() {
|
|
|
303
304
|
try {
|
|
304
305
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-musl/core.linux-loong64-musl.node");
|
|
305
306
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-musl/package.json").version;
|
|
306
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
307
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
307
308
|
return binding;
|
|
308
309
|
} catch (e) {
|
|
309
310
|
loadErrors.push(e);
|
|
@@ -317,7 +318,7 @@ function requireNative() {
|
|
|
317
318
|
try {
|
|
318
319
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-gnu/core.linux-loong64-gnu.node");
|
|
319
320
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-gnu/package.json").version;
|
|
320
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
321
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
321
322
|
return binding;
|
|
322
323
|
} catch (e) {
|
|
323
324
|
loadErrors.push(e);
|
|
@@ -332,7 +333,7 @@ function requireNative() {
|
|
|
332
333
|
try {
|
|
333
334
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-musl/core.linux-riscv64-musl.node");
|
|
334
335
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-musl/package.json").version;
|
|
335
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
336
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
336
337
|
return binding;
|
|
337
338
|
} catch (e) {
|
|
338
339
|
loadErrors.push(e);
|
|
@@ -346,7 +347,7 @@ function requireNative() {
|
|
|
346
347
|
try {
|
|
347
348
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-gnu/core.linux-riscv64-gnu.node");
|
|
348
349
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-gnu/package.json").version;
|
|
349
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
350
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
350
351
|
return binding;
|
|
351
352
|
} catch (e) {
|
|
352
353
|
loadErrors.push(e);
|
|
@@ -361,7 +362,7 @@ function requireNative() {
|
|
|
361
362
|
try {
|
|
362
363
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-ppc64-gnu/core.linux-ppc64-gnu.node");
|
|
363
364
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-ppc64-gnu/package.json").version;
|
|
364
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
365
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
365
366
|
return binding;
|
|
366
367
|
} catch (e) {
|
|
367
368
|
loadErrors.push(e);
|
|
@@ -375,7 +376,7 @@ function requireNative() {
|
|
|
375
376
|
try {
|
|
376
377
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-s390x-gnu/core.linux-s390x-gnu.node");
|
|
377
378
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-linux-s390x-gnu/package.json").version;
|
|
378
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
379
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
379
380
|
return binding;
|
|
380
381
|
} catch (e) {
|
|
381
382
|
loadErrors.push(e);
|
|
@@ -390,7 +391,7 @@ function requireNative() {
|
|
|
390
391
|
try {
|
|
391
392
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm64/core.openharmony-arm64.node");
|
|
392
393
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm64/package.json").version;
|
|
393
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
394
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
394
395
|
return binding;
|
|
395
396
|
} catch (e) {
|
|
396
397
|
loadErrors.push(e);
|
|
@@ -404,7 +405,7 @@ function requireNative() {
|
|
|
404
405
|
try {
|
|
405
406
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-x64/core.openharmony-x64.node");
|
|
406
407
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-x64/package.json").version;
|
|
407
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
408
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
408
409
|
return binding;
|
|
409
410
|
} catch (e) {
|
|
410
411
|
loadErrors.push(e);
|
|
@@ -418,7 +419,7 @@ function requireNative() {
|
|
|
418
419
|
try {
|
|
419
420
|
const binding = require(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm/core.openharmony-arm.node");
|
|
420
421
|
const bindingPackageVersion = require(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm/package.json").version;
|
|
421
|
-
if (bindingPackageVersion !== "2.0.0-rc.
|
|
422
|
+
if (bindingPackageVersion !== "2.0.0-rc.6" && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
422
423
|
return binding;
|
|
423
424
|
} catch (e) {
|
|
424
425
|
loadErrors.push(e);
|
|
@@ -467,48 +468,12 @@ if (!nativeBinding) {
|
|
|
467
468
|
const { Renderer: Renderer$1, AnimationOutputFormat, DitheringAlgorithm, ImageCacheMode, OutputFormat } = nativeBinding;
|
|
468
469
|
//#endregion
|
|
469
470
|
//#region src/export.ts
|
|
470
|
-
async function resolveImageLoaders(images) {
|
|
471
|
-
const { sources = [], cache } = Array.isArray(images) ? { sources: images } : images;
|
|
472
|
-
const bySrc = /* @__PURE__ */ new Map();
|
|
473
|
-
for (const image of sources) bySrc.set(image.src, image);
|
|
474
|
-
return Promise.all([...bySrc.values()].map(async ({ src, data, cache: own }) => ({
|
|
475
|
-
src,
|
|
476
|
-
data: typeof data === "function" ? await data() : data,
|
|
477
|
-
cache: own ?? cache
|
|
478
|
-
})));
|
|
479
|
-
}
|
|
480
471
|
var Renderer = class {
|
|
481
|
-
fontsByKey = /* @__PURE__ */ new Map();
|
|
482
|
-
fontsByData = /* @__PURE__ */ new WeakMap();
|
|
483
472
|
inner = new Renderer$1();
|
|
484
|
-
|
|
485
|
-
return typeof key === "string" ? this.fontsByKey.get(key) : this.fontsByData.get(key);
|
|
486
|
-
}
|
|
487
|
-
setFont(key, family) {
|
|
488
|
-
if (typeof key === "string") this.fontsByKey.set(key, family);
|
|
489
|
-
else this.fontsByData.set(key, family);
|
|
490
|
-
}
|
|
491
|
-
deleteFont(key) {
|
|
492
|
-
if (typeof key === "string") this.fontsByKey.delete(key);
|
|
493
|
-
else this.fontsByData.delete(key);
|
|
494
|
-
}
|
|
495
|
-
async prepareFonts(fonts) {
|
|
496
|
-
if (!fonts) return;
|
|
497
|
-
const families = await Promise.all(fonts.map(this.registerFont.bind(this)));
|
|
498
|
-
return [...new Set(families.flat().map((f) => f.name))];
|
|
499
|
-
}
|
|
500
|
-
/** Registers `fonts` and resolves lazy `images`, yielding the `images`/`fontFamilies`
|
|
501
|
-
* the napi binding expects. Explicit `fontFamilies` wins over the registered set. */
|
|
502
|
-
async resolveResources(fonts, images, fontFamilies) {
|
|
503
|
-
const registeredFamilies = await this.prepareFonts(fonts);
|
|
504
|
-
return {
|
|
505
|
-
images: images ? await resolveImageLoaders(images) : void 0,
|
|
506
|
-
fontFamilies: fontFamilies ?? registeredFamilies
|
|
507
|
-
};
|
|
508
|
-
}
|
|
473
|
+
fonts = new FontRegistry((font) => this.inner.registerFont(font));
|
|
509
474
|
async render(node, options) {
|
|
510
475
|
const { fonts, fontFamilies, signal, images, ...rest } = options ?? {};
|
|
511
|
-
const resolved = await this.resolveResources(fonts && subsetFonts({
|
|
476
|
+
const resolved = await this.fonts.resolveResources(fonts && subsetFonts({
|
|
512
477
|
fonts,
|
|
513
478
|
source: node
|
|
514
479
|
}), images, fontFamilies);
|
|
@@ -519,7 +484,7 @@ var Renderer = class {
|
|
|
519
484
|
}
|
|
520
485
|
async renderSvg(node, options) {
|
|
521
486
|
const { fonts, fontFamilies, signal, images, ...rest } = options ?? {};
|
|
522
|
-
const resolved = await this.resolveResources(fonts && subsetFonts({
|
|
487
|
+
const resolved = await this.fonts.resolveResources(fonts && subsetFonts({
|
|
523
488
|
fonts,
|
|
524
489
|
source: node
|
|
525
490
|
}), images, fontFamilies);
|
|
@@ -530,7 +495,7 @@ var Renderer = class {
|
|
|
530
495
|
}
|
|
531
496
|
async measure(node, options) {
|
|
532
497
|
const { fonts, fontFamilies, signal, images, ...rest } = options ?? {};
|
|
533
|
-
const resolved = await this.resolveResources(fonts && subsetFonts({
|
|
498
|
+
const resolved = await this.fonts.resolveResources(fonts && subsetFonts({
|
|
534
499
|
fonts,
|
|
535
500
|
source: node
|
|
536
501
|
}), images, fontFamilies);
|
|
@@ -542,7 +507,7 @@ var Renderer = class {
|
|
|
542
507
|
async renderAnimation(options) {
|
|
543
508
|
const { fonts, fontFamilies, signal, images, ...rest } = options;
|
|
544
509
|
const nodes = options.scenes.map((scene) => scene.node);
|
|
545
|
-
const resolved = await this.resolveResources(fonts && subsetFonts({
|
|
510
|
+
const resolved = await this.fonts.resolveResources(fonts && subsetFonts({
|
|
546
511
|
fonts,
|
|
547
512
|
source: nodes
|
|
548
513
|
}), images, fontFamilies);
|
|
@@ -551,42 +516,9 @@ var Renderer = class {
|
|
|
551
516
|
...resolved
|
|
552
517
|
}, signal);
|
|
553
518
|
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
const key = createFontKey(loader);
|
|
557
|
-
const cached = this.getFont(key);
|
|
558
|
-
if (cached) return cached;
|
|
559
|
-
const extracted = extractFontBuffer(loader);
|
|
560
|
-
const register = (data) => this.inner.registerFont(isBuffer(loader) ? data : {
|
|
561
|
-
...loader,
|
|
562
|
-
data
|
|
563
|
-
});
|
|
564
|
-
if (isBuffer(extracted)) {
|
|
565
|
-
const binded = register(extracted);
|
|
566
|
-
this.setFont(key, Promise.resolve(binded));
|
|
567
|
-
return binded;
|
|
568
|
-
}
|
|
569
|
-
const promise = extracted.then(register).catch((error) => {
|
|
570
|
-
this.deleteFont(key);
|
|
571
|
-
throw error;
|
|
572
|
-
});
|
|
573
|
-
this.setFont(key, promise);
|
|
574
|
-
return promise;
|
|
519
|
+
registerFont(font) {
|
|
520
|
+
return this.fonts.register(font);
|
|
575
521
|
}
|
|
576
522
|
};
|
|
577
|
-
function extractFontBuffer(font) {
|
|
578
|
-
if (isBuffer(font)) return font;
|
|
579
|
-
if (typeof font.data !== "function") return font.data;
|
|
580
|
-
return font.data();
|
|
581
|
-
}
|
|
582
|
-
function createFontKey(font) {
|
|
583
|
-
if (isBuffer(font)) return font;
|
|
584
|
-
if ("key" in font && font.key) return font.key;
|
|
585
|
-
if (typeof font.data === "function") return `${font.name ?? ""}:${font.weight ?? ""}:${font.style ?? ""}`;
|
|
586
|
-
return font.data;
|
|
587
|
-
}
|
|
588
|
-
function isBuffer(data) {
|
|
589
|
-
return data instanceof Uint8Array || data instanceof ArrayBuffer || typeof Buffer !== "undefined" && Buffer.isBuffer(data);
|
|
590
|
-
}
|
|
591
523
|
//#endregion
|
|
592
524
|
export { Renderer };
|
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.6",
|
|
4
4
|
"description": "Native Node.js bindings for the Takumi Rust image rendering engine.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"publish-lint": "attw --pack . && publint --strict ."
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@takumi-rs/helpers": "2.0.0-rc.
|
|
73
|
+
"@takumi-rs/helpers": "2.0.0-rc.6",
|
|
74
74
|
"csstype": "^3.2.3"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@types/bun": "^1.3.14",
|
|
79
79
|
"@types/react": "19.2.17",
|
|
80
80
|
"@types/react-dom": "^19.2.3",
|
|
81
|
-
"lucide-react": "^1.
|
|
81
|
+
"lucide-react": "^1.23.0",
|
|
82
82
|
"mitata": "^1.0.34",
|
|
83
83
|
"react": "^19.2.7",
|
|
84
84
|
"tsdown": "^0.22.3",
|
|
@@ -102,13 +102,13 @@
|
|
|
102
102
|
"node": ">=18"
|
|
103
103
|
},
|
|
104
104
|
"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.
|
|
105
|
+
"@takumi-rs/core-darwin-x64": "2.0.0-rc.6",
|
|
106
|
+
"@takumi-rs/core-darwin-arm64": "2.0.0-rc.6",
|
|
107
|
+
"@takumi-rs/core-linux-arm64-gnu": "2.0.0-rc.6",
|
|
108
|
+
"@takumi-rs/core-linux-arm64-musl": "2.0.0-rc.6",
|
|
109
|
+
"@takumi-rs/core-win32-arm64-msvc": "2.0.0-rc.6",
|
|
110
|
+
"@takumi-rs/core-linux-x64-gnu": "2.0.0-rc.6",
|
|
111
|
+
"@takumi-rs/core-linux-x64-musl": "2.0.0-rc.6",
|
|
112
|
+
"@takumi-rs/core-win32-x64-msvc": "2.0.0-rc.6"
|
|
113
113
|
}
|
|
114
114
|
}
|