@takumi-rs/core 2.0.0-beta.8 → 2.0.0-rc.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/dist/export.cjs +36 -51
- package/dist/export.d.cts +6 -53
- package/dist/export.d.mts +6 -53
- package/dist/export.mjs +37 -53
- package/index.d.ts +0 -48
- package/package.json +16 -6
package/dist/export.cjs
CHANGED
|
@@ -59,7 +59,7 @@ function requireNative() {
|
|
|
59
59
|
try {
|
|
60
60
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-android-arm64/core.android-arm64.node");
|
|
61
61
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-android-arm64/package.json").version;
|
|
62
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
62
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
63
63
|
return binding;
|
|
64
64
|
} catch (e) {
|
|
65
65
|
loadErrors.push(e);
|
|
@@ -73,7 +73,7 @@ function requireNative() {
|
|
|
73
73
|
try {
|
|
74
74
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-android-arm-eabi/core.android-arm-eabi.node");
|
|
75
75
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-android-arm-eabi/package.json").version;
|
|
76
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
76
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
77
77
|
return binding;
|
|
78
78
|
} catch (e) {
|
|
79
79
|
loadErrors.push(e);
|
|
@@ -88,7 +88,7 @@ function requireNative() {
|
|
|
88
88
|
try {
|
|
89
89
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-gnu/core.win32-x64-gnu.node");
|
|
90
90
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-gnu/package.json").version;
|
|
91
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
91
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
92
92
|
return binding;
|
|
93
93
|
} catch (e) {
|
|
94
94
|
loadErrors.push(e);
|
|
@@ -102,7 +102,7 @@ function requireNative() {
|
|
|
102
102
|
try {
|
|
103
103
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-msvc/core.win32-x64-msvc.node");
|
|
104
104
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-x64-msvc/package.json").version;
|
|
105
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
105
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
106
106
|
return binding;
|
|
107
107
|
} catch (e) {
|
|
108
108
|
loadErrors.push(e);
|
|
@@ -117,7 +117,7 @@ function requireNative() {
|
|
|
117
117
|
try {
|
|
118
118
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-ia32-msvc/core.win32-ia32-msvc.node");
|
|
119
119
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-ia32-msvc/package.json").version;
|
|
120
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
120
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
121
121
|
return binding;
|
|
122
122
|
} catch (e) {
|
|
123
123
|
loadErrors.push(e);
|
|
@@ -131,7 +131,7 @@ function requireNative() {
|
|
|
131
131
|
try {
|
|
132
132
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-arm64-msvc/core.win32-arm64-msvc.node");
|
|
133
133
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-win32-arm64-msvc/package.json").version;
|
|
134
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
134
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
135
135
|
return binding;
|
|
136
136
|
} catch (e) {
|
|
137
137
|
loadErrors.push(e);
|
|
@@ -146,7 +146,7 @@ function requireNative() {
|
|
|
146
146
|
try {
|
|
147
147
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-universal/core.darwin-universal.node");
|
|
148
148
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-universal/package.json").version;
|
|
149
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
149
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
150
150
|
return binding;
|
|
151
151
|
} catch (e) {
|
|
152
152
|
loadErrors.push(e);
|
|
@@ -160,7 +160,7 @@ function requireNative() {
|
|
|
160
160
|
try {
|
|
161
161
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-x64/core.darwin-x64.node");
|
|
162
162
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-x64/package.json").version;
|
|
163
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
163
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
164
164
|
return binding;
|
|
165
165
|
} catch (e) {
|
|
166
166
|
loadErrors.push(e);
|
|
@@ -174,7 +174,7 @@ function requireNative() {
|
|
|
174
174
|
try {
|
|
175
175
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-arm64/core.darwin-arm64.node");
|
|
176
176
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-darwin-arm64/package.json").version;
|
|
177
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
177
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
178
178
|
return binding;
|
|
179
179
|
} catch (e) {
|
|
180
180
|
loadErrors.push(e);
|
|
@@ -189,7 +189,7 @@ function requireNative() {
|
|
|
189
189
|
try {
|
|
190
190
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-x64/core.freebsd-x64.node");
|
|
191
191
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-x64/package.json").version;
|
|
192
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
192
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
193
193
|
return binding;
|
|
194
194
|
} catch (e) {
|
|
195
195
|
loadErrors.push(e);
|
|
@@ -203,7 +203,7 @@ function requireNative() {
|
|
|
203
203
|
try {
|
|
204
204
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-arm64/core.freebsd-arm64.node");
|
|
205
205
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-freebsd-arm64/package.json").version;
|
|
206
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
206
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
207
207
|
return binding;
|
|
208
208
|
} catch (e) {
|
|
209
209
|
loadErrors.push(e);
|
|
@@ -218,7 +218,7 @@ function requireNative() {
|
|
|
218
218
|
try {
|
|
219
219
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-musl/core.linux-x64-musl.node");
|
|
220
220
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-musl/package.json").version;
|
|
221
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
221
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
222
222
|
return binding;
|
|
223
223
|
} catch (e) {
|
|
224
224
|
loadErrors.push(e);
|
|
@@ -232,7 +232,7 @@ function requireNative() {
|
|
|
232
232
|
try {
|
|
233
233
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-gnu/core.linux-x64-gnu.node");
|
|
234
234
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-x64-gnu/package.json").version;
|
|
235
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
235
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
236
236
|
return binding;
|
|
237
237
|
} catch (e) {
|
|
238
238
|
loadErrors.push(e);
|
|
@@ -247,7 +247,7 @@ function requireNative() {
|
|
|
247
247
|
try {
|
|
248
248
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-musl/core.linux-arm64-musl.node");
|
|
249
249
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-musl/package.json").version;
|
|
250
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
250
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
251
251
|
return binding;
|
|
252
252
|
} catch (e) {
|
|
253
253
|
loadErrors.push(e);
|
|
@@ -261,7 +261,7 @@ function requireNative() {
|
|
|
261
261
|
try {
|
|
262
262
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-gnu/core.linux-arm64-gnu.node");
|
|
263
263
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm64-gnu/package.json").version;
|
|
264
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
264
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
265
265
|
return binding;
|
|
266
266
|
} catch (e) {
|
|
267
267
|
loadErrors.push(e);
|
|
@@ -276,7 +276,7 @@ function requireNative() {
|
|
|
276
276
|
try {
|
|
277
277
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-musleabihf/core.linux-arm-musleabihf.node");
|
|
278
278
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-musleabihf/package.json").version;
|
|
279
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
279
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
280
280
|
return binding;
|
|
281
281
|
} catch (e) {
|
|
282
282
|
loadErrors.push(e);
|
|
@@ -290,7 +290,7 @@ function requireNative() {
|
|
|
290
290
|
try {
|
|
291
291
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-gnueabihf/core.linux-arm-gnueabihf.node");
|
|
292
292
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-arm-gnueabihf/package.json").version;
|
|
293
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
293
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
294
294
|
return binding;
|
|
295
295
|
} catch (e) {
|
|
296
296
|
loadErrors.push(e);
|
|
@@ -305,7 +305,7 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-musl/core.linux-loong64-musl.node");
|
|
307
307
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-musl/package.json").version;
|
|
308
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
308
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
309
309
|
return binding;
|
|
310
310
|
} catch (e) {
|
|
311
311
|
loadErrors.push(e);
|
|
@@ -319,7 +319,7 @@ function requireNative() {
|
|
|
319
319
|
try {
|
|
320
320
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-gnu/core.linux-loong64-gnu.node");
|
|
321
321
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-loong64-gnu/package.json").version;
|
|
322
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
322
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
323
323
|
return binding;
|
|
324
324
|
} catch (e) {
|
|
325
325
|
loadErrors.push(e);
|
|
@@ -334,7 +334,7 @@ function requireNative() {
|
|
|
334
334
|
try {
|
|
335
335
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-musl/core.linux-riscv64-musl.node");
|
|
336
336
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-musl/package.json").version;
|
|
337
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
337
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
338
338
|
return binding;
|
|
339
339
|
} catch (e) {
|
|
340
340
|
loadErrors.push(e);
|
|
@@ -348,7 +348,7 @@ function requireNative() {
|
|
|
348
348
|
try {
|
|
349
349
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-gnu/core.linux-riscv64-gnu.node");
|
|
350
350
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-riscv64-gnu/package.json").version;
|
|
351
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
351
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
352
352
|
return binding;
|
|
353
353
|
} catch (e) {
|
|
354
354
|
loadErrors.push(e);
|
|
@@ -363,7 +363,7 @@ function requireNative() {
|
|
|
363
363
|
try {
|
|
364
364
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-ppc64-gnu/core.linux-ppc64-gnu.node");
|
|
365
365
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-ppc64-gnu/package.json").version;
|
|
366
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
366
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
367
367
|
return binding;
|
|
368
368
|
} catch (e) {
|
|
369
369
|
loadErrors.push(e);
|
|
@@ -377,7 +377,7 @@ function requireNative() {
|
|
|
377
377
|
try {
|
|
378
378
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-s390x-gnu/core.linux-s390x-gnu.node");
|
|
379
379
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-linux-s390x-gnu/package.json").version;
|
|
380
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
380
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
381
381
|
return binding;
|
|
382
382
|
} catch (e) {
|
|
383
383
|
loadErrors.push(e);
|
|
@@ -392,7 +392,7 @@ function requireNative() {
|
|
|
392
392
|
try {
|
|
393
393
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm64/core.openharmony-arm64.node");
|
|
394
394
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm64/package.json").version;
|
|
395
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
395
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
396
396
|
return binding;
|
|
397
397
|
} catch (e) {
|
|
398
398
|
loadErrors.push(e);
|
|
@@ -406,7 +406,7 @@ function requireNative() {
|
|
|
406
406
|
try {
|
|
407
407
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-x64/core.openharmony-x64.node");
|
|
408
408
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-x64/package.json").version;
|
|
409
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
409
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
410
410
|
return binding;
|
|
411
411
|
} catch (e) {
|
|
412
412
|
loadErrors.push(e);
|
|
@@ -420,7 +420,7 @@ function requireNative() {
|
|
|
420
420
|
try {
|
|
421
421
|
const binding = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm/core.openharmony-arm.node");
|
|
422
422
|
const bindingPackageVersion = require$1(/* turbopackOptional: true */ "@takumi-rs/core-openharmony-arm/package.json").version;
|
|
423
|
-
if (bindingPackageVersion !== "2.0.0-
|
|
423
|
+
if (bindingPackageVersion !== "2.0.0-rc.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-rc.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
424
424
|
return binding;
|
|
425
425
|
} catch (e) {
|
|
426
426
|
loadErrors.push(e);
|
|
@@ -504,11 +504,11 @@ var Renderer = class {
|
|
|
504
504
|
const registeredFamilies = await this.prepareFonts(fonts);
|
|
505
505
|
return {
|
|
506
506
|
images: images ? await resolveImageLoaders(images) : void 0,
|
|
507
|
-
fontFamilies: fontFamilies
|
|
507
|
+
fontFamilies: fontFamilies ?? registeredFamilies
|
|
508
508
|
};
|
|
509
509
|
}
|
|
510
510
|
async render(node, options) {
|
|
511
|
-
const { fonts, fontFamilies, signal, images, subset, ...rest } = options
|
|
511
|
+
const { fonts, fontFamilies, signal, images, subset, ...rest } = options ?? {};
|
|
512
512
|
const resolved = await this.resolveResources((0, _takumi_rs_helpers.pickFonts)({
|
|
513
513
|
fonts,
|
|
514
514
|
source: node,
|
|
@@ -520,7 +520,7 @@ var Renderer = class {
|
|
|
520
520
|
}, signal);
|
|
521
521
|
}
|
|
522
522
|
async renderSvg(node, options) {
|
|
523
|
-
const { fonts, fontFamilies, signal, images, subset, ...rest } = options
|
|
523
|
+
const { fonts, fontFamilies, signal, images, subset, ...rest } = options ?? {};
|
|
524
524
|
const resolved = await this.resolveResources((0, _takumi_rs_helpers.pickFonts)({
|
|
525
525
|
fonts,
|
|
526
526
|
source: node,
|
|
@@ -532,7 +532,7 @@ var Renderer = class {
|
|
|
532
532
|
}, signal);
|
|
533
533
|
}
|
|
534
534
|
async measure(node, options) {
|
|
535
|
-
const { fonts, fontFamilies, signal, images, subset, ...rest } = options
|
|
535
|
+
const { fonts, fontFamilies, signal, images, subset, ...rest } = options ?? {};
|
|
536
536
|
const resolved = await this.resolveResources((0, _takumi_rs_helpers.pickFonts)({
|
|
537
537
|
fonts,
|
|
538
538
|
source: node,
|
|
@@ -556,26 +556,14 @@ var Renderer = class {
|
|
|
556
556
|
...resolved
|
|
557
557
|
}, signal);
|
|
558
558
|
}
|
|
559
|
-
async encodeFrames(frames, options) {
|
|
560
|
-
const { fonts, fontFamilies, signal, images, subset, ...rest } = options;
|
|
561
|
-
const nodes = frames.map((frame) => frame.node);
|
|
562
|
-
const resolved = await this.resolveResources((0, _takumi_rs_helpers.pickFonts)({
|
|
563
|
-
fonts,
|
|
564
|
-
source: nodes,
|
|
565
|
-
subset
|
|
566
|
-
}), images, fontFamilies);
|
|
567
|
-
return this.inner.encodeFrames(frames, {
|
|
568
|
-
...rest,
|
|
569
|
-
...resolved
|
|
570
|
-
}, signal);
|
|
571
|
-
}
|
|
572
559
|
async registerFont(font) {
|
|
573
|
-
const
|
|
560
|
+
const loader = typeof font === "string" ? (0, _takumi_rs_helpers.fontFromUrl)(font) : font;
|
|
561
|
+
const key = createFontKey(loader);
|
|
574
562
|
const cached = this.getFont(key);
|
|
575
563
|
if (cached) return cached;
|
|
576
|
-
const extracted = extractFontBuffer(
|
|
577
|
-
const register = (data) => this.inner.registerFont(isBuffer(
|
|
578
|
-
...
|
|
564
|
+
const extracted = extractFontBuffer(loader);
|
|
565
|
+
const register = (data) => this.inner.registerFont(isBuffer(loader) ? data : {
|
|
566
|
+
...loader,
|
|
579
567
|
data
|
|
580
568
|
});
|
|
581
569
|
if (isBuffer(extracted)) {
|
|
@@ -599,10 +587,7 @@ function extractFontBuffer(font) {
|
|
|
599
587
|
function createFontKey(font) {
|
|
600
588
|
if (isBuffer(font)) return font;
|
|
601
589
|
if ("key" in font && font.key) return font.key;
|
|
602
|
-
if (typeof font.data === "function") {
|
|
603
|
-
var _font$name, _font$weight, _font$style;
|
|
604
|
-
return `${(_font$name = font.name) !== null && _font$name !== void 0 ? _font$name : ""}:${(_font$weight = font.weight) !== null && _font$weight !== void 0 ? _font$weight : ""}:${(_font$style = font.style) !== null && _font$style !== void 0 ? _font$style : ""}`;
|
|
605
|
-
}
|
|
590
|
+
if (typeof font.data === "function") return `${font.name ?? ""}:${font.weight ?? ""}:${font.style ?? ""}`;
|
|
606
591
|
return font.data;
|
|
607
592
|
}
|
|
608
593
|
function isBuffer(data) {
|
package/dist/export.d.cts
CHANGED
|
@@ -37,13 +37,6 @@ type KeyframesRuleList = {
|
|
|
37
37
|
}[];
|
|
38
38
|
}[];
|
|
39
39
|
type Keyframes = KeyframesMap | KeyframesRuleList;
|
|
40
|
-
/** Represents a single frame in a precomputed animation sequence. */
|
|
41
|
-
interface AnimationFrameSource {
|
|
42
|
-
/** The node tree to render for this frame. */
|
|
43
|
-
node: Node;
|
|
44
|
-
/** The duration of this frame in milliseconds. */
|
|
45
|
-
durationMs: number;
|
|
46
|
-
}
|
|
47
40
|
/** Output format for animated images. */
|
|
48
41
|
type AnimationOutputFormat = /** Animated WebP format. */'webp' | /** Animated PNG format. */'apng' | /** Animated GIF format. */'gif';
|
|
49
42
|
/** Represents a single scene in a sequential animation timeline. */
|
|
@@ -54,43 +47,6 @@ interface AnimationSceneSource {
|
|
|
54
47
|
durationMs: number;
|
|
55
48
|
}
|
|
56
49
|
type DitheringAlgorithm = 'none' | 'ordered-bayer' | 'floyd-steinberg';
|
|
57
|
-
/** Options for encoding a precomputed frame sequence. */
|
|
58
|
-
interface EncodeFramesOptions$1 {
|
|
59
|
-
/** Whether to draw debug borders around layout elements. */
|
|
60
|
-
drawDebugBorder?: boolean;
|
|
61
|
-
/** The width of each frame in pixels. */
|
|
62
|
-
width: number;
|
|
63
|
-
/** The height of each frame in pixels. */
|
|
64
|
-
height: number;
|
|
65
|
-
/** The output animation format (WebP, APNG, or GIF). */
|
|
66
|
-
format?: AnimationOutputFormat;
|
|
67
|
-
/**
|
|
68
|
-
* The quality of lossy WebP (0-100). Ignored for APNG and GIF, and when
|
|
69
|
-
* `lossless` is set.
|
|
70
|
-
*/
|
|
71
|
-
quality?: number;
|
|
72
|
-
/**
|
|
73
|
-
* Encode WebP losslessly. Defaults to lossless when neither `quality` nor
|
|
74
|
-
* `lossless` is given. Ignored for APNG and GIF.
|
|
75
|
-
*/
|
|
76
|
-
lossless?: boolean;
|
|
77
|
-
/** Images keyed by `src`, each carrying raw bytes. */
|
|
78
|
-
images?: Array<ImageSource>;
|
|
79
|
-
/** CSS stylesheets to apply before rendering. */
|
|
80
|
-
stylesheets?: Array<string>;
|
|
81
|
-
/**
|
|
82
|
-
* The device pixel ratio.
|
|
83
|
-
* @default 1.0
|
|
84
|
-
*/
|
|
85
|
-
devicePixelRatio?: number;
|
|
86
|
-
/**
|
|
87
|
-
* Per-render font stack: ordered family names used as the fallback chain.
|
|
88
|
-
* Defaults to all registered families in registration order.
|
|
89
|
-
*/
|
|
90
|
-
fontFamilies?: Array<string>;
|
|
91
|
-
/** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
|
|
92
|
-
lang?: string;
|
|
93
|
-
}
|
|
94
50
|
/** Cache policy for a decoded image. Defaults to `"auto"`. */
|
|
95
51
|
type ImageCacheMode = /** Cache the decoded image for reuse (evictable). */'auto' | /** Skip the decoded-image cache. */'none';
|
|
96
52
|
/** An image source with its URL and raw data. */
|
|
@@ -260,7 +216,11 @@ interface SvgRenderOptions$1 {
|
|
|
260
216
|
}
|
|
261
217
|
//#endregion
|
|
262
218
|
//#region src/export.d.ts
|
|
263
|
-
|
|
219
|
+
/**
|
|
220
|
+
* A font to register. Either a URL string (fetched on demand, with name/weight/style read from the
|
|
221
|
+
* file), raw bytes, or a descriptor with a lazy `data()` loader.
|
|
222
|
+
*/
|
|
223
|
+
type FontLoader = string | Font | (Omit<FontDetails, "data"> & {
|
|
264
224
|
data: () => Promise<FontDetails["data"]> | FontDetails["data"]; /** Inclusive codepoint ranges this face covers; lets `render` skip it when unused. */
|
|
265
225
|
ranges?: [number, number][];
|
|
266
226
|
} & ({
|
|
@@ -318,12 +278,6 @@ type RenderAnimationOptions = Omit<RenderAnimationOptions$1, "images" | "format"
|
|
|
318
278
|
images?: ImageLoader[]; /** Register only the `fonts` subsets the content renders. @default true */
|
|
319
279
|
subset?: boolean;
|
|
320
280
|
};
|
|
321
|
-
type EncodeFramesOptions = Omit<EncodeFramesOptions$1, "images" | "format" | "quality" | "lossless"> & AnimationOutputFormatOptions & {
|
|
322
|
-
fonts?: FontLoader[];
|
|
323
|
-
signal?: AbortSignal;
|
|
324
|
-
images?: ImageLoader[]; /** Register only the `fonts` subsets the content renders. @default true */
|
|
325
|
-
subset?: boolean;
|
|
326
|
-
};
|
|
327
281
|
type SvgRenderOptions = Omit<SvgRenderOptions$1, "images"> & {
|
|
328
282
|
fonts?: FontLoader[];
|
|
329
283
|
signal?: AbortSignal;
|
|
@@ -345,8 +299,7 @@ declare class Renderer {
|
|
|
345
299
|
renderSvg(node: Node, options?: SvgRenderOptions): Promise<string>;
|
|
346
300
|
measure(node: Node, options?: RenderOptions): Promise<MeasuredNode>;
|
|
347
301
|
renderAnimation(options: RenderAnimationOptions): Promise<Buffer>;
|
|
348
|
-
encodeFrames(frames: AnimationFrameSource[], options: EncodeFramesOptions): Promise<Buffer>;
|
|
349
302
|
registerFont(font: FontLoader): Promise<any>;
|
|
350
303
|
}
|
|
351
304
|
//#endregion
|
|
352
|
-
export { type
|
|
305
|
+
export { type AnimationOutputFormat, AnimationOutputFormatOptions, type AnimationSceneSource, type ByteBuf, type ContainerNode, type DitheringAlgorithm, type Font, type FontDetails, FontLoader, type ImageCacheMode, ImageLoader, type ImageNode, type ImageSource, 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, extractResourceUrls };
|
package/dist/export.d.mts
CHANGED
|
@@ -37,13 +37,6 @@ type KeyframesRuleList = {
|
|
|
37
37
|
}[];
|
|
38
38
|
}[];
|
|
39
39
|
type Keyframes = KeyframesMap | KeyframesRuleList;
|
|
40
|
-
/** Represents a single frame in a precomputed animation sequence. */
|
|
41
|
-
interface AnimationFrameSource {
|
|
42
|
-
/** The node tree to render for this frame. */
|
|
43
|
-
node: Node;
|
|
44
|
-
/** The duration of this frame in milliseconds. */
|
|
45
|
-
durationMs: number;
|
|
46
|
-
}
|
|
47
40
|
/** Output format for animated images. */
|
|
48
41
|
type AnimationOutputFormat = /** Animated WebP format. */'webp' | /** Animated PNG format. */'apng' | /** Animated GIF format. */'gif';
|
|
49
42
|
/** Represents a single scene in a sequential animation timeline. */
|
|
@@ -54,43 +47,6 @@ interface AnimationSceneSource {
|
|
|
54
47
|
durationMs: number;
|
|
55
48
|
}
|
|
56
49
|
type DitheringAlgorithm = 'none' | 'ordered-bayer' | 'floyd-steinberg';
|
|
57
|
-
/** Options for encoding a precomputed frame sequence. */
|
|
58
|
-
interface EncodeFramesOptions$1 {
|
|
59
|
-
/** Whether to draw debug borders around layout elements. */
|
|
60
|
-
drawDebugBorder?: boolean;
|
|
61
|
-
/** The width of each frame in pixels. */
|
|
62
|
-
width: number;
|
|
63
|
-
/** The height of each frame in pixels. */
|
|
64
|
-
height: number;
|
|
65
|
-
/** The output animation format (WebP, APNG, or GIF). */
|
|
66
|
-
format?: AnimationOutputFormat;
|
|
67
|
-
/**
|
|
68
|
-
* The quality of lossy WebP (0-100). Ignored for APNG and GIF, and when
|
|
69
|
-
* `lossless` is set.
|
|
70
|
-
*/
|
|
71
|
-
quality?: number;
|
|
72
|
-
/**
|
|
73
|
-
* Encode WebP losslessly. Defaults to lossless when neither `quality` nor
|
|
74
|
-
* `lossless` is given. Ignored for APNG and GIF.
|
|
75
|
-
*/
|
|
76
|
-
lossless?: boolean;
|
|
77
|
-
/** Images keyed by `src`, each carrying raw bytes. */
|
|
78
|
-
images?: Array<ImageSource>;
|
|
79
|
-
/** CSS stylesheets to apply before rendering. */
|
|
80
|
-
stylesheets?: Array<string>;
|
|
81
|
-
/**
|
|
82
|
-
* The device pixel ratio.
|
|
83
|
-
* @default 1.0
|
|
84
|
-
*/
|
|
85
|
-
devicePixelRatio?: number;
|
|
86
|
-
/**
|
|
87
|
-
* Per-render font stack: ordered family names used as the fallback chain.
|
|
88
|
-
* Defaults to all registered families in registration order.
|
|
89
|
-
*/
|
|
90
|
-
fontFamilies?: Array<string>;
|
|
91
|
-
/** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
|
|
92
|
-
lang?: string;
|
|
93
|
-
}
|
|
94
50
|
/** Cache policy for a decoded image. Defaults to `"auto"`. */
|
|
95
51
|
type ImageCacheMode = /** Cache the decoded image for reuse (evictable). */'auto' | /** Skip the decoded-image cache. */'none';
|
|
96
52
|
/** An image source with its URL and raw data. */
|
|
@@ -260,7 +216,11 @@ interface SvgRenderOptions$1 {
|
|
|
260
216
|
}
|
|
261
217
|
//#endregion
|
|
262
218
|
//#region src/export.d.ts
|
|
263
|
-
|
|
219
|
+
/**
|
|
220
|
+
* A font to register. Either a URL string (fetched on demand, with name/weight/style read from the
|
|
221
|
+
* file), raw bytes, or a descriptor with a lazy `data()` loader.
|
|
222
|
+
*/
|
|
223
|
+
type FontLoader = string | Font | (Omit<FontDetails, "data"> & {
|
|
264
224
|
data: () => Promise<FontDetails["data"]> | FontDetails["data"]; /** Inclusive codepoint ranges this face covers; lets `render` skip it when unused. */
|
|
265
225
|
ranges?: [number, number][];
|
|
266
226
|
} & ({
|
|
@@ -318,12 +278,6 @@ type RenderAnimationOptions = Omit<RenderAnimationOptions$1, "images" | "format"
|
|
|
318
278
|
images?: ImageLoader[]; /** Register only the `fonts` subsets the content renders. @default true */
|
|
319
279
|
subset?: boolean;
|
|
320
280
|
};
|
|
321
|
-
type EncodeFramesOptions = Omit<EncodeFramesOptions$1, "images" | "format" | "quality" | "lossless"> & AnimationOutputFormatOptions & {
|
|
322
|
-
fonts?: FontLoader[];
|
|
323
|
-
signal?: AbortSignal;
|
|
324
|
-
images?: ImageLoader[]; /** Register only the `fonts` subsets the content renders. @default true */
|
|
325
|
-
subset?: boolean;
|
|
326
|
-
};
|
|
327
281
|
type SvgRenderOptions = Omit<SvgRenderOptions$1, "images"> & {
|
|
328
282
|
fonts?: FontLoader[];
|
|
329
283
|
signal?: AbortSignal;
|
|
@@ -345,8 +299,7 @@ declare class Renderer {
|
|
|
345
299
|
renderSvg(node: Node, options?: SvgRenderOptions): Promise<string>;
|
|
346
300
|
measure(node: Node, options?: RenderOptions): Promise<MeasuredNode>;
|
|
347
301
|
renderAnimation(options: RenderAnimationOptions): Promise<Buffer>;
|
|
348
|
-
encodeFrames(frames: AnimationFrameSource[], options: EncodeFramesOptions): Promise<Buffer>;
|
|
349
302
|
registerFont(font: FontLoader): Promise<any>;
|
|
350
303
|
}
|
|
351
304
|
//#endregion
|
|
352
|
-
export { type
|
|
305
|
+
export { type AnimationOutputFormat, AnimationOutputFormatOptions, type AnimationSceneSource, type ByteBuf, type ContainerNode, type DitheringAlgorithm, type Font, type FontDetails, FontLoader, type ImageCacheMode, ImageLoader, type ImageNode, type ImageSource, 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, extractResourceUrls };
|
package/dist/export.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "module";
|
|
2
|
-
import { extractResourceUrls, pickFonts } from "@takumi-rs/helpers";
|
|
2
|
+
import { extractResourceUrls, fontFromUrl, pickFonts } from "@takumi-rs/helpers";
|
|
3
3
|
//#region index.js
|
|
4
4
|
const require = createRequire(import.meta.url);
|
|
5
|
-
new URL(".", import.meta.url).pathname;
|
|
6
5
|
const { readFileSync } = require(/* turbopackOptional: true */ "fs");
|
|
7
6
|
let nativeBinding = null;
|
|
8
7
|
const loadErrors = [];
|
|
@@ -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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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-rc.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);
|
|
@@ -503,11 +502,11 @@ var Renderer = class {
|
|
|
503
502
|
const registeredFamilies = await this.prepareFonts(fonts);
|
|
504
503
|
return {
|
|
505
504
|
images: images ? await resolveImageLoaders(images) : void 0,
|
|
506
|
-
fontFamilies: fontFamilies
|
|
505
|
+
fontFamilies: fontFamilies ?? registeredFamilies
|
|
507
506
|
};
|
|
508
507
|
}
|
|
509
508
|
async render(node, options) {
|
|
510
|
-
const { fonts, fontFamilies, signal, images, subset, ...rest } = options
|
|
509
|
+
const { fonts, fontFamilies, signal, images, subset, ...rest } = options ?? {};
|
|
511
510
|
const resolved = await this.resolveResources(pickFonts({
|
|
512
511
|
fonts,
|
|
513
512
|
source: node,
|
|
@@ -519,7 +518,7 @@ var Renderer = class {
|
|
|
519
518
|
}, signal);
|
|
520
519
|
}
|
|
521
520
|
async renderSvg(node, options) {
|
|
522
|
-
const { fonts, fontFamilies, signal, images, subset, ...rest } = options
|
|
521
|
+
const { fonts, fontFamilies, signal, images, subset, ...rest } = options ?? {};
|
|
523
522
|
const resolved = await this.resolveResources(pickFonts({
|
|
524
523
|
fonts,
|
|
525
524
|
source: node,
|
|
@@ -531,7 +530,7 @@ var Renderer = class {
|
|
|
531
530
|
}, signal);
|
|
532
531
|
}
|
|
533
532
|
async measure(node, options) {
|
|
534
|
-
const { fonts, fontFamilies, signal, images, subset, ...rest } = options
|
|
533
|
+
const { fonts, fontFamilies, signal, images, subset, ...rest } = options ?? {};
|
|
535
534
|
const resolved = await this.resolveResources(pickFonts({
|
|
536
535
|
fonts,
|
|
537
536
|
source: node,
|
|
@@ -555,26 +554,14 @@ var Renderer = class {
|
|
|
555
554
|
...resolved
|
|
556
555
|
}, signal);
|
|
557
556
|
}
|
|
558
|
-
async encodeFrames(frames, options) {
|
|
559
|
-
const { fonts, fontFamilies, signal, images, subset, ...rest } = options;
|
|
560
|
-
const nodes = frames.map((frame) => frame.node);
|
|
561
|
-
const resolved = await this.resolveResources(pickFonts({
|
|
562
|
-
fonts,
|
|
563
|
-
source: nodes,
|
|
564
|
-
subset
|
|
565
|
-
}), images, fontFamilies);
|
|
566
|
-
return this.inner.encodeFrames(frames, {
|
|
567
|
-
...rest,
|
|
568
|
-
...resolved
|
|
569
|
-
}, signal);
|
|
570
|
-
}
|
|
571
557
|
async registerFont(font) {
|
|
572
|
-
const
|
|
558
|
+
const loader = typeof font === "string" ? fontFromUrl(font) : font;
|
|
559
|
+
const key = createFontKey(loader);
|
|
573
560
|
const cached = this.getFont(key);
|
|
574
561
|
if (cached) return cached;
|
|
575
|
-
const extracted = extractFontBuffer(
|
|
576
|
-
const register = (data) => this.inner.registerFont(isBuffer(
|
|
577
|
-
...
|
|
562
|
+
const extracted = extractFontBuffer(loader);
|
|
563
|
+
const register = (data) => this.inner.registerFont(isBuffer(loader) ? data : {
|
|
564
|
+
...loader,
|
|
578
565
|
data
|
|
579
566
|
});
|
|
580
567
|
if (isBuffer(extracted)) {
|
|
@@ -598,10 +585,7 @@ function extractFontBuffer(font) {
|
|
|
598
585
|
function createFontKey(font) {
|
|
599
586
|
if (isBuffer(font)) return font;
|
|
600
587
|
if ("key" in font && font.key) return font.key;
|
|
601
|
-
if (typeof font.data === "function") {
|
|
602
|
-
var _font$name, _font$weight, _font$style;
|
|
603
|
-
return `${(_font$name = font.name) !== null && _font$name !== void 0 ? _font$name : ""}:${(_font$weight = font.weight) !== null && _font$weight !== void 0 ? _font$weight : ""}:${(_font$style = font.style) !== null && _font$style !== void 0 ? _font$style : ""}`;
|
|
604
|
-
}
|
|
588
|
+
if (typeof font.data === "function") return `${font.name ?? ""}:${font.weight ?? ""}:${font.style ?? ""}`;
|
|
605
589
|
return font.data;
|
|
606
590
|
}
|
|
607
591
|
function isBuffer(data) {
|
package/index.d.ts
CHANGED
|
@@ -57,16 +57,6 @@ export declare class Renderer {
|
|
|
57
57
|
measure(source: Node, options?: RenderOptions, signal?: AbortSignal): Promise<MeasuredNode>
|
|
58
58
|
/** Renders a sequential scene animation into a buffer asynchronously. */
|
|
59
59
|
renderAnimation(options: RenderAnimationOptions, signal?: AbortSignal): Promise<Buffer>
|
|
60
|
-
/** Encodes a precomputed frame sequence into an animated image buffer asynchronously. */
|
|
61
|
-
encodeFrames(source: AnimationFrameSource[], options: EncodeFramesOptions, signal?: AbortSignal): Promise<Buffer>
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** Represents a single frame in a precomputed animation sequence. */
|
|
65
|
-
export interface AnimationFrameSource {
|
|
66
|
-
/** The node tree to render for this frame. */
|
|
67
|
-
node: Node
|
|
68
|
-
/** The duration of this frame in milliseconds. */
|
|
69
|
-
durationMs: number
|
|
70
60
|
}
|
|
71
61
|
|
|
72
62
|
/** Output format for animated images. */
|
|
@@ -89,44 +79,6 @@ export type DitheringAlgorithm = 'none'|
|
|
|
89
79
|
'ordered-bayer'|
|
|
90
80
|
'floyd-steinberg';
|
|
91
81
|
|
|
92
|
-
/** Options for encoding a precomputed frame sequence. */
|
|
93
|
-
export interface EncodeFramesOptions {
|
|
94
|
-
/** Whether to draw debug borders around layout elements. */
|
|
95
|
-
drawDebugBorder?: boolean
|
|
96
|
-
/** The width of each frame in pixels. */
|
|
97
|
-
width: number
|
|
98
|
-
/** The height of each frame in pixels. */
|
|
99
|
-
height: number
|
|
100
|
-
/** The output animation format (WebP, APNG, or GIF). */
|
|
101
|
-
format?: AnimationOutputFormat
|
|
102
|
-
/**
|
|
103
|
-
* The quality of lossy WebP (0-100). Ignored for APNG and GIF, and when
|
|
104
|
-
* `lossless` is set.
|
|
105
|
-
*/
|
|
106
|
-
quality?: number
|
|
107
|
-
/**
|
|
108
|
-
* Encode WebP losslessly. Defaults to lossless when neither `quality` nor
|
|
109
|
-
* `lossless` is given. Ignored for APNG and GIF.
|
|
110
|
-
*/
|
|
111
|
-
lossless?: boolean
|
|
112
|
-
/** Images keyed by `src`, each carrying raw bytes. */
|
|
113
|
-
images?: Array<ImageSource>
|
|
114
|
-
/** CSS stylesheets to apply before rendering. */
|
|
115
|
-
stylesheets?: Array<string>
|
|
116
|
-
/**
|
|
117
|
-
* The device pixel ratio.
|
|
118
|
-
* @default 1.0
|
|
119
|
-
*/
|
|
120
|
-
devicePixelRatio?: number
|
|
121
|
-
/**
|
|
122
|
-
* Per-render font stack: ordered family names used as the fallback chain.
|
|
123
|
-
* Defaults to all registered families in registration order.
|
|
124
|
-
*/
|
|
125
|
-
fontFamilies?: Array<string>
|
|
126
|
-
/** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
|
|
127
|
-
lang?: string
|
|
128
|
-
}
|
|
129
|
-
|
|
130
82
|
/** Cache policy for a decoded image. Defaults to `"auto"`. */
|
|
131
83
|
export type ImageCacheMode = /** Cache the decoded image for reuse (evictable). */
|
|
132
84
|
'auto'|
|
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-rc.0",
|
|
4
4
|
"description": "Native Node.js bindings for the Takumi Rust image rendering engine.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -63,21 +63,21 @@
|
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "napi build --release --no-const-enum --platform --esm --strip",
|
|
66
|
-
"build:js": "tsdown
|
|
66
|
+
"build:js": "tsdown",
|
|
67
67
|
"prepublishOnly": "bun artifacts && napi prepublish -t npm --no-gh-release",
|
|
68
68
|
"artifacts": "napi create-npm-dirs && napi artifacts && napi version",
|
|
69
69
|
"bench": "bun tests/bench/index.tsx",
|
|
70
70
|
"publish-lint": "attw --pack . && publint --strict ."
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@takumi-rs/helpers": "2.0.0-
|
|
73
|
+
"@takumi-rs/helpers": "2.0.0-rc.0",
|
|
74
|
+
"csstype": "^3.2.3"
|
|
74
75
|
},
|
|
75
76
|
"devDependencies": {
|
|
76
77
|
"@napi-rs/cli": "3.7.2",
|
|
77
78
|
"@types/bun": "^1.3.14",
|
|
78
79
|
"@types/react": "19.2.17",
|
|
79
80
|
"@types/react-dom": "^19.2.3",
|
|
80
|
-
"csstype": "^3.2.3",
|
|
81
81
|
"lucide-react": "^1.21.0",
|
|
82
82
|
"mitata": "^1.0.34",
|
|
83
83
|
"react": "^19.2.7",
|
|
@@ -99,6 +99,16 @@
|
|
|
99
99
|
]
|
|
100
100
|
},
|
|
101
101
|
"engines": {
|
|
102
|
-
"node": ">=
|
|
102
|
+
"node": ">=18"
|
|
103
|
+
},
|
|
104
|
+
"optionalDependencies": {
|
|
105
|
+
"@takumi-rs/core-darwin-x64": "2.0.0-rc.0",
|
|
106
|
+
"@takumi-rs/core-darwin-arm64": "2.0.0-rc.0",
|
|
107
|
+
"@takumi-rs/core-linux-arm64-gnu": "2.0.0-rc.0",
|
|
108
|
+
"@takumi-rs/core-linux-arm64-musl": "2.0.0-rc.0",
|
|
109
|
+
"@takumi-rs/core-win32-arm64-msvc": "2.0.0-rc.0",
|
|
110
|
+
"@takumi-rs/core-linux-x64-gnu": "2.0.0-rc.0",
|
|
111
|
+
"@takumi-rs/core-linux-x64-musl": "2.0.0-rc.0",
|
|
112
|
+
"@takumi-rs/core-win32-x64-msvc": "2.0.0-rc.0"
|
|
103
113
|
}
|
|
104
|
-
}
|
|
114
|
+
}
|