libopus-wasm 0.3.0 → 0.4.1
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/CHANGELOG.md +14 -0
- package/dist/discordjs.d.ts.map +1 -1
- package/dist/discordjs.js +14 -2
- package/dist/generated/libopus.generated.mjs +0 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +55 -100
- package/package.json +13 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.4.1 - 2026-09-24
|
|
6
|
+
|
|
7
|
+
**Highlights:** Safer numeric settings and codec initialization, with accurate guidance for decoder output formats.
|
|
8
|
+
|
|
9
|
+
- Reject CTL values and numeric bitrates outside signed 32-bit bounds and invalid application modes before WebAssembly can coerce them into different settings; correct the Q8 decoder gain examples. (#19)
|
|
10
|
+
- Free partially initialized Discord adapters when either codec fails, and reject failed WASM error-buffer allocations before creating native codecs. (#20)
|
|
11
|
+
- Correct decoder documentation to describe selectable output sample rates and mono/stereo conversion, and clarify that source builds recompile cached libopus sources. (#23)
|
|
12
|
+
|
|
13
|
+
## 0.4.0 - 2026-09-13
|
|
14
|
+
|
|
15
|
+
- Reserve enough WebAssembly stack for 40 ms and 60 ms stereo frames so encoding cannot corrupt later codec operations. (#18)
|
|
16
|
+
|
|
3
17
|
## 0.3.0 - 2026-09-05
|
|
4
18
|
|
|
5
19
|
**Highlights:** Safer encoder initialization and packet-size handling, plus reliable documentation navigation. This release requires Node.js 22 or newer.
|
package/dist/discordjs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discordjs.d.ts","sourceRoot":"","sources":["../src/discordjs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,qBAAa,WAAW;;IACtB,QAAQ,CAAC,QAAQ,E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export class OpusEncoder {
|
|
|
11
11
|
constructor(rate = 48_000, channels = 2) {
|
|
12
12
|
this.rate = rate;
|
|
13
13
|
this.channels = channels;
|
|
14
|
-
this.ready = Promise.
|
|
14
|
+
this.ready = Promise.allSettled([
|
|
15
15
|
createEncoder({
|
|
16
16
|
channels: channels,
|
|
17
17
|
sampleRate: rate,
|
|
@@ -20,7 +20,19 @@ export class OpusEncoder {
|
|
|
20
20
|
channels: channels,
|
|
21
21
|
sampleRate: rate,
|
|
22
22
|
}),
|
|
23
|
-
]).then(([
|
|
23
|
+
]).then(([encoderResult, decoderResult]) => {
|
|
24
|
+
if (encoderResult.status === "rejected") {
|
|
25
|
+
if (decoderResult.status === "fulfilled") {
|
|
26
|
+
decoderResult.value.free();
|
|
27
|
+
}
|
|
28
|
+
throw encoderResult.reason;
|
|
29
|
+
}
|
|
30
|
+
const encoder = encoderResult.value;
|
|
31
|
+
if (decoderResult.status === "rejected") {
|
|
32
|
+
encoder.free();
|
|
33
|
+
throw decoderResult.reason;
|
|
34
|
+
}
|
|
35
|
+
const decoder = decoderResult.value;
|
|
24
36
|
if (this.#freed) {
|
|
25
37
|
encoder.free();
|
|
26
38
|
decoder.free();
|
|
Binary file
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;aACtB,IAAI,EAAE,IAAI;aACV,KAAK,EAAE,IAAI;aACX,kBAAkB,EAAE,IAAI;CAChB,CAAC;AAEX,eAAO,MAAM,MAAM;aACjB,IAAI,EAAE,CAAC,IAAI;aACX,KAAK,EAAE,IAAI;aACX,KAAK,EAAE,IAAI;CACH,CAAC;AAEX,eAAO,MAAM,OAAO;aAClB,IAAI,EAAE,CAAC,IAAI;aACX,GAAG,EAAE,CAAC,CAAC;CACC,CAAC;AAEX,eAAO,MAAM,SAAS;aACpB,UAAU,EAAE,IAAI;aAChB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2;
|
|
|
46
46
|
const DEFAULT_FRAME_DURATION_MS = 20;
|
|
47
47
|
const MAX_PACKET_DURATION_MS = 120;
|
|
48
48
|
const DEFAULT_MAX_PACKET_BYTES = 4000;
|
|
49
|
+
const MIN_I32 = -0x8000_0000;
|
|
49
50
|
const MAX_I32 = 0x7fff_ffff;
|
|
50
51
|
const DEFAULT_SAMPLE_RATE = 48_000;
|
|
51
52
|
const DECODER_INTEGER_CTL_REQUESTS = new Set(Object.values(DecoderCtl));
|
|
@@ -110,6 +111,31 @@ export async function getPacketInfo(packet, options = {}) {
|
|
|
110
111
|
module._free(packetPtr);
|
|
111
112
|
}
|
|
112
113
|
}
|
|
114
|
+
class WasmBuffer {
|
|
115
|
+
module;
|
|
116
|
+
#bytes = 0;
|
|
117
|
+
#ptr = 0;
|
|
118
|
+
constructor(module) {
|
|
119
|
+
this.module = module;
|
|
120
|
+
}
|
|
121
|
+
ensure(requiredBytes) {
|
|
122
|
+
if (this.#ptr !== 0 && this.#bytes >= requiredBytes) {
|
|
123
|
+
return this.#ptr;
|
|
124
|
+
}
|
|
125
|
+
const nextPtr = checkedMalloc(this.module, requiredBytes);
|
|
126
|
+
this.free();
|
|
127
|
+
this.#ptr = nextPtr;
|
|
128
|
+
this.#bytes = requiredBytes;
|
|
129
|
+
return this.#ptr;
|
|
130
|
+
}
|
|
131
|
+
free() {
|
|
132
|
+
if (this.#ptr !== 0) {
|
|
133
|
+
this.module._free(this.#ptr);
|
|
134
|
+
}
|
|
135
|
+
this.#ptr = 0;
|
|
136
|
+
this.#bytes = 0;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
113
139
|
class WasmOpusEncoder {
|
|
114
140
|
application;
|
|
115
141
|
channels;
|
|
@@ -117,18 +143,18 @@ class WasmOpusEncoder {
|
|
|
117
143
|
sampleRate;
|
|
118
144
|
#freed = false;
|
|
119
145
|
#module;
|
|
120
|
-
#
|
|
121
|
-
#
|
|
122
|
-
#pcmBytes = 0;
|
|
123
|
-
#pcmPtr = 0;
|
|
146
|
+
#packet;
|
|
147
|
+
#pcm;
|
|
124
148
|
#ptr;
|
|
125
149
|
constructor(module, options) {
|
|
126
150
|
this.#module = module;
|
|
151
|
+
this.#packet = new WasmBuffer(module);
|
|
152
|
+
this.#pcm = new WasmBuffer(module);
|
|
127
153
|
this.application = options.application;
|
|
128
154
|
this.channels = options.channels;
|
|
129
155
|
this.frameSize = options.frameSize;
|
|
130
156
|
this.sampleRate = options.sampleRate;
|
|
131
|
-
const errorPtr = module
|
|
157
|
+
const errorPtr = checkedMalloc(module, 4);
|
|
132
158
|
try {
|
|
133
159
|
const ptr = module._oc_create_encoder(options.sampleRate, options.channels, options.application, errorPtr);
|
|
134
160
|
const error = module.HEAP32[errorPtr >> 2] ?? 0;
|
|
@@ -176,8 +202,8 @@ class WasmOpusEncoder {
|
|
|
176
202
|
}
|
|
177
203
|
const maxPacketBytes = options.maxPacketBytes ?? DEFAULT_MAX_PACKET_BYTES;
|
|
178
204
|
validateIntegerRange(maxPacketBytes, 1, MAX_I32, "maxPacketBytes");
|
|
179
|
-
const pcmPtr = this.#
|
|
180
|
-
const packetPtr = this.#
|
|
205
|
+
const pcmPtr = this.#pcm.ensure(pcmBytes.byteLength);
|
|
206
|
+
const packetPtr = this.#packet.ensure(maxPacketBytes);
|
|
181
207
|
this.#module.HEAPU8.set(pcmBytes, pcmPtr);
|
|
182
208
|
const encodedBytes = this.#module._oc_encode(this.#ptr, pcmPtr, frameSize, packetPtr, maxPacketBytes);
|
|
183
209
|
if (encodedBytes < 0) {
|
|
@@ -195,8 +221,8 @@ class WasmOpusEncoder {
|
|
|
195
221
|
}
|
|
196
222
|
const maxPacketBytes = options.maxPacketBytes ?? DEFAULT_MAX_PACKET_BYTES;
|
|
197
223
|
validateIntegerRange(maxPacketBytes, 1, MAX_I32, "maxPacketBytes");
|
|
198
|
-
const pcmPtr = this.#
|
|
199
|
-
const packetPtr = this.#
|
|
224
|
+
const pcmPtr = this.#pcm.ensure(pcm.byteLength);
|
|
225
|
+
const packetPtr = this.#packet.ensure(maxPacketBytes);
|
|
200
226
|
this.#module.HEAPF32.set(pcm, pcmPtr >> 2);
|
|
201
227
|
const encodedBytes = this.#module._oc_encode_float(this.#ptr, pcmPtr, frameSize, packetPtr, maxPacketBytes);
|
|
202
228
|
if (encodedBytes < 0) {
|
|
@@ -213,7 +239,7 @@ class WasmOpusEncoder {
|
|
|
213
239
|
encoderCtl(request, value) {
|
|
214
240
|
this.#assertLive();
|
|
215
241
|
validateInteger(request, "request");
|
|
216
|
-
|
|
242
|
+
validateIntegerRange(value, MIN_I32, MAX_I32, "value");
|
|
217
243
|
if (!ENCODER_INTEGER_CTL_REQUESTS.has(request)) {
|
|
218
244
|
throw new RangeError("encoderCtl only supports integer setter requests");
|
|
219
245
|
}
|
|
@@ -280,7 +306,8 @@ class WasmOpusEncoder {
|
|
|
280
306
|
if (this.#freed) {
|
|
281
307
|
return;
|
|
282
308
|
}
|
|
283
|
-
this.#
|
|
309
|
+
this.#packet.free();
|
|
310
|
+
this.#pcm.free();
|
|
284
311
|
this.#module._oc_destroy_encoder(this.#ptr);
|
|
285
312
|
this.#freed = true;
|
|
286
313
|
}
|
|
@@ -297,42 +324,6 @@ class WasmOpusEncoder {
|
|
|
297
324
|
throw createOpusError(this.#module, code, operation);
|
|
298
325
|
}
|
|
299
326
|
}
|
|
300
|
-
#ensurePacketBytes(requiredBytes) {
|
|
301
|
-
if (this.#packetPtr !== 0 && this.#packetBytes >= requiredBytes) {
|
|
302
|
-
return this.#packetPtr;
|
|
303
|
-
}
|
|
304
|
-
const nextPtr = checkedMalloc(this.#module, requiredBytes);
|
|
305
|
-
if (this.#packetPtr !== 0) {
|
|
306
|
-
this.#module._free(this.#packetPtr);
|
|
307
|
-
}
|
|
308
|
-
this.#packetPtr = nextPtr;
|
|
309
|
-
this.#packetBytes = requiredBytes;
|
|
310
|
-
return this.#packetPtr;
|
|
311
|
-
}
|
|
312
|
-
#ensurePcmBytes(requiredBytes) {
|
|
313
|
-
if (this.#pcmPtr !== 0 && this.#pcmBytes >= requiredBytes) {
|
|
314
|
-
return this.#pcmPtr;
|
|
315
|
-
}
|
|
316
|
-
const nextPtr = checkedMalloc(this.#module, requiredBytes);
|
|
317
|
-
if (this.#pcmPtr !== 0) {
|
|
318
|
-
this.#module._free(this.#pcmPtr);
|
|
319
|
-
}
|
|
320
|
-
this.#pcmPtr = nextPtr;
|
|
321
|
-
this.#pcmBytes = requiredBytes;
|
|
322
|
-
return this.#pcmPtr;
|
|
323
|
-
}
|
|
324
|
-
#freeScratch() {
|
|
325
|
-
if (this.#packetPtr !== 0) {
|
|
326
|
-
this.#module._free(this.#packetPtr);
|
|
327
|
-
}
|
|
328
|
-
if (this.#pcmPtr !== 0) {
|
|
329
|
-
this.#module._free(this.#pcmPtr);
|
|
330
|
-
}
|
|
331
|
-
this.#packetPtr = 0;
|
|
332
|
-
this.#packetBytes = 0;
|
|
333
|
-
this.#pcmPtr = 0;
|
|
334
|
-
this.#pcmBytes = 0;
|
|
335
|
-
}
|
|
336
327
|
}
|
|
337
328
|
class WasmOpusDecoder {
|
|
338
329
|
channels;
|
|
@@ -340,17 +331,17 @@ class WasmOpusDecoder {
|
|
|
340
331
|
sampleRate;
|
|
341
332
|
#freed = false;
|
|
342
333
|
#module;
|
|
343
|
-
#
|
|
344
|
-
#
|
|
345
|
-
#pcmBytes = 0;
|
|
346
|
-
#pcmPtr = 0;
|
|
334
|
+
#packet;
|
|
335
|
+
#pcm;
|
|
347
336
|
#ptr;
|
|
348
337
|
constructor(module, options) {
|
|
349
338
|
this.#module = module;
|
|
339
|
+
this.#packet = new WasmBuffer(module);
|
|
340
|
+
this.#pcm = new WasmBuffer(module);
|
|
350
341
|
this.channels = options.channels;
|
|
351
342
|
this.maxFrameSize = options.maxFrameSize;
|
|
352
343
|
this.sampleRate = options.sampleRate;
|
|
353
|
-
const errorPtr = module
|
|
344
|
+
const errorPtr = checkedMalloc(module, 4);
|
|
354
345
|
try {
|
|
355
346
|
const ptr = module._oc_create_decoder(options.sampleRate, options.channels, errorPtr);
|
|
356
347
|
const error = module.HEAP32[errorPtr >> 2] ?? 0;
|
|
@@ -367,7 +358,7 @@ class WasmOpusDecoder {
|
|
|
367
358
|
this.#assertLive();
|
|
368
359
|
const frameSize = this.#resolveDecodeFrameSize(packet, options);
|
|
369
360
|
const pcmBytes = frameSize * this.channels * 2;
|
|
370
|
-
const pcmPtr = this.#
|
|
361
|
+
const pcmPtr = this.#pcm.ensure(pcmBytes);
|
|
371
362
|
const { packetLength, packetPtr } = this.#copyPacket(packet, options.decodeFec);
|
|
372
363
|
const decodedSamples = this.#module._oc_decode(this.#ptr, packetPtr, packetLength, pcmPtr, frameSize, options.decodeFec ? 1 : 0);
|
|
373
364
|
if (decodedSamples < 0) {
|
|
@@ -380,7 +371,7 @@ class WasmOpusDecoder {
|
|
|
380
371
|
this.#assertLive();
|
|
381
372
|
const frameSize = this.#resolveDecodeFrameSize(packet, options);
|
|
382
373
|
const pcmBytes = frameSize * this.channels * 4;
|
|
383
|
-
const pcmPtr = this.#
|
|
374
|
+
const pcmPtr = this.#pcm.ensure(pcmBytes);
|
|
384
375
|
const { packetLength, packetPtr } = this.#copyPacket(packet, options.decodeFec);
|
|
385
376
|
const decodedSamples = this.#module._oc_decode_float(this.#ptr, packetPtr, packetLength, pcmPtr, frameSize, options.decodeFec ? 1 : 0);
|
|
386
377
|
if (decodedSamples < 0) {
|
|
@@ -404,7 +395,7 @@ class WasmOpusDecoder {
|
|
|
404
395
|
decoderCtl(request, value) {
|
|
405
396
|
this.#assertLive();
|
|
406
397
|
validateInteger(request, "request");
|
|
407
|
-
|
|
398
|
+
validateIntegerRange(value, MIN_I32, MAX_I32, "value");
|
|
408
399
|
if (!DECODER_INTEGER_CTL_REQUESTS.has(request)) {
|
|
409
400
|
throw new RangeError("decoderCtl only supports integer setter requests");
|
|
410
401
|
}
|
|
@@ -417,7 +408,8 @@ class WasmOpusDecoder {
|
|
|
417
408
|
if (this.#freed) {
|
|
418
409
|
return;
|
|
419
410
|
}
|
|
420
|
-
this.#
|
|
411
|
+
this.#packet.free();
|
|
412
|
+
this.#pcm.free();
|
|
421
413
|
this.#module._oc_destroy_decoder(this.#ptr);
|
|
422
414
|
this.#freed = true;
|
|
423
415
|
}
|
|
@@ -439,46 +431,10 @@ class WasmOpusDecoder {
|
|
|
439
431
|
if (packet.byteLength === 0) {
|
|
440
432
|
throw new RangeError("packet must not be empty; use null or decodePacketLoss() for PLC");
|
|
441
433
|
}
|
|
442
|
-
const packetPtr = this.#
|
|
434
|
+
const packetPtr = this.#packet.ensure(packet.byteLength);
|
|
443
435
|
this.#module.HEAPU8.set(packet, packetPtr);
|
|
444
436
|
return { packetLength: packet.byteLength, packetPtr };
|
|
445
437
|
}
|
|
446
|
-
#ensurePacketBytes(requiredBytes) {
|
|
447
|
-
if (this.#packetPtr !== 0 && this.#packetBytes >= requiredBytes) {
|
|
448
|
-
return this.#packetPtr;
|
|
449
|
-
}
|
|
450
|
-
const nextPtr = checkedMalloc(this.#module, requiredBytes);
|
|
451
|
-
if (this.#packetPtr !== 0) {
|
|
452
|
-
this.#module._free(this.#packetPtr);
|
|
453
|
-
}
|
|
454
|
-
this.#packetPtr = nextPtr;
|
|
455
|
-
this.#packetBytes = requiredBytes;
|
|
456
|
-
return this.#packetPtr;
|
|
457
|
-
}
|
|
458
|
-
#ensurePcmBytes(requiredBytes) {
|
|
459
|
-
if (this.#pcmPtr !== 0 && this.#pcmBytes >= requiredBytes) {
|
|
460
|
-
return this.#pcmPtr;
|
|
461
|
-
}
|
|
462
|
-
const nextPtr = checkedMalloc(this.#module, requiredBytes);
|
|
463
|
-
if (this.#pcmPtr !== 0) {
|
|
464
|
-
this.#module._free(this.#pcmPtr);
|
|
465
|
-
}
|
|
466
|
-
this.#pcmPtr = nextPtr;
|
|
467
|
-
this.#pcmBytes = requiredBytes;
|
|
468
|
-
return this.#pcmPtr;
|
|
469
|
-
}
|
|
470
|
-
#freeScratch() {
|
|
471
|
-
if (this.#packetPtr !== 0) {
|
|
472
|
-
this.#module._free(this.#packetPtr);
|
|
473
|
-
}
|
|
474
|
-
if (this.#pcmPtr !== 0) {
|
|
475
|
-
this.#module._free(this.#pcmPtr);
|
|
476
|
-
}
|
|
477
|
-
this.#packetPtr = 0;
|
|
478
|
-
this.#packetBytes = 0;
|
|
479
|
-
this.#pcmPtr = 0;
|
|
480
|
-
this.#pcmBytes = 0;
|
|
481
|
-
}
|
|
482
438
|
#resolveDecodeFrameSize(packet, options) {
|
|
483
439
|
const frameSize = packet === null || options.decodeFec
|
|
484
440
|
? (options.frameSize ?? options.maxFrameSize ?? samplesForDuration(this.sampleRate, DEFAULT_FRAME_DURATION_MS))
|
|
@@ -550,6 +506,10 @@ function normalizeEncoderOptions(options) {
|
|
|
550
506
|
const sampleRate = options.sampleRate ?? DEFAULT_SAMPLE_RATE;
|
|
551
507
|
const channels = options.channels ?? DEFAULT_CHANNELS;
|
|
552
508
|
validateCodecOptions({ channels, sampleRate });
|
|
509
|
+
const application = options.application ?? Application.Audio;
|
|
510
|
+
if (!Object.values(Application).includes(application)) {
|
|
511
|
+
throw new RangeError("application must be Application.Voip, Application.Audio, or Application.RestrictedLowDelay");
|
|
512
|
+
}
|
|
553
513
|
const frameSize = options.frameSize ?? samplesForDuration(sampleRate, DEFAULT_FRAME_DURATION_MS);
|
|
554
514
|
validateEncodeFrameSize(frameSize, sampleRate, "frameSize");
|
|
555
515
|
if (options.maxBandwidth !== undefined) {
|
|
@@ -564,7 +524,7 @@ function normalizeEncoderOptions(options) {
|
|
|
564
524
|
throw new RangeError("signal must be Signal.Auto, Signal.Voice, or Signal.Music");
|
|
565
525
|
}
|
|
566
526
|
return {
|
|
567
|
-
application
|
|
527
|
+
application,
|
|
568
528
|
bitrate: normalizeBitrate(options.bitrate ?? 64_000),
|
|
569
529
|
channels,
|
|
570
530
|
complexity,
|
|
@@ -608,7 +568,7 @@ function normalizeBitrate(bitrate) {
|
|
|
608
568
|
if (bitrate === Bitrate.Auto || bitrate === Bitrate.Max) {
|
|
609
569
|
return bitrate;
|
|
610
570
|
}
|
|
611
|
-
|
|
571
|
+
validateIntegerRange(bitrate, 1, MAX_I32, "bitrate");
|
|
612
572
|
return bitrate;
|
|
613
573
|
}
|
|
614
574
|
function validateBandwidth(bandwidth, name) {
|
|
@@ -646,11 +606,6 @@ function validateInteger(value, name) {
|
|
|
646
606
|
throw new RangeError(`${name} must be an integer`);
|
|
647
607
|
}
|
|
648
608
|
}
|
|
649
|
-
function validatePositiveInteger(value, name) {
|
|
650
|
-
if (!Number.isInteger(value) || value <= 0) {
|
|
651
|
-
throw new RangeError(`${name} must be a positive integer`);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
609
|
function validateIntegerRange(value, min, max, name) {
|
|
655
610
|
if (!Number.isInteger(value) || value < min || value > max) {
|
|
656
611
|
throw new RangeError(`${name} must be an integer from ${min} to ${max}`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libopus-wasm",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"packageManager": "pnpm@11.25.0",
|
|
3
|
+
"version": "0.4.1",
|
|
5
4
|
"description": "Small, modern WASM bindings for libopus raw packet encode/decode.",
|
|
6
5
|
"type": "module",
|
|
7
6
|
"sideEffects": false,
|
|
@@ -35,26 +34,25 @@
|
|
|
35
34
|
"README.md",
|
|
36
35
|
"THIRD_PARTY_NOTICES.md"
|
|
37
36
|
],
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@discordjs/opus": "0.10.0",
|
|
39
|
+
"@types/node": "26.6.2",
|
|
40
|
+
"@vitest/coverage-v8": "5.0.1",
|
|
41
|
+
"typescript": "^7.0.2",
|
|
42
|
+
"vite": "8.3.0",
|
|
43
|
+
"vitest": "5.0.1"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=22"
|
|
47
|
+
},
|
|
38
48
|
"scripts": {
|
|
39
49
|
"build": "pnpm build:wasm && tsc -p tsconfig.json && node scripts/copy-generated.mjs",
|
|
40
50
|
"build:wasm": "node scripts/build-libopus-wasm.mjs",
|
|
41
51
|
"benchmark": "pnpm build && node scripts/benchmark-native.mjs",
|
|
42
52
|
"clean": "rm -rf dist .cache",
|
|
43
53
|
"docs:build": "node scripts/build-docs-site.mjs",
|
|
44
|
-
"prepack": "pnpm build",
|
|
45
54
|
"test": "pnpm build:wasm && vitest run",
|
|
46
55
|
"test:coverage": "pnpm build:wasm && vitest run --coverage",
|
|
47
56
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
48
|
-
},
|
|
49
|
-
"devDependencies": {
|
|
50
|
-
"@discordjs/opus": "0.10.0",
|
|
51
|
-
"@types/node": "26.4.1",
|
|
52
|
-
"@vitest/coverage-v8": "5.0.0",
|
|
53
|
-
"typescript": "^7.0.2",
|
|
54
|
-
"vite": "8.2.2",
|
|
55
|
-
"vitest": "5.0.0"
|
|
56
|
-
},
|
|
57
|
-
"engines": {
|
|
58
|
-
"node": ">=22"
|
|
59
57
|
}
|
|
60
|
-
}
|
|
58
|
+
}
|