@takumi-rs/core 2.0.0-beta.0 → 2.0.0-beta.10

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 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
62
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
76
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
91
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
105
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
120
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
134
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
149
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
163
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
177
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
192
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
206
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
221
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
235
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
250
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
264
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
279
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
293
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
308
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
322
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
337
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
351
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
366
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
380
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
395
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
409
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
423
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
424
424
  return binding;
425
425
  } catch (e) {
426
426
  loadErrors.push(e);
@@ -479,8 +479,20 @@ async function resolveImageLoaders(images) {
479
479
  })));
480
480
  }
481
481
  var Renderer = class {
482
- fontMapping = /* @__PURE__ */ new Map();
482
+ fontsByKey = /* @__PURE__ */ new Map();
483
+ fontsByData = /* @__PURE__ */ new WeakMap();
483
484
  inner = new Renderer$1();
485
+ getFont(key) {
486
+ return typeof key === "string" ? this.fontsByKey.get(key) : this.fontsByData.get(key);
487
+ }
488
+ setFont(key, family) {
489
+ if (typeof key === "string") this.fontsByKey.set(key, family);
490
+ else this.fontsByData.set(key, family);
491
+ }
492
+ deleteFont(key) {
493
+ if (typeof key === "string") this.fontsByKey.delete(key);
494
+ else this.fontsByData.delete(key);
495
+ }
484
496
  async prepareFonts(fonts) {
485
497
  if (!fonts) return;
486
498
  const families = await Promise.all(fonts.map(this.registerFont.bind(this)));
@@ -492,44 +504,66 @@ var Renderer = class {
492
504
  const registeredFamilies = await this.prepareFonts(fonts);
493
505
  return {
494
506
  images: images ? await resolveImageLoaders(images) : void 0,
495
- fontFamilies: fontFamilies !== null && fontFamilies !== void 0 ? fontFamilies : registeredFamilies
507
+ fontFamilies: fontFamilies ?? registeredFamilies
496
508
  };
497
509
  }
498
510
  async render(node, options) {
499
- const { fonts, fontFamilies, signal, images, ...rest } = options !== null && options !== void 0 ? options : {};
500
- const resolved = await this.resolveResources(fonts, images, fontFamilies);
511
+ const { fonts, fontFamilies, signal, images, subset, ...rest } = options ?? {};
512
+ const resolved = await this.resolveResources((0, _takumi_rs_helpers.pickFonts)({
513
+ fonts,
514
+ source: node,
515
+ subset
516
+ }), images, fontFamilies);
501
517
  return this.inner.render(node, {
502
518
  ...rest,
503
519
  ...resolved
504
520
  }, signal);
505
521
  }
506
522
  async renderSvg(node, options) {
507
- const { fonts, fontFamilies, signal, images, ...rest } = options !== null && options !== void 0 ? options : {};
508
- const resolved = await this.resolveResources(fonts, images, fontFamilies);
523
+ const { fonts, fontFamilies, signal, images, subset, ...rest } = options ?? {};
524
+ const resolved = await this.resolveResources((0, _takumi_rs_helpers.pickFonts)({
525
+ fonts,
526
+ source: node,
527
+ subset
528
+ }), images, fontFamilies);
509
529
  return this.inner.renderSvg(node, {
510
530
  ...rest,
511
531
  ...resolved
512
532
  }, signal);
513
533
  }
514
534
  async measure(node, options) {
515
- const { fonts, fontFamilies, signal, images, ...rest } = options !== null && options !== void 0 ? options : {};
516
- const resolved = await this.resolveResources(fonts, images, fontFamilies);
535
+ const { fonts, fontFamilies, signal, images, subset, ...rest } = options ?? {};
536
+ const resolved = await this.resolveResources((0, _takumi_rs_helpers.pickFonts)({
537
+ fonts,
538
+ source: node,
539
+ subset
540
+ }), images, fontFamilies);
517
541
  return this.inner.measure(node, {
518
542
  ...rest,
519
543
  ...resolved
520
544
  }, signal);
521
545
  }
522
546
  async renderAnimation(options) {
523
- const { fonts, fontFamilies, signal, images, ...rest } = options;
524
- const resolved = await this.resolveResources(fonts, images, fontFamilies);
547
+ const { fonts, fontFamilies, signal, images, subset, ...rest } = options;
548
+ const nodes = options.scenes.map((scene) => scene.node);
549
+ const resolved = await this.resolveResources((0, _takumi_rs_helpers.pickFonts)({
550
+ fonts,
551
+ source: nodes,
552
+ subset
553
+ }), images, fontFamilies);
525
554
  return this.inner.renderAnimation({
526
555
  ...rest,
527
556
  ...resolved
528
557
  }, signal);
529
558
  }
530
559
  async encodeFrames(frames, options) {
531
- const { fonts, fontFamilies, signal, images, ...rest } = options;
532
- const resolved = await this.resolveResources(fonts, images, fontFamilies);
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);
533
567
  return this.inner.encodeFrames(frames, {
534
568
  ...rest,
535
569
  ...resolved
@@ -537,19 +571,23 @@ var Renderer = class {
537
571
  }
538
572
  async registerFont(font) {
539
573
  const key = createFontKey(font);
540
- const cached = this.fontMapping.get(key);
574
+ const cached = this.getFont(key);
541
575
  if (cached) return cached;
542
576
  const extracted = extractFontBuffer(font);
577
+ const register = (data) => this.inner.registerFont(isBuffer(font) ? data : {
578
+ ...font,
579
+ data
580
+ });
543
581
  if (isBuffer(extracted)) {
544
- const binded = this.inner.registerFont(extracted);
545
- this.fontMapping.set(key, Promise.resolve(binded));
582
+ const binded = register(extracted);
583
+ this.setFont(key, Promise.resolve(binded));
546
584
  return binded;
547
585
  }
548
- const promise = extracted.then(this.inner.registerFont.bind(this.inner)).catch((error) => {
549
- this.fontMapping.delete(key);
586
+ const promise = extracted.then(register).catch((error) => {
587
+ this.deleteFont(key);
550
588
  throw error;
551
589
  });
552
- this.fontMapping.set(key, promise);
590
+ this.setFont(key, promise);
553
591
  return promise;
554
592
  }
555
593
  };
@@ -561,10 +599,7 @@ function extractFontBuffer(font) {
561
599
  function createFontKey(font) {
562
600
  if (isBuffer(font)) return font;
563
601
  if ("key" in font && font.key) return font.key;
564
- if (typeof font.data === "function") {
565
- var _font$name, _font$weight, _font$style;
566
- 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 : ""}`;
567
- }
602
+ if (typeof font.data === "function") return `${font.name ?? ""}:${font.weight ?? ""}:${font.style ?? ""}`;
568
603
  return font.data;
569
604
  }
570
605
  function isBuffer(data) {
@@ -572,9 +607,4 @@ function isBuffer(data) {
572
607
  }
573
608
  //#endregion
574
609
  exports.Renderer = Renderer;
575
- Object.defineProperty(exports, "extractResourceUrls", {
576
- enumerable: true,
577
- get: function() {
578
- return _takumi_rs_helpers.extractResourceUrls;
579
- }
580
- });
610
+ exports.extractResourceUrls = _takumi_rs_helpers.extractResourceUrls;
package/dist/export.d.cts CHANGED
@@ -20,6 +20,12 @@ interface FontDetails {
20
20
  * The style of the font. If not provided, the style in the font file will be used.
21
21
  */
22
22
  style?: "normal" | "italic" | "oblique" | `oblique ${number}deg` | (string & {});
23
+ /**
24
+ * Logical family this font is a coverage subset of. Subsets sharing a `subsetOf` are
25
+ * kept as distinct families and `font-family: {subsetOf}` expands to all of them, so each
26
+ * script routes to the subset that covers it. Set by {@link loadGoogleFonts}.
27
+ */
28
+ subsetOf?: string;
23
29
  }
24
30
  type Font = FontDetails | ByteBuf;
25
31
  type KeyframesMap = Record<string, Record<string, Properties>>;
@@ -82,6 +88,8 @@ interface EncodeFramesOptions$1 {
82
88
  * Defaults to all registered families in registration order.
83
89
  */
84
90
  fontFamilies?: Array<string>;
91
+ /** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
92
+ lang?: string;
85
93
  }
86
94
  /** Cache policy for a decoded image. Defaults to `"auto"`. */
87
95
  type ImageCacheMode = /** Cache the decoded image for reuse (evictable). */'auto' | /** Skip the decoded-image cache. */'none';
@@ -178,6 +186,8 @@ interface RenderAnimationOptions$1 {
178
186
  * Defaults to all registered families in registration order.
179
187
  */
180
188
  fontFamilies?: Array<string>;
189
+ /** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
190
+ lang?: string;
181
191
  }
182
192
  /** Options for rendering an image. */
183
193
  interface RenderOptions$1 {
@@ -219,6 +229,8 @@ interface RenderOptions$1 {
219
229
  * Defaults to all registered families in registration order.
220
230
  */
221
231
  fontFamilies?: Array<string>;
232
+ /** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
233
+ lang?: string;
222
234
  }
223
235
  /**
224
236
  * Options for rendering a node tree to an SVG document. SVG is a vector
@@ -243,11 +255,14 @@ interface SvgRenderOptions$1 {
243
255
  * Defaults to all registered families in registration order.
244
256
  */
245
257
  fontFamilies?: Array<string>;
258
+ /** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
259
+ lang?: string;
246
260
  }
247
261
  //#endregion
248
262
  //#region src/export.d.ts
249
263
  type FontLoader = Font | (Omit<FontDetails, "data"> & {
250
- data: () => Promise<FontDetails["data"]> | FontDetails["data"];
264
+ data: () => Promise<FontDetails["data"]> | FontDetails["data"]; /** Inclusive codepoint ranges this face covers; lets `render` skip it when unused. */
265
+ ranges?: [number, number][];
251
266
  } & ({
252
267
  key: string;
253
268
  } | {
@@ -280,7 +295,8 @@ type OutputFormatOptions = {
280
295
  type RenderOptions = Omit<RenderOptions$1, "images" | "format" | "quality" | "lossless"> & OutputFormatOptions & {
281
296
  fonts?: FontLoader[];
282
297
  signal?: AbortSignal;
283
- images?: ImageLoader[];
298
+ images?: ImageLoader[]; /** Register only the `fonts` subsets the content renders. @default true */
299
+ subset?: boolean;
284
300
  };
285
301
  /**
286
302
  * Animation output format. `quality` and `lossless` are WebP-only; for WebP,
@@ -299,21 +315,28 @@ type AnimationOutputFormatOptions = {
299
315
  type RenderAnimationOptions = Omit<RenderAnimationOptions$1, "images" | "format" | "quality" | "lossless"> & AnimationOutputFormatOptions & {
300
316
  fonts?: FontLoader[];
301
317
  signal?: AbortSignal;
302
- images?: ImageLoader[];
318
+ images?: ImageLoader[]; /** Register only the `fonts` subsets the content renders. @default true */
319
+ subset?: boolean;
303
320
  };
304
321
  type EncodeFramesOptions = Omit<EncodeFramesOptions$1, "images" | "format" | "quality" | "lossless"> & AnimationOutputFormatOptions & {
305
322
  fonts?: FontLoader[];
306
323
  signal?: AbortSignal;
307
- images?: ImageLoader[];
324
+ images?: ImageLoader[]; /** Register only the `fonts` subsets the content renders. @default true */
325
+ subset?: boolean;
308
326
  };
309
327
  type SvgRenderOptions = Omit<SvgRenderOptions$1, "images"> & {
310
328
  fonts?: FontLoader[];
311
329
  signal?: AbortSignal;
312
- images?: ImageLoader[];
330
+ images?: ImageLoader[]; /** Register only the `fonts` subsets the content renders. @default true */
331
+ subset?: boolean;
313
332
  };
314
333
  declare class Renderer {
315
- private fontMapping;
334
+ private fontsByKey;
335
+ private fontsByData;
316
336
  private inner;
337
+ private getFont;
338
+ private setFont;
339
+ private deleteFont;
317
340
  private prepareFonts;
318
341
  /** Registers `fonts` and resolves lazy `images`, yielding the `images`/`fontFamilies`
319
342
  * the napi binding expects. Explicit `fontFamilies` wins over the registered set. */
package/dist/export.d.mts CHANGED
@@ -20,6 +20,12 @@ interface FontDetails {
20
20
  * The style of the font. If not provided, the style in the font file will be used.
21
21
  */
22
22
  style?: "normal" | "italic" | "oblique" | `oblique ${number}deg` | (string & {});
23
+ /**
24
+ * Logical family this font is a coverage subset of. Subsets sharing a `subsetOf` are
25
+ * kept as distinct families and `font-family: {subsetOf}` expands to all of them, so each
26
+ * script routes to the subset that covers it. Set by {@link loadGoogleFonts}.
27
+ */
28
+ subsetOf?: string;
23
29
  }
24
30
  type Font = FontDetails | ByteBuf;
25
31
  type KeyframesMap = Record<string, Record<string, Properties>>;
@@ -82,6 +88,8 @@ interface EncodeFramesOptions$1 {
82
88
  * Defaults to all registered families in registration order.
83
89
  */
84
90
  fontFamilies?: Array<string>;
91
+ /** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
92
+ lang?: string;
85
93
  }
86
94
  /** Cache policy for a decoded image. Defaults to `"auto"`. */
87
95
  type ImageCacheMode = /** Cache the decoded image for reuse (evictable). */'auto' | /** Skip the decoded-image cache. */'none';
@@ -178,6 +186,8 @@ interface RenderAnimationOptions$1 {
178
186
  * Defaults to all registered families in registration order.
179
187
  */
180
188
  fontFamilies?: Array<string>;
189
+ /** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
190
+ lang?: string;
181
191
  }
182
192
  /** Options for rendering an image. */
183
193
  interface RenderOptions$1 {
@@ -219,6 +229,8 @@ interface RenderOptions$1 {
219
229
  * Defaults to all registered families in registration order.
220
230
  */
221
231
  fontFamilies?: Array<string>;
232
+ /** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
233
+ lang?: string;
222
234
  }
223
235
  /**
224
236
  * Options for rendering a node tree to an SVG document. SVG is a vector
@@ -243,11 +255,14 @@ interface SvgRenderOptions$1 {
243
255
  * Defaults to all registered families in registration order.
244
256
  */
245
257
  fontFamilies?: Array<string>;
258
+ /** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
259
+ lang?: string;
246
260
  }
247
261
  //#endregion
248
262
  //#region src/export.d.ts
249
263
  type FontLoader = Font | (Omit<FontDetails, "data"> & {
250
- data: () => Promise<FontDetails["data"]> | FontDetails["data"];
264
+ data: () => Promise<FontDetails["data"]> | FontDetails["data"]; /** Inclusive codepoint ranges this face covers; lets `render` skip it when unused. */
265
+ ranges?: [number, number][];
251
266
  } & ({
252
267
  key: string;
253
268
  } | {
@@ -280,7 +295,8 @@ type OutputFormatOptions = {
280
295
  type RenderOptions = Omit<RenderOptions$1, "images" | "format" | "quality" | "lossless"> & OutputFormatOptions & {
281
296
  fonts?: FontLoader[];
282
297
  signal?: AbortSignal;
283
- images?: ImageLoader[];
298
+ images?: ImageLoader[]; /** Register only the `fonts` subsets the content renders. @default true */
299
+ subset?: boolean;
284
300
  };
285
301
  /**
286
302
  * Animation output format. `quality` and `lossless` are WebP-only; for WebP,
@@ -299,21 +315,28 @@ type AnimationOutputFormatOptions = {
299
315
  type RenderAnimationOptions = Omit<RenderAnimationOptions$1, "images" | "format" | "quality" | "lossless"> & AnimationOutputFormatOptions & {
300
316
  fonts?: FontLoader[];
301
317
  signal?: AbortSignal;
302
- images?: ImageLoader[];
318
+ images?: ImageLoader[]; /** Register only the `fonts` subsets the content renders. @default true */
319
+ subset?: boolean;
303
320
  };
304
321
  type EncodeFramesOptions = Omit<EncodeFramesOptions$1, "images" | "format" | "quality" | "lossless"> & AnimationOutputFormatOptions & {
305
322
  fonts?: FontLoader[];
306
323
  signal?: AbortSignal;
307
- images?: ImageLoader[];
324
+ images?: ImageLoader[]; /** Register only the `fonts` subsets the content renders. @default true */
325
+ subset?: boolean;
308
326
  };
309
327
  type SvgRenderOptions = Omit<SvgRenderOptions$1, "images"> & {
310
328
  fonts?: FontLoader[];
311
329
  signal?: AbortSignal;
312
- images?: ImageLoader[];
330
+ images?: ImageLoader[]; /** Register only the `fonts` subsets the content renders. @default true */
331
+ subset?: boolean;
313
332
  };
314
333
  declare class Renderer {
315
- private fontMapping;
334
+ private fontsByKey;
335
+ private fontsByData;
316
336
  private inner;
337
+ private getFont;
338
+ private setFont;
339
+ private deleteFont;
317
340
  private prepareFonts;
318
341
  /** Registers `fonts` and resolves lazy `images`, yielding the `images`/`fontFamilies`
319
342
  * the napi binding expects. Explicit `fontFamilies` wins over the registered set. */
package/dist/export.mjs CHANGED
@@ -1,8 +1,7 @@
1
1
  import { createRequire } from "module";
2
- import { extractResourceUrls } from "@takumi-rs/helpers";
2
+ import { extractResourceUrls, 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
60
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
74
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
89
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
103
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
118
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
132
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
147
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
161
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
175
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
190
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
204
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
219
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
233
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
248
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
262
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
277
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
291
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
306
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
320
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
335
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
349
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
364
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
378
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
393
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
407
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 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-beta.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-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
421
+ if (bindingPackageVersion !== "2.0.0-beta.10" && 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-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
423
422
  return binding;
424
423
  } catch (e) {
425
424
  loadErrors.push(e);
@@ -478,8 +477,20 @@ async function resolveImageLoaders(images) {
478
477
  })));
479
478
  }
480
479
  var Renderer = class {
481
- fontMapping = /* @__PURE__ */ new Map();
480
+ fontsByKey = /* @__PURE__ */ new Map();
481
+ fontsByData = /* @__PURE__ */ new WeakMap();
482
482
  inner = new Renderer$1();
483
+ getFont(key) {
484
+ return typeof key === "string" ? this.fontsByKey.get(key) : this.fontsByData.get(key);
485
+ }
486
+ setFont(key, family) {
487
+ if (typeof key === "string") this.fontsByKey.set(key, family);
488
+ else this.fontsByData.set(key, family);
489
+ }
490
+ deleteFont(key) {
491
+ if (typeof key === "string") this.fontsByKey.delete(key);
492
+ else this.fontsByData.delete(key);
493
+ }
483
494
  async prepareFonts(fonts) {
484
495
  if (!fonts) return;
485
496
  const families = await Promise.all(fonts.map(this.registerFont.bind(this)));
@@ -491,44 +502,66 @@ var Renderer = class {
491
502
  const registeredFamilies = await this.prepareFonts(fonts);
492
503
  return {
493
504
  images: images ? await resolveImageLoaders(images) : void 0,
494
- fontFamilies: fontFamilies !== null && fontFamilies !== void 0 ? fontFamilies : registeredFamilies
505
+ fontFamilies: fontFamilies ?? registeredFamilies
495
506
  };
496
507
  }
497
508
  async render(node, options) {
498
- const { fonts, fontFamilies, signal, images, ...rest } = options !== null && options !== void 0 ? options : {};
499
- const resolved = await this.resolveResources(fonts, images, fontFamilies);
509
+ const { fonts, fontFamilies, signal, images, subset, ...rest } = options ?? {};
510
+ const resolved = await this.resolveResources(pickFonts({
511
+ fonts,
512
+ source: node,
513
+ subset
514
+ }), images, fontFamilies);
500
515
  return this.inner.render(node, {
501
516
  ...rest,
502
517
  ...resolved
503
518
  }, signal);
504
519
  }
505
520
  async renderSvg(node, options) {
506
- const { fonts, fontFamilies, signal, images, ...rest } = options !== null && options !== void 0 ? options : {};
507
- const resolved = await this.resolveResources(fonts, images, fontFamilies);
521
+ const { fonts, fontFamilies, signal, images, subset, ...rest } = options ?? {};
522
+ const resolved = await this.resolveResources(pickFonts({
523
+ fonts,
524
+ source: node,
525
+ subset
526
+ }), images, fontFamilies);
508
527
  return this.inner.renderSvg(node, {
509
528
  ...rest,
510
529
  ...resolved
511
530
  }, signal);
512
531
  }
513
532
  async measure(node, options) {
514
- const { fonts, fontFamilies, signal, images, ...rest } = options !== null && options !== void 0 ? options : {};
515
- const resolved = await this.resolveResources(fonts, images, fontFamilies);
533
+ const { fonts, fontFamilies, signal, images, subset, ...rest } = options ?? {};
534
+ const resolved = await this.resolveResources(pickFonts({
535
+ fonts,
536
+ source: node,
537
+ subset
538
+ }), images, fontFamilies);
516
539
  return this.inner.measure(node, {
517
540
  ...rest,
518
541
  ...resolved
519
542
  }, signal);
520
543
  }
521
544
  async renderAnimation(options) {
522
- const { fonts, fontFamilies, signal, images, ...rest } = options;
523
- const resolved = await this.resolveResources(fonts, images, fontFamilies);
545
+ const { fonts, fontFamilies, signal, images, subset, ...rest } = options;
546
+ const nodes = options.scenes.map((scene) => scene.node);
547
+ const resolved = await this.resolveResources(pickFonts({
548
+ fonts,
549
+ source: nodes,
550
+ subset
551
+ }), images, fontFamilies);
524
552
  return this.inner.renderAnimation({
525
553
  ...rest,
526
554
  ...resolved
527
555
  }, signal);
528
556
  }
529
557
  async encodeFrames(frames, options) {
530
- const { fonts, fontFamilies, signal, images, ...rest } = options;
531
- const resolved = await this.resolveResources(fonts, images, fontFamilies);
558
+ const { fonts, fontFamilies, signal, images, subset, ...rest } = options;
559
+ const nodes = frames.map((frame) => frame.node);
560
+ const resolved = await this.resolveResources(pickFonts({
561
+ fonts,
562
+ source: nodes,
563
+ subset
564
+ }), images, fontFamilies);
532
565
  return this.inner.encodeFrames(frames, {
533
566
  ...rest,
534
567
  ...resolved
@@ -536,19 +569,23 @@ var Renderer = class {
536
569
  }
537
570
  async registerFont(font) {
538
571
  const key = createFontKey(font);
539
- const cached = this.fontMapping.get(key);
572
+ const cached = this.getFont(key);
540
573
  if (cached) return cached;
541
574
  const extracted = extractFontBuffer(font);
575
+ const register = (data) => this.inner.registerFont(isBuffer(font) ? data : {
576
+ ...font,
577
+ data
578
+ });
542
579
  if (isBuffer(extracted)) {
543
- const binded = this.inner.registerFont(extracted);
544
- this.fontMapping.set(key, Promise.resolve(binded));
580
+ const binded = register(extracted);
581
+ this.setFont(key, Promise.resolve(binded));
545
582
  return binded;
546
583
  }
547
- const promise = extracted.then(this.inner.registerFont.bind(this.inner)).catch((error) => {
548
- this.fontMapping.delete(key);
584
+ const promise = extracted.then(register).catch((error) => {
585
+ this.deleteFont(key);
549
586
  throw error;
550
587
  });
551
- this.fontMapping.set(key, promise);
588
+ this.setFont(key, promise);
552
589
  return promise;
553
590
  }
554
591
  };
@@ -560,10 +597,7 @@ function extractFontBuffer(font) {
560
597
  function createFontKey(font) {
561
598
  if (isBuffer(font)) return font;
562
599
  if ("key" in font && font.key) return font.key;
563
- if (typeof font.data === "function") {
564
- var _font$name, _font$weight, _font$style;
565
- 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 : ""}`;
566
- }
600
+ if (typeof font.data === "function") return `${font.name ?? ""}:${font.weight ?? ""}:${font.style ?? ""}`;
567
601
  return font.data;
568
602
  }
569
603
  function isBuffer(data) {
package/index.d.ts CHANGED
@@ -24,6 +24,12 @@ export interface FontDetails {
24
24
  * The style of the font. If not provided, the style in the font file will be used.
25
25
  */
26
26
  style?: "normal" | "italic" | "oblique" | `oblique ${number}deg` | (string & {});
27
+ /**
28
+ * Logical family this font is a coverage subset of. Subsets sharing a `subsetOf` are
29
+ * kept as distinct families and `font-family: {subsetOf}` expands to all of them, so each
30
+ * script routes to the subset that covers it. Set by {@link loadGoogleFonts}.
31
+ */
32
+ subsetOf?: string;
27
33
  }
28
34
 
29
35
  export type Font = FontDetails | ByteBuf;
@@ -117,6 +123,8 @@ export interface EncodeFramesOptions {
117
123
  * Defaults to all registered families in registration order.
118
124
  */
119
125
  fontFamilies?: Array<string>
126
+ /** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
127
+ lang?: string
120
128
  }
121
129
 
122
130
  /** Cache policy for a decoded image. Defaults to `"auto"`. */
@@ -233,6 +241,8 @@ export interface RenderAnimationOptions {
233
241
  * Defaults to all registered families in registration order.
234
242
  */
235
243
  fontFamilies?: Array<string>
244
+ /** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
245
+ lang?: string
236
246
  }
237
247
 
238
248
  /** Options for rendering an image. */
@@ -275,6 +285,8 @@ export interface RenderOptions {
275
285
  * Defaults to all registered families in registration order.
276
286
  */
277
287
  fontFamilies?: Array<string>
288
+ /** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
289
+ lang?: string
278
290
  }
279
291
 
280
292
  /**
@@ -300,4 +312,6 @@ export interface SvgRenderOptions {
300
312
  * Defaults to all registered families in registration order.
301
313
  */
302
314
  fontFamilies?: Array<string>
315
+ /** Default BCP-47 language applied to the root, inherited by nodes without their own lang. */
316
+ lang?: string
303
317
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/core",
3
- "version": "2.0.0-beta.0",
3
+ "version": "2.0.0-beta.10",
4
4
  "description": "Native Node.js bindings for the Takumi Rust image rendering engine.",
5
5
  "keywords": [
6
6
  "css",
@@ -63,27 +63,26 @@
63
63
  },
64
64
  "scripts": {
65
65
  "build": "napi build --release --no-const-enum --platform --esm --strip",
66
- "build:js": "tsdown && bun scripts/patch-dist-loader.ts",
67
- "prepublishOnly": "jq '.dependencies[\"@takumi-rs/helpers\"] = .version' package.json > tmp.json && mv tmp.json package.json && bun artifacts && napi prepublish -t npm --no-gh-release",
66
+ "build:js": "tsdown",
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-beta.0"
73
+ "@takumi-rs/helpers": "2.0.0-beta.10"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@napi-rs/cli": "3.7.2",
77
- "@types/bun": "catalog:",
78
- "@types/react": "catalog:",
79
- "@types/react-dom": "catalog:",
77
+ "@types/bun": "^1.3.14",
78
+ "@types/react": "19.2.17",
79
+ "@types/react-dom": "^19.2.3",
80
80
  "csstype": "^3.2.3",
81
- "lucide-react": "catalog:",
81
+ "lucide-react": "^1.21.0",
82
82
  "mitata": "^1.0.34",
83
- "react": "catalog:",
84
- "tsdown": "catalog:",
85
- "typescript": "catalog:",
86
- "unrun": "catalog:"
83
+ "react": "^19.2.7",
84
+ "tsdown": "^0.22.3",
85
+ "unrun": "^0.3.1"
87
86
  },
88
87
  "napi": {
89
88
  "binaryName": "core",
@@ -100,16 +99,6 @@
100
99
  ]
101
100
  },
102
101
  "engines": {
103
- "node": ">= 12.22.0 < 13 || >= 14.17.0 < 15 || >= 15.12.0 < 16 || >= 16.0.0"
104
- },
105
- "optionalDependencies": {
106
- "@takumi-rs/core-darwin-x64": "2.0.0-beta.0",
107
- "@takumi-rs/core-darwin-arm64": "2.0.0-beta.0",
108
- "@takumi-rs/core-linux-arm64-gnu": "2.0.0-beta.0",
109
- "@takumi-rs/core-linux-arm64-musl": "2.0.0-beta.0",
110
- "@takumi-rs/core-win32-arm64-msvc": "2.0.0-beta.0",
111
- "@takumi-rs/core-linux-x64-gnu": "2.0.0-beta.0",
112
- "@takumi-rs/core-linux-x64-musl": "2.0.0-beta.0",
113
- "@takumi-rs/core-win32-x64-msvc": "2.0.0-beta.0"
102
+ "node": ">=18"
114
103
  }
115
- }
104
+ }