@kenzuya/mediabunny 1.26.0 → 1.28.5

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.
Files changed (237) hide show
  1. package/README.md +1 -1
  2. package/dist/bundles/{mediabunny.mjs → mediabunny.js} +21963 -21388
  3. package/dist/bundles/mediabunny.min.js +490 -0
  4. package/dist/modules/shared/mp3-misc.d.ts.map +1 -1
  5. package/dist/modules/src/adts/adts-demuxer.d.ts +6 -6
  6. package/dist/modules/src/adts/adts-demuxer.d.ts.map +1 -1
  7. package/dist/modules/src/adts/adts-muxer.d.ts +4 -4
  8. package/dist/modules/src/adts/adts-muxer.d.ts.map +1 -1
  9. package/dist/modules/src/adts/adts-reader.d.ts +1 -1
  10. package/dist/modules/src/adts/adts-reader.d.ts.map +1 -1
  11. package/dist/modules/src/avi/avi-demuxer.d.ts +44 -0
  12. package/dist/modules/src/avi/avi-demuxer.d.ts.map +1 -0
  13. package/dist/modules/src/avi/avi-misc.d.ts +88 -0
  14. package/dist/modules/src/avi/avi-misc.d.ts.map +1 -0
  15. package/dist/modules/src/avi/avi-muxer.d.ts +45 -0
  16. package/dist/modules/src/avi/avi-muxer.d.ts.map +1 -0
  17. package/dist/modules/src/avi/riff-writer.d.ts +26 -0
  18. package/dist/modules/src/avi/riff-writer.d.ts.map +1 -0
  19. package/dist/modules/src/codec-data.d.ts +8 -3
  20. package/dist/modules/src/codec-data.d.ts.map +1 -1
  21. package/dist/modules/src/codec.d.ts +10 -10
  22. package/dist/modules/src/codec.d.ts.map +1 -1
  23. package/dist/modules/src/conversion.d.ts +33 -16
  24. package/dist/modules/src/conversion.d.ts.map +1 -1
  25. package/dist/modules/src/custom-coder.d.ts +8 -8
  26. package/dist/modules/src/custom-coder.d.ts.map +1 -1
  27. package/dist/modules/src/demuxer.d.ts +3 -3
  28. package/dist/modules/src/demuxer.d.ts.map +1 -1
  29. package/dist/modules/src/encode.d.ts +8 -8
  30. package/dist/modules/src/encode.d.ts.map +1 -1
  31. package/dist/modules/src/flac/flac-demuxer.d.ts +7 -7
  32. package/dist/modules/src/flac/flac-demuxer.d.ts.map +1 -1
  33. package/dist/modules/src/flac/flac-misc.d.ts +3 -3
  34. package/dist/modules/src/flac/flac-misc.d.ts.map +1 -1
  35. package/dist/modules/src/flac/flac-muxer.d.ts +5 -5
  36. package/dist/modules/src/flac/flac-muxer.d.ts.map +1 -1
  37. package/dist/modules/src/id3.d.ts +3 -3
  38. package/dist/modules/src/id3.d.ts.map +1 -1
  39. package/dist/modules/src/index.d.ts +20 -20
  40. package/dist/modules/src/index.d.ts.map +1 -1
  41. package/dist/modules/src/input-format.d.ts +22 -0
  42. package/dist/modules/src/input-format.d.ts.map +1 -1
  43. package/dist/modules/src/input-track.d.ts +8 -8
  44. package/dist/modules/src/input-track.d.ts.map +1 -1
  45. package/dist/modules/src/input.d.ts +12 -12
  46. package/dist/modules/src/isobmff/isobmff-boxes.d.ts +2 -2
  47. package/dist/modules/src/isobmff/isobmff-boxes.d.ts.map +1 -1
  48. package/dist/modules/src/isobmff/isobmff-demuxer.d.ts +12 -12
  49. package/dist/modules/src/isobmff/isobmff-demuxer.d.ts.map +1 -1
  50. package/dist/modules/src/isobmff/isobmff-misc.d.ts.map +1 -1
  51. package/dist/modules/src/isobmff/isobmff-muxer.d.ts +11 -11
  52. package/dist/modules/src/isobmff/isobmff-muxer.d.ts.map +1 -1
  53. package/dist/modules/src/isobmff/isobmff-reader.d.ts +2 -2
  54. package/dist/modules/src/isobmff/isobmff-reader.d.ts.map +1 -1
  55. package/dist/modules/src/matroska/ebml.d.ts +3 -3
  56. package/dist/modules/src/matroska/ebml.d.ts.map +1 -1
  57. package/dist/modules/src/matroska/matroska-demuxer.d.ts +13 -13
  58. package/dist/modules/src/matroska/matroska-demuxer.d.ts.map +1 -1
  59. package/dist/modules/src/matroska/matroska-input.d.ts +33 -0
  60. package/dist/modules/src/matroska/matroska-input.d.ts.map +1 -0
  61. package/dist/modules/src/matroska/matroska-misc.d.ts.map +1 -1
  62. package/dist/modules/src/matroska/matroska-muxer.d.ts +5 -5
  63. package/dist/modules/src/matroska/matroska-muxer.d.ts.map +1 -1
  64. package/dist/modules/src/media-sink.d.ts +5 -5
  65. package/dist/modules/src/media-sink.d.ts.map +1 -1
  66. package/dist/modules/src/media-source.d.ts +22 -4
  67. package/dist/modules/src/media-source.d.ts.map +1 -1
  68. package/dist/modules/src/metadata.d.ts +2 -2
  69. package/dist/modules/src/metadata.d.ts.map +1 -1
  70. package/dist/modules/src/misc.d.ts +5 -4
  71. package/dist/modules/src/misc.d.ts.map +1 -1
  72. package/dist/modules/src/mp3/mp3-demuxer.d.ts +7 -7
  73. package/dist/modules/src/mp3/mp3-demuxer.d.ts.map +1 -1
  74. package/dist/modules/src/mp3/mp3-muxer.d.ts +4 -4
  75. package/dist/modules/src/mp3/mp3-muxer.d.ts.map +1 -1
  76. package/dist/modules/src/mp3/mp3-reader.d.ts +2 -2
  77. package/dist/modules/src/mp3/mp3-reader.d.ts.map +1 -1
  78. package/dist/modules/src/mp3/mp3-writer.d.ts +1 -1
  79. package/dist/modules/src/mp3/mp3-writer.d.ts.map +1 -1
  80. package/dist/modules/src/muxer.d.ts +4 -4
  81. package/dist/modules/src/muxer.d.ts.map +1 -1
  82. package/dist/modules/src/node.d.ts +1 -1
  83. package/dist/modules/src/ogg/ogg-demuxer.d.ts +7 -7
  84. package/dist/modules/src/ogg/ogg-demuxer.d.ts.map +1 -1
  85. package/dist/modules/src/ogg/ogg-misc.d.ts +1 -1
  86. package/dist/modules/src/ogg/ogg-misc.d.ts.map +1 -1
  87. package/dist/modules/src/ogg/ogg-muxer.d.ts +5 -5
  88. package/dist/modules/src/ogg/ogg-muxer.d.ts.map +1 -1
  89. package/dist/modules/src/ogg/ogg-reader.d.ts +1 -1
  90. package/dist/modules/src/ogg/ogg-reader.d.ts.map +1 -1
  91. package/dist/modules/src/output-format.d.ts +51 -6
  92. package/dist/modules/src/output-format.d.ts.map +1 -1
  93. package/dist/modules/src/output.d.ts +13 -13
  94. package/dist/modules/src/output.d.ts.map +1 -1
  95. package/dist/modules/src/packet.d.ts +1 -1
  96. package/dist/modules/src/packet.d.ts.map +1 -1
  97. package/dist/modules/src/pcm.d.ts.map +1 -1
  98. package/dist/modules/src/reader.d.ts +2 -2
  99. package/dist/modules/src/reader.d.ts.map +1 -1
  100. package/dist/modules/src/sample.d.ts +57 -15
  101. package/dist/modules/src/sample.d.ts.map +1 -1
  102. package/dist/modules/src/source.d.ts +3 -3
  103. package/dist/modules/src/source.d.ts.map +1 -1
  104. package/dist/modules/src/subtitles.d.ts +1 -1
  105. package/dist/modules/src/subtitles.d.ts.map +1 -1
  106. package/dist/modules/src/target.d.ts +2 -2
  107. package/dist/modules/src/target.d.ts.map +1 -1
  108. package/dist/modules/src/tsconfig.tsbuildinfo +1 -1
  109. package/dist/modules/src/wave/riff-writer.d.ts +1 -1
  110. package/dist/modules/src/wave/riff-writer.d.ts.map +1 -1
  111. package/dist/modules/src/wave/wave-demuxer.d.ts +6 -6
  112. package/dist/modules/src/wave/wave-demuxer.d.ts.map +1 -1
  113. package/dist/modules/src/wave/wave-muxer.d.ts +4 -4
  114. package/dist/modules/src/wave/wave-muxer.d.ts.map +1 -1
  115. package/dist/modules/src/writer.d.ts +1 -1
  116. package/dist/modules/src/writer.d.ts.map +1 -1
  117. package/dist/packages/eac3/eac3.wasm +0 -0
  118. package/dist/packages/eac3/mediabunny-eac3.js +1058 -0
  119. package/dist/packages/eac3/mediabunny-eac3.min.js +44 -0
  120. package/dist/packages/mp3-encoder/mediabunny-mp3-encoder.js +694 -0
  121. package/dist/packages/mp3-encoder/mediabunny-mp3-encoder.min.js +58 -0
  122. package/dist/packages/mpeg4/mediabunny-mpeg4.js +1198 -0
  123. package/dist/packages/mpeg4/mediabunny-mpeg4.min.js +44 -0
  124. package/dist/packages/mpeg4/xvid.wasm +0 -0
  125. package/package.json +18 -57
  126. package/dist/bundles/mediabunny.cjs +0 -26140
  127. package/dist/bundles/mediabunny.min.cjs +0 -147
  128. package/dist/bundles/mediabunny.min.mjs +0 -146
  129. package/dist/mediabunny.d.ts +0 -3319
  130. package/dist/modules/shared/mp3-misc.js +0 -147
  131. package/dist/modules/src/adts/adts-demuxer.js +0 -239
  132. package/dist/modules/src/adts/adts-muxer.js +0 -80
  133. package/dist/modules/src/adts/adts-reader.js +0 -63
  134. package/dist/modules/src/codec-data.js +0 -1730
  135. package/dist/modules/src/codec.js +0 -869
  136. package/dist/modules/src/conversion.js +0 -1459
  137. package/dist/modules/src/custom-coder.js +0 -117
  138. package/dist/modules/src/demuxer.js +0 -12
  139. package/dist/modules/src/encode.js +0 -442
  140. package/dist/modules/src/flac/flac-demuxer.js +0 -504
  141. package/dist/modules/src/flac/flac-misc.js +0 -135
  142. package/dist/modules/src/flac/flac-muxer.js +0 -222
  143. package/dist/modules/src/id3.js +0 -848
  144. package/dist/modules/src/index.js +0 -28
  145. package/dist/modules/src/input-format.js +0 -480
  146. package/dist/modules/src/input-track.js +0 -372
  147. package/dist/modules/src/input.js +0 -188
  148. package/dist/modules/src/isobmff/isobmff-boxes.js +0 -1480
  149. package/dist/modules/src/isobmff/isobmff-demuxer.js +0 -2618
  150. package/dist/modules/src/isobmff/isobmff-misc.js +0 -20
  151. package/dist/modules/src/isobmff/isobmff-muxer.js +0 -966
  152. package/dist/modules/src/isobmff/isobmff-reader.js +0 -72
  153. package/dist/modules/src/matroska/ebml.js +0 -653
  154. package/dist/modules/src/matroska/matroska-demuxer.js +0 -2133
  155. package/dist/modules/src/matroska/matroska-misc.js +0 -20
  156. package/dist/modules/src/matroska/matroska-muxer.js +0 -1017
  157. package/dist/modules/src/media-sink.js +0 -1736
  158. package/dist/modules/src/media-source.js +0 -1825
  159. package/dist/modules/src/metadata.js +0 -193
  160. package/dist/modules/src/misc.js +0 -623
  161. package/dist/modules/src/mp3/mp3-demuxer.js +0 -285
  162. package/dist/modules/src/mp3/mp3-muxer.js +0 -123
  163. package/dist/modules/src/mp3/mp3-reader.js +0 -26
  164. package/dist/modules/src/mp3/mp3-writer.js +0 -78
  165. package/dist/modules/src/muxer.js +0 -50
  166. package/dist/modules/src/node.js +0 -9
  167. package/dist/modules/src/ogg/ogg-demuxer.js +0 -763
  168. package/dist/modules/src/ogg/ogg-misc.js +0 -78
  169. package/dist/modules/src/ogg/ogg-muxer.js +0 -353
  170. package/dist/modules/src/ogg/ogg-reader.js +0 -65
  171. package/dist/modules/src/output-format.js +0 -527
  172. package/dist/modules/src/output.js +0 -300
  173. package/dist/modules/src/packet.js +0 -182
  174. package/dist/modules/src/pcm.js +0 -85
  175. package/dist/modules/src/reader.js +0 -236
  176. package/dist/modules/src/sample.js +0 -1056
  177. package/dist/modules/src/source.js +0 -1182
  178. package/dist/modules/src/subtitles.js +0 -575
  179. package/dist/modules/src/target.js +0 -140
  180. package/dist/modules/src/wave/riff-writer.js +0 -30
  181. package/dist/modules/src/wave/wave-demuxer.js +0 -447
  182. package/dist/modules/src/wave/wave-muxer.js +0 -318
  183. package/dist/modules/src/writer.js +0 -370
  184. package/src/adts/adts-demuxer.ts +0 -331
  185. package/src/adts/adts-muxer.ts +0 -111
  186. package/src/adts/adts-reader.ts +0 -85
  187. package/src/codec-data.ts +0 -2078
  188. package/src/codec.ts +0 -1092
  189. package/src/conversion.ts +0 -2112
  190. package/src/custom-coder.ts +0 -197
  191. package/src/demuxer.ts +0 -24
  192. package/src/encode.ts +0 -739
  193. package/src/flac/flac-demuxer.ts +0 -730
  194. package/src/flac/flac-misc.ts +0 -164
  195. package/src/flac/flac-muxer.ts +0 -320
  196. package/src/id3.ts +0 -925
  197. package/src/index.ts +0 -221
  198. package/src/input-format.ts +0 -541
  199. package/src/input-track.ts +0 -529
  200. package/src/input.ts +0 -235
  201. package/src/isobmff/isobmff-boxes.ts +0 -1719
  202. package/src/isobmff/isobmff-demuxer.ts +0 -3190
  203. package/src/isobmff/isobmff-misc.ts +0 -29
  204. package/src/isobmff/isobmff-muxer.ts +0 -1348
  205. package/src/isobmff/isobmff-reader.ts +0 -91
  206. package/src/matroska/ebml.ts +0 -730
  207. package/src/matroska/matroska-demuxer.ts +0 -2481
  208. package/src/matroska/matroska-misc.ts +0 -29
  209. package/src/matroska/matroska-muxer.ts +0 -1276
  210. package/src/media-sink.ts +0 -2179
  211. package/src/media-source.ts +0 -2243
  212. package/src/metadata.ts +0 -320
  213. package/src/misc.ts +0 -798
  214. package/src/mp3/mp3-demuxer.ts +0 -383
  215. package/src/mp3/mp3-muxer.ts +0 -166
  216. package/src/mp3/mp3-reader.ts +0 -34
  217. package/src/mp3/mp3-writer.ts +0 -120
  218. package/src/muxer.ts +0 -88
  219. package/src/node.ts +0 -11
  220. package/src/ogg/ogg-demuxer.ts +0 -1053
  221. package/src/ogg/ogg-misc.ts +0 -116
  222. package/src/ogg/ogg-muxer.ts +0 -497
  223. package/src/ogg/ogg-reader.ts +0 -93
  224. package/src/output-format.ts +0 -945
  225. package/src/output.ts +0 -488
  226. package/src/packet.ts +0 -263
  227. package/src/pcm.ts +0 -112
  228. package/src/reader.ts +0 -323
  229. package/src/sample.ts +0 -1461
  230. package/src/source.ts +0 -1688
  231. package/src/subtitles.ts +0 -711
  232. package/src/target.ts +0 -204
  233. package/src/tsconfig.json +0 -16
  234. package/src/wave/riff-writer.ts +0 -36
  235. package/src/wave/wave-demuxer.ts +0 -529
  236. package/src/wave/wave-muxer.ts +0 -371
  237. package/src/writer.ts +0 -490
