@takumi-rs/core 0.29.8 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/index.js +100 -51
- package/package.json +19 -10
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
# @takumi-rs/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Takumi is a **image rendering engine** written in Rust and this package provides Node.js bindings using [napi-rs](https://napi.rs/).
|
|
4
|
+
|
|
5
|
+
If you are looking for WebAssembly bindings, please refer to the [@takumi-rs/wasm](https://npmjs.com/package/@takumi-rs/wasm) package.
|
|
6
|
+
|
|
7
|
+
Please refer to the [Use Takumi in Node.js or Bun](https://takumi.kane.tw/docs/getting-started/nodejs) page in our official documentation for more details.
|
package/index.js
CHANGED
|
@@ -66,7 +66,7 @@ const isMuslFromChildProcess = () => {
|
|
|
66
66
|
function requireNative() {
|
|
67
67
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
68
68
|
try {
|
|
69
|
-
|
|
69
|
+
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
70
70
|
} catch (err) {
|
|
71
71
|
loadErrors.push(err)
|
|
72
72
|
}
|
|
@@ -80,8 +80,8 @@ function requireNative() {
|
|
|
80
80
|
try {
|
|
81
81
|
const binding = require('@takumi-rs/core-android-arm64')
|
|
82
82
|
const bindingPackageVersion = require('@takumi-rs/core-android-arm64/package.json').version
|
|
83
|
-
if (bindingPackageVersion !== '0.
|
|
84
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
83
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
84
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
85
85
|
}
|
|
86
86
|
return binding
|
|
87
87
|
} catch (e) {
|
|
@@ -96,8 +96,8 @@ function requireNative() {
|
|
|
96
96
|
try {
|
|
97
97
|
const binding = require('@takumi-rs/core-android-arm-eabi')
|
|
98
98
|
const bindingPackageVersion = require('@takumi-rs/core-android-arm-eabi/package.json').version
|
|
99
|
-
if (bindingPackageVersion !== '0.
|
|
100
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
99
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
100
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
101
101
|
}
|
|
102
102
|
return binding
|
|
103
103
|
} catch (e) {
|
|
@@ -116,8 +116,8 @@ function requireNative() {
|
|
|
116
116
|
try {
|
|
117
117
|
const binding = require('@takumi-rs/core-win32-x64-msvc')
|
|
118
118
|
const bindingPackageVersion = require('@takumi-rs/core-win32-x64-msvc/package.json').version
|
|
119
|
-
if (bindingPackageVersion !== '0.
|
|
120
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
119
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
120
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
121
121
|
}
|
|
122
122
|
return binding
|
|
123
123
|
} catch (e) {
|
|
@@ -132,8 +132,8 @@ function requireNative() {
|
|
|
132
132
|
try {
|
|
133
133
|
const binding = require('@takumi-rs/core-win32-ia32-msvc')
|
|
134
134
|
const bindingPackageVersion = require('@takumi-rs/core-win32-ia32-msvc/package.json').version
|
|
135
|
-
if (bindingPackageVersion !== '0.
|
|
136
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
135
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
136
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
137
137
|
}
|
|
138
138
|
return binding
|
|
139
139
|
} catch (e) {
|
|
@@ -148,8 +148,8 @@ function requireNative() {
|
|
|
148
148
|
try {
|
|
149
149
|
const binding = require('@takumi-rs/core-win32-arm64-msvc')
|
|
150
150
|
const bindingPackageVersion = require('@takumi-rs/core-win32-arm64-msvc/package.json').version
|
|
151
|
-
if (bindingPackageVersion !== '0.
|
|
152
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
151
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
152
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
153
153
|
}
|
|
154
154
|
return binding
|
|
155
155
|
} catch (e) {
|
|
@@ -167,8 +167,8 @@ function requireNative() {
|
|
|
167
167
|
try {
|
|
168
168
|
const binding = require('@takumi-rs/core-darwin-universal')
|
|
169
169
|
const bindingPackageVersion = require('@takumi-rs/core-darwin-universal/package.json').version
|
|
170
|
-
if (bindingPackageVersion !== '0.
|
|
171
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
170
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
171
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
172
172
|
}
|
|
173
173
|
return binding
|
|
174
174
|
} catch (e) {
|
|
@@ -183,8 +183,8 @@ function requireNative() {
|
|
|
183
183
|
try {
|
|
184
184
|
const binding = require('@takumi-rs/core-darwin-x64')
|
|
185
185
|
const bindingPackageVersion = require('@takumi-rs/core-darwin-x64/package.json').version
|
|
186
|
-
if (bindingPackageVersion !== '0.
|
|
187
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
186
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
187
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
188
188
|
}
|
|
189
189
|
return binding
|
|
190
190
|
} catch (e) {
|
|
@@ -199,8 +199,8 @@ function requireNative() {
|
|
|
199
199
|
try {
|
|
200
200
|
const binding = require('@takumi-rs/core-darwin-arm64')
|
|
201
201
|
const bindingPackageVersion = require('@takumi-rs/core-darwin-arm64/package.json').version
|
|
202
|
-
if (bindingPackageVersion !== '0.
|
|
203
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
202
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
203
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
204
204
|
}
|
|
205
205
|
return binding
|
|
206
206
|
} catch (e) {
|
|
@@ -219,8 +219,8 @@ function requireNative() {
|
|
|
219
219
|
try {
|
|
220
220
|
const binding = require('@takumi-rs/core-freebsd-x64')
|
|
221
221
|
const bindingPackageVersion = require('@takumi-rs/core-freebsd-x64/package.json').version
|
|
222
|
-
if (bindingPackageVersion !== '0.
|
|
223
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
222
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
223
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
224
224
|
}
|
|
225
225
|
return binding
|
|
226
226
|
} catch (e) {
|
|
@@ -235,8 +235,8 @@ function requireNative() {
|
|
|
235
235
|
try {
|
|
236
236
|
const binding = require('@takumi-rs/core-freebsd-arm64')
|
|
237
237
|
const bindingPackageVersion = require('@takumi-rs/core-freebsd-arm64/package.json').version
|
|
238
|
-
if (bindingPackageVersion !== '0.
|
|
239
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
238
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
239
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
240
240
|
}
|
|
241
241
|
return binding
|
|
242
242
|
} catch (e) {
|
|
@@ -256,8 +256,8 @@ function requireNative() {
|
|
|
256
256
|
try {
|
|
257
257
|
const binding = require('@takumi-rs/core-linux-x64-musl')
|
|
258
258
|
const bindingPackageVersion = require('@takumi-rs/core-linux-x64-musl/package.json').version
|
|
259
|
-
if (bindingPackageVersion !== '0.
|
|
260
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
259
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
260
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
261
261
|
}
|
|
262
262
|
return binding
|
|
263
263
|
} catch (e) {
|
|
@@ -272,8 +272,8 @@ function requireNative() {
|
|
|
272
272
|
try {
|
|
273
273
|
const binding = require('@takumi-rs/core-linux-x64-gnu')
|
|
274
274
|
const bindingPackageVersion = require('@takumi-rs/core-linux-x64-gnu/package.json').version
|
|
275
|
-
if (bindingPackageVersion !== '0.
|
|
276
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
275
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
276
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
277
277
|
}
|
|
278
278
|
return binding
|
|
279
279
|
} catch (e) {
|
|
@@ -290,8 +290,8 @@ function requireNative() {
|
|
|
290
290
|
try {
|
|
291
291
|
const binding = require('@takumi-rs/core-linux-arm64-musl')
|
|
292
292
|
const bindingPackageVersion = require('@takumi-rs/core-linux-arm64-musl/package.json').version
|
|
293
|
-
if (bindingPackageVersion !== '0.
|
|
294
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
293
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
294
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
295
295
|
}
|
|
296
296
|
return binding
|
|
297
297
|
} catch (e) {
|
|
@@ -306,8 +306,8 @@ function requireNative() {
|
|
|
306
306
|
try {
|
|
307
307
|
const binding = require('@takumi-rs/core-linux-arm64-gnu')
|
|
308
308
|
const bindingPackageVersion = require('@takumi-rs/core-linux-arm64-gnu/package.json').version
|
|
309
|
-
if (bindingPackageVersion !== '0.
|
|
310
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
309
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
310
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
311
311
|
}
|
|
312
312
|
return binding
|
|
313
313
|
} catch (e) {
|
|
@@ -324,8 +324,8 @@ function requireNative() {
|
|
|
324
324
|
try {
|
|
325
325
|
const binding = require('@takumi-rs/core-linux-arm-musleabihf')
|
|
326
326
|
const bindingPackageVersion = require('@takumi-rs/core-linux-arm-musleabihf/package.json').version
|
|
327
|
-
if (bindingPackageVersion !== '0.
|
|
328
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
327
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
328
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
329
329
|
}
|
|
330
330
|
return binding
|
|
331
331
|
} catch (e) {
|
|
@@ -340,8 +340,42 @@ function requireNative() {
|
|
|
340
340
|
try {
|
|
341
341
|
const binding = require('@takumi-rs/core-linux-arm-gnueabihf')
|
|
342
342
|
const bindingPackageVersion = require('@takumi-rs/core-linux-arm-gnueabihf/package.json').version
|
|
343
|
-
if (bindingPackageVersion !== '0.
|
|
344
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
343
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
344
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
345
|
+
}
|
|
346
|
+
return binding
|
|
347
|
+
} catch (e) {
|
|
348
|
+
loadErrors.push(e)
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
} else if (process.arch === 'loong64') {
|
|
352
|
+
if (isMusl()) {
|
|
353
|
+
try {
|
|
354
|
+
return require('./core.linux-loong64-musl.node')
|
|
355
|
+
} catch (e) {
|
|
356
|
+
loadErrors.push(e)
|
|
357
|
+
}
|
|
358
|
+
try {
|
|
359
|
+
const binding = require('@takumi-rs/core-linux-loong64-musl')
|
|
360
|
+
const bindingPackageVersion = require('@takumi-rs/core-linux-loong64-musl/package.json').version
|
|
361
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
362
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
363
|
+
}
|
|
364
|
+
return binding
|
|
365
|
+
} catch (e) {
|
|
366
|
+
loadErrors.push(e)
|
|
367
|
+
}
|
|
368
|
+
} else {
|
|
369
|
+
try {
|
|
370
|
+
return require('./core.linux-loong64-gnu.node')
|
|
371
|
+
} catch (e) {
|
|
372
|
+
loadErrors.push(e)
|
|
373
|
+
}
|
|
374
|
+
try {
|
|
375
|
+
const binding = require('@takumi-rs/core-linux-loong64-gnu')
|
|
376
|
+
const bindingPackageVersion = require('@takumi-rs/core-linux-loong64-gnu/package.json').version
|
|
377
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
378
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
345
379
|
}
|
|
346
380
|
return binding
|
|
347
381
|
} catch (e) {
|
|
@@ -358,8 +392,8 @@ function requireNative() {
|
|
|
358
392
|
try {
|
|
359
393
|
const binding = require('@takumi-rs/core-linux-riscv64-musl')
|
|
360
394
|
const bindingPackageVersion = require('@takumi-rs/core-linux-riscv64-musl/package.json').version
|
|
361
|
-
if (bindingPackageVersion !== '0.
|
|
362
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
395
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
396
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
363
397
|
}
|
|
364
398
|
return binding
|
|
365
399
|
} catch (e) {
|
|
@@ -374,8 +408,8 @@ function requireNative() {
|
|
|
374
408
|
try {
|
|
375
409
|
const binding = require('@takumi-rs/core-linux-riscv64-gnu')
|
|
376
410
|
const bindingPackageVersion = require('@takumi-rs/core-linux-riscv64-gnu/package.json').version
|
|
377
|
-
if (bindingPackageVersion !== '0.
|
|
378
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
411
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
412
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
379
413
|
}
|
|
380
414
|
return binding
|
|
381
415
|
} catch (e) {
|
|
@@ -391,8 +425,8 @@ function requireNative() {
|
|
|
391
425
|
try {
|
|
392
426
|
const binding = require('@takumi-rs/core-linux-ppc64-gnu')
|
|
393
427
|
const bindingPackageVersion = require('@takumi-rs/core-linux-ppc64-gnu/package.json').version
|
|
394
|
-
if (bindingPackageVersion !== '0.
|
|
395
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
428
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
429
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
396
430
|
}
|
|
397
431
|
return binding
|
|
398
432
|
} catch (e) {
|
|
@@ -407,8 +441,8 @@ function requireNative() {
|
|
|
407
441
|
try {
|
|
408
442
|
const binding = require('@takumi-rs/core-linux-s390x-gnu')
|
|
409
443
|
const bindingPackageVersion = require('@takumi-rs/core-linux-s390x-gnu/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
444
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
445
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
446
|
}
|
|
413
447
|
return binding
|
|
414
448
|
} catch (e) {
|
|
@@ -427,8 +461,8 @@ function requireNative() {
|
|
|
427
461
|
try {
|
|
428
462
|
const binding = require('@takumi-rs/core-openharmony-arm64')
|
|
429
463
|
const bindingPackageVersion = require('@takumi-rs/core-openharmony-arm64/package.json').version
|
|
430
|
-
if (bindingPackageVersion !== '0.
|
|
431
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
464
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
465
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
432
466
|
}
|
|
433
467
|
return binding
|
|
434
468
|
} catch (e) {
|
|
@@ -443,8 +477,8 @@ function requireNative() {
|
|
|
443
477
|
try {
|
|
444
478
|
const binding = require('@takumi-rs/core-openharmony-x64')
|
|
445
479
|
const bindingPackageVersion = require('@takumi-rs/core-openharmony-x64/package.json').version
|
|
446
|
-
if (bindingPackageVersion !== '0.
|
|
447
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
480
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
481
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
448
482
|
}
|
|
449
483
|
return binding
|
|
450
484
|
} catch (e) {
|
|
@@ -459,8 +493,8 @@ function requireNative() {
|
|
|
459
493
|
try {
|
|
460
494
|
const binding = require('@takumi-rs/core-openharmony-arm')
|
|
461
495
|
const bindingPackageVersion = require('@takumi-rs/core-openharmony-arm/package.json').version
|
|
462
|
-
if (bindingPackageVersion !== '0.
|
|
463
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
496
|
+
if (bindingPackageVersion !== '0.30.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
497
|
+
throw new Error(`Native binding package version mismatch, expected 0.30.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
464
498
|
}
|
|
465
499
|
return binding
|
|
466
500
|
} catch (e) {
|
|
@@ -477,22 +511,32 @@ function requireNative() {
|
|
|
477
511
|
nativeBinding = requireNative()
|
|
478
512
|
|
|
479
513
|
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
514
|
+
let wasiBinding = null
|
|
515
|
+
let wasiBindingError = null
|
|
480
516
|
try {
|
|
481
|
-
|
|
517
|
+
wasiBinding = require('./core.wasi.cjs')
|
|
518
|
+
nativeBinding = wasiBinding
|
|
482
519
|
} catch (err) {
|
|
483
520
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
484
|
-
|
|
521
|
+
wasiBindingError = err
|
|
485
522
|
}
|
|
486
523
|
}
|
|
487
524
|
if (!nativeBinding) {
|
|
488
525
|
try {
|
|
489
|
-
|
|
526
|
+
wasiBinding = require('@takumi-rs/core-wasm32-wasi')
|
|
527
|
+
nativeBinding = wasiBinding
|
|
490
528
|
} catch (err) {
|
|
491
529
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
530
|
+
wasiBindingError.cause = err
|
|
492
531
|
loadErrors.push(err)
|
|
493
532
|
}
|
|
494
533
|
}
|
|
495
534
|
}
|
|
535
|
+
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
|
536
|
+
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
|
|
537
|
+
error.cause = wasiBindingError
|
|
538
|
+
throw error
|
|
539
|
+
}
|
|
496
540
|
}
|
|
497
541
|
|
|
498
542
|
if (!nativeBinding) {
|
|
@@ -501,7 +545,12 @@ if (!nativeBinding) {
|
|
|
501
545
|
`Cannot find native binding. ` +
|
|
502
546
|
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
503
547
|
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
|
504
|
-
{
|
|
548
|
+
{
|
|
549
|
+
cause: loadErrors.reduce((err, cur) => {
|
|
550
|
+
cur.cause = err
|
|
551
|
+
return cur
|
|
552
|
+
}),
|
|
553
|
+
},
|
|
505
554
|
)
|
|
506
555
|
}
|
|
507
556
|
throw new Error(`Failed to load native binding`)
|
package/package.json
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takumi-rs/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "me@kane.tw",
|
|
6
6
|
"name": "Kane Wang",
|
|
7
7
|
"url": "https://kane.tw"
|
|
8
8
|
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"image",
|
|
11
|
+
"rendering",
|
|
12
|
+
"css",
|
|
13
|
+
"react",
|
|
14
|
+
"jsx",
|
|
15
|
+
"nodejs",
|
|
16
|
+
"napi"
|
|
17
|
+
],
|
|
9
18
|
"repository": {
|
|
10
19
|
"url": "git+https://github.com/kane50613/takumi.git"
|
|
11
20
|
},
|
|
12
21
|
"main": "index.js",
|
|
13
22
|
"devDependencies": {
|
|
14
|
-
"@napi-rs/cli": "3.
|
|
23
|
+
"@napi-rs/cli": "3.2.0",
|
|
15
24
|
"@takumi-rs/helpers": "workspace:*",
|
|
16
25
|
"@types/bun": "catalog:",
|
|
17
26
|
"mitata": "^1.0.34",
|
|
@@ -21,7 +30,7 @@
|
|
|
21
30
|
"engines": {
|
|
22
31
|
"node": ">= 12.22.0 < 13 || >= 14.17.0 < 15 || >= 15.12.0 < 16 || >= 16.0.0"
|
|
23
32
|
},
|
|
24
|
-
"license": "MIT",
|
|
33
|
+
"license": "(MIT OR Apache-2.0)",
|
|
25
34
|
"napi": {
|
|
26
35
|
"binaryName": "core",
|
|
27
36
|
"targets": [
|
|
@@ -46,12 +55,12 @@
|
|
|
46
55
|
"type": "commonjs",
|
|
47
56
|
"types": "index.d.ts",
|
|
48
57
|
"optionalDependencies": {
|
|
49
|
-
"@takumi-rs/core-darwin-arm64": "0.
|
|
50
|
-
"@takumi-rs/core-linux-arm64-gnu": "0.
|
|
51
|
-
"@takumi-rs/core-linux-arm64-musl": "0.
|
|
52
|
-
"@takumi-rs/core-win32-arm64-msvc": "0.
|
|
53
|
-
"@takumi-rs/core-linux-x64-gnu": "0.
|
|
54
|
-
"@takumi-rs/core-linux-x64-musl": "0.
|
|
55
|
-
"@takumi-rs/core-win32-x64-msvc": "0.
|
|
58
|
+
"@takumi-rs/core-darwin-arm64": "0.30.0",
|
|
59
|
+
"@takumi-rs/core-linux-arm64-gnu": "0.30.0",
|
|
60
|
+
"@takumi-rs/core-linux-arm64-musl": "0.30.0",
|
|
61
|
+
"@takumi-rs/core-win32-arm64-msvc": "0.30.0",
|
|
62
|
+
"@takumi-rs/core-linux-x64-gnu": "0.30.0",
|
|
63
|
+
"@takumi-rs/core-linux-x64-musl": "0.30.0",
|
|
64
|
+
"@takumi-rs/core-win32-x64-msvc": "0.30.0"
|
|
56
65
|
}
|
|
57
66
|
}
|