@napi-rs/webcodecs 1.2.0 → 1.3.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 +105 -18
- package/index.d.ts +271 -215
- package/index.js +82 -237
- package/package.json +42 -33
package/index.js
CHANGED
|
@@ -63,7 +63,7 @@ const isMuslFromChildProcess = () => {
|
|
|
63
63
|
function requireNative() {
|
|
64
64
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
65
65
|
try {
|
|
66
|
-
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
|
|
66
|
+
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
67
67
|
} catch (err) {
|
|
68
68
|
loadErrors.push(err)
|
|
69
69
|
}
|
|
@@ -77,14 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@napi-rs/webcodecs-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@napi-rs/webcodecs-android-arm64/package.json').version
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
83
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
84
|
-
) {
|
|
85
|
-
throw new Error(
|
|
86
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
87
|
-
)
|
|
80
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
88
82
|
}
|
|
89
83
|
return binding
|
|
90
84
|
} catch (e) {
|
|
@@ -99,14 +93,8 @@ function requireNative() {
|
|
|
99
93
|
try {
|
|
100
94
|
const binding = require('@napi-rs/webcodecs-android-arm-eabi')
|
|
101
95
|
const bindingPackageVersion = require('@napi-rs/webcodecs-android-arm-eabi/package.json').version
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
105
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
106
|
-
) {
|
|
107
|
-
throw new Error(
|
|
108
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
109
|
-
)
|
|
96
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
110
98
|
}
|
|
111
99
|
return binding
|
|
112
100
|
} catch (e) {
|
|
@@ -117,53 +105,38 @@ function requireNative() {
|
|
|
117
105
|
}
|
|
118
106
|
} else if (process.platform === 'win32') {
|
|
119
107
|
if (process.arch === 'x64') {
|
|
120
|
-
if (
|
|
121
|
-
process.config?.variables?.shlib_suffix === 'dll.a' ||
|
|
122
|
-
process.config?.variables?.node_target_type === 'shared_library'
|
|
123
|
-
) {
|
|
108
|
+
if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
|
|
124
109
|
try {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
135
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
136
|
-
) {
|
|
137
|
-
throw new Error(
|
|
138
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
return binding
|
|
142
|
-
} catch (e) {
|
|
143
|
-
loadErrors.push(e)
|
|
110
|
+
return require('./webcodecs.win32-x64-gnu.node')
|
|
111
|
+
} catch (e) {
|
|
112
|
+
loadErrors.push(e)
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
const binding = require('@napi-rs/webcodecs-win32-x64-gnu')
|
|
116
|
+
const bindingPackageVersion = require('@napi-rs/webcodecs-win32-x64-gnu/package.json').version
|
|
117
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
144
119
|
}
|
|
120
|
+
return binding
|
|
121
|
+
} catch (e) {
|
|
122
|
+
loadErrors.push(e)
|
|
123
|
+
}
|
|
145
124
|
} else {
|
|
146
125
|
try {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
157
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
158
|
-
) {
|
|
159
|
-
throw new Error(
|
|
160
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
return binding
|
|
164
|
-
} catch (e) {
|
|
165
|
-
loadErrors.push(e)
|
|
126
|
+
return require('./webcodecs.win32-x64-msvc.node')
|
|
127
|
+
} catch (e) {
|
|
128
|
+
loadErrors.push(e)
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
const binding = require('@napi-rs/webcodecs-win32-x64-msvc')
|
|
132
|
+
const bindingPackageVersion = require('@napi-rs/webcodecs-win32-x64-msvc/package.json').version
|
|
133
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
166
135
|
}
|
|
136
|
+
return binding
|
|
137
|
+
} catch (e) {
|
|
138
|
+
loadErrors.push(e)
|
|
139
|
+
}
|
|
167
140
|
}
|
|
168
141
|
} else if (process.arch === 'ia32') {
|
|
169
142
|
try {
|
|
@@ -174,14 +147,8 @@ function requireNative() {
|
|
|
174
147
|
try {
|
|
175
148
|
const binding = require('@napi-rs/webcodecs-win32-ia32-msvc')
|
|
176
149
|
const bindingPackageVersion = require('@napi-rs/webcodecs-win32-ia32-msvc/package.json').version
|
|
177
|
-
if (
|
|
178
|
-
|
|
179
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
180
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
181
|
-
) {
|
|
182
|
-
throw new Error(
|
|
183
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
184
|
-
)
|
|
150
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
185
152
|
}
|
|
186
153
|
return binding
|
|
187
154
|
} catch (e) {
|
|
@@ -196,14 +163,8 @@ function requireNative() {
|
|
|
196
163
|
try {
|
|
197
164
|
const binding = require('@napi-rs/webcodecs-win32-arm64-msvc')
|
|
198
165
|
const bindingPackageVersion = require('@napi-rs/webcodecs-win32-arm64-msvc/package.json').version
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
202
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
203
|
-
) {
|
|
204
|
-
throw new Error(
|
|
205
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
206
|
-
)
|
|
166
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
207
168
|
}
|
|
208
169
|
return binding
|
|
209
170
|
} catch (e) {
|
|
@@ -221,14 +182,8 @@ function requireNative() {
|
|
|
221
182
|
try {
|
|
222
183
|
const binding = require('@napi-rs/webcodecs-darwin-universal')
|
|
223
184
|
const bindingPackageVersion = require('@napi-rs/webcodecs-darwin-universal/package.json').version
|
|
224
|
-
if (
|
|
225
|
-
|
|
226
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
227
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
228
|
-
) {
|
|
229
|
-
throw new Error(
|
|
230
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
231
|
-
)
|
|
185
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
232
187
|
}
|
|
233
188
|
return binding
|
|
234
189
|
} catch (e) {
|
|
@@ -243,14 +198,8 @@ function requireNative() {
|
|
|
243
198
|
try {
|
|
244
199
|
const binding = require('@napi-rs/webcodecs-darwin-x64')
|
|
245
200
|
const bindingPackageVersion = require('@napi-rs/webcodecs-darwin-x64/package.json').version
|
|
246
|
-
if (
|
|
247
|
-
|
|
248
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
249
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
250
|
-
) {
|
|
251
|
-
throw new Error(
|
|
252
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
253
|
-
)
|
|
201
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
254
203
|
}
|
|
255
204
|
return binding
|
|
256
205
|
} catch (e) {
|
|
@@ -265,14 +214,8 @@ function requireNative() {
|
|
|
265
214
|
try {
|
|
266
215
|
const binding = require('@napi-rs/webcodecs-darwin-arm64')
|
|
267
216
|
const bindingPackageVersion = require('@napi-rs/webcodecs-darwin-arm64/package.json').version
|
|
268
|
-
if (
|
|
269
|
-
|
|
270
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
271
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
272
|
-
) {
|
|
273
|
-
throw new Error(
|
|
274
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
275
|
-
)
|
|
217
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
219
|
}
|
|
277
220
|
return binding
|
|
278
221
|
} catch (e) {
|
|
@@ -291,14 +234,8 @@ function requireNative() {
|
|
|
291
234
|
try {
|
|
292
235
|
const binding = require('@napi-rs/webcodecs-freebsd-x64')
|
|
293
236
|
const bindingPackageVersion = require('@napi-rs/webcodecs-freebsd-x64/package.json').version
|
|
294
|
-
if (
|
|
295
|
-
|
|
296
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
297
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
298
|
-
) {
|
|
299
|
-
throw new Error(
|
|
300
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
301
|
-
)
|
|
237
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
302
239
|
}
|
|
303
240
|
return binding
|
|
304
241
|
} catch (e) {
|
|
@@ -313,14 +250,8 @@ function requireNative() {
|
|
|
313
250
|
try {
|
|
314
251
|
const binding = require('@napi-rs/webcodecs-freebsd-arm64')
|
|
315
252
|
const bindingPackageVersion = require('@napi-rs/webcodecs-freebsd-arm64/package.json').version
|
|
316
|
-
if (
|
|
317
|
-
|
|
318
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
319
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
320
|
-
) {
|
|
321
|
-
throw new Error(
|
|
322
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
323
|
-
)
|
|
253
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
324
255
|
}
|
|
325
256
|
return binding
|
|
326
257
|
} catch (e) {
|
|
@@ -340,14 +271,8 @@ function requireNative() {
|
|
|
340
271
|
try {
|
|
341
272
|
const binding = require('@napi-rs/webcodecs-linux-x64-musl')
|
|
342
273
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-x64-musl/package.json').version
|
|
343
|
-
if (
|
|
344
|
-
|
|
345
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
346
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
347
|
-
) {
|
|
348
|
-
throw new Error(
|
|
349
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
350
|
-
)
|
|
274
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
351
276
|
}
|
|
352
277
|
return binding
|
|
353
278
|
} catch (e) {
|
|
@@ -362,14 +287,8 @@ function requireNative() {
|
|
|
362
287
|
try {
|
|
363
288
|
const binding = require('@napi-rs/webcodecs-linux-x64-gnu')
|
|
364
289
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-x64-gnu/package.json').version
|
|
365
|
-
if (
|
|
366
|
-
|
|
367
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
368
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
369
|
-
) {
|
|
370
|
-
throw new Error(
|
|
371
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
372
|
-
)
|
|
290
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
373
292
|
}
|
|
374
293
|
return binding
|
|
375
294
|
} catch (e) {
|
|
@@ -386,14 +305,8 @@ function requireNative() {
|
|
|
386
305
|
try {
|
|
387
306
|
const binding = require('@napi-rs/webcodecs-linux-arm64-musl')
|
|
388
307
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm64-musl/package.json').version
|
|
389
|
-
if (
|
|
390
|
-
|
|
391
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
392
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
393
|
-
) {
|
|
394
|
-
throw new Error(
|
|
395
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
396
|
-
)
|
|
308
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
397
310
|
}
|
|
398
311
|
return binding
|
|
399
312
|
} catch (e) {
|
|
@@ -408,14 +321,8 @@ function requireNative() {
|
|
|
408
321
|
try {
|
|
409
322
|
const binding = require('@napi-rs/webcodecs-linux-arm64-gnu')
|
|
410
323
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm64-gnu/package.json').version
|
|
411
|
-
if (
|
|
412
|
-
|
|
413
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
414
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
415
|
-
) {
|
|
416
|
-
throw new Error(
|
|
417
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
418
|
-
)
|
|
324
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
419
326
|
}
|
|
420
327
|
return binding
|
|
421
328
|
} catch (e) {
|
|
@@ -432,14 +339,8 @@ function requireNative() {
|
|
|
432
339
|
try {
|
|
433
340
|
const binding = require('@napi-rs/webcodecs-linux-arm-musleabihf')
|
|
434
341
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm-musleabihf/package.json').version
|
|
435
|
-
if (
|
|
436
|
-
|
|
437
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
438
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
439
|
-
) {
|
|
440
|
-
throw new Error(
|
|
441
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
442
|
-
)
|
|
342
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
443
344
|
}
|
|
444
345
|
return binding
|
|
445
346
|
} catch (e) {
|
|
@@ -454,14 +355,8 @@ function requireNative() {
|
|
|
454
355
|
try {
|
|
455
356
|
const binding = require('@napi-rs/webcodecs-linux-arm-gnueabihf')
|
|
456
357
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm-gnueabihf/package.json').version
|
|
457
|
-
if (
|
|
458
|
-
|
|
459
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
460
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
461
|
-
) {
|
|
462
|
-
throw new Error(
|
|
463
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
464
|
-
)
|
|
358
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
465
360
|
}
|
|
466
361
|
return binding
|
|
467
362
|
} catch (e) {
|
|
@@ -478,14 +373,8 @@ function requireNative() {
|
|
|
478
373
|
try {
|
|
479
374
|
const binding = require('@napi-rs/webcodecs-linux-loong64-musl')
|
|
480
375
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-loong64-musl/package.json').version
|
|
481
|
-
if (
|
|
482
|
-
|
|
483
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
484
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
485
|
-
) {
|
|
486
|
-
throw new Error(
|
|
487
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
488
|
-
)
|
|
376
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
489
378
|
}
|
|
490
379
|
return binding
|
|
491
380
|
} catch (e) {
|
|
@@ -500,14 +389,8 @@ function requireNative() {
|
|
|
500
389
|
try {
|
|
501
390
|
const binding = require('@napi-rs/webcodecs-linux-loong64-gnu')
|
|
502
391
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-loong64-gnu/package.json').version
|
|
503
|
-
if (
|
|
504
|
-
|
|
505
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
506
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
507
|
-
) {
|
|
508
|
-
throw new Error(
|
|
509
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
510
|
-
)
|
|
392
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
511
394
|
}
|
|
512
395
|
return binding
|
|
513
396
|
} catch (e) {
|
|
@@ -524,14 +407,8 @@ function requireNative() {
|
|
|
524
407
|
try {
|
|
525
408
|
const binding = require('@napi-rs/webcodecs-linux-riscv64-musl')
|
|
526
409
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-riscv64-musl/package.json').version
|
|
527
|
-
if (
|
|
528
|
-
|
|
529
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
530
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
531
|
-
) {
|
|
532
|
-
throw new Error(
|
|
533
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
534
|
-
)
|
|
410
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
535
412
|
}
|
|
536
413
|
return binding
|
|
537
414
|
} catch (e) {
|
|
@@ -546,14 +423,8 @@ function requireNative() {
|
|
|
546
423
|
try {
|
|
547
424
|
const binding = require('@napi-rs/webcodecs-linux-riscv64-gnu')
|
|
548
425
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-riscv64-gnu/package.json').version
|
|
549
|
-
if (
|
|
550
|
-
|
|
551
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
552
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
553
|
-
) {
|
|
554
|
-
throw new Error(
|
|
555
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
556
|
-
)
|
|
426
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
557
428
|
}
|
|
558
429
|
return binding
|
|
559
430
|
} catch (e) {
|
|
@@ -569,14 +440,8 @@ function requireNative() {
|
|
|
569
440
|
try {
|
|
570
441
|
const binding = require('@napi-rs/webcodecs-linux-ppc64-gnu')
|
|
571
442
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-ppc64-gnu/package.json').version
|
|
572
|
-
if (
|
|
573
|
-
|
|
574
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
575
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
576
|
-
) {
|
|
577
|
-
throw new Error(
|
|
578
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
579
|
-
)
|
|
443
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
580
445
|
}
|
|
581
446
|
return binding
|
|
582
447
|
} catch (e) {
|
|
@@ -591,14 +456,8 @@ function requireNative() {
|
|
|
591
456
|
try {
|
|
592
457
|
const binding = require('@napi-rs/webcodecs-linux-s390x-gnu')
|
|
593
458
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-s390x-gnu/package.json').version
|
|
594
|
-
if (
|
|
595
|
-
|
|
596
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
597
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
598
|
-
) {
|
|
599
|
-
throw new Error(
|
|
600
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
601
|
-
)
|
|
459
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
602
461
|
}
|
|
603
462
|
return binding
|
|
604
463
|
} catch (e) {
|
|
@@ -617,14 +476,8 @@ function requireNative() {
|
|
|
617
476
|
try {
|
|
618
477
|
const binding = require('@napi-rs/webcodecs-openharmony-arm64')
|
|
619
478
|
const bindingPackageVersion = require('@napi-rs/webcodecs-openharmony-arm64/package.json').version
|
|
620
|
-
if (
|
|
621
|
-
|
|
622
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
623
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
624
|
-
) {
|
|
625
|
-
throw new Error(
|
|
626
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
627
|
-
)
|
|
479
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
628
481
|
}
|
|
629
482
|
return binding
|
|
630
483
|
} catch (e) {
|
|
@@ -639,14 +492,8 @@ function requireNative() {
|
|
|
639
492
|
try {
|
|
640
493
|
const binding = require('@napi-rs/webcodecs-openharmony-x64')
|
|
641
494
|
const bindingPackageVersion = require('@napi-rs/webcodecs-openharmony-x64/package.json').version
|
|
642
|
-
if (
|
|
643
|
-
|
|
644
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
645
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
646
|
-
) {
|
|
647
|
-
throw new Error(
|
|
648
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
649
|
-
)
|
|
495
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
650
497
|
}
|
|
651
498
|
return binding
|
|
652
499
|
} catch (e) {
|
|
@@ -661,14 +508,8 @@ function requireNative() {
|
|
|
661
508
|
try {
|
|
662
509
|
const binding = require('@napi-rs/webcodecs-openharmony-arm')
|
|
663
510
|
const bindingPackageVersion = require('@napi-rs/webcodecs-openharmony-arm/package.json').version
|
|
664
|
-
if (
|
|
665
|
-
|
|
666
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
667
|
-
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
668
|
-
) {
|
|
669
|
-
throw new Error(
|
|
670
|
-
`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
671
|
-
)
|
|
511
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
672
513
|
}
|
|
673
514
|
return binding
|
|
674
515
|
} catch (e) {
|
|
@@ -695,13 +536,17 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
|
695
536
|
wasiBindingError = err
|
|
696
537
|
}
|
|
697
538
|
}
|
|
698
|
-
if (!nativeBinding) {
|
|
539
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
699
540
|
try {
|
|
700
541
|
wasiBinding = require('@napi-rs/webcodecs-wasm32-wasi')
|
|
701
542
|
nativeBinding = wasiBinding
|
|
702
543
|
} catch (err) {
|
|
703
544
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
704
|
-
wasiBindingError
|
|
545
|
+
if (!wasiBindingError) {
|
|
546
|
+
wasiBindingError = err
|
|
547
|
+
} else {
|
|
548
|
+
wasiBindingError.cause = err
|
|
549
|
+
}
|
|
705
550
|
loadErrors.push(err)
|
|
706
551
|
}
|
|
707
552
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napi-rs/webcodecs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "WebCodecs API implementation for Node.js using FFmpeg",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"N-API",
|
|
@@ -43,56 +43,52 @@
|
|
|
43
43
|
],
|
|
44
44
|
"scripts": {
|
|
45
45
|
"artifacts": "napi artifacts",
|
|
46
|
-
"bench": "node --import @oxc-node/core/register benchmark/
|
|
47
|
-
"build": "
|
|
48
|
-
"build:debug": "
|
|
49
|
-
"format": "run-p format:rs format:
|
|
46
|
+
"bench": "node --import @oxc-node/core/register benchmark/compare.ts",
|
|
47
|
+
"build": "oxnode ./build.ts --platform --release",
|
|
48
|
+
"build:debug": "oxnode ./build.ts --platform",
|
|
49
|
+
"format": "run-p format:rs format:oxfmt format:prettier",
|
|
50
50
|
"format:prettier": "prettier . \"!**/*.{js,jsx,ts,tsx}\" -w",
|
|
51
51
|
"format:oxfmt": "oxfmt",
|
|
52
|
-
"format:toml": "taplo format",
|
|
53
52
|
"format:rs": "cargo fmt",
|
|
54
53
|
"lint": "oxlint --type-aware",
|
|
55
54
|
"prepublishOnly": "napi prepublish -t npm",
|
|
56
55
|
"test": "ava",
|
|
56
|
+
"demo": "cd example && vite",
|
|
57
57
|
"typecheck": "tsc -b tsconfig.json && tsc ./index.d.ts",
|
|
58
58
|
"preversion": "napi build --platform && git add .",
|
|
59
59
|
"version": "napi version"
|
|
60
60
|
},
|
|
61
61
|
"lint-staged": {
|
|
62
62
|
"*.@(js|ts|tsx)": [
|
|
63
|
-
"oxlint --fix"
|
|
64
|
-
"oxfmt"
|
|
65
|
-
],
|
|
66
|
-
"*.@(yml|yaml|md|json)": [
|
|
67
|
-
"prettier --write"
|
|
68
|
-
],
|
|
69
|
-
"*.toml": [
|
|
70
|
-
"taplo format"
|
|
63
|
+
"oxlint --fix"
|
|
71
64
|
]
|
|
72
65
|
},
|
|
73
66
|
"devDependencies": {
|
|
74
67
|
"@emnapi/core": "^1.7.1",
|
|
75
68
|
"@emnapi/runtime": "^1.7.1",
|
|
76
|
-
"@napi-rs/canvas": "^0.1.
|
|
77
|
-
"@napi-rs/cli": "^3.5.
|
|
78
|
-
"@napi-rs/wasm-runtime": "^1.1.
|
|
69
|
+
"@napi-rs/canvas": "^0.1.88",
|
|
70
|
+
"@napi-rs/cli": "^3.5.1",
|
|
71
|
+
"@napi-rs/wasm-runtime": "^1.1.1",
|
|
72
|
+
"@oxc-node/cli": "^0.0.35",
|
|
79
73
|
"@oxc-node/core": "^0.0.35",
|
|
80
74
|
"@taplo/cli": "^0.7.0",
|
|
81
75
|
"@tybys/wasm-util": "^0.10.1",
|
|
82
|
-
"@types/node": "^25.0.
|
|
76
|
+
"@types/node": "^25.0.3",
|
|
83
77
|
"ava": "^6.4.1",
|
|
84
78
|
"chalk": "^5.6.2",
|
|
85
79
|
"emnapi": "^1.7.1",
|
|
86
80
|
"husky": "^9.1.7",
|
|
87
81
|
"lint-staged": "^16.2.7",
|
|
88
|
-
"mediabunny": "1.
|
|
82
|
+
"mediabunny": "1.27.3",
|
|
89
83
|
"npm-run-all2": "^8.0.4",
|
|
90
|
-
"oxfmt": "^0.
|
|
91
|
-
"oxlint": "^1.
|
|
92
|
-
"oxlint-tsgolint": "^0.
|
|
84
|
+
"oxfmt": "^0.21.0",
|
|
85
|
+
"oxlint": "^1.36.0",
|
|
86
|
+
"oxlint-tsgolint": "^0.10.0",
|
|
93
87
|
"prettier": "^3.7.4",
|
|
94
88
|
"tinybench": "^6.0.0",
|
|
95
|
-
"typescript": "^5.9.3"
|
|
89
|
+
"typescript": "^5.9.3",
|
|
90
|
+
"webcodecs-polyfill": "^1.0.1",
|
|
91
|
+
"vite-plugin-mkcert": "^1.17.9"
|
|
96
92
|
},
|
|
97
93
|
"peerDependencies": {
|
|
98
94
|
"@napi-rs/canvas": ">=0.1.0"
|
|
@@ -118,7 +114,7 @@
|
|
|
118
114
|
"armv7-unknown-linux-gnueabihf"
|
|
119
115
|
]
|
|
120
116
|
},
|
|
121
|
-
"packageManager": "pnpm@10.
|
|
117
|
+
"packageManager": "pnpm@10.27.0",
|
|
122
118
|
"prettier": {
|
|
123
119
|
"arrowParens": "always",
|
|
124
120
|
"printWidth": 120,
|
|
@@ -150,15 +146,28 @@
|
|
|
150
146
|
"access": "public",
|
|
151
147
|
"registry": "https://registry.npmjs.org/"
|
|
152
148
|
},
|
|
149
|
+
"pnpm": {
|
|
150
|
+
"onlyBuiltDependencies": [
|
|
151
|
+
"node-av",
|
|
152
|
+
"@seydx/node-av-darwin-arm64",
|
|
153
|
+
"@seydx/node-av-darwin-x64",
|
|
154
|
+
"@seydx/node-av-linux-arm64",
|
|
155
|
+
"@seydx/node-av-linux-x64",
|
|
156
|
+
"@seydx/node-av-win32-arm64-mingw",
|
|
157
|
+
"@seydx/node-av-win32-arm64-msvc",
|
|
158
|
+
"@seydx/node-av-win32-x64-mingw",
|
|
159
|
+
"@seydx/node-av-win32-x64-msvc"
|
|
160
|
+
]
|
|
161
|
+
},
|
|
153
162
|
"optionalDependencies": {
|
|
154
|
-
"@napi-rs/webcodecs-darwin-x64": "1.
|
|
155
|
-
"@napi-rs/webcodecs-darwin-arm64": "1.
|
|
156
|
-
"@napi-rs/webcodecs-linux-x64-gnu": "1.
|
|
157
|
-
"@napi-rs/webcodecs-linux-x64-musl": "1.
|
|
158
|
-
"@napi-rs/webcodecs-win32-x64-msvc": "1.
|
|
159
|
-
"@napi-rs/webcodecs-linux-arm64-gnu": "1.
|
|
160
|
-
"@napi-rs/webcodecs-linux-arm64-musl": "1.
|
|
161
|
-
"@napi-rs/webcodecs-win32-arm64-msvc": "1.
|
|
162
|
-
"@napi-rs/webcodecs-linux-arm-gnueabihf": "1.
|
|
163
|
+
"@napi-rs/webcodecs-darwin-x64": "1.3.0",
|
|
164
|
+
"@napi-rs/webcodecs-darwin-arm64": "1.3.0",
|
|
165
|
+
"@napi-rs/webcodecs-linux-x64-gnu": "1.3.0",
|
|
166
|
+
"@napi-rs/webcodecs-linux-x64-musl": "1.3.0",
|
|
167
|
+
"@napi-rs/webcodecs-win32-x64-msvc": "1.3.0",
|
|
168
|
+
"@napi-rs/webcodecs-linux-arm64-gnu": "1.3.0",
|
|
169
|
+
"@napi-rs/webcodecs-linux-arm64-musl": "1.3.0",
|
|
170
|
+
"@napi-rs/webcodecs-win32-arm64-msvc": "1.3.0",
|
|
171
|
+
"@napi-rs/webcodecs-linux-arm-gnueabihf": "1.3.0"
|
|
163
172
|
}
|
|
164
173
|
}
|