@@ -0,0 +1,44 @@
1
+ /*!
2
+ * Copyright (c) 2025-present, Vanilagy and contributors
3
+ *
4
+ * This Source Code Form is subject to the terms of the Mozilla Public
5
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
6
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7
+ */
8
+ /*!
9
+ * Copyright (c) 2025-present, Vanilagy and contributors
10
+ *
11
+ * This Source Code Form is subject to the terms of the Mozilla Public
12
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
13
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
14
+ */function G(Q){if(!Q)throw Error("Assertion failed.")}var H=(Q)=>{if(Q.constructor===Uint8Array)return Q;if(ArrayBuffer.isView(Q))return new Uint8Array(Q.buffer,Q.byteOffset,Q.byteLength);if(typeof SharedArrayBuffer<"u"&&Q instanceof SharedArrayBuffer)return new Uint8Array(Q);return new Uint8Array(Q)};var C=(Q)=>{return Object.fromEntries(Object.entries(Q).map(([Y,J])=>[J,Y]))},e={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},IQ=C(e),QQ={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},zQ=C(QQ),YQ={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},LQ=C(YQ);var f=(Q)=>{return Q instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&Q instanceof SharedArrayBuffer||ArrayBuffer.isView(Q)};class JQ{currentPromise=Promise.resolve();async acquire(){let Q,Y=new Promise((U)=>{Q=U}),J=this.currentPromise;return this.currentPromise=Y,await J,Q}}var h=(Q)=>{throw Error(`Unexpected value: ${Q}`)};var j=1e6*(1+Number.EPSILON);class UQ{currentPromise=Promise.resolve();call(Q){return this.currentPromise=this.currentPromise.then(Q)}}var O=null,m=()=>{if(O!==null)return O;return O=typeof navigator<"u"&&navigator.userAgent?.includes("Firefox")};var u=()=>{Symbol.dispose??=Symbol("Symbol.dispose")};/*!
15
+ * Copyright (c) 2025-present, Vanilagy and contributors
16
+ *
17
+ * This Source Code Form is subject to the terms of the Mozilla Public
18
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
19
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
20
+ */class E{codec;config;onSample;static supports(Q,Y){return!1}}class D{codec;config;onSample;static supports(Q,Y){return!1}}class F{codec;config;onPacket;static supports(Q,Y){return!1}}class w{codec;config;onPacket;static supports(Q,Y){return!1}}var p=[],l=[],c=[],d=[],b=(Q)=>{if(Q.prototype instanceof E){let Y=Q;if(p.includes(Y)){console.warn("Video decoder already registered.");return}p.push(Y)}else if(Q.prototype instanceof D){let Y=Q;if(l.includes(Y)){console.warn("Audio decoder already registered.");return}l.push(Y)}else throw TypeError("Decoder must be a CustomVideoDecoder or CustomAudioDecoder.")},g=(Q)=>{if(Q.prototype instanceof F){let Y=Q;if(c.includes(Y)){console.warn("Video encoder already registered.");return}c.push(Y)}else if(Q.prototype instanceof w){let Y=Q;if(d.includes(Y)){console.warn("Audio encoder already registered.");return}d.push(Y)}else throw TypeError("Encoder must be a CustomVideoEncoder or CustomAudioEncoder.")};/*!
21
+ * Copyright (c) 2025-present, Vanilagy and contributors
22
+ *
23
+ * This Source Code Form is subject to the terms of the Mozilla Public
24
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
25
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
26
+ */var r=new Uint8Array(0);class S{data;type;timestamp;duration;sequenceNumber;byteLength;sideData;constructor(Q,Y,J,U,$=-1,M,K){this.data=Q;this.type=Y;this.timestamp=J;this.duration=U;this.sequenceNumber=$;if(Q===r&&M===void 0)throw Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(M===void 0)M=Q.byteLength;if(!(Q instanceof Uint8Array))throw TypeError("data must be a Uint8Array.");if(Y!=="key"&&Y!=="delta")throw TypeError('type must be either "key" or "delta".');if(!Number.isFinite(J))throw TypeError("timestamp must be a number.");if(!Number.isFinite(U)||U<0)throw TypeError("duration must be a non-negative number.");if(!Number.isFinite($))throw TypeError("sequenceNumber must be a number.");if(!Number.isInteger(M)||M<0)throw TypeError("byteLength must be a non-negative integer.");if(K!==void 0&&(typeof K!=="object"||!K))throw TypeError("sideData, when provided, must be an object.");if(K?.alpha!==void 0&&!(K.alpha instanceof Uint8Array))throw TypeError("sideData.alpha, when provided, must be a Uint8Array.");if(K?.alphaByteLength!==void 0&&(!Number.isInteger(K.alphaByteLength)||K.alphaByteLength<0))throw TypeError("sideData.alphaByteLength, when provided, must be a non-negative integer.");if(this.byteLength=M,this.sideData=K??{},this.sideData.alpha&&this.sideData.alphaByteLength===void 0)this.sideData.alphaByteLength=this.sideData.alpha.byteLength}get isMetadataOnly(){return this.data===r}get microsecondTimestamp(){return Math.trunc(j*this.timestamp)}get microsecondDuration(){return Math.trunc(j*this.duration)}toEncodedVideoChunk(){if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to a video chunk.");if(typeof EncodedVideoChunk>"u")throw Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}alphaToEncodedVideoChunk(Q=this.type){if(!this.sideData.alpha)throw TypeError("This packet does not contain alpha side data.");if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to a video chunk.");if(typeof EncodedVideoChunk>"u")throw Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.sideData.alpha,type:Q,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}toEncodedAudioChunk(){if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to an audio chunk.");if(typeof EncodedAudioChunk>"u")throw Error("Your browser does not support EncodedAudioChunk.");return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}static fromEncodedChunk(Q,Y){if(!(Q instanceof EncodedVideoChunk||Q instanceof EncodedAudioChunk))throw TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");let J=new Uint8Array(Q.byteLength);return Q.copyTo(J),new S(J,Q.type,Q.timestamp/1e6,(Q.duration??0)/1e6,void 0,void 0,Y)}clone(Q){if(Q!==void 0&&(typeof Q!=="object"||Q===null))throw TypeError("options, when provided, must be an object.");if(Q?.timestamp!==void 0&&!Number.isFinite(Q.timestamp))throw TypeError("options.timestamp, when provided, must be a number.");if(Q?.duration!==void 0&&!Number.isFinite(Q.duration))throw TypeError("options.duration, when provided, must be a number.");return new S(this.data,this.type,Q?.timestamp??this.timestamp,Q?.duration??this.duration,this.sequenceNumber,this.byteLength)}}/*!
27
+ * Copyright (c) 2025-present, Vanilagy and contributors
28
+ *
29
+ * This Source Code Form is subject to the terms of the Mozilla Public
30
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
31
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
32
+ */u();var s=-1/0,o=-1/0,x=null;if(typeof FinalizationRegistry<"u")x=new FinalizationRegistry((Q)=>{let Y=Date.now();if(Q.type==="video"){if(Y-s>=1000)console.error("A VideoSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your VideoSamples as soon as you're done using them."),s=Y;if(typeof VideoFrame<"u"&&Q.data instanceof VideoFrame)Q.data.close()}else{if(Y-o>=1000)console.error("An AudioSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your AudioSamples as soon as you're done using them."),o=Y;if(typeof AudioData<"u"&&Q.data instanceof AudioData)Q.data.close()}});var y=["I420","I420P10","I420P12","I420A","I420AP10","I420AP12","I422","I422P10","I422P12","I422A","I422AP10","I422AP12","I444","I444P10","I444P12","I444A","I444AP10","I444AP12","NV12","RGBA","RGBX","BGRA","BGRX"],$Q=new Set(y);class A{_data;_layout;_closed=!1;format;codedWidth;codedHeight;rotation;timestamp;duration;colorSpace;get displayWidth(){return this.rotation%180===0?this.codedWidth:this.codedHeight}get displayHeight(){return this.rotation%180===0?this.codedHeight:this.codedWidth}get microsecondTimestamp(){return Math.trunc(j*this.timestamp)}get microsecondDuration(){return Math.trunc(j*this.duration)}get hasAlpha(){return this.format&&this.format.includes("A")}constructor(Q,Y){if(Q instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&Q instanceof SharedArrayBuffer||ArrayBuffer.isView(Q)){if(!Y||typeof Y!=="object")throw TypeError("init must be an object.");if(Y.format===void 0||!$Q.has(Y.format))throw TypeError("init.format must be one of: "+y.join(", "));if(!Number.isInteger(Y.codedWidth)||Y.codedWidth<=0)throw TypeError("init.codedWidth must be a positive integer.");if(!Number.isInteger(Y.codedHeight)||Y.codedHeight<=0)throw TypeError("init.codedHeight must be a positive integer.");if(Y.rotation!==void 0&&![0,90,180,270].includes(Y.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(Y.timestamp))throw TypeError("init.timestamp must be a number.");if(Y.duration!==void 0&&(!Number.isFinite(Y.duration)||Y.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");this._data=H(Q).slice(),this._layout=Y.layout??ZQ(Y.format,Y.codedWidth,Y.codedHeight),this.format=Y.format,this.codedWidth=Y.codedWidth,this.codedHeight=Y.codedHeight,this.rotation=Y.rotation??0,this.timestamp=Y.timestamp,this.duration=Y.duration??0,this.colorSpace=new W(Y.colorSpace)}else if(typeof VideoFrame<"u"&&Q instanceof VideoFrame){if(Y?.rotation!==void 0&&![0,90,180,270].includes(Y.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(Y?.timestamp!==void 0&&!Number.isFinite(Y?.timestamp))throw TypeError("init.timestamp, when provided, must be a number.");if(Y?.duration!==void 0&&(!Number.isFinite(Y.duration)||Y.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");this._data=Q,this._layout=null,this.format=Q.format,this.codedWidth=Q.displayWidth,this.codedHeight=Q.displayHeight,this.rotation=Y?.rotation??0,this.timestamp=Y?.timestamp??Q.timestamp/1e6,this.duration=Y?.duration??(Q.duration??0)/1e6,this.colorSpace=new W(Q.colorSpace)}else if(typeof HTMLImageElement<"u"&&Q instanceof HTMLImageElement||typeof SVGImageElement<"u"&&Q instanceof SVGImageElement||typeof ImageBitmap<"u"&&Q instanceof ImageBitmap||typeof HTMLVideoElement<"u"&&Q instanceof HTMLVideoElement||typeof HTMLCanvasElement<"u"&&Q instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&Q instanceof OffscreenCanvas){if(!Y||typeof Y!=="object")throw TypeError("init must be an object.");if(Y.rotation!==void 0&&![0,90,180,270].includes(Y.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(Y.timestamp))throw TypeError("init.timestamp must be a number.");if(Y.duration!==void 0&&(!Number.isFinite(Y.duration)||Y.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");if(typeof VideoFrame<"u")return new A(new VideoFrame(Q,{timestamp:Math.trunc(Y.timestamp*j),duration:Math.trunc((Y.duration??0)*j)||void 0}),Y);let J=0,U=0;if("naturalWidth"in Q)J=Q.naturalWidth,U=Q.naturalHeight;else if("videoWidth"in Q)J=Q.videoWidth,U=Q.videoHeight;else if("width"in Q)J=Number(Q.width),U=Number(Q.height);if(!J||!U)throw TypeError("Could not determine dimensions.");let $=new OffscreenCanvas(J,U),M=$.getContext("2d",{alpha:m(),willReadFrequently:!0});G(M),M.drawImage(Q,0,0),this._data=$,this._layout=null,this.format="RGBX",this.codedWidth=J,this.codedHeight=U,this.rotation=Y.rotation??0,this.timestamp=Y.timestamp,this.duration=Y.duration??0,this.colorSpace=new W({matrix:"rgb",primaries:"bt709",transfer:"iec61966-2-1",fullRange:!0})}else throw TypeError("Invalid data type: Must be a BufferSource or CanvasImageSource.");x?.register(this,{type:"video",data:this._data},this)}clone(){if(this._closed)throw Error("VideoSample is closed.");if(G(this._data!==null),V(this._data))return new A(this._data.clone(),{timestamp:this.timestamp,duration:this.duration,rotation:this.rotation});if(this._data instanceof Uint8Array)return G(this._layout),new A(this._data,{format:this.format,layout:this._layout,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation});return new A(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation})}close(){if(this._closed)return;if(x?.unregister(this),V(this._data))this._data.close();else this._data=null;this._closed=!0}allocationSize(Q={}){if(qQ(Q),this._closed)throw Error("VideoSample is closed.");if((Q.format??this.format)===null)throw Error("Cannot get allocation size when format is null. Please manually provide an RGB pixel format in the options instead.");if(G(this._data!==null),!V(this._data)){if(Q.colorSpace||Q.format&&Q.format!==this.format||Q.layout||Q.rect){let Y=this.toVideoFrame(),J=Y.allocationSize(Q);return Y.close(),J}}if(V(this._data))return this._data.allocationSize(Q);if(this._data instanceof Uint8Array)return this._data.byteLength;return this.codedWidth*this.codedHeight*4}async copyTo(Q,Y={}){if(!f(Q))throw TypeError("destination must be an ArrayBuffer or an ArrayBuffer view.");if(this._closed)throw Error("VideoSample is closed.");if((Y.format??this.format)===null)throw Error("Cannot copy video sample data when format is null. Please manually provide an RGB pixel format in the options instead.");if(G(this._data!==null),!V(this._data)){if(Y.colorSpace||Y.format&&Y.format!==this.format||Y.layout||Y.rect){let J=this.toVideoFrame(),U=await J.copyTo(Q,Y);return J.close(),U}}if(V(this._data))return this._data.copyTo(Q,Y);else if(this._data instanceof Uint8Array)return G(this._layout),H(Q).set(this._data),this._layout;else{let U=this._data.getContext("2d");G(U);let $=U.getImageData(0,0,this.codedWidth,this.codedHeight);return H(Q).set($.data),[{offset:0,stride:4*this.codedWidth}]}}toVideoFrame(){if(this._closed)throw Error("VideoSample is closed.");if(G(this._data!==null),V(this._data))return new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0});if(this._data instanceof Uint8Array)return new VideoFrame(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0,colorSpace:this.colorSpace});return new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0})}draw(Q,Y,J,U,$,M,K,I,k){let q=0,Z=0,z=this.displayWidth,L=this.displayHeight,N=0,P=0,X=this.displayWidth,T=this.displayHeight;if(M!==void 0)if(q=Y,Z=J,z=U,L=$,N=M,P=K,I!==void 0)X=I,T=k;else X=z,T=L;else if(N=Y,P=J,U!==void 0)X=U,T=$;if(!(typeof CanvasRenderingContext2D<"u"&&Q instanceof CanvasRenderingContext2D||typeof OffscreenCanvasRenderingContext2D<"u"&&Q instanceof OffscreenCanvasRenderingContext2D))throw TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!Number.isFinite(q))throw TypeError("sx must be a number.");if(!Number.isFinite(Z))throw TypeError("sy must be a number.");if(!Number.isFinite(z)||z<0)throw TypeError("sWidth must be a non-negative number.");if(!Number.isFinite(L)||L<0)throw TypeError("sHeight must be a non-negative number.");if(!Number.isFinite(N))throw TypeError("dx must be a number.");if(!Number.isFinite(P))throw TypeError("dy must be a number.");if(!Number.isFinite(X)||X<0)throw TypeError("dWidth must be a non-negative number.");if(!Number.isFinite(T)||T<0)throw TypeError("dHeight must be a non-negative number.");if(this._closed)throw Error("VideoSample is closed.");({sx:q,sy:Z,sWidth:z,sHeight:L}=this._rotateSourceRegion(q,Z,z,L,this.rotation));let _=this.toCanvasImageSource();Q.save();let R=N+X/2,t=P+T/2;Q.translate(R,t),Q.rotate(this.rotation*Math.PI/180);let v=this.rotation%180===0?1:X/T;Q.scale(1/v,v),Q.drawImage(_,q,Z,z,L,-X/2,-T/2,X,T),Q.restore()}drawWithFit(Q,Y){if(!(typeof CanvasRenderingContext2D<"u"&&Q instanceof CanvasRenderingContext2D||typeof OffscreenCanvasRenderingContext2D<"u"&&Q instanceof OffscreenCanvasRenderingContext2D))throw TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!Y||typeof Y!=="object")throw TypeError("options must be an object.");if(!["fill","contain","cover"].includes(Y.fit))throw TypeError("options.fit must be 'fill', 'contain', or 'cover'.");if(Y.rotation!==void 0&&![0,90,180,270].includes(Y.rotation))throw TypeError("options.rotation, when provided, must be 0, 90, 180, or 270.");if(Y.crop!==void 0)KQ(Y.crop,"options.");let J=Q.canvas.width,U=Q.canvas.height,$=Y.rotation??this.rotation,[M,K]=$%180===0?[this.codedWidth,this.codedHeight]:[this.codedHeight,this.codedWidth];if(Y.crop)MQ(Y.crop,M,K);let I,k,q,Z,{sx:z,sy:L,sWidth:N,sHeight:P}=this._rotateSourceRegion(Y.crop?.left??0,Y.crop?.top??0,Y.crop?.width??M,Y.crop?.height??K,$);if(Y.fit==="fill")I=0,k=0,q=J,Z=U;else{let[T,_]=Y.crop?[Y.crop.width,Y.crop.height]:[M,K],R=Y.fit==="contain"?Math.min(J/T,U/_):Math.max(J/T,U/_);q=T*R,Z=_*R,I=(J-q)/2,k=(U-Z)/2}Q.save();let X=$%180===0?1:q/Z;Q.translate(J/2,U/2),Q.rotate($*Math.PI/180),Q.scale(1/X,X),Q.translate(-J/2,-U/2),Q.drawImage(this.toCanvasImageSource(),z,L,N,P,I,k,q,Z),Q.restore()}_rotateSourceRegion(Q,Y,J,U,$){if($===90)[Q,Y,J,U]=[Y,this.codedHeight-Q-J,U,J];else if($===180)[Q,Y]=[this.codedWidth-Q-J,this.codedHeight-Y-U];else if($===270)[Q,Y,J,U]=[this.codedWidth-Y-U,Q,U,J];return{sx:Q,sy:Y,sWidth:J,sHeight:U}}toCanvasImageSource(){if(this._closed)throw Error("VideoSample is closed.");if(G(this._data!==null),this._data instanceof Uint8Array){let Q=this.toVideoFrame();return queueMicrotask(()=>Q.close()),Q}return this._data}setRotation(Q){if(![0,90,180,270].includes(Q))throw TypeError("newRotation must be 0, 90, 180, or 270.");this.rotation=Q}setTimestamp(Q){if(!Number.isFinite(Q))throw TypeError("newTimestamp must be a number.");this.timestamp=Q}setDuration(Q){if(!Number.isFinite(Q)||Q<0)throw TypeError("newDuration must be a non-negative number.");this.duration=Q}[Symbol.dispose](){this.close()}}class W{primaries;transfer;matrix;fullRange;constructor(Q){this.primaries=Q?.primaries??null,this.transfer=Q?.transfer??null,this.matrix=Q?.matrix??null,this.fullRange=Q?.fullRange??null}toJSON(){return{primaries:this.primaries,transfer:this.transfer,matrix:this.matrix,fullRange:this.fullRange}}}var V=(Q)=>{return typeof VideoFrame<"u"&&Q instanceof VideoFrame},MQ=(Q,Y,J)=>{Q.left=Math.min(Q.left,Y),Q.top=Math.min(Q.top,J),Q.width=Math.min(Q.width,Y-Q.left),Q.height=Math.min(Q.height,J-Q.top),G(Q.width>=0),G(Q.height>=0)},KQ=(Q,Y)=>{if(!Q||typeof Q!=="object")throw TypeError(Y+"crop, when provided, must be an object.");if(!Number.isInteger(Q.left)||Q.left<0)throw TypeError(Y+"crop.left must be a non-negative integer.");if(!Number.isInteger(Q.top)||Q.top<0)throw TypeError(Y+"crop.top must be a non-negative integer.");if(!Number.isInteger(Q.width)||Q.width<0)throw TypeError(Y+"crop.width must be a non-negative integer.");if(!Number.isInteger(Q.height)||Q.height<0)throw TypeError(Y+"crop.height must be a non-negative integer.")},qQ=(Q)=>{if(!Q||typeof Q!=="object")throw TypeError("options must be an object.");if(Q.colorSpace!==void 0&&!["display-p3","srgb"].includes(Q.colorSpace))throw TypeError("options.colorSpace, when provided, must be 'display-p3' or 'srgb'.");if(Q.format!==void 0&&typeof Q.format!=="string")throw TypeError("options.format, when provided, must be a string.");if(Q.layout!==void 0){if(!Array.isArray(Q.layout))throw TypeError("options.layout, when provided, must be an array.");for(let Y of Q.layout){if(!Y||typeof Y!=="object")throw TypeError("Each entry in options.layout must be an object.");if(!Number.isInteger(Y.offset)||Y.offset<0)throw TypeError("plane.offset must be a non-negative integer.");if(!Number.isInteger(Y.stride)||Y.stride<0)throw TypeError("plane.stride must be a non-negative integer.")}}if(Q.rect!==void 0){if(!Q.rect||typeof Q.rect!=="object")throw TypeError("options.rect, when provided, must be an object.");if(Q.rect.x!==void 0&&(!Number.isInteger(Q.rect.x)||Q.rect.x<0))throw TypeError("options.rect.x, when provided, must be a non-negative integer.");if(Q.rect.y!==void 0&&(!Number.isInteger(Q.rect.y)||Q.rect.y<0))throw TypeError("options.rect.y, when provided, must be a non-negative integer.");if(Q.rect.width!==void 0&&(!Number.isInteger(Q.rect.width)||Q.rect.width<0))throw TypeError("options.rect.width, when provided, must be a non-negative integer.");if(Q.rect.height!==void 0&&(!Number.isInteger(Q.rect.height)||Q.rect.height<0))throw TypeError("options.rect.height, when provided, must be a non-negative integer.")}},ZQ=(Q,Y,J)=>{let U=TQ(Q),$=[],M=0;for(let K of U){let I=Math.ceil(Y/K.widthDivisor),k=Math.ceil(J/K.heightDivisor),q=I*K.sampleBytes,Z=q*k;$.push({offset:M,stride:q}),M+=Z}return $},TQ=(Q)=>{let Y=(J,U,$,M,K)=>{let I=[{sampleBytes:J,widthDivisor:1,heightDivisor:1},{sampleBytes:U,widthDivisor:$,heightDivisor:M},{sampleBytes:U,widthDivisor:$,heightDivisor:M}];if(K)I.push({sampleBytes:J,widthDivisor:1,heightDivisor:1});return I};switch(Q){case"I420":return Y(1,1,2,2,!1);case"I420P10":case"I420P12":return Y(2,2,2,2,!1);case"I420A":return Y(1,1,2,2,!0);case"I420AP10":case"I420AP12":return Y(2,2,2,2,!0);case"I422":return Y(1,1,2,1,!1);case"I422P10":case"I422P12":return Y(2,2,2,1,!1);case"I422A":return Y(1,1,2,1,!0);case"I422AP10":case"I422AP12":return Y(2,2,2,1,!0);case"I444":return Y(1,1,1,1,!1);case"I444P10":case"I444P12":return Y(2,2,1,1,!1);case"I444A":return Y(1,1,1,1,!0);case"I444AP10":case"I444AP12":return Y(2,2,1,1,!0);case"NV12":return[{sampleBytes:1,widthDivisor:1,heightDivisor:1},{sampleBytes:2,widthDivisor:2,heightDivisor:2}];case"RGBA":case"RGBX":case"BGRA":case"BGRX":return[{sampleBytes:4,widthDivisor:1,heightDivisor:1}];default:h(Q),G(!1)}};/*!
33
+ * Copyright (c) 2025-present, Vanilagy and contributors
34
+ *
35
+ * This Source Code Form is subject to the terms of the Mozilla Public
36
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
37
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
38
+ *//*!
39
+ * Copyright (c) 2025-present, Vanilagy and contributors (Wiedy Mi)
40
+ *
41
+ * This Source Code Form is subject to the terms of the Mozilla Public
42
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
43
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
44
+ */var GQ=new URL("./decode.worker.ts",import.meta.url),XQ=new URL("./encode.worker.ts",import.meta.url),n=(Q)=>{return new Worker(Q,{type:"module"})};class a extends E{worker=null;nextMessageId=0;pendingMessages=new Map;static supports(Q,Y){return Q==="mpeg4"}async init(){this.worker=n(GQ);let Q=(Y)=>{let J=Y.data,U=this.pendingMessages.get(J.id);if(B(U!==void 0),this.pendingMessages.delete(J.id),J.success)U.resolve(J.data);else U.reject(J.error)};this.worker.addEventListener("message",Q),await this.sendCommand({type:"init",data:{width:this.config.codedWidth,height:this.config.codedHeight}})}async decode(Q,Y){let J=Q.data.slice().buffer,U=await this.sendCommand({type:"decode",data:{frameData:J}},[J]);if(!U||!("yuvData"in U))return;let $=new VideoFrame(new Uint8Array(U.yuvData),{format:"I420",codedWidth:U.width,codedHeight:U.height,timestamp:Q.timestamp*1e6}),M=new A($);this.onSample(M)}async flush(){await this.sendCommand({type:"flush"})}close(){if(this.worker)this.sendCommand({type:"close"}),this.worker.terminate()}sendCommand(Q,Y){return new Promise((J,U)=>{let $=this.nextMessageId++;if(this.pendingMessages.set($,{resolve:J,reject:U}),B(this.worker!==null),Y)this.worker.postMessage({id:$,command:Q},Y);else this.worker.postMessage({id:$,command:Q})})}}class i extends F{worker=null;nextMessageId=0;pendingMessages=new Map;frameCount=0;static supports(Q,Y){return Q==="mpeg4"}async init(){this.worker=n(XQ);let Q=(U)=>{let $=U.data,M=this.pendingMessages.get($.id);if(B(M!==void 0),this.pendingMessages.delete($.id),$.success)M.resolve($.data);else M.reject($.error)};this.worker.addEventListener("message",Q);let Y=Math.round((this.config.framerate??30)*1000),J=1000;await this.sendCommand({type:"init",data:{width:this.config.width,height:this.config.height,bitrate:this.config.bitrate??2000000,fpsNum:Y,fpsDen:J}})}async encode(Q,Y){let J=Q.codedWidth*Q.codedHeight*3/2,U=new ArrayBuffer(J),$=new Uint8Array(U);await Q.copyTo($);let M=await this.sendCommand({type:"encode",data:{yuvData:U,forceKeyframe:Y.keyFrame??!1}},[U]);B(M&&"encodedData"in M);let K=new S(new Uint8Array(M.encodedData),Y.keyFrame?"key":"delta",Q.timestamp,Q.duration,this.frameCount++);this.onPacket(K,this.frameCount===1?{decoderConfig:{codec:"mpeg4",codedWidth:this.config.width,codedHeight:this.config.height}}:void 0)}async flush(){}close(){if(this.worker)this.sendCommand({type:"close"}),this.worker.terminate()}sendCommand(Q,Y){return new Promise((J,U)=>{let $=this.nextMessageId++;if(this.pendingMessages.set($,{resolve:J,reject:U}),B(this.worker!==null),Y)this.worker.postMessage({id:$,command:Q},Y);else this.worker.postMessage({id:$,command:Q})})}}var OQ=()=>{b(a)},CQ=()=>{g(i)};function B(Q){if(!Q)throw Error("Assertion failed.")}export{CQ as registerMpeg4Encoder,OQ as registerMpeg4Decoder,i as Mpeg4Encoder,a as Mpeg4Decoder};
Binary file
package/package.json CHANGED
@@ -1,54 +1,37 @@
1
1
  {
2
2
  "name": "@kenzuya/mediabunny",
3
3
  "author": "Vanilagy",
4
- "version": "1.26.0",
4
+ "version": "1.28.5",
5
5
  "description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
6
6
  "type": "module",
7
-
8
- "workspaces": [
9
- "packages/*"
10
- ],
11
- "main": "./dist/bundles/mediabunny.cjs",
12
- "module": "./dist/modules/src/index.js",
7
+ "main": "./dist/bundles/mediabunny.js",
8
+ "module": "./dist/bundles/mediabunny.js",
13
9
  "types": "./dist/modules/src/index.d.ts",
14
10
  "exports": {
15
- "types": "./dist/modules/src/index.d.ts",
16
- "import": "./dist/modules/src/index.js",
17
- "require": "./dist/bundles/mediabunny.cjs"
11
+ ".": {
12
+ "types": "./dist/modules/src/index.d.ts",
13
+ "import": "./dist/bundles/mediabunny.js",
14
+ "default": "./dist/bundles/mediabunny.js"
15
+ },
16
+ "./package.json": "./package.json"
18
17
  },
19
18
  "files": [
20
19
  "README.md",
21
20
  "package.json",
22
21
  "LICENSE",
23
- "dist",
24
- "src"
22
+ "dist"
25
23
  ],
26
24
  "browser": {
27
- "./dist/modules/src/node.js": false,
28
25
  "./src/node.ts": false,
29
26
  "node:fs/promises": false
30
27
  },
31
28
  "sideEffects": false,
32
29
  "scripts": {
33
- "build": "./build.sh",
34
- "watch": "tsx scripts/bundle.ts --watch",
35
- "lint": "eslint .",
36
- "test": "npx vitest --run",
37
- "test-node": "npm run test node/",
38
- "test-browser": "npm run test browser/",
39
- "check": "rm -rf dist/modules && tsc -p src && tsc -p packages/mp3-encoder/src --noEmit && tsc -p tsconfig.vitest.json --noEmit && tsc -p scripts --noEmit && tsc -p tsconfig.vite.json --noEmit",
40
- "check-docblocks": "tsx scripts/check-docblocks.ts dist/mediabunny.d.ts",
41
- "docs:dev": "vitepress dev docs",
42
- "docs:build": "npm run build && npm run docs:generate && vitepress build docs && npm run examples:build && cp dist/mediabunny.d.ts dist-docs/",
43
- "docs:preview": "vitepress preview docs",
44
- "docs:generate": "tsx scripts/generate-api-docs.ts src/index.ts packages/mp3-encoder/src/index.ts docs/api-config.json",
45
- "dev": "vite",
46
- "examples:build": "vite build",
47
- "fix-build-import-paths": "tsx scripts/add-import-extensions.ts",
48
- "append-namespace": "echo 'export as namespace Mediabunny;' >> dist/mediabunny.d.ts",
49
- "bump-patch": "npm version patch --no-git-tag-version --workspaces --include-workspace-root",
50
- "bump-minor": "npm version minor --no-git-tag-version --workspaces --include-workspace-root",
51
- "bump-major": "npm version major --no-git-tag-version --workspaces --include-workspace-root"
30
+ "build": "bun run build.ts",
31
+ "check-types": "tsc --noEmit",
32
+ "check-docblocks": "bun run scripts/check-docblocks.ts dist/mediabunny.d.ts",
33
+ "fix-build-import-paths": "bun run scripts/add-import-extensions.ts",
34
+ "append-namespace": "echo 'export as namespace Mediabunny;' >> dist/mediabunny.d.ts"
52
35
  },
53
36
  "license": "MPL-2.0",
54
37
  "repository": {
@@ -68,32 +51,10 @@
68
51
  "@types/dom-webcodecs": "0.1.13"
69
52
  },
70
53
  "devDependencies": {
71
- "@eslint/js": "^9.22.0",
72
- "@fontsource-variable/rubik": "^5.2.6",
73
- "@fontsource/dm-mono": "^5.2.6",
74
- "@microsoft/api-extractor": "^7.52.1",
75
- "@stylistic/eslint-plugin": "^4.2.0",
76
- "@tailwindcss/vite": "^4.1.7",
77
- "@types/markdown-it-footnote": "^3.0.4",
54
+ "@types/bun": "^1.3.3",
55
+ "@types/emscripten": "^1.40.1",
78
56
  "@types/node": "^22.13.10",
79
- "esbuild": "^0.25.1",
80
- "esbuild-plugin-external-global": "^1.0.1",
81
- "eslint": "^9.22.0",
82
- "find-cache-dir": "^5.0.0",
83
- "markdown-it-footnote": "^4.0.0",
84
- "markdown-it-mathjax3": "^4.3.2",
85
- "mermaid": "^11.6.0",
86
- "tailwindcss": "^4.1.7",
87
- "tsx": "^4.19.4",
88
- "typescript": "^5.8.2",
89
- "typescript-eslint": "^8.26.1",
90
- "vite": "^6.3.5",
91
- "vitepress": "^1.6.3",
92
- "vitepress-plugin-llms": "^1.5.1",
93
- "vitepress-plugin-mermaid": "^2.0.17",
94
- "vitest": "3.2.4",
95
- "@vitest/browser": "3.2.4",
96
- "webdriverio": "9.19.2"
57
+ "typescript": "^5.8.2"
97
58
  },
98
59
  "keywords": [
99
60
  "media",