@walkhi/code-relax 0.1.0-beta.4 → 0.1.0-beta.41

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 (845) hide show
  1. package/README.md +83 -71
  2. package/dist/bin/cleanup-accounts.mjs +63 -0
  3. package/dist/bin/codex-remote.mjs +323 -184
  4. package/dist/bin/manage-relay-admin.mjs +20 -0
  5. package/dist/bin/migrate-relay-db.mjs +109 -0
  6. package/dist/bin/publish-android-release.mjs +63 -0
  7. package/dist/bin/publish-harmony-release.mjs +46 -0
  8. package/dist/bin/release-upload-server.mjs +174 -0
  9. package/dist/bin/self-relay-admin.mjs +8 -0
  10. package/dist/bin/self-relay-demo.mjs +2 -2
  11. package/dist/bin/self-relay-server.mjs +43 -30
  12. package/dist/build-platform.json +1 -0
  13. package/dist/get-shared-service-url.ps1 +6 -6
  14. package/dist/shared/app-server-events.cjs +368 -238
  15. package/dist/shared/code-browser.cjs +159 -0
  16. package/dist/shared/file-changes.cjs +31 -0
  17. package/dist/shared/file-citations.cjs +117 -0
  18. package/dist/shared/file-mentions.cjs +92 -0
  19. package/dist/shared/message-delivery.cjs +100 -0
  20. package/dist/shared/p2p-data-channel.cjs +22 -0
  21. package/dist/shared/p2p-diagnostics.cjs +1 -1
  22. package/dist/shared/p2p-file-channel.cjs +87 -0
  23. package/dist/shared/p2p-ice-policy.cjs +22 -0
  24. package/dist/shared/plan-pricing.cjs +32 -0
  25. package/dist/shared/question-attention.cjs +69 -0
  26. package/dist/shared/server-requests.cjs +157 -5
  27. package/dist/shared/service-endpoints.cjs +21 -0
  28. package/dist/shared/timeline-sync.cjs +111 -5
  29. package/dist/skills/code-relax/SKILL.md +13 -8
  30. package/dist/src/archived-threads.mjs +22 -0
  31. package/dist/src/bounded-process-log.mjs +63 -0
  32. package/dist/src/celsius-client.mjs +107 -0
  33. package/dist/src/code-browser.mjs +100 -0
  34. package/dist/src/desktop-launcher.mjs +33 -38
  35. package/dist/src/dots-approval-timeline.mjs +99 -0
  36. package/dist/src/dots-avatar.mjs +42 -0
  37. package/dist/src/dots-chat-projection.mjs +50 -0
  38. package/dist/src/dots-chat-server.mjs +482 -0
  39. package/dist/src/dots-message-images.mjs +319 -0
  40. package/dist/src/dots-profile.mjs +77 -0
  41. package/dist/src/dots-room-activity.mjs +94 -0
  42. package/dist/src/dots-room-client.mjs +135 -0
  43. package/dist/src/dots-room-projection.mjs +94 -0
  44. package/dist/src/dots-schedules.mjs +66 -0
  45. package/dist/src/dots-summary-tasks.mjs +32 -0
  46. package/dist/src/dots-task-catalog.mjs +430 -0
  47. package/dist/src/dots-task-files.mjs +52 -0
  48. package/dist/src/file-transfer-range.mjs +22 -0
  49. package/dist/src/file-upload-session.mjs +130 -0
  50. package/dist/src/hosted-history-app-server.mjs +103 -0
  51. package/dist/src/hosted-history-cache.mjs +113 -0
  52. package/dist/src/lan-socket-server.mjs +241 -84
  53. package/dist/src/managed-app-server.mjs +54 -16
  54. package/dist/src/message-images.mjs +0 -18
  55. package/dist/src/message-upload-files.mjs +109 -0
  56. package/dist/src/onboarding.mjs +10 -29
  57. package/dist/src/plan-pricing.mjs +47 -0
  58. package/dist/src/platform/README.md +2 -2
  59. package/dist/src/platform/codex-protocol.mjs +46 -0
  60. package/dist/src/platform/codex-runtime.mjs +3 -0
  61. package/dist/src/platform/credential-store.mjs +3 -0
  62. package/dist/src/platform/desktop-host.mjs +3 -0
  63. package/dist/src/platform/desktop-project-registration.mjs +3 -0
  64. package/dist/src/platform/desktop-project-store.mjs +208 -0
  65. package/dist/src/platform/file-opener.mjs +9 -0
  66. package/dist/src/platform/linux/codex-runtime.mjs +56 -0
  67. package/dist/src/platform/linux/credential-store.mjs +28 -0
  68. package/dist/src/platform/linux/desktop-host.mjs +83 -0
  69. package/dist/src/platform/linux/desktop-installation.mjs +36 -0
  70. package/dist/src/platform/linux/desktop-project-registration.mjs +11 -0
  71. package/dist/src/platform/linux/network-info.mjs +11 -0
  72. package/dist/src/platform/linux/process.mjs +42 -0
  73. package/dist/src/platform/linux/project-locations.mjs +17 -0
  74. package/dist/src/platform/linux/resident-startup.mjs +52 -0
  75. package/dist/src/platform/linux/retained-runtime.mjs +76 -0
  76. package/dist/src/platform/linux/service-host.mjs +18 -0
  77. package/dist/src/platform/linux/system.mjs +49 -0
  78. package/dist/src/platform/linux/user-environment.mjs +7 -0
  79. package/dist/src/platform/macos/codex-runtime.mjs +125 -0
  80. package/dist/src/platform/macos/credential-store.mjs +10 -0
  81. package/dist/src/platform/macos/desktop-host.mjs +82 -0
  82. package/dist/src/platform/macos/desktop-project-registration.mjs +11 -0
  83. package/dist/src/platform/macos/network-info.mjs +8 -0
  84. package/dist/src/platform/macos/project-locations.mjs +8 -0
  85. package/dist/src/platform/macos/resident-startup.mjs +84 -0
  86. package/dist/src/platform/macos/retained-runtime.mjs +127 -0
  87. package/dist/src/platform/macos/service-host.mjs +18 -0
  88. package/dist/src/platform/macos/system.mjs +29 -0
  89. package/dist/src/platform/macos/user-environment.mjs +7 -0
  90. package/dist/src/platform/native-package.mjs +58 -0
  91. package/dist/src/platform/network-info.mjs +3 -0
  92. package/dist/src/platform/path-identity.mjs +5 -0
  93. package/dist/src/platform/posix/network-candidates.mjs +23 -0
  94. package/dist/src/platform/posix/runtime-paths.mjs +25 -0
  95. package/dist/src/platform/power-inhibitor.mjs +22 -0
  96. package/dist/src/platform/project-locations.mjs +3 -0
  97. package/dist/src/platform/runtime-paths.mjs +8 -0
  98. package/dist/src/platform/select.mjs +5 -0
  99. package/dist/src/platform/service-host.mjs +3 -0
  100. package/dist/src/platform/user-environment.mjs +3 -0
  101. package/dist/src/platform/windows/activate-desktop.ps1 +48 -0
  102. package/dist/src/platform/windows/codex-runtime.mjs +215 -0
  103. package/dist/src/platform/windows/credential-store.mjs +27 -27
  104. package/dist/src/platform/windows/credential-store.ps1 +49 -49
  105. package/dist/src/platform/windows/desktop-helper.mjs +179 -0
  106. package/dist/src/platform/windows/desktop-host.mjs +43 -23
  107. package/dist/src/platform/windows/desktop-info.ps1 +14 -16
  108. package/dist/src/platform/windows/desktop-project-registration.mjs +4 -0
  109. package/dist/src/platform/windows/desktop-runtime.ps1 +10 -0
  110. package/dist/src/platform/windows/desktop-shortcuts.ps1 +21 -28
  111. package/dist/src/platform/windows/dots-profile.mjs +49 -0
  112. package/dist/src/platform/windows/keep-awake.ps1 +20 -0
  113. package/dist/src/platform/windows/launch-worker.mjs +17 -18
  114. package/dist/src/platform/windows/project-locations.mjs +16 -0
  115. package/dist/src/platform/windows/resident-start.js +20 -0
  116. package/dist/src/platform/windows/resident-startup.ps1 +76 -20
  117. package/dist/src/platform/windows/rustdesk-video-probe.mjs +168 -0
  118. package/dist/src/platform/windows/service-host.mjs +24 -36
  119. package/dist/src/platform/windows/stop-desktop.ps1 +7 -4
  120. package/dist/src/platform/windows/user-environment.mjs +1 -1
  121. package/dist/src/project-create.mjs +121 -0
  122. package/dist/src/project-management.mjs +59 -0
  123. package/dist/src/project-remove.mjs +55 -0
  124. package/dist/src/project-update.mjs +59 -0
  125. package/dist/src/runtime-discovery.mjs +47 -0
  126. package/dist/src/self-relay/account-cleanup.mjs +30 -0
  127. package/dist/src/self-relay/account-connections.mjs +52 -0
  128. package/dist/src/self-relay/admin-cloud.mjs +101 -0
  129. package/dist/src/self-relay/admin-page.mjs +80 -0
  130. package/dist/src/self-relay/admin-server.mjs +74 -0
  131. package/dist/src/self-relay/admin-state.mjs +85 -19
  132. package/dist/src/self-relay/admin-style.mjs +14 -0
  133. package/dist/src/self-relay/android-releases.mjs +61 -0
  134. package/dist/src/self-relay/client.mjs +45 -45
  135. package/dist/src/self-relay/connector.mjs +421 -144
  136. package/dist/src/self-relay/demo.mjs +34 -35
  137. package/dist/src/self-relay/device-info.mjs +27 -0
  138. package/dist/src/self-relay/device-store.mjs +10 -2
  139. package/dist/src/self-relay/diagnostics.mjs +54 -0
  140. package/dist/src/self-relay/email-accounts.mjs +183 -0
  141. package/dist/src/self-relay/file-wire.mjs +13 -0
  142. package/dist/src/self-relay/lan-authorizations.mjs +44 -2
  143. package/dist/src/self-relay/lifecycle.mjs +250 -272
  144. package/dist/src/self-relay/long-pairing.mjs +40 -0
  145. package/dist/src/self-relay/mysql-state.mjs +118 -0
  146. package/dist/src/self-relay/p2p-probe.mjs +56 -11
  147. package/dist/src/self-relay/privacy-page.mjs +26 -0
  148. package/dist/src/self-relay/public-releases.mjs +52 -0
  149. package/dist/src/self-relay/rtc-file-bridge.mjs +41 -0
  150. package/dist/src/self-relay/server.mjs +652 -114
  151. package/dist/src/self-relay/usage-daily.mjs +55 -0
  152. package/dist/src/self-relay/usage-meter.mjs +141 -0
  153. package/dist/src/server.mjs +1519 -1793
  154. package/dist/src/service-control.mjs +17 -7
  155. package/dist/src/service-doctor.mjs +86 -33
  156. package/dist/src/service-health.mjs +2 -2
  157. package/dist/src/service-install.mjs +91 -85
  158. package/dist/src/service-lifecycle.mjs +117 -108
  159. package/dist/src/service-power.mjs +58 -0
  160. package/dist/src/service-restart.mjs +43 -10
  161. package/dist/src/service-update-worker.mjs +42 -0
  162. package/dist/src/service-update.mjs +71 -0
  163. package/dist/src/shared-app-server.mjs +561 -407
  164. package/dist/src/shared-catalog.mjs +95 -13
  165. package/dist/src/shared-recovery.mjs +15 -11
  166. package/dist/src/shared-thread-stream.mjs +147 -63
  167. package/dist/src/skill-install.mjs +0 -13
  168. package/dist/src/turn-model-history.mjs +47 -0
  169. package/dist/src/usage-reset.mjs +17 -0
  170. package/dist/src/workstation-downloads.mjs +120 -0
  171. package/package.json +35 -37
  172. package/tools/postinstall.mjs +86 -22
  173. package/dist/src/app-server-client.mjs +0 -468
  174. package/dist/src/app-server-tasks.mjs +0 -358
  175. package/dist/src/debug-ui.mjs +0 -131
  176. package/dist/src/platform/windows/desktop-monitor.mjs +0 -34
  177. package/dist/src/platform/windows/desktop-shortcut-run.ps1 +0 -5
  178. package/dist/src/platform/windows/desktop-tools.mjs +0 -48
  179. package/dist/src/thread-catalog.mjs +0 -47
  180. package/dist/tools/find-desktop-pipe.mjs +0 -10
  181. package/dist/web/activity-view.js +0 -283
  182. package/dist/web/approval-ui.js +0 -188
  183. package/dist/web/capabilities.js +0 -57
  184. package/dist/web/chat-transport.js +0 -202
  185. package/dist/web/chat.css +0 -782
  186. package/dist/web/chat.js +0 -3830
  187. package/dist/web/client-platform.js +0 -11
  188. package/dist/web/community-view.js +0 -20
  189. package/dist/web/community.css +0 -77
  190. package/dist/web/community.html +0 -37
  191. package/dist/web/composer-controller.js +0 -101
  192. package/dist/web/conversation-controller.js +0 -99
  193. package/dist/web/disclosure-state-controller.js +0 -95
  194. package/dist/web/draft-controller.js +0 -103
  195. package/dist/web/harmony-platform.js +0 -52
  196. package/dist/web/highlight-powershell.min.js +0 -39
  197. package/dist/web/highlight.min.js +0 -1262
  198. package/dist/web/history-cache.js +0 -240
  199. package/dist/web/history-controller.js +0 -167
  200. package/dist/web/index.html +0 -325
  201. package/dist/web/lan-session.js +0 -122
  202. package/dist/web/link-action-controller.js +0 -212
  203. package/dist/web/message-send-controller.js +0 -177
  204. package/dist/web/message-view.js +0 -98
  205. package/dist/web/p2p-data-channel.js +0 -50
  206. package/dist/web/p2p-diagnostics.js +0 -28
  207. package/dist/web/p2p-probe.js +0 -123
  208. package/dist/web/page-resume.js +0 -28
  209. package/dist/web/pending-message-store.js +0 -108
  210. package/dist/web/queue-controller.js +0 -82
  211. package/dist/web/resources.json +0 -1
  212. package/dist/web/self-relay-session.js +0 -129
  213. package/dist/web/server-requests.js +0 -67
  214. package/dist/web/station-connection-controller.js +0 -75
  215. package/dist/web/task-list-view.js +0 -296
  216. package/dist/web/thread-attention-controller.js +0 -124
  217. package/dist/web/thread-context-controller.js +0 -30
  218. package/dist/web/thread-list-controller.js +0 -61
  219. package/dist/web/thread-list-sync.js +0 -86
  220. package/dist/web/thread-title-controller.js +0 -57
  221. package/dist/web/timeline-formatters.js +0 -249
  222. package/dist/web/timeline-reducer.js +0 -81
  223. package/dist/web/timeline-renderer.js +0 -161
  224. package/dist/web/timeline-scroll-controller.js +0 -50
  225. package/dist/web/timeline-sync.js +0 -67
  226. package/dist/web/usage-controller.js +0 -258
  227. package/dist/web/vendor/README.md +0 -14
  228. package/dist/web/vendor/highlight-powershell.min.js +0 -39
  229. package/dist/web/vendor/highlight.LICENSE.txt +0 -29
  230. package/dist/web/vendor/highlight.min.js +0 -1262
  231. package/dist/web/vendor/lucide.LICENSE.txt +0 -17
  232. package/node_modules/@img/colour/LICENSE.md +0 -82
  233. package/node_modules/@img/colour/README.md +0 -15
  234. package/node_modules/@img/colour/color.cjs +0 -1596
  235. package/node_modules/@img/colour/index.cjs +0 -1
  236. package/node_modules/@img/colour/index.d.ts +0 -929
  237. package/node_modules/@img/colour/package.json +0 -58
  238. package/node_modules/@img/sharp-win32-x64/LICENSE +0 -191
  239. package/node_modules/@img/sharp-win32-x64/README.md +0 -59
  240. package/node_modules/@img/sharp-win32-x64/index.cjs +0 -1
  241. package/node_modules/@img/sharp-win32-x64/lib/libvips-42.dll +0 -0
  242. package/node_modules/@img/sharp-win32-x64/lib/libvips-cpp-8.18.6.dll +0 -0
  243. package/node_modules/@img/sharp-win32-x64/lib/sharp-win32-x64-0.35.4.node +0 -0
  244. package/node_modules/@img/sharp-win32-x64/package.json +0 -40
  245. package/node_modules/@img/sharp-win32-x64/versions.json +0 -30
  246. package/node_modules/@node-datachannel/win32-x64-msvc/node_datachannel.node +0 -0
  247. package/node_modules/@node-datachannel/win32-x64-msvc/package.json +0 -20
  248. package/node_modules/ansi-regex/index.d.ts +0 -37
  249. package/node_modules/ansi-regex/index.js +0 -10
  250. package/node_modules/ansi-regex/license +0 -9
  251. package/node_modules/ansi-regex/package.json +0 -55
  252. package/node_modules/ansi-regex/readme.md +0 -78
  253. package/node_modules/ansi-styles/index.d.ts +0 -345
  254. package/node_modules/ansi-styles/index.js +0 -163
  255. package/node_modules/ansi-styles/license +0 -9
  256. package/node_modules/ansi-styles/package.json +0 -56
  257. package/node_modules/ansi-styles/readme.md +0 -152
  258. package/node_modules/camelcase/index.d.ts +0 -63
  259. package/node_modules/camelcase/index.js +0 -76
  260. package/node_modules/camelcase/license +0 -9
  261. package/node_modules/camelcase/package.json +0 -43
  262. package/node_modules/camelcase/readme.md +0 -99
  263. package/node_modules/cliui/CHANGELOG.md +0 -76
  264. package/node_modules/cliui/LICENSE.txt +0 -14
  265. package/node_modules/cliui/README.md +0 -115
  266. package/node_modules/cliui/index.js +0 -354
  267. package/node_modules/cliui/package.json +0 -65
  268. package/node_modules/color-convert/CHANGELOG.md +0 -54
  269. package/node_modules/color-convert/LICENSE +0 -21
  270. package/node_modules/color-convert/README.md +0 -68
  271. package/node_modules/color-convert/conversions.js +0 -839
  272. package/node_modules/color-convert/index.js +0 -81
  273. package/node_modules/color-convert/package.json +0 -48
  274. package/node_modules/color-convert/route.js +0 -97
  275. package/node_modules/color-name/LICENSE +0 -8
  276. package/node_modules/color-name/README.md +0 -11
  277. package/node_modules/color-name/index.js +0 -152
  278. package/node_modules/color-name/package.json +0 -28
  279. package/node_modules/decamelize/index.js +0 -13
  280. package/node_modules/decamelize/license +0 -21
  281. package/node_modules/decamelize/package.json +0 -38
  282. package/node_modules/decamelize/readme.md +0 -48
  283. package/node_modules/detect-libc/LICENSE +0 -201
  284. package/node_modules/detect-libc/README.md +0 -163
  285. package/node_modules/detect-libc/index.d.ts +0 -14
  286. package/node_modules/detect-libc/lib/detect-libc.js +0 -313
  287. package/node_modules/detect-libc/lib/elf.js +0 -39
  288. package/node_modules/detect-libc/lib/filesystem.js +0 -51
  289. package/node_modules/detect-libc/lib/process.js +0 -24
  290. package/node_modules/detect-libc/package.json +0 -44
  291. package/node_modules/dijkstrajs/.travis.yml +0 -4
  292. package/node_modules/dijkstrajs/CONTRIBUTING.md +0 -8
  293. package/node_modules/dijkstrajs/LICENSE.md +0 -19
  294. package/node_modules/dijkstrajs/README.md +0 -18
  295. package/node_modules/dijkstrajs/dijkstra.js +0 -165
  296. package/node_modules/dijkstrajs/package.json +0 -60
  297. package/node_modules/dijkstrajs/test/dijkstra.test.js +0 -96
  298. package/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
  299. package/node_modules/emoji-regex/README.md +0 -73
  300. package/node_modules/emoji-regex/es2015/index.js +0 -6
  301. package/node_modules/emoji-regex/es2015/text.js +0 -6
  302. package/node_modules/emoji-regex/index.d.ts +0 -23
  303. package/node_modules/emoji-regex/index.js +0 -6
  304. package/node_modules/emoji-regex/package.json +0 -50
  305. package/node_modules/emoji-regex/text.js +0 -6
  306. package/node_modules/find-up/index.d.ts +0 -137
  307. package/node_modules/find-up/index.js +0 -89
  308. package/node_modules/find-up/license +0 -9
  309. package/node_modules/find-up/package.json +0 -53
  310. package/node_modules/find-up/readme.md +0 -156
  311. package/node_modules/get-caller-file/LICENSE.md +0 -6
  312. package/node_modules/get-caller-file/README.md +0 -41
  313. package/node_modules/get-caller-file/index.d.ts +0 -2
  314. package/node_modules/get-caller-file/index.js +0 -22
  315. package/node_modules/get-caller-file/index.js.map +0 -1
  316. package/node_modules/get-caller-file/package.json +0 -42
  317. package/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
  318. package/node_modules/is-fullwidth-code-point/index.js +0 -50
  319. package/node_modules/is-fullwidth-code-point/license +0 -9
  320. package/node_modules/is-fullwidth-code-point/package.json +0 -42
  321. package/node_modules/is-fullwidth-code-point/readme.md +0 -39
  322. package/node_modules/locate-path/index.d.ts +0 -83
  323. package/node_modules/locate-path/index.js +0 -65
  324. package/node_modules/locate-path/license +0 -9
  325. package/node_modules/locate-path/package.json +0 -45
  326. package/node_modules/locate-path/readme.md +0 -122
  327. package/node_modules/node-datachannel/.clang-format +0 -17
  328. package/node_modules/node-datachannel/.editorconfig +0 -12
  329. package/node_modules/node-datachannel/.eslintignore +0 -8
  330. package/node_modules/node-datachannel/.eslintrc.json +0 -27
  331. package/node_modules/node-datachannel/.gitmodules +0 -3
  332. package/node_modules/node-datachannel/.prettierignore +0 -7
  333. package/node_modules/node-datachannel/.prettierrc +0 -13
  334. package/node_modules/node-datachannel/API.md +0 -247
  335. package/node_modules/node-datachannel/BULDING.md +0 -26
  336. package/node_modules/node-datachannel/CMakeLists.txt +0 -153
  337. package/node_modules/node-datachannel/LICENSE +0 -373
  338. package/node_modules/node-datachannel/README.md +0 -129
  339. package/node_modules/node-datachannel/dist/cjs/index.cjs +0 -11
  340. package/node_modules/node-datachannel/dist/cjs/index.cjs.map +0 -1
  341. package/node_modules/node-datachannel/dist/cjs/lib/datachannel-stream.cjs +0 -101
  342. package/node_modules/node-datachannel/dist/cjs/lib/datachannel-stream.cjs.map +0 -1
  343. package/node_modules/node-datachannel/dist/cjs/lib/index.cjs +0 -91
  344. package/node_modules/node-datachannel/dist/cjs/lib/index.cjs.map +0 -1
  345. package/node_modules/node-datachannel/dist/cjs/lib/node-datachannel.cjs +0 -94
  346. package/node_modules/node-datachannel/dist/cjs/lib/node-datachannel.cjs.map +0 -1
  347. package/node_modules/node-datachannel/dist/cjs/lib/websocket-server.cjs +0 -45
  348. package/node_modules/node-datachannel/dist/cjs/lib/websocket-server.cjs.map +0 -1
  349. package/node_modules/node-datachannel/dist/cjs/lib/websocket.cjs +0 -8
  350. package/node_modules/node-datachannel/dist/cjs/lib/websocket.cjs.map +0 -1
  351. package/node_modules/node-datachannel/dist/cjs/polyfill/Events.cjs +0 -86
  352. package/node_modules/node-datachannel/dist/cjs/polyfill/Events.cjs.map +0 -1
  353. package/node_modules/node-datachannel/dist/cjs/polyfill/Exception.cjs +0 -34
  354. package/node_modules/node-datachannel/dist/cjs/polyfill/Exception.cjs.map +0 -1
  355. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCCertificate.cjs +0 -34
  356. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCCertificate.cjs.map +0 -1
  357. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCDataChannel.cjs +0 -214
  358. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCDataChannel.cjs.map +0 -1
  359. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCDtlsTransport.cjs +0 -53
  360. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCDtlsTransport.cjs.map +0 -1
  361. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCError.cjs +0 -83
  362. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCError.cjs.map +0 -1
  363. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCIceCandidate.cjs +0 -132
  364. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCIceCandidate.cjs.map +0 -1
  365. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCIceTransport.cjs +0 -94
  366. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCIceTransport.cjs.map +0 -1
  367. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCPeerConnection.cjs +0 -434
  368. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCPeerConnection.cjs.map +0 -1
  369. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCSctpTransport.cjs +0 -59
  370. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCSctpTransport.cjs.map +0 -1
  371. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCSessionDescription.cjs +0 -45
  372. package/node_modules/node-datachannel/dist/cjs/polyfill/RTCSessionDescription.cjs.map +0 -1
  373. package/node_modules/node-datachannel/dist/cjs/polyfill/index.cjs +0 -42
  374. package/node_modules/node-datachannel/dist/cjs/polyfill/index.cjs.map +0 -1
  375. package/node_modules/node-datachannel/dist/esm/index.mjs +0 -8
  376. package/node_modules/node-datachannel/dist/esm/index.mjs.map +0 -1
  377. package/node_modules/node-datachannel/dist/esm/lib/datachannel-stream.mjs +0 -78
  378. package/node_modules/node-datachannel/dist/esm/lib/datachannel-stream.mjs.map +0 -1
  379. package/node_modules/node-datachannel/dist/esm/lib/index.mjs +0 -64
  380. package/node_modules/node-datachannel/dist/esm/lib/index.mjs.map +0 -1
  381. package/node_modules/node-datachannel/dist/esm/lib/node-datachannel.mjs +0 -78
  382. package/node_modules/node-datachannel/dist/esm/lib/node-datachannel.mjs.map +0 -1
  383. package/node_modules/node-datachannel/dist/esm/lib/websocket-server.mjs +0 -43
  384. package/node_modules/node-datachannel/dist/esm/lib/websocket-server.mjs.map +0 -1
  385. package/node_modules/node-datachannel/dist/esm/lib/websocket.mjs +0 -6
  386. package/node_modules/node-datachannel/dist/esm/lib/websocket.mjs.map +0 -1
  387. package/node_modules/node-datachannel/dist/esm/polyfill/Events.mjs +0 -82
  388. package/node_modules/node-datachannel/dist/esm/polyfill/Events.mjs.map +0 -1
  389. package/node_modules/node-datachannel/dist/esm/polyfill/Exception.mjs +0 -28
  390. package/node_modules/node-datachannel/dist/esm/polyfill/Exception.mjs.map +0 -1
  391. package/node_modules/node-datachannel/dist/esm/polyfill/RTCCertificate.mjs +0 -30
  392. package/node_modules/node-datachannel/dist/esm/polyfill/RTCCertificate.mjs.map +0 -1
  393. package/node_modules/node-datachannel/dist/esm/polyfill/RTCDataChannel.mjs +0 -210
  394. package/node_modules/node-datachannel/dist/esm/polyfill/RTCDataChannel.mjs.map +0 -1
  395. package/node_modules/node-datachannel/dist/esm/polyfill/RTCDtlsTransport.mjs +0 -49
  396. package/node_modules/node-datachannel/dist/esm/polyfill/RTCDtlsTransport.mjs.map +0 -1
  397. package/node_modules/node-datachannel/dist/esm/polyfill/RTCError.mjs +0 -79
  398. package/node_modules/node-datachannel/dist/esm/polyfill/RTCError.mjs.map +0 -1
  399. package/node_modules/node-datachannel/dist/esm/polyfill/RTCIceCandidate.mjs +0 -128
  400. package/node_modules/node-datachannel/dist/esm/polyfill/RTCIceCandidate.mjs.map +0 -1
  401. package/node_modules/node-datachannel/dist/esm/polyfill/RTCIceTransport.mjs +0 -89
  402. package/node_modules/node-datachannel/dist/esm/polyfill/RTCIceTransport.mjs.map +0 -1
  403. package/node_modules/node-datachannel/dist/esm/polyfill/RTCPeerConnection.mjs +0 -430
  404. package/node_modules/node-datachannel/dist/esm/polyfill/RTCPeerConnection.mjs.map +0 -1
  405. package/node_modules/node-datachannel/dist/esm/polyfill/RTCSctpTransport.mjs +0 -55
  406. package/node_modules/node-datachannel/dist/esm/polyfill/RTCSctpTransport.mjs.map +0 -1
  407. package/node_modules/node-datachannel/dist/esm/polyfill/RTCSessionDescription.mjs +0 -41
  408. package/node_modules/node-datachannel/dist/esm/polyfill/RTCSessionDescription.mjs.map +0 -1
  409. package/node_modules/node-datachannel/dist/esm/polyfill/index.mjs +0 -27
  410. package/node_modules/node-datachannel/dist/esm/polyfill/index.mjs.map +0 -1
  411. package/node_modules/node-datachannel/dist/types/lib/datachannel-stream.d.ts +0 -24
  412. package/node_modules/node-datachannel/dist/types/lib/index.d.ts +0 -241
  413. package/node_modules/node-datachannel/dist/types/lib/types.d.ts +0 -119
  414. package/node_modules/node-datachannel/dist/types/lib/websocket-server.d.ts +0 -13
  415. package/node_modules/node-datachannel/dist/types/lib/websocket.d.ts +0 -25
  416. package/node_modules/node-datachannel/dist/types/polyfill/Events.d.ts +0 -15
  417. package/node_modules/node-datachannel/dist/types/polyfill/RTCCertificate.d.ts +0 -9
  418. package/node_modules/node-datachannel/dist/types/polyfill/RTCDataChannel.d.ts +0 -29
  419. package/node_modules/node-datachannel/dist/types/polyfill/RTCDtlsTransport.d.ts +0 -15
  420. package/node_modules/node-datachannel/dist/types/polyfill/RTCError.d.ts +0 -17
  421. package/node_modules/node-datachannel/dist/types/polyfill/RTCIceCandidate.d.ts +0 -21
  422. package/node_modules/node-datachannel/dist/types/polyfill/RTCIceTransport.d.ts +0 -30
  423. package/node_modules/node-datachannel/dist/types/polyfill/RTCPeerConnection.d.ts +0 -64
  424. package/node_modules/node-datachannel/dist/types/polyfill/RTCSctpTransport.d.ts +0 -15
  425. package/node_modules/node-datachannel/dist/types/polyfill/RTCSessionDescription.d.ts +0 -10
  426. package/node_modules/node-datachannel/dist/types/polyfill/index.d.ts +0 -26
  427. package/node_modules/node-datachannel/jest.config.ts +0 -14
  428. package/node_modules/node-datachannel/package.json +0 -133
  429. package/node_modules/node-datachannel/rollup.config.mjs +0 -67
  430. package/node_modules/node-datachannel/src/cpp/data-channel-wrapper.cpp +0 -530
  431. package/node_modules/node-datachannel/src/cpp/data-channel-wrapper.h +0 -63
  432. package/node_modules/node-datachannel/src/cpp/ice-udp-mux-listener-wrapper.cpp +0 -172
  433. package/node_modules/node-datachannel/src/cpp/ice-udp-mux-listener-wrapper.h +0 -43
  434. package/node_modules/node-datachannel/src/cpp/main.cpp +0 -58
  435. package/node_modules/node-datachannel/src/cpp/media-audio-wrapper.cpp +0 -457
  436. package/node_modules/node-datachannel/src/cpp/media-audio-wrapper.h +0 -52
  437. package/node_modules/node-datachannel/src/cpp/media-av1packetization.cpp +0 -24
  438. package/node_modules/node-datachannel/src/cpp/media-av1packetization.h +0 -11
  439. package/node_modules/node-datachannel/src/cpp/media-av1rtppacketizer-wrapper.cpp +0 -126
  440. package/node_modules/node-datachannel/src/cpp/media-av1rtppacketizer-wrapper.h +0 -29
  441. package/node_modules/node-datachannel/src/cpp/media-direction.cpp +0 -43
  442. package/node_modules/node-datachannel/src/cpp/media-direction.h +0 -10
  443. package/node_modules/node-datachannel/src/cpp/media-h264rtppacketizer-wrapper.cpp +0 -126
  444. package/node_modules/node-datachannel/src/cpp/media-h264rtppacketizer-wrapper.h +0 -30
  445. package/node_modules/node-datachannel/src/cpp/media-h265rtppacketizer-wrapper.cpp +0 -126
  446. package/node_modules/node-datachannel/src/cpp/media-h265rtppacketizer-wrapper.h +0 -30
  447. package/node_modules/node-datachannel/src/cpp/media-h26xseparator.cpp +0 -32
  448. package/node_modules/node-datachannel/src/cpp/media-h26xseparator.h +0 -11
  449. package/node_modules/node-datachannel/src/cpp/media-mediahandler-helper.cpp +0 -31
  450. package/node_modules/node-datachannel/src/cpp/media-mediahandler-helper.h +0 -11
  451. package/node_modules/node-datachannel/src/cpp/media-pacinghandler-wrapper.cpp +0 -79
  452. package/node_modules/node-datachannel/src/cpp/media-pacinghandler-wrapper.h +0 -28
  453. package/node_modules/node-datachannel/src/cpp/media-rtcpnackresponder-wrapper.cpp +0 -68
  454. package/node_modules/node-datachannel/src/cpp/media-rtcpnackresponder-wrapper.h +0 -28
  455. package/node_modules/node-datachannel/src/cpp/media-rtcpreceivingsession-wrapper.cpp +0 -57
  456. package/node_modules/node-datachannel/src/cpp/media-rtcpreceivingsession-wrapper.h +0 -28
  457. package/node_modules/node-datachannel/src/cpp/media-rtcpsrreporter-wrapper.cpp +0 -93
  458. package/node_modules/node-datachannel/src/cpp/media-rtcpsrreporter-wrapper.h +0 -30
  459. package/node_modules/node-datachannel/src/cpp/media-rtppacketizationconfig-wrapper.cpp +0 -167
  460. package/node_modules/node-datachannel/src/cpp/media-rtppacketizationconfig-wrapper.h +0 -35
  461. package/node_modules/node-datachannel/src/cpp/media-rtppacketizer-wrapper.cpp +0 -95
  462. package/node_modules/node-datachannel/src/cpp/media-rtppacketizer-wrapper.h +0 -30
  463. package/node_modules/node-datachannel/src/cpp/media-track-wrapper.cpp +0 -458
  464. package/node_modules/node-datachannel/src/cpp/media-track-wrapper.h +0 -61
  465. package/node_modules/node-datachannel/src/cpp/media-video-wrapper.cpp +0 -526
  466. package/node_modules/node-datachannel/src/cpp/media-video-wrapper.h +0 -56
  467. package/node_modules/node-datachannel/src/cpp/peer-connection-wrapper.cpp +0 -1298
  468. package/node_modules/node-datachannel/src/cpp/peer-connection-wrapper.h +0 -89
  469. package/node_modules/node-datachannel/src/cpp/rtc-wrapper.cpp +0 -205
  470. package/node_modules/node-datachannel/src/cpp/rtc-wrapper.h +0 -24
  471. package/node_modules/node-datachannel/src/cpp/thread-safe-callback.cpp +0 -57
  472. package/node_modules/node-datachannel/src/cpp/thread-safe-callback.h +0 -47
  473. package/node_modules/node-datachannel/src/cpp/web-socket-server-wrapper.cpp +0 -275
  474. package/node_modules/node-datachannel/src/cpp/web-socket-server-wrapper.h +0 -41
  475. package/node_modules/node-datachannel/src/cpp/web-socket-wrapper.cpp +0 -796
  476. package/node_modules/node-datachannel/src/cpp/web-socket-wrapper.h +0 -63
  477. package/node_modules/node-datachannel/src/index.ts +0 -9
  478. package/node_modules/node-datachannel/src/lib/datachannel-stream.ts +0 -100
  479. package/node_modules/node-datachannel/src/lib/index.ts +0 -290
  480. package/node_modules/node-datachannel/src/lib/node-datachannel.ts +0 -84
  481. package/node_modules/node-datachannel/src/lib/types.ts +0 -169
  482. package/node_modules/node-datachannel/src/lib/websocket-server.ts +0 -37
  483. package/node_modules/node-datachannel/src/lib/websocket.ts +0 -26
  484. package/node_modules/node-datachannel/src/polyfill/Events.ts +0 -82
  485. package/node_modules/node-datachannel/src/polyfill/Exception.ts +0 -37
  486. package/node_modules/node-datachannel/src/polyfill/README.md +0 -41
  487. package/node_modules/node-datachannel/src/polyfill/RTCCertificate.ts +0 -21
  488. package/node_modules/node-datachannel/src/polyfill/RTCDataChannel.ts +0 -225
  489. package/node_modules/node-datachannel/src/polyfill/RTCDtlsTransport.ts +0 -46
  490. package/node_modules/node-datachannel/src/polyfill/RTCError.ts +0 -78
  491. package/node_modules/node-datachannel/src/polyfill/RTCIceCandidate.ts +0 -128
  492. package/node_modules/node-datachannel/src/polyfill/RTCIceTransport.ts +0 -90
  493. package/node_modules/node-datachannel/src/polyfill/RTCPeerConnection.ts +0 -527
  494. package/node_modules/node-datachannel/src/polyfill/RTCSctpTransport.ts +0 -51
  495. package/node_modules/node-datachannel/src/polyfill/RTCSessionDescription.ts +0 -41
  496. package/node_modules/node-datachannel/src/polyfill/index.ts +0 -38
  497. package/node_modules/node-datachannel/tsconfig.json +0 -21
  498. package/node_modules/p-limit/index.d.ts +0 -38
  499. package/node_modules/p-limit/index.js +0 -57
  500. package/node_modules/p-limit/license +0 -9
  501. package/node_modules/p-limit/package.json +0 -52
  502. package/node_modules/p-limit/readme.md +0 -101
  503. package/node_modules/p-locate/index.d.ts +0 -64
  504. package/node_modules/p-locate/index.js +0 -52
  505. package/node_modules/p-locate/license +0 -9
  506. package/node_modules/p-locate/package.json +0 -53
  507. package/node_modules/p-locate/readme.md +0 -90
  508. package/node_modules/p-try/index.d.ts +0 -39
  509. package/node_modules/p-try/index.js +0 -9
  510. package/node_modules/p-try/license +0 -9
  511. package/node_modules/p-try/package.json +0 -42
  512. package/node_modules/p-try/readme.md +0 -58
  513. package/node_modules/path-exists/index.d.ts +0 -28
  514. package/node_modules/path-exists/index.js +0 -23
  515. package/node_modules/path-exists/license +0 -9
  516. package/node_modules/path-exists/package.json +0 -39
  517. package/node_modules/path-exists/readme.md +0 -52
  518. package/node_modules/pngjs/.eslintignore +0 -2
  519. package/node_modules/pngjs/.eslintrc.json +0 -19
  520. package/node_modules/pngjs/.prettierignore +0 -3
  521. package/node_modules/pngjs/LICENSE +0 -20
  522. package/node_modules/pngjs/README.md +0 -429
  523. package/node_modules/pngjs/browser.js +0 -16096
  524. package/node_modules/pngjs/coverage/lcov-report/base.css +0 -354
  525. package/node_modules/pngjs/coverage/lcov-report/bitmapper.js.html +0 -881
  526. package/node_modules/pngjs/coverage/lcov-report/bitpacker.js.html +0 -554
  527. package/node_modules/pngjs/coverage/lcov-report/block-navigation.js +0 -77
  528. package/node_modules/pngjs/coverage/lcov-report/chunkstream.js.html +0 -647
  529. package/node_modules/pngjs/coverage/lcov-report/constants.js.html +0 -176
  530. package/node_modules/pngjs/coverage/lcov-report/crc.js.html +0 -200
  531. package/node_modules/pngjs/coverage/lcov-report/favicon.png +0 -0
  532. package/node_modules/pngjs/coverage/lcov-report/filter-pack.js.html +0 -593
  533. package/node_modules/pngjs/coverage/lcov-report/filter-parse-async.js.html +0 -152
  534. package/node_modules/pngjs/coverage/lcov-report/filter-parse-sync.js.html +0 -143
  535. package/node_modules/pngjs/coverage/lcov-report/filter-parse.js.html +0 -611
  536. package/node_modules/pngjs/coverage/lcov-report/format-normaliser.js.html +0 -359
  537. package/node_modules/pngjs/coverage/lcov-report/index.html +0 -426
  538. package/node_modules/pngjs/coverage/lcov-report/interlace.js.html +0 -365
  539. package/node_modules/pngjs/coverage/lcov-report/packer-async.js.html +0 -230
  540. package/node_modules/pngjs/coverage/lcov-report/packer-sync.js.html +0 -248
  541. package/node_modules/pngjs/coverage/lcov-report/packer.js.html +0 -467
  542. package/node_modules/pngjs/coverage/lcov-report/paeth-predictor.js.html +0 -128
  543. package/node_modules/pngjs/coverage/lcov-report/parser-async.js.html +0 -575
  544. package/node_modules/pngjs/coverage/lcov-report/parser-sync.js.html +0 -404
  545. package/node_modules/pngjs/coverage/lcov-report/parser.js.html +0 -950
  546. package/node_modules/pngjs/coverage/lcov-report/png-sync.js.html +0 -116
  547. package/node_modules/pngjs/coverage/lcov-report/png.js.html +0 -662
  548. package/node_modules/pngjs/coverage/lcov-report/prettify.css +0 -101
  549. package/node_modules/pngjs/coverage/lcov-report/prettify.js +0 -1007
  550. package/node_modules/pngjs/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  551. package/node_modules/pngjs/coverage/lcov-report/sorter.js +0 -169
  552. package/node_modules/pngjs/coverage/lcov-report/sync-inflate.js.html +0 -584
  553. package/node_modules/pngjs/coverage/lcov-report/sync-reader.js.html +0 -215
  554. package/node_modules/pngjs/coverage/lcov.info +0 -2177
  555. package/node_modules/pngjs/lib/bitmapper.js +0 -267
  556. package/node_modules/pngjs/lib/bitpacker.js +0 -158
  557. package/node_modules/pngjs/lib/chunkstream.js +0 -189
  558. package/node_modules/pngjs/lib/constants.js +0 -32
  559. package/node_modules/pngjs/lib/crc.js +0 -40
  560. package/node_modules/pngjs/lib/filter-pack.js +0 -171
  561. package/node_modules/pngjs/lib/filter-parse-async.js +0 -24
  562. package/node_modules/pngjs/lib/filter-parse-sync.js +0 -21
  563. package/node_modules/pngjs/lib/filter-parse.js +0 -177
  564. package/node_modules/pngjs/lib/format-normaliser.js +0 -93
  565. package/node_modules/pngjs/lib/interlace.js +0 -95
  566. package/node_modules/pngjs/lib/packer-async.js +0 -50
  567. package/node_modules/pngjs/lib/packer-sync.js +0 -56
  568. package/node_modules/pngjs/lib/packer.js +0 -129
  569. package/node_modules/pngjs/lib/paeth-predictor.js +0 -16
  570. package/node_modules/pngjs/lib/parser-async.js +0 -165
  571. package/node_modules/pngjs/lib/parser-sync.js +0 -108
  572. package/node_modules/pngjs/lib/parser.js +0 -290
  573. package/node_modules/pngjs/lib/png-sync.js +0 -12
  574. package/node_modules/pngjs/lib/png.js +0 -194
  575. package/node_modules/pngjs/lib/sync-inflate.js +0 -168
  576. package/node_modules/pngjs/lib/sync-reader.js +0 -45
  577. package/node_modules/pngjs/package.json +0 -73
  578. package/node_modules/qrcode/README.md +0 -770
  579. package/node_modules/qrcode/bin/qrcode +0 -159
  580. package/node_modules/qrcode/helper/to-sjis-browser.js +0 -2
  581. package/node_modules/qrcode/helper/to-sjis.js +0 -105
  582. package/node_modules/qrcode/lib/browser.js +0 -76
  583. package/node_modules/qrcode/lib/can-promise.js +0 -7
  584. package/node_modules/qrcode/lib/core/alignment-pattern.js +0 -83
  585. package/node_modules/qrcode/lib/core/alphanumeric-data.js +0 -59
  586. package/node_modules/qrcode/lib/core/bit-buffer.js +0 -37
  587. package/node_modules/qrcode/lib/core/bit-matrix.js +0 -65
  588. package/node_modules/qrcode/lib/core/byte-data.js +0 -30
  589. package/node_modules/qrcode/lib/core/error-correction-code.js +0 -135
  590. package/node_modules/qrcode/lib/core/error-correction-level.js +0 -50
  591. package/node_modules/qrcode/lib/core/finder-pattern.js +0 -22
  592. package/node_modules/qrcode/lib/core/format-info.js +0 -29
  593. package/node_modules/qrcode/lib/core/galois-field.js +0 -69
  594. package/node_modules/qrcode/lib/core/kanji-data.js +0 -54
  595. package/node_modules/qrcode/lib/core/mask-pattern.js +0 -234
  596. package/node_modules/qrcode/lib/core/mode.js +0 -167
  597. package/node_modules/qrcode/lib/core/numeric-data.js +0 -43
  598. package/node_modules/qrcode/lib/core/polynomial.js +0 -62
  599. package/node_modules/qrcode/lib/core/qrcode.js +0 -495
  600. package/node_modules/qrcode/lib/core/reed-solomon-encoder.js +0 -56
  601. package/node_modules/qrcode/lib/core/regex.js +0 -31
  602. package/node_modules/qrcode/lib/core/segments.js +0 -330
  603. package/node_modules/qrcode/lib/core/utils.js +0 -63
  604. package/node_modules/qrcode/lib/core/version-check.js +0 -9
  605. package/node_modules/qrcode/lib/core/version.js +0 -163
  606. package/node_modules/qrcode/lib/index.js +0 -12
  607. package/node_modules/qrcode/lib/renderer/canvas.js +0 -63
  608. package/node_modules/qrcode/lib/renderer/png.js +0 -78
  609. package/node_modules/qrcode/lib/renderer/svg-tag.js +0 -81
  610. package/node_modules/qrcode/lib/renderer/svg.js +0 -19
  611. package/node_modules/qrcode/lib/renderer/terminal/terminal-small.js +0 -85
  612. package/node_modules/qrcode/lib/renderer/terminal/terminal.js +0 -49
  613. package/node_modules/qrcode/lib/renderer/terminal.js +0 -9
  614. package/node_modules/qrcode/lib/renderer/utf8.js +0 -71
  615. package/node_modules/qrcode/lib/renderer/utils.js +0 -99
  616. package/node_modules/qrcode/lib/server.js +0 -138
  617. package/node_modules/qrcode/license +0 -10
  618. package/node_modules/qrcode/package.json +0 -77
  619. package/node_modules/require-directory/.jshintrc +0 -67
  620. package/node_modules/require-directory/.npmignore +0 -1
  621. package/node_modules/require-directory/.travis.yml +0 -3
  622. package/node_modules/require-directory/LICENSE +0 -22
  623. package/node_modules/require-directory/README.markdown +0 -184
  624. package/node_modules/require-directory/index.js +0 -86
  625. package/node_modules/require-directory/package.json +0 -40
  626. package/node_modules/require-main-filename/CHANGELOG.md +0 -26
  627. package/node_modules/require-main-filename/LICENSE.txt +0 -14
  628. package/node_modules/require-main-filename/README.md +0 -26
  629. package/node_modules/require-main-filename/index.js +0 -18
  630. package/node_modules/require-main-filename/package.json +0 -35
  631. package/node_modules/semver/LICENSE +0 -15
  632. package/node_modules/semver/README.md +0 -680
  633. package/node_modules/semver/bin/semver.js +0 -195
  634. package/node_modules/semver/classes/comparator.js +0 -143
  635. package/node_modules/semver/classes/index.js +0 -7
  636. package/node_modules/semver/classes/range.js +0 -577
  637. package/node_modules/semver/classes/semver.js +0 -350
  638. package/node_modules/semver/functions/clean.js +0 -8
  639. package/node_modules/semver/functions/cmp.js +0 -54
  640. package/node_modules/semver/functions/coerce.js +0 -62
  641. package/node_modules/semver/functions/compare-build.js +0 -9
  642. package/node_modules/semver/functions/compare-loose.js +0 -5
  643. package/node_modules/semver/functions/compare.js +0 -7
  644. package/node_modules/semver/functions/diff.js +0 -60
  645. package/node_modules/semver/functions/eq.js +0 -5
  646. package/node_modules/semver/functions/gt.js +0 -5
  647. package/node_modules/semver/functions/gte.js +0 -5
  648. package/node_modules/semver/functions/inc.js +0 -21
  649. package/node_modules/semver/functions/lt.js +0 -5
  650. package/node_modules/semver/functions/lte.js +0 -5
  651. package/node_modules/semver/functions/major.js +0 -5
  652. package/node_modules/semver/functions/minor.js +0 -5
  653. package/node_modules/semver/functions/neq.js +0 -5
  654. package/node_modules/semver/functions/parse.js +0 -18
  655. package/node_modules/semver/functions/patch.js +0 -5
  656. package/node_modules/semver/functions/prerelease.js +0 -8
  657. package/node_modules/semver/functions/rcompare.js +0 -5
  658. package/node_modules/semver/functions/rsort.js +0 -5
  659. package/node_modules/semver/functions/satisfies.js +0 -12
  660. package/node_modules/semver/functions/sort.js +0 -5
  661. package/node_modules/semver/functions/truncate.js +0 -48
  662. package/node_modules/semver/functions/valid.js +0 -8
  663. package/node_modules/semver/index.js +0 -93
  664. package/node_modules/semver/internal/constants.js +0 -37
  665. package/node_modules/semver/internal/debug.js +0 -11
  666. package/node_modules/semver/internal/identifiers.js +0 -29
  667. package/node_modules/semver/internal/lrucache.js +0 -42
  668. package/node_modules/semver/internal/parse-options.js +0 -17
  669. package/node_modules/semver/internal/re.js +0 -223
  670. package/node_modules/semver/package.json +0 -78
  671. package/node_modules/semver/preload.js +0 -4
  672. package/node_modules/semver/range.bnf +0 -17
  673. package/node_modules/semver/ranges/gtr.js +0 -6
  674. package/node_modules/semver/ranges/intersects.js +0 -9
  675. package/node_modules/semver/ranges/ltr.js +0 -6
  676. package/node_modules/semver/ranges/max-satisfying.js +0 -27
  677. package/node_modules/semver/ranges/min-satisfying.js +0 -26
  678. package/node_modules/semver/ranges/min-version.js +0 -63
  679. package/node_modules/semver/ranges/outside.js +0 -82
  680. package/node_modules/semver/ranges/simplify.js +0 -49
  681. package/node_modules/semver/ranges/subset.js +0 -249
  682. package/node_modules/semver/ranges/to-comparators.js +0 -10
  683. package/node_modules/semver/ranges/valid.js +0 -13
  684. package/node_modules/set-blocking/CHANGELOG.md +0 -26
  685. package/node_modules/set-blocking/LICENSE.txt +0 -14
  686. package/node_modules/set-blocking/README.md +0 -31
  687. package/node_modules/set-blocking/index.js +0 -7
  688. package/node_modules/set-blocking/package.json +0 -42
  689. package/node_modules/sharp/LICENSE +0 -191
  690. package/node_modules/sharp/README.md +0 -112
  691. package/node_modules/sharp/dist/channel.cjs +0 -177
  692. package/node_modules/sharp/dist/channel.mjs +0 -177
  693. package/node_modules/sharp/dist/colour.cjs +0 -199
  694. package/node_modules/sharp/dist/colour.mjs +0 -199
  695. package/node_modules/sharp/dist/composite.cjs +0 -213
  696. package/node_modules/sharp/dist/composite.mjs +0 -213
  697. package/node_modules/sharp/dist/constructor.cjs +0 -511
  698. package/node_modules/sharp/dist/constructor.mjs +0 -511
  699. package/node_modules/sharp/dist/index.cjs +0 -25
  700. package/node_modules/sharp/dist/index.d.cts +0 -1999
  701. package/node_modules/sharp/dist/index.d.mts +0 -2046
  702. package/node_modules/sharp/dist/index.mjs +0 -25
  703. package/node_modules/sharp/dist/input.cjs +0 -819
  704. package/node_modules/sharp/dist/input.mjs +0 -819
  705. package/node_modules/sharp/dist/is.cjs +0 -143
  706. package/node_modules/sharp/dist/is.mjs +0 -143
  707. package/node_modules/sharp/dist/libvips.cjs +0 -212
  708. package/node_modules/sharp/dist/libvips.mjs +0 -212
  709. package/node_modules/sharp/dist/operation.cjs +0 -1002
  710. package/node_modules/sharp/dist/operation.mjs +0 -1002
  711. package/node_modules/sharp/dist/output.cjs +0 -1785
  712. package/node_modules/sharp/dist/output.mjs +0 -1785
  713. package/node_modules/sharp/dist/resize.cjs +0 -617
  714. package/node_modules/sharp/dist/resize.mjs +0 -617
  715. package/node_modules/sharp/dist/sharp.cjs +0 -174
  716. package/node_modules/sharp/dist/sharp.mjs +0 -174
  717. package/node_modules/sharp/dist/utility.cjs +0 -301
  718. package/node_modules/sharp/dist/utility.mjs +0 -301
  719. package/node_modules/sharp/install/build.js +0 -38
  720. package/node_modules/sharp/lib/index.d.ts +0 -1999
  721. package/node_modules/sharp/package.json +0 -227
  722. package/node_modules/sharp/src/binding.gyp +0 -303
  723. package/node_modules/sharp/src/common.cc +0 -1186
  724. package/node_modules/sharp/src/common.h +0 -421
  725. package/node_modules/sharp/src/metadata.cc +0 -404
  726. package/node_modules/sharp/src/metadata.h +0 -95
  727. package/node_modules/sharp/src/operations.cc +0 -516
  728. package/node_modules/sharp/src/operations.h +0 -137
  729. package/node_modules/sharp/src/pipeline.cc +0 -1948
  730. package/node_modules/sharp/src/pipeline.h +0 -422
  731. package/node_modules/sharp/src/sharp.cc +0 -43
  732. package/node_modules/sharp/src/stats.cc +0 -186
  733. package/node_modules/sharp/src/stats.h +0 -62
  734. package/node_modules/sharp/src/utilities.cc +0 -289
  735. package/node_modules/sharp/src/utilities.h +0 -22
  736. package/node_modules/string-width/index.d.ts +0 -29
  737. package/node_modules/string-width/index.js +0 -47
  738. package/node_modules/string-width/license +0 -9
  739. package/node_modules/string-width/package.json +0 -56
  740. package/node_modules/string-width/readme.md +0 -50
  741. package/node_modules/strip-ansi/index.d.ts +0 -17
  742. package/node_modules/strip-ansi/index.js +0 -4
  743. package/node_modules/strip-ansi/license +0 -9
  744. package/node_modules/strip-ansi/package.json +0 -54
  745. package/node_modules/strip-ansi/readme.md +0 -46
  746. package/node_modules/which-module/LICENSE +0 -13
  747. package/node_modules/which-module/README.md +0 -58
  748. package/node_modules/which-module/index.js +0 -9
  749. package/node_modules/which-module/package.json +0 -41
  750. package/node_modules/wrap-ansi/index.js +0 -186
  751. package/node_modules/wrap-ansi/license +0 -9
  752. package/node_modules/wrap-ansi/package.json +0 -61
  753. package/node_modules/wrap-ansi/readme.md +0 -97
  754. package/node_modules/ws/LICENSE +0 -20
  755. package/node_modules/ws/README.md +0 -548
  756. package/node_modules/ws/browser.js +0 -8
  757. package/node_modules/ws/index.js +0 -22
  758. package/node_modules/ws/lib/buffer-util.js +0 -131
  759. package/node_modules/ws/lib/constants.js +0 -19
  760. package/node_modules/ws/lib/event-target.js +0 -292
  761. package/node_modules/ws/lib/extension.js +0 -203
  762. package/node_modules/ws/lib/limiter.js +0 -55
  763. package/node_modules/ws/lib/permessage-deflate.js +0 -530
  764. package/node_modules/ws/lib/receiver.js +0 -743
  765. package/node_modules/ws/lib/sender.js +0 -607
  766. package/node_modules/ws/lib/stream.js +0 -161
  767. package/node_modules/ws/lib/subprotocol.js +0 -62
  768. package/node_modules/ws/lib/validation.js +0 -152
  769. package/node_modules/ws/lib/websocket-server.js +0 -562
  770. package/node_modules/ws/lib/websocket.js +0 -1407
  771. package/node_modules/ws/package.json +0 -74
  772. package/node_modules/ws/wrapper.mjs +0 -21
  773. package/node_modules/y18n/CHANGELOG.md +0 -35
  774. package/node_modules/y18n/LICENSE +0 -13
  775. package/node_modules/y18n/README.md +0 -109
  776. package/node_modules/y18n/index.js +0 -188
  777. package/node_modules/y18n/package.json +0 -39
  778. package/node_modules/yargs/CHANGELOG.md +0 -420
  779. package/node_modules/yargs/LICENSE +0 -21
  780. package/node_modules/yargs/README.md +0 -140
  781. package/node_modules/yargs/build/lib/apply-extends.d.ts +0 -2
  782. package/node_modules/yargs/build/lib/apply-extends.js +0 -65
  783. package/node_modules/yargs/build/lib/argsert.d.ts +0 -2
  784. package/node_modules/yargs/build/lib/argsert.js +0 -65
  785. package/node_modules/yargs/build/lib/command.d.ts +0 -64
  786. package/node_modules/yargs/build/lib/command.js +0 -416
  787. package/node_modules/yargs/build/lib/common-types.d.ts +0 -36
  788. package/node_modules/yargs/build/lib/common-types.js +0 -25
  789. package/node_modules/yargs/build/lib/completion-templates.d.ts +0 -2
  790. package/node_modules/yargs/build/lib/completion-templates.js +0 -50
  791. package/node_modules/yargs/build/lib/completion.d.ts +0 -21
  792. package/node_modules/yargs/build/lib/completion.js +0 -135
  793. package/node_modules/yargs/build/lib/is-promise.d.ts +0 -1
  794. package/node_modules/yargs/build/lib/is-promise.js +0 -9
  795. package/node_modules/yargs/build/lib/levenshtein.d.ts +0 -1
  796. package/node_modules/yargs/build/lib/levenshtein.js +0 -58
  797. package/node_modules/yargs/build/lib/middleware.d.ts +0 -10
  798. package/node_modules/yargs/build/lib/middleware.js +0 -57
  799. package/node_modules/yargs/build/lib/obj-filter.d.ts +0 -1
  800. package/node_modules/yargs/build/lib/obj-filter.js +0 -14
  801. package/node_modules/yargs/build/lib/parse-command.d.ts +0 -11
  802. package/node_modules/yargs/build/lib/parse-command.js +0 -36
  803. package/node_modules/yargs/build/lib/process-argv.d.ts +0 -2
  804. package/node_modules/yargs/build/lib/process-argv.js +0 -31
  805. package/node_modules/yargs/build/lib/usage.d.ts +0 -49
  806. package/node_modules/yargs/build/lib/usage.js +0 -540
  807. package/node_modules/yargs/build/lib/validation.d.ts +0 -34
  808. package/node_modules/yargs/build/lib/validation.js +0 -330
  809. package/node_modules/yargs/build/lib/yargs.d.ts +0 -274
  810. package/node_modules/yargs/build/lib/yargs.js +0 -1190
  811. package/node_modules/yargs/build/lib/yerror.d.ts +0 -4
  812. package/node_modules/yargs/build/lib/yerror.js +0 -11
  813. package/node_modules/yargs/index.js +0 -40
  814. package/node_modules/yargs/locales/be.json +0 -46
  815. package/node_modules/yargs/locales/de.json +0 -46
  816. package/node_modules/yargs/locales/en.json +0 -51
  817. package/node_modules/yargs/locales/es.json +0 -46
  818. package/node_modules/yargs/locales/fi.json +0 -49
  819. package/node_modules/yargs/locales/fr.json +0 -53
  820. package/node_modules/yargs/locales/hi.json +0 -49
  821. package/node_modules/yargs/locales/hu.json +0 -46
  822. package/node_modules/yargs/locales/id.json +0 -50
  823. package/node_modules/yargs/locales/it.json +0 -46
  824. package/node_modules/yargs/locales/ja.json +0 -51
  825. package/node_modules/yargs/locales/ko.json +0 -49
  826. package/node_modules/yargs/locales/nb.json +0 -44
  827. package/node_modules/yargs/locales/nl.json +0 -49
  828. package/node_modules/yargs/locales/nn.json +0 -44
  829. package/node_modules/yargs/locales/pirate.json +0 -13
  830. package/node_modules/yargs/locales/pl.json +0 -49
  831. package/node_modules/yargs/locales/pt.json +0 -45
  832. package/node_modules/yargs/locales/pt_BR.json +0 -48
  833. package/node_modules/yargs/locales/ru.json +0 -46
  834. package/node_modules/yargs/locales/th.json +0 -46
  835. package/node_modules/yargs/locales/tr.json +0 -48
  836. package/node_modules/yargs/locales/zh_CN.json +0 -48
  837. package/node_modules/yargs/locales/zh_TW.json +0 -47
  838. package/node_modules/yargs/package.json +0 -92
  839. package/node_modules/yargs/yargs.js +0 -14
  840. package/node_modules/yargs-parser/CHANGELOG.md +0 -601
  841. package/node_modules/yargs-parser/LICENSE.txt +0 -14
  842. package/node_modules/yargs-parser/README.md +0 -449
  843. package/node_modules/yargs-parser/index.js +0 -1032
  844. package/node_modules/yargs-parser/lib/tokenize-arg-string.js +0 -40
  845. package/node_modules/yargs-parser/package.json +0 -46
@@ -1,1785 +0,0 @@
1
- /*!
2
- Copyright 2013 Lovell Fuller and others.
3
- SPDX-License-Identifier: Apache-2.0
4
- */
5
-
6
- const path = require('node:path');
7
- const is = require('./is.cjs');
8
- const sharp = require('./sharp.cjs');
9
-
10
- const formats = new Map([
11
- ['heic', 'heif'],
12
- ['heif', 'heif'],
13
- ['avif', 'avif'],
14
- ['jpeg', 'jpeg'],
15
- ['jpg', 'jpeg'],
16
- ['jpe', 'jpeg'],
17
- ['tile', 'tile'],
18
- ['dz', 'tile'],
19
- ['png', 'png'],
20
- ['raw', 'raw'],
21
- ['tiff', 'tiff'],
22
- ['tif', 'tiff'],
23
- ['webp', 'webp'],
24
- ['gif', 'gif'],
25
- ['jp2', 'jp2'],
26
- ['jpx', 'jp2'],
27
- ['j2k', 'jp2'],
28
- ['j2c', 'jp2'],
29
- ['jxl', 'jxl']
30
- ]);
31
-
32
- const jp2Regex = /\.(jp[2x]|j2[kc])$/i;
33
-
34
- const errJp2Save = () => new Error('JP2 output requires libvips with support for OpenJPEG');
35
-
36
- const bitdepthFromColourCount = (colours) => 1 << 32 - Math.clz32(Math.ceil(Math.log2(colours)) - 1);
37
-
38
- /**
39
- * Write output image data to a file.
40
- *
41
- * If an explicit output format is not selected, it will be inferred from the extension,
42
- * with JPEG, PNG, WebP, AVIF, TIFF, GIF, DZI, and libvips' V format supported.
43
- * Note that raw pixel data is only supported for buffer output.
44
- *
45
- * By default all metadata will be removed, which includes EXIF-based orientation.
46
- * See {@link #withmetadata withMetadata} for control over this.
47
- *
48
- * The caller is responsible for ensuring directory structures and permissions exist.
49
- *
50
- * A `Promise` is returned when `callback` is not provided.
51
- *
52
- * @example
53
- * sharp(input)
54
- * .toFile('output.png', (err, info) => { ... });
55
- *
56
- * @example
57
- * sharp(input)
58
- * .toFile('output.png')
59
- * .then(info => { ... })
60
- * .catch(err => { ... });
61
- *
62
- * @param {string} fileOut - the path to write the image data to.
63
- * @param {Function} [callback] - called on completion with two arguments `(err, info)`.
64
- * `info` contains the output image `format`, `size` (bytes), `width`, `height`,
65
- * `channels` and `premultiplied` (indicating if premultiplication was used).
66
- * When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
67
- * When using the attention crop strategy also contains `attentionX` and `attentionY`, the focal point of the cropped region.
68
- * Animated output will also contain `pageHeight` and `pages`.
69
- * May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text.
70
- * @returns {Promise<Object>} - when no callback is provided
71
- * @throws {Error} Invalid parameters
72
- */
73
- function toFile (fileOut, callback) {
74
- let err;
75
- if (!is.string(fileOut)) {
76
- err = new Error('Missing output file path');
77
- } else if (is.string(this.options.input.file) && path.resolve(this.options.input.file) === path.resolve(fileOut)) {
78
- err = new Error('Cannot use same file for input and output');
79
- } else if (jp2Regex.test(path.extname(fileOut)) && !this.constructor.format.jp2.output.file) {
80
- err = errJp2Save();
81
- }
82
- if (err) {
83
- if (is.fn(callback)) {
84
- callback(err);
85
- } else {
86
- return Promise.reject(err);
87
- }
88
- } else {
89
- this.options.fileOut = fileOut;
90
- const stack = Error();
91
- return this._pipeline(callback, stack);
92
- }
93
- return this;
94
- }
95
-
96
- /**
97
- * Write output to a Buffer.
98
- * JPEG, PNG, WebP, AVIF, TIFF, GIF and raw pixel data output are supported.
99
- *
100
- * Use {@link #toformat toFormat} or one of the format-specific functions such as {@link #jpeg jpeg}, {@link #png png} etc. to set the output format.
101
- *
102
- * If no explicit format is set, the output format will match the input image, except SVG input which becomes PNG output.
103
- *
104
- * By default all metadata will be removed, which includes EXIF-based orientation.
105
- * See {@link #withmetadata withMetadata} for control over this.
106
- *
107
- * `callback`, if present, gets three arguments `(err, data, info)` where:
108
- * - `err` is an error, if any.
109
- * - `data` is the output image data.
110
- * - `info` contains the output image `format`, `size` (bytes), `width`, `height`,
111
- * `channels` and `premultiplied` (indicating if premultiplication was used).
112
- * When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
113
- * Animated output will also contain `pageHeight` and `pages`.
114
- * May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text.
115
- *
116
- * The underlying `ArrayBuffer` may be marked as non-transferable by some JavaScript runtimes.
117
- * Use {@link #touint8array toUint8Array} for a guaranteed transferable `ArrayBuffer`.
118
- *
119
- * A `Promise` is returned when `callback` is not provided.
120
- *
121
- * @example
122
- * const data = await sharp(input)
123
- * .png()
124
- * .toBuffer();
125
- *
126
- * @example
127
- * const { data, info } = await sharp(input)
128
- * .png()
129
- * .toBuffer({ resolveWithObject: true });
130
- *
131
- * @example
132
- * const { data, info } = await sharp('my-image.jpg')
133
- * // output the raw pixels
134
- * .raw()
135
- * .toBuffer({ resolveWithObject: true });
136
- *
137
- * // create a more type safe way to work with the raw pixel data
138
- * // this will not copy the data, instead it will change `data`s underlying ArrayBuffer
139
- * // so `data` and `pixelArray` point to the same memory location
140
- * const pixelArray = new Uint8ClampedArray(data.buffer);
141
- *
142
- * // When you are done changing the pixelArray, sharp takes the `pixelArray` as an input
143
- * const { width, height, channels } = info;
144
- * await sharp(pixelArray, { raw: { width, height, channels } })
145
- * .toFile('my-changed-image.jpg');
146
- *
147
- * @param {Object} [options]
148
- * @param {boolean} [options.resolveWithObject] Resolve the Promise with an Object containing `data` and `info` properties instead of resolving only with `data`.
149
- * @param {Function} [callback]
150
- * @returns {Promise<Buffer>} - when no callback is provided
151
- */
152
- function toBuffer (options, callback) {
153
- if (is.object(options)) {
154
- this._setBooleanOption('resolveWithObject', options.resolveWithObject);
155
- } else if (this.options.resolveWithObject) {
156
- this.options.resolveWithObject = false;
157
- }
158
- this.options.fileOut = '';
159
- const stack = Error();
160
- return this._pipeline(is.fn(options) ? options : callback, stack);
161
- }
162
-
163
- /**
164
- * Write output to a `Uint8Array` backed by a transferable `ArrayBuffer`.
165
- * JPEG, PNG, WebP, AVIF, TIFF, GIF and raw pixel data output are supported.
166
- *
167
- * Use {@link #toformat toFormat} or one of the format-specific functions such as {@link #jpeg jpeg}, {@link #png png} etc. to set the output format.
168
- *
169
- * If no explicit format is set, the output format will match the input image, except SVG input which becomes PNG output.
170
- *
171
- * By default all metadata will be removed, which includes EXIF-based orientation.
172
- * See {@link #keepexif keepExif} and similar methods for control over this.
173
- *
174
- * Resolves with an `Object` containing:
175
- * - `data` is the output image as a `Uint8Array` backed by a transferable `ArrayBuffer`.
176
- * - `info` contains properties relating to the output image such as `width` and `height`.
177
- *
178
- * @since v0.35.0
179
- *
180
- * @example
181
- * const { data, info } = await sharp(input).toUint8Array();
182
- *
183
- * @example
184
- * const { data } = await sharp(input)
185
- * .avif()
186
- * .toUint8Array();
187
- * const base64String = data.toBase64();
188
- *
189
- * @returns {Promise<{ data: Uint8Array, info: Object }>}
190
- */
191
- function toUint8Array () {
192
- this.options.resolveWithObject = true;
193
- this.options.typedArrayOut = true;
194
- const stack = Error();
195
- return this._pipeline(null, stack);
196
- }
197
-
198
- /**
199
- * Set output density (DPI) in EXIF metadata.
200
- *
201
- * @since 0.35.0
202
- *
203
- * @example
204
- * const data = await sharp(input)
205
- * .withDensity(96)
206
- * .toBuffer();
207
- *
208
- * @param {number} density Number of pixels per inch (DPI).
209
- * @returns {Sharp}
210
- * @throws {Error} Invalid parameters
211
- */
212
- function withDensity (density) {
213
- if (is.number(density) && density > 0) {
214
- this.options.withMetadataDensity = density;
215
- } else {
216
- throw is.invalidParameterError('density', 'positive number', density);
217
- }
218
- return this.keepExif();
219
- }
220
-
221
- /**
222
- * Keep all EXIF metadata from the input image in the output image.
223
- *
224
- * EXIF metadata is unsupported for TIFF output.
225
- *
226
- * @since 0.33.0
227
- *
228
- * @example
229
- * const outputWithExif = await sharp(inputWithExif)
230
- * .keepExif()
231
- * .toBuffer();
232
- *
233
- * @returns {Sharp}
234
- */
235
- function keepExif () {
236
- this.options.keepMetadata |= 0b00001;
237
- return this;
238
- }
239
-
240
- /**
241
- * Set EXIF metadata in the output image, ignoring any EXIF in the input image.
242
- *
243
- * @since 0.33.0
244
- *
245
- * @example
246
- * const dataWithExif = await sharp(input)
247
- * .withExif({
248
- * IFD0: {
249
- * Copyright: 'The National Gallery'
250
- * },
251
- * IFD3: {
252
- * GPSLatitudeRef: 'N',
253
- * GPSLatitude: '51/1 30/1 3230/100',
254
- * GPSLongitudeRef: 'W',
255
- * GPSLongitude: '0/1 7/1 4366/100'
256
- * }
257
- * })
258
- * .toBuffer();
259
- *
260
- * @param {Object<string, Object<string, string>>} exif Object keyed by IFD0, IFD1 etc. of key/value string pairs to write as EXIF data.
261
- * @returns {Sharp}
262
- * @throws {Error} Invalid parameters
263
- */
264
- function withExif (exif) {
265
- if (is.object(exif)) {
266
- for (const [ifd, entries] of Object.entries(exif)) {
267
- if (is.object(entries)) {
268
- for (const [k, v] of Object.entries(entries)) {
269
- if (is.string(v)) {
270
- this.options.withExif[`exif-${ifd.toLowerCase()}-${k}`] = v;
271
- } else {
272
- throw is.invalidParameterError(`${ifd}.${k}`, 'string', v);
273
- }
274
- }
275
- } else {
276
- throw is.invalidParameterError(ifd, 'object', entries);
277
- }
278
- }
279
- } else {
280
- throw is.invalidParameterError('exif', 'object', exif);
281
- }
282
- this.options.withExifMerge = false;
283
- return this.keepExif();
284
- }
285
-
286
- /**
287
- * Update EXIF metadata from the input image in the output image.
288
- *
289
- * @since 0.33.0
290
- *
291
- * @example
292
- * const dataWithMergedExif = await sharp(inputWithExif)
293
- * .withExifMerge({
294
- * IFD0: {
295
- * Copyright: 'The National Gallery'
296
- * }
297
- * })
298
- * .toBuffer();
299
- *
300
- * @param {Object<string, Object<string, string>>} exif Object keyed by IFD0, IFD1 etc. of key/value string pairs to write as EXIF data.
301
- * @returns {Sharp}
302
- * @throws {Error} Invalid parameters
303
- */
304
- function withExifMerge (exif) {
305
- this.withExif(exif);
306
- this.options.withExifMerge = true;
307
- return this;
308
- }
309
-
310
- /**
311
- * Keep ICC profile from the input image in the output image.
312
- *
313
- * When input and output colour spaces differ, use with {@link /api-colour/#tocolourspace toColourspace} and optionally {@link /api-colour/#pipelinecolourspace pipelineColourspace}.
314
- *
315
- * @since 0.33.0
316
- *
317
- * @example
318
- * const outputWithIccProfile = await sharp(inputWithIccProfile)
319
- * .keepIccProfile()
320
- * .toBuffer();
321
- *
322
- * @example
323
- * const cmykOutputWithIccProfile = await sharp(cmykInputWithIccProfile)
324
- * .pipelineColourspace('cmyk')
325
- * .toColourspace('cmyk')
326
- * .keepIccProfile()
327
- * .toBuffer();
328
- *
329
- * @returns {Sharp}
330
- */
331
- function keepIccProfile () {
332
- this.options.keepMetadata |= 0b01000;
333
- return this;
334
- }
335
-
336
- /**
337
- * Transform using an ICC profile and attach to the output image.
338
- *
339
- * This can either be an absolute filesystem path or
340
- * built-in profile name (`srgb`, `p3`, `cmyk`).
341
- *
342
- * @since 0.33.0
343
- *
344
- * @example
345
- * const outputWithP3 = await sharp(input)
346
- * .withIccProfile('p3')
347
- * .toBuffer();
348
- *
349
- * @param {string} icc - Absolute filesystem path to output ICC profile or built-in profile name (srgb, p3, cmyk).
350
- * @param {Object} [options]
351
- * @param {number} [options.attach=true] Should the ICC profile be included in the output image metadata?
352
- * @returns {Sharp}
353
- * @throws {Error} Invalid parameters
354
- */
355
- function withIccProfile (icc, options) {
356
- if (is.string(icc)) {
357
- this.options.withIccProfile = icc;
358
- } else {
359
- throw is.invalidParameterError('icc', 'string', icc);
360
- }
361
- this.keepIccProfile();
362
- if (is.object(options)) {
363
- if (is.defined(options.attach)) {
364
- if (is.bool(options.attach)) {
365
- if (!options.attach) {
366
- this.options.keepMetadata &= ~0b01000;
367
- }
368
- } else {
369
- throw is.invalidParameterError('attach', 'boolean', options.attach);
370
- }
371
- }
372
- }
373
- return this;
374
- }
375
-
376
- /**
377
- * If the input contains gain map metadata, attempt to process the image and gain map separately,
378
- * recombining them into a single output image.
379
- *
380
- * This approach is faster and should produce better results than {@link #withgainmap withGainMap},
381
- * however not all operations are supported.
382
- *
383
- * Only JPEG input and output are supported.
384
- * JPEG output options other than `quality` are ignored.
385
- *
386
- * This feature is experimental and the API may change.
387
- *
388
- * @since 0.35.0
389
- *
390
- * @example
391
- * const outputWithResizedGainMap = await sharp(inputWithGainMap)
392
- * .keepGainMap()
393
- * .resize({ width: 64 })
394
- * .toBuffer();
395
- *
396
- * @returns {Sharp}
397
- */
398
- function keepGainMap() {
399
- this.options.keepGainMap = true;
400
- this.options.withGainMap = false;
401
- this.options.keepMetadata |= 0b100000;
402
- return this;
403
- }
404
-
405
- /**
406
- * If the input contains gain map metadata, use it to convert the main image to HDR (High Dynamic Range) before further processing.
407
- * The input gain map is discarded.
408
- *
409
- * If the output is JPEG, generate and attach a new ISO 21496-1 gain map.
410
- * JPEG output options other than `quality` are ignored.
411
- *
412
- * This feature is experimental and the API may change.
413
- *
414
- * @since 0.35.0
415
- *
416
- * @example
417
- * const outputWithRegeneratedGainMap = await sharp(inputWithGainMap)
418
- * .withGainMap()
419
- * .toBuffer();
420
- *
421
- * @returns {Sharp}
422
- */
423
- function withGainMap() {
424
- this.options.withGainMap = true;
425
- this.options.keepGainMap = false;
426
- this.options.colourspace = 'scrgb';
427
- return this;
428
- }
429
-
430
- /**
431
- * Keep XMP metadata from the input image in the output image.
432
- *
433
- * @since 0.34.3
434
- *
435
- * @example
436
- * const outputWithXmp = await sharp(inputWithXmp)
437
- * .keepXmp()
438
- * .toBuffer();
439
- *
440
- * @returns {Sharp}
441
- */
442
- function keepXmp () {
443
- this.options.keepMetadata |= 0b00010;
444
- return this;
445
- }
446
-
447
- /**
448
- * Set XMP metadata in the output image.
449
- *
450
- * Supported by PNG, JPEG, WebP, and TIFF output.
451
- *
452
- * @since 0.34.3
453
- *
454
- * @example
455
- * const xmpString = `
456
- * <?xml version="1.0"?>
457
- * <x:xmpmeta xmlns:x="adobe:ns:meta/">
458
- * <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
459
- * <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
460
- * <dc:creator><rdf:Seq><rdf:li>John Doe</rdf:li></rdf:Seq></dc:creator>
461
- * </rdf:Description>
462
- * </rdf:RDF>
463
- * </x:xmpmeta>`;
464
- *
465
- * const data = await sharp(input)
466
- * .withXmp(xmpString)
467
- * .toBuffer();
468
- *
469
- * @param {string} xmp String containing XMP metadata to be embedded in the output image.
470
- * @returns {Sharp}
471
- * @throws {Error} Invalid parameters
472
- */
473
- function withXmp (xmp) {
474
- if (is.string(xmp) && xmp.length > 0) {
475
- this.options.withXmp = xmp;
476
- this.options.keepMetadata |= 0b00010;
477
- } else {
478
- throw is.invalidParameterError('xmp', 'non-empty string', xmp);
479
- }
480
- return this;
481
- }
482
-
483
- /**
484
- * Keep all metadata (EXIF, ICC, XMP, IPTC) from the input image in the output image.
485
- *
486
- * The default behaviour, when `keepMetadata` is not used, is to convert to the device-independent
487
- * sRGB colour space and strip all metadata, including the removal of any ICC profile.
488
- *
489
- * @since 0.33.0
490
- *
491
- * @example
492
- * const outputWithMetadata = await sharp(inputWithMetadata)
493
- * .keepMetadata()
494
- * .toBuffer();
495
- *
496
- * @returns {Sharp}
497
- */
498
- function keepMetadata () {
499
- this.options.keepMetadata |= 0b11111;
500
- return this;
501
- }
502
-
503
- /**
504
- * Keep most metadata (EXIF, XMP, IPTC) from the input image in the output image.
505
- *
506
- * This will also convert to and add a web-friendly sRGB ICC profile if appropriate.
507
- *
508
- * Allows orientation and density to be set or updated.
509
- *
510
- * @example
511
- * const outputSrgbWithMetadata = await sharp(inputRgbWithMetadata)
512
- * .withMetadata()
513
- * .toBuffer();
514
- *
515
- * @example
516
- * // Set output metadata to 96 DPI
517
- * const data = await sharp(input)
518
- * .withMetadata({ density: 96 })
519
- * .toBuffer();
520
- *
521
- * @param {Object} [options]
522
- * @param {number} [options.orientation] Used to update the EXIF `Orientation` tag, integer between 1 and 8.
523
- * @param {number} [options.density] Number of pixels per inch (DPI).
524
- * @returns {Sharp}
525
- * @throws {Error} Invalid parameters
526
- */
527
- function withMetadata (options) {
528
- this.keepMetadata();
529
- this.withIccProfile('srgb');
530
- if (is.object(options)) {
531
- if (is.defined(options.orientation)) {
532
- if (is.integer(options.orientation) && is.inRange(options.orientation, 1, 8)) {
533
- this.options.withMetadataOrientation = options.orientation;
534
- } else {
535
- throw is.invalidParameterError('orientation', 'integer between 1 and 8', options.orientation);
536
- }
537
- }
538
- if (is.defined(options.density)) {
539
- if (is.number(options.density) && options.density > 0) {
540
- this.options.withMetadataDensity = options.density;
541
- } else {
542
- throw is.invalidParameterError('density', 'positive number', options.density);
543
- }
544
- }
545
- if (is.defined(options.icc)) {
546
- this.withIccProfile(options.icc);
547
- }
548
- if (is.defined(options.exif)) {
549
- this.withExifMerge(options.exif);
550
- }
551
- }
552
- return this;
553
- }
554
-
555
- /**
556
- * Force output to a given format.
557
- *
558
- * @example
559
- * // Convert any input to PNG output
560
- * const data = await sharp(input)
561
- * .toFormat('png')
562
- * .toBuffer();
563
- *
564
- * @param {(string|Object)} format - as a string or an Object with an 'id' attribute
565
- * @param {Object} options - output options
566
- * @returns {Sharp}
567
- * @throws {Error} unsupported format or options
568
- */
569
- function toFormat (format, options) {
570
- const actualFormat = formats.get((is.object(format) && is.string(format.id) ? format.id : format).toLowerCase());
571
- if (!actualFormat) {
572
- throw is.invalidParameterError('format', `one of: ${[...formats.keys()].join(', ')}`, format);
573
- }
574
- return this[actualFormat](options);
575
- }
576
-
577
- /**
578
- * Use these JPEG options for output image.
579
- *
580
- * @example
581
- * // Convert any input to very high quality JPEG output
582
- * const data = await sharp(input)
583
- * .jpeg({
584
- * quality: 100,
585
- * chromaSubsampling: '4:4:4'
586
- * })
587
- * .toBuffer();
588
- *
589
- * @example
590
- * // Use mozjpeg to reduce output JPEG file size (slower)
591
- * const data = await sharp(input)
592
- * .jpeg({ mozjpeg: true })
593
- * .toBuffer();
594
- *
595
- * @param {Object} [options] - output options
596
- * @param {number} [options.quality=80] - quality, integer 1-100
597
- * @param {boolean} [options.progressive=false] - use progressive (interlace) scan
598
- * @param {string} [options.chromaSubsampling='4:2:0'] - set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling
599
- * @param {boolean} [options.optimiseCoding=true] - optimise Huffman coding tables
600
- * @param {boolean} [options.optimizeCoding=true] - alternative spelling of optimiseCoding
601
- * @param {boolean} [options.mozjpeg=false] - use mozjpeg defaults, equivalent to `{ trellisQuantisation: true, overshootDeringing: true, optimiseScans: true, quantisationTable: 3 }`
602
- * @param {boolean} [options.trellisQuantisation=false] - apply trellis quantisation
603
- * @param {boolean} [options.overshootDeringing=false] - apply overshoot deringing
604
- * @param {boolean} [options.optimiseScans=false] - optimise progressive scans, forces progressive
605
- * @param {boolean} [options.optimizeScans=false] - alternative spelling of optimiseScans
606
- * @param {number} [options.quantisationTable=0] - quantization table to use, integer 0-8
607
- * @param {number} [options.quantizationTable=0] - alternative spelling of quantisationTable
608
- * @param {boolean} [options.force=true] - force JPEG output, otherwise attempt to use input format
609
- * @returns {Sharp}
610
- * @throws {Error} Invalid options
611
- */
612
- function jpeg (options) {
613
- if (is.object(options)) {
614
- if (is.defined(options.quality)) {
615
- if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
616
- this.options.jpegQuality = options.quality;
617
- } else {
618
- throw is.invalidParameterError('quality', 'integer between 1 and 100', options.quality);
619
- }
620
- }
621
- if (is.defined(options.progressive)) {
622
- this._setBooleanOption('jpegProgressive', options.progressive);
623
- }
624
- if (is.defined(options.chromaSubsampling)) {
625
- if (is.string(options.chromaSubsampling) && is.inArray(options.chromaSubsampling, ['4:2:0', '4:4:4'])) {
626
- this.options.jpegChromaSubsampling = options.chromaSubsampling;
627
- } else {
628
- throw is.invalidParameterError('chromaSubsampling', 'one of: 4:2:0, 4:4:4', options.chromaSubsampling);
629
- }
630
- }
631
- const optimiseCoding = is.bool(options.optimizeCoding) ? options.optimizeCoding : options.optimiseCoding;
632
- if (is.defined(optimiseCoding)) {
633
- this._setBooleanOption('jpegOptimiseCoding', optimiseCoding);
634
- }
635
- if (is.defined(options.mozjpeg)) {
636
- if (is.bool(options.mozjpeg)) {
637
- if (options.mozjpeg) {
638
- this.options.jpegTrellisQuantisation = true;
639
- this.options.jpegOvershootDeringing = true;
640
- this.options.jpegOptimiseScans = true;
641
- this.options.jpegProgressive = true;
642
- this.options.jpegQuantisationTable = 3;
643
- }
644
- } else {
645
- throw is.invalidParameterError('mozjpeg', 'boolean', options.mozjpeg);
646
- }
647
- }
648
- const trellisQuantisation = is.bool(options.trellisQuantization) ? options.trellisQuantization : options.trellisQuantisation;
649
- if (is.defined(trellisQuantisation)) {
650
- this._setBooleanOption('jpegTrellisQuantisation', trellisQuantisation);
651
- }
652
- if (is.defined(options.overshootDeringing)) {
653
- this._setBooleanOption('jpegOvershootDeringing', options.overshootDeringing);
654
- }
655
- const optimiseScans = is.bool(options.optimizeScans) ? options.optimizeScans : options.optimiseScans;
656
- if (is.defined(optimiseScans)) {
657
- this._setBooleanOption('jpegOptimiseScans', optimiseScans);
658
- if (optimiseScans) {
659
- this.options.jpegProgressive = true;
660
- }
661
- }
662
- const quantisationTable = is.number(options.quantizationTable) ? options.quantizationTable : options.quantisationTable;
663
- if (is.defined(quantisationTable)) {
664
- if (is.integer(quantisationTable) && is.inRange(quantisationTable, 0, 8)) {
665
- this.options.jpegQuantisationTable = quantisationTable;
666
- } else {
667
- throw is.invalidParameterError('quantisationTable', 'integer between 0 and 8', quantisationTable);
668
- }
669
- }
670
- }
671
- return this._updateFormatOut('jpeg', options);
672
- }
673
-
674
- /**
675
- * Use these PNG options for output image.
676
- *
677
- * By default, PNG output is full colour at 8 bits per pixel.
678
- *
679
- * Indexed PNG input at 1, 2 or 4 bits per pixel is converted to 8 bits per pixel.
680
- * Set `palette` to `true` for slower, indexed PNG output.
681
- *
682
- * For 16 bits per pixel output, convert to `rgb16` via
683
- * {@link /api-colour/#tocolourspace toColourspace}.
684
- *
685
- * @example
686
- * // Convert any input to full colour PNG output
687
- * const data = await sharp(input)
688
- * .png()
689
- * .toBuffer();
690
- *
691
- * @example
692
- * // Convert any input to indexed PNG output (slower)
693
- * const data = await sharp(input)
694
- * .png({ palette: true })
695
- * .toBuffer();
696
- *
697
- * @example
698
- * // Output 16 bits per pixel RGB(A)
699
- * const data = await sharp(input)
700
- * .toColourspace('rgb16')
701
- * .png()
702
- * .toBuffer();
703
- *
704
- * @param {Object} [options]
705
- * @param {boolean} [options.progressive=false] - use progressive (interlace) scan
706
- * @param {number} [options.compressionLevel=6] - zlib compression level, 0 (fastest, largest) to 9 (slowest, smallest)
707
- * @param {boolean} [options.adaptiveFiltering=false] - use adaptive row filtering
708
- * @param {boolean} [options.palette=false] - quantise to a palette-based image with alpha transparency support
709
- * @param {number} [options.quality=100] - use the lowest number of colours needed to achieve given quality, sets `palette` to `true`
710
- * @param {number} [options.effort=7] - CPU effort, between 1 (fastest) and 10 (slowest), sets `palette` to `true`
711
- * @param {number} [options.colours=256] - maximum number of palette entries, sets `palette` to `true`
712
- * @param {number} [options.colors=256] - alternative spelling of `options.colours`, sets `palette` to `true`
713
- * @param {number} [options.dither=1.0] - level of Floyd-Steinberg error diffusion, sets `palette` to `true`
714
- * @param {boolean} [options.force=true] - force PNG output, otherwise attempt to use input format
715
- * @returns {Sharp}
716
- * @throws {Error} Invalid options
717
- */
718
- function png (options) {
719
- if (is.object(options)) {
720
- if (is.defined(options.progressive)) {
721
- this._setBooleanOption('pngProgressive', options.progressive);
722
- }
723
- if (is.defined(options.compressionLevel)) {
724
- if (is.integer(options.compressionLevel) && is.inRange(options.compressionLevel, 0, 9)) {
725
- this.options.pngCompressionLevel = options.compressionLevel;
726
- } else {
727
- throw is.invalidParameterError('compressionLevel', 'integer between 0 and 9', options.compressionLevel);
728
- }
729
- }
730
- if (is.defined(options.adaptiveFiltering)) {
731
- this._setBooleanOption('pngAdaptiveFiltering', options.adaptiveFiltering);
732
- }
733
- const colours = options.colours || options.colors;
734
- if (is.defined(colours)) {
735
- if (is.integer(colours) && is.inRange(colours, 2, 256)) {
736
- this.options.pngBitdepth = bitdepthFromColourCount(colours);
737
- } else {
738
- throw is.invalidParameterError('colours', 'integer between 2 and 256', colours);
739
- }
740
- }
741
- if (is.defined(options.palette)) {
742
- this._setBooleanOption('pngPalette', options.palette);
743
- } else if ([options.quality, options.effort, options.colours, options.colors, options.dither].some(is.defined)) {
744
- this._setBooleanOption('pngPalette', true);
745
- }
746
- if (this.options.pngPalette) {
747
- if (is.defined(options.quality)) {
748
- if (is.integer(options.quality) && is.inRange(options.quality, 0, 100)) {
749
- this.options.pngQuality = options.quality;
750
- } else {
751
- throw is.invalidParameterError('quality', 'integer between 0 and 100', options.quality);
752
- }
753
- }
754
- if (is.defined(options.effort)) {
755
- if (is.integer(options.effort) && is.inRange(options.effort, 1, 10)) {
756
- this.options.pngEffort = options.effort;
757
- } else {
758
- throw is.invalidParameterError('effort', 'integer between 1 and 10', options.effort);
759
- }
760
- }
761
- if (is.defined(options.dither)) {
762
- if (is.number(options.dither) && is.inRange(options.dither, 0, 1)) {
763
- this.options.pngDither = options.dither;
764
- } else {
765
- throw is.invalidParameterError('dither', 'number between 0.0 and 1.0', options.dither);
766
- }
767
- }
768
- }
769
- }
770
- return this._updateFormatOut('png', options);
771
- }
772
-
773
- /**
774
- * Use these WebP options for output image.
775
- *
776
- * @example
777
- * // Convert any input to lossless WebP output
778
- * const data = await sharp(input)
779
- * .webp({ lossless: true })
780
- * .toBuffer();
781
- *
782
- * @example
783
- * // Optimise the file size of an animated WebP
784
- * const outputWebp = await sharp(inputWebp, { animated: true })
785
- * .webp({ effort: 6 })
786
- * .toBuffer();
787
- *
788
- * @param {Object} [options] - output options
789
- * @param {number} [options.quality=80] - quality, integer 1-100
790
- * @param {number} [options.alphaQuality=100] - quality of alpha layer, integer 0-100
791
- * @param {boolean} [options.lossless=false] - use lossless compression mode
792
- * @param {boolean} [options.nearLossless=false] - use near_lossless compression mode
793
- * @param {boolean} [options.smartSubsample=false] - use high quality chroma subsampling
794
- * @param {boolean} [options.smartDeblock=false] - auto-adjust the deblocking filter, can improve low contrast edges (slow)
795
- * @param {string} [options.preset='default'] - named preset for preprocessing/filtering, one of: default, photo, picture, drawing, icon, text
796
- * @param {number} [options.effort=4] - CPU effort, between 0 (fastest) and 6 (slowest)
797
- * @param {number} [options.loop=0] - number of animation iterations, use 0 for infinite animation
798
- * @param {number|number[]} [options.delay] - delay(s) between animation frames (in milliseconds)
799
- * @param {boolean} [options.minSize=false] - prevent use of animation key frames to minimise file size (slow)
800
- * @param {boolean} [options.mixed=false] - allow mixture of lossy and lossless animation frames (slow)
801
- * @param {boolean} [options.exact=false] - preserve the colour data in transparent pixels
802
- * @param {boolean} [options.force=true] - force WebP output, otherwise attempt to use input format
803
- * @returns {Sharp}
804
- * @throws {Error} Invalid options
805
- */
806
- function webp (options) {
807
- if (is.object(options)) {
808
- if (is.defined(options.quality)) {
809
- if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
810
- this.options.webpQuality = options.quality;
811
- } else {
812
- throw is.invalidParameterError('quality', 'integer between 1 and 100', options.quality);
813
- }
814
- }
815
- if (is.defined(options.alphaQuality)) {
816
- if (is.integer(options.alphaQuality) && is.inRange(options.alphaQuality, 0, 100)) {
817
- this.options.webpAlphaQuality = options.alphaQuality;
818
- } else {
819
- throw is.invalidParameterError('alphaQuality', 'integer between 0 and 100', options.alphaQuality);
820
- }
821
- }
822
- if (is.defined(options.lossless)) {
823
- this._setBooleanOption('webpLossless', options.lossless);
824
- }
825
- if (is.defined(options.nearLossless)) {
826
- this._setBooleanOption('webpNearLossless', options.nearLossless);
827
- }
828
- if (is.defined(options.smartSubsample)) {
829
- this._setBooleanOption('webpSmartSubsample', options.smartSubsample);
830
- }
831
- if (is.defined(options.smartDeblock)) {
832
- this._setBooleanOption('webpSmartDeblock', options.smartDeblock);
833
- }
834
- if (is.defined(options.preset)) {
835
- if (is.string(options.preset) && is.inArray(options.preset, ['default', 'photo', 'picture', 'drawing', 'icon', 'text'])) {
836
- this.options.webpPreset = options.preset;
837
- } else {
838
- throw is.invalidParameterError('preset', 'one of: default, photo, picture, drawing, icon, text', options.preset);
839
- }
840
- }
841
- if (is.defined(options.effort)) {
842
- if (is.integer(options.effort) && is.inRange(options.effort, 0, 6)) {
843
- this.options.webpEffort = options.effort;
844
- } else {
845
- throw is.invalidParameterError('effort', 'integer between 0 and 6', options.effort);
846
- }
847
- }
848
- if (is.defined(options.minSize)) {
849
- this._setBooleanOption('webpMinSize', options.minSize);
850
- }
851
- if (is.defined(options.mixed)) {
852
- this._setBooleanOption('webpMixed', options.mixed);
853
- }
854
- if (is.defined(options.exact)) {
855
- this._setBooleanOption('webpExact', options.exact);
856
- }
857
- }
858
- trySetAnimationOptions(options, this.options);
859
- return this._updateFormatOut('webp', options);
860
- }
861
-
862
- /**
863
- * Use these GIF options for the output image.
864
- *
865
- * The first entry in the palette is reserved for transparency.
866
- *
867
- * The palette of the input image will be re-used if possible.
868
- *
869
- * @since 0.30.0
870
- *
871
- * @example
872
- * // Convert PNG to GIF
873
- * await sharp(pngBuffer)
874
- * .gif()
875
- * .toBuffer();
876
- *
877
- * @example
878
- * // Convert animated WebP to animated GIF
879
- * await sharp('animated.webp', { animated: true })
880
- * .toFile('animated.gif');
881
- *
882
- * @example
883
- * // Create a 128x128, cropped, non-dithered, animated thumbnail of an animated GIF
884
- * const out = await sharp('in.gif', { animated: true })
885
- * .resize({ width: 128, height: 128 })
886
- * .gif({ dither: 0 })
887
- * .toBuffer();
888
- *
889
- * @example
890
- * // Lossy file size reduction of animated GIF
891
- * await sharp('in.gif', { animated: true })
892
- * .gif({ interFrameMaxError: 8 })
893
- * .toFile('optim.gif');
894
- *
895
- * @param {Object} [options] - output options
896
- * @param {boolean} [options.reuse=true] - re-use existing palette, otherwise generate new (slow)
897
- * @param {boolean} [options.progressive=false] - use progressive (interlace) scan
898
- * @param {number} [options.colours=256] - maximum number of palette entries, including transparency, between 2 and 256
899
- * @param {number} [options.colors=256] - alternative spelling of `options.colours`
900
- * @param {number} [options.effort=7] - CPU effort, between 1 (fastest) and 10 (slowest)
901
- * @param {number} [options.dither=1.0] - level of Floyd-Steinberg error diffusion, between 0 (least) and 1 (most)
902
- * @param {number} [options.interFrameMaxError=0] - maximum inter-frame error for transparency, between 0 (lossless) and 32
903
- * @param {number} [options.interPaletteMaxError=3] - maximum inter-palette error for palette reuse, between 0 and 256
904
- * @param {boolean} [options.keepDuplicateFrames=false] - keep duplicate frames in the output instead of combining them
905
- * @param {number} [options.loop=0] - number of animation iterations, use 0 for infinite animation
906
- * @param {number|number[]} [options.delay] - delay(s) between animation frames (in milliseconds)
907
- * @param {boolean} [options.force=true] - force GIF output, otherwise attempt to use input format
908
- * @returns {Sharp}
909
- * @throws {Error} Invalid options
910
- */
911
- function gif (options) {
912
- if (is.object(options)) {
913
- if (is.defined(options.reuse)) {
914
- this._setBooleanOption('gifReuse', options.reuse);
915
- }
916
- if (is.defined(options.progressive)) {
917
- this._setBooleanOption('gifProgressive', options.progressive);
918
- }
919
- const colours = options.colours || options.colors;
920
- if (is.defined(colours)) {
921
- if (is.integer(colours) && is.inRange(colours, 2, 256)) {
922
- this.options.gifBitdepth = bitdepthFromColourCount(colours);
923
- } else {
924
- throw is.invalidParameterError('colours', 'integer between 2 and 256', colours);
925
- }
926
- }
927
- if (is.defined(options.effort)) {
928
- if (is.integer(options.effort) && is.inRange(options.effort, 1, 10)) {
929
- this.options.gifEffort = options.effort;
930
- } else {
931
- throw is.invalidParameterError('effort', 'integer between 1 and 10', options.effort);
932
- }
933
- }
934
- if (is.defined(options.dither)) {
935
- if (is.number(options.dither) && is.inRange(options.dither, 0, 1)) {
936
- this.options.gifDither = options.dither;
937
- } else {
938
- throw is.invalidParameterError('dither', 'number between 0.0 and 1.0', options.dither);
939
- }
940
- }
941
- if (is.defined(options.interFrameMaxError)) {
942
- if (is.number(options.interFrameMaxError) && is.inRange(options.interFrameMaxError, 0, 32)) {
943
- this.options.gifInterFrameMaxError = options.interFrameMaxError;
944
- } else {
945
- throw is.invalidParameterError('interFrameMaxError', 'number between 0.0 and 32.0', options.interFrameMaxError);
946
- }
947
- }
948
- if (is.defined(options.interPaletteMaxError)) {
949
- if (is.number(options.interPaletteMaxError) && is.inRange(options.interPaletteMaxError, 0, 256)) {
950
- this.options.gifInterPaletteMaxError = options.interPaletteMaxError;
951
- } else {
952
- throw is.invalidParameterError('interPaletteMaxError', 'number between 0.0 and 256.0', options.interPaletteMaxError);
953
- }
954
- }
955
- if (is.defined(options.keepDuplicateFrames)) {
956
- if (is.bool(options.keepDuplicateFrames)) {
957
- this._setBooleanOption('gifKeepDuplicateFrames', options.keepDuplicateFrames);
958
- } else {
959
- throw is.invalidParameterError('keepDuplicateFrames', 'boolean', options.keepDuplicateFrames);
960
- }
961
- }
962
- }
963
- trySetAnimationOptions(options, this.options);
964
- return this._updateFormatOut('gif', options);
965
- }
966
-
967
- /**
968
- * Use these JP2 options for output image.
969
- *
970
- * Requires libvips compiled with support for OpenJPEG.
971
- * The prebuilt binaries do not include this - see
972
- * {@link /install#custom-libvips installing a custom libvips}.
973
- *
974
- * @example
975
- * // Convert any input to lossless JP2 output
976
- * const data = await sharp(input)
977
- * .jp2({ lossless: true })
978
- * .toBuffer();
979
- *
980
- * @example
981
- * // Convert any input to very high quality JP2 output
982
- * const data = await sharp(input)
983
- * .jp2({
984
- * quality: 100,
985
- * chromaSubsampling: '4:4:4'
986
- * })
987
- * .toBuffer();
988
- *
989
- * @since 0.29.1
990
- *
991
- * @param {Object} [options] - output options
992
- * @param {number} [options.quality=80] - quality, integer 1-100
993
- * @param {boolean} [options.lossless=false] - use lossless compression mode
994
- * @param {number} [options.tileWidth=512] - horizontal tile size
995
- * @param {number} [options.tileHeight=512] - vertical tile size
996
- * @param {string} [options.chromaSubsampling='4:4:4'] - set to '4:2:0' to use chroma subsampling
997
- * @returns {Sharp}
998
- * @throws {Error} Invalid options
999
- */
1000
- function jp2 (options) {
1001
- /* node:coverage ignore next 41 */
1002
- if (!this.constructor.format.jp2.output.buffer) {
1003
- throw errJp2Save();
1004
- }
1005
- if (is.object(options)) {
1006
- if (is.defined(options.quality)) {
1007
- if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
1008
- this.options.jp2Quality = options.quality;
1009
- } else {
1010
- throw is.invalidParameterError('quality', 'integer between 1 and 100', options.quality);
1011
- }
1012
- }
1013
- if (is.defined(options.lossless)) {
1014
- if (is.bool(options.lossless)) {
1015
- this.options.jp2Lossless = options.lossless;
1016
- } else {
1017
- throw is.invalidParameterError('lossless', 'boolean', options.lossless);
1018
- }
1019
- }
1020
- if (is.defined(options.tileWidth)) {
1021
- if (is.integer(options.tileWidth) && is.inRange(options.tileWidth, 1, 32768)) {
1022
- this.options.jp2TileWidth = options.tileWidth;
1023
- } else {
1024
- throw is.invalidParameterError('tileWidth', 'integer between 1 and 32768', options.tileWidth);
1025
- }
1026
- }
1027
- if (is.defined(options.tileHeight)) {
1028
- if (is.integer(options.tileHeight) && is.inRange(options.tileHeight, 1, 32768)) {
1029
- this.options.jp2TileHeight = options.tileHeight;
1030
- } else {
1031
- throw is.invalidParameterError('tileHeight', 'integer between 1 and 32768', options.tileHeight);
1032
- }
1033
- }
1034
- if (is.defined(options.chromaSubsampling)) {
1035
- if (is.string(options.chromaSubsampling) && is.inArray(options.chromaSubsampling, ['4:2:0', '4:4:4'])) {
1036
- this.options.jp2ChromaSubsampling = options.chromaSubsampling;
1037
- } else {
1038
- throw is.invalidParameterError('chromaSubsampling', 'one of: 4:2:0, 4:4:4', options.chromaSubsampling);
1039
- }
1040
- }
1041
- }
1042
- return this._updateFormatOut('jp2', options);
1043
- }
1044
-
1045
- /**
1046
- * Set animation options if available.
1047
- * @private
1048
- *
1049
- * @param {Object} [source] - output options
1050
- * @param {number} [source.loop=0] - number of animation iterations, use 0 for infinite animation
1051
- * @param {number[]} [source.delay] - list of delays between animation frames (in milliseconds)
1052
- * @param {Object} [target] - target object for valid options
1053
- * @throws {Error} Invalid options
1054
- */
1055
- function trySetAnimationOptions (source, target) {
1056
- if (is.object(source) && is.defined(source.loop)) {
1057
- if (is.integer(source.loop) && is.inRange(source.loop, 0, 65535)) {
1058
- target.loop = source.loop;
1059
- } else {
1060
- throw is.invalidParameterError('loop', 'integer between 0 and 65535', source.loop);
1061
- }
1062
- }
1063
- if (is.object(source) && is.defined(source.delay)) {
1064
- // We allow singular values as well
1065
- if (is.integer(source.delay) && is.inRange(source.delay, 0, 65535)) {
1066
- target.delay = [source.delay];
1067
- } else if (
1068
- Array.isArray(source.delay) &&
1069
- source.delay.every(is.integer) &&
1070
- source.delay.every(v => is.inRange(v, 0, 65535))) {
1071
- target.delay = source.delay;
1072
- } else {
1073
- throw is.invalidParameterError('delay', 'integer or an array of integers between 0 and 65535', source.delay);
1074
- }
1075
- }
1076
- }
1077
-
1078
- /**
1079
- * Use these TIFF options for output image.
1080
- *
1081
- * The `density` can be set in pixels/inch via {@link #withmetadata withMetadata}
1082
- * instead of providing `xres` and `yres` in pixels/mm.
1083
- *
1084
- * @example
1085
- * // Convert SVG input to LZW-compressed, 1 bit per pixel TIFF output
1086
- * sharp('input.svg')
1087
- * .tiff({
1088
- * compression: 'lzw',
1089
- * bitdepth: 1
1090
- * })
1091
- * .toFile('1-bpp-output.tiff')
1092
- * .then(info => { ... });
1093
- *
1094
- * @param {Object} [options] - output options
1095
- * @param {number} [options.quality=80] - quality, integer 1-100
1096
- * @param {boolean} [options.force=true] - force TIFF output, otherwise attempt to use input format
1097
- * @param {string} [options.compression='jpeg'] - compression options: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k
1098
- * @param {boolean} [options.bigtiff=false] - use BigTIFF variant (has no effect when compression is none)
1099
- * @param {string} [options.predictor='horizontal'] - compression predictor options: none, horizontal, float
1100
- * @param {boolean} [options.pyramid=false] - write an image pyramid
1101
- * @param {boolean} [options.tile=false] - write a tiled tiff
1102
- * @param {number} [options.tileWidth=256] - horizontal tile size, valid values are integers in the range 1-32768
1103
- * @param {number} [options.tileHeight=256] - vertical tile size, valid values are integers in the range 1-32768
1104
- * @param {number} [options.xres=1.0] - horizontal resolution in pixels/mm, valid values are numbers in the range 0.001-1000000
1105
- * @param {number} [options.yres=1.0] - vertical resolution in pixels/mm, valid values are numbers in the range 0.001-1000000
1106
- * @param {string} [options.resolutionUnit='inch'] - resolution unit options: inch, cm
1107
- * @param {number} [options.bitdepth=0] - reduce bitdepth to 1, 2 or 4 bit
1108
- * @param {boolean} [options.miniswhite=false] - write 1-bit images as miniswhite
1109
- * @returns {Sharp}
1110
- * @throws {Error} Invalid options
1111
- */
1112
- function tiff (options) {
1113
- if (is.object(options)) {
1114
- if (is.defined(options.quality)) {
1115
- if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
1116
- this.options.tiffQuality = options.quality;
1117
- } else {
1118
- throw is.invalidParameterError('quality', 'integer between 1 and 100', options.quality);
1119
- }
1120
- }
1121
- if (is.defined(options.bitdepth)) {
1122
- if (is.integer(options.bitdepth) && is.inArray(options.bitdepth, [1, 2, 4])) {
1123
- this.options.tiffBitdepth = options.bitdepth;
1124
- } else {
1125
- throw is.invalidParameterError('bitdepth', '1, 2 or 4', options.bitdepth);
1126
- }
1127
- }
1128
- // tiling
1129
- if (is.defined(options.tile)) {
1130
- this._setBooleanOption('tiffTile', options.tile);
1131
- }
1132
- if (is.defined(options.tileWidth)) {
1133
- if (is.integer(options.tileWidth) && is.inRange(options.tileWidth, 1, 32768)) {
1134
- this.options.tiffTileWidth = options.tileWidth;
1135
- } else {
1136
- throw is.invalidParameterError('tileWidth', 'integer between 1 and 32768', options.tileWidth);
1137
- }
1138
- }
1139
- if (is.defined(options.tileHeight)) {
1140
- if (is.integer(options.tileHeight) && is.inRange(options.tileHeight, 1, 32768)) {
1141
- this.options.tiffTileHeight = options.tileHeight;
1142
- } else {
1143
- throw is.invalidParameterError('tileHeight', 'integer between 1 and 32768', options.tileHeight);
1144
- }
1145
- }
1146
- // miniswhite
1147
- if (is.defined(options.miniswhite)) {
1148
- this._setBooleanOption('tiffMiniswhite', options.miniswhite);
1149
- }
1150
- // pyramid
1151
- if (is.defined(options.pyramid)) {
1152
- this._setBooleanOption('tiffPyramid', options.pyramid);
1153
- }
1154
- // resolution
1155
- if (is.defined(options.xres)) {
1156
- if (is.number(options.xres) && is.inRange(options.xres, 0.001, 1000000)) {
1157
- this.options.tiffXres = options.xres;
1158
- } else {
1159
- throw is.invalidParameterError('xres', 'number between 0.001 and 1000000', options.xres);
1160
- }
1161
- }
1162
- if (is.defined(options.yres)) {
1163
- if (is.number(options.yres) && is.inRange(options.yres, 0.001, 1000000)) {
1164
- this.options.tiffYres = options.yres;
1165
- } else {
1166
- throw is.invalidParameterError('yres', 'number between 0.001 and 1000000', options.yres);
1167
- }
1168
- }
1169
- // compression
1170
- if (is.defined(options.compression)) {
1171
- if (is.string(options.compression) && is.inArray(options.compression, ['none', 'jpeg', 'deflate', 'packbits', 'ccittfax4', 'lzw', 'webp', 'zstd', 'jp2k'])) {
1172
- this.options.tiffCompression = options.compression;
1173
- } else {
1174
- throw is.invalidParameterError('compression', 'one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k', options.compression);
1175
- }
1176
- }
1177
- // bigtiff
1178
- if (is.defined(options.bigtiff)) {
1179
- this._setBooleanOption('tiffBigtiff', options.bigtiff);
1180
- }
1181
- // predictor
1182
- if (is.defined(options.predictor)) {
1183
- if (is.string(options.predictor) && is.inArray(options.predictor, ['none', 'horizontal', 'float'])) {
1184
- this.options.tiffPredictor = options.predictor;
1185
- } else {
1186
- throw is.invalidParameterError('predictor', 'one of: none, horizontal, float', options.predictor);
1187
- }
1188
- }
1189
- // resolutionUnit
1190
- if (is.defined(options.resolutionUnit)) {
1191
- if (is.string(options.resolutionUnit) && is.inArray(options.resolutionUnit, ['inch', 'cm'])) {
1192
- this.options.tiffResolutionUnit = options.resolutionUnit;
1193
- } else {
1194
- throw is.invalidParameterError('resolutionUnit', 'one of: inch, cm', options.resolutionUnit);
1195
- }
1196
- }
1197
- }
1198
- return this._updateFormatOut('tiff', options);
1199
- }
1200
-
1201
- /**
1202
- * Use these AVIF options for output image.
1203
- *
1204
- * AVIF image sequences are not supported.
1205
- *
1206
- * @example
1207
- * const data = await sharp(input)
1208
- * .avif({ effort: 2 })
1209
- * .toBuffer();
1210
- *
1211
- * @example
1212
- * const data = await sharp(input)
1213
- * .avif({ lossless: true })
1214
- * .toBuffer();
1215
- *
1216
- * @since 0.27.0
1217
- *
1218
- * @param {Object} [options] - output options
1219
- * @param {number} [options.quality=50] - quality, integer 1-100
1220
- * @param {boolean} [options.lossless=false] - use lossless compression
1221
- * @param {number} [options.effort=4] - CPU effort, between 0 (fastest) and 9 (slowest)
1222
- * @param {string} [options.chromaSubsampling='4:4:4'] - set to '4:2:0' to use chroma subsampling
1223
- * @param {number} [options.bitdepth=8] - set bitdepth to 8, 10 or 12 bit
1224
- * @param {string} [options.tune='auto'] - tune output for a quality metric, one of 'auto' (default), 'iq', 'psnr' or 'ssim'
1225
- * @returns {Sharp}
1226
- * @throws {Error} Invalid options
1227
- */
1228
- function avif (options) {
1229
- return this.heif({ ...options, compression: 'av1' });
1230
- }
1231
-
1232
- /**
1233
- * Use these HEIF options for output image.
1234
- *
1235
- * Support for patent-encumbered HEIC images using `hevc` compression requires the use of a
1236
- * globally-installed libvips compiled with support for libheif, libde265 and x265.
1237
- *
1238
- * @example
1239
- * const data = await sharp(input)
1240
- * .heif({ compression: 'hevc' })
1241
- * .toBuffer();
1242
- *
1243
- * @since 0.23.0
1244
- *
1245
- * @param {Object} options - output options
1246
- * @param {string} options.compression - compression format: av1, hevc
1247
- * @param {number} [options.quality=50] - quality, integer 1-100
1248
- * @param {boolean} [options.lossless=false] - use lossless compression
1249
- * @param {number} [options.effort=4] - CPU effort, between 0 (fastest) and 9 (slowest)
1250
- * @param {string} [options.chromaSubsampling='4:4:4'] - set to '4:2:0' to use chroma subsampling
1251
- * @param {number} [options.bitdepth=8] - set bitdepth to 8, 10 or 12 bit
1252
- * @param {string} [options.tune='auto'] - tune output for a quality metric, one of 'auto' (default), 'iq', 'psnr' or 'ssim'
1253
- * @returns {Sharp}
1254
- * @throws {Error} Invalid options
1255
- */
1256
- function heif (options) {
1257
- if (is.object(options)) {
1258
- if (is.string(options.compression) && is.inArray(options.compression, ['av1', 'hevc'])) {
1259
- this.options.heifCompression = options.compression;
1260
- } else {
1261
- throw is.invalidParameterError('compression', 'one of: av1, hevc', options.compression);
1262
- }
1263
- if (is.defined(options.quality)) {
1264
- if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
1265
- this.options.heifQuality = options.quality;
1266
- } else {
1267
- throw is.invalidParameterError('quality', 'integer between 1 and 100', options.quality);
1268
- }
1269
- }
1270
- if (is.defined(options.lossless)) {
1271
- if (is.bool(options.lossless)) {
1272
- this.options.heifLossless = options.lossless;
1273
- } else {
1274
- throw is.invalidParameterError('lossless', 'boolean', options.lossless);
1275
- }
1276
- }
1277
- if (is.defined(options.effort)) {
1278
- if (is.integer(options.effort) && is.inRange(options.effort, 0, 9)) {
1279
- this.options.heifEffort = options.effort;
1280
- } else {
1281
- throw is.invalidParameterError('effort', 'integer between 0 and 9', options.effort);
1282
- }
1283
- }
1284
- if (is.defined(options.chromaSubsampling)) {
1285
- if (is.string(options.chromaSubsampling) && is.inArray(options.chromaSubsampling, ['4:2:0', '4:4:4'])) {
1286
- this.options.heifChromaSubsampling = options.chromaSubsampling;
1287
- } else {
1288
- throw is.invalidParameterError('chromaSubsampling', 'one of: 4:2:0, 4:4:4', options.chromaSubsampling);
1289
- }
1290
- }
1291
- if (is.defined(options.bitdepth)) {
1292
- if (is.integer(options.bitdepth) && is.inArray(options.bitdepth, [8, 10, 12])) {
1293
- this.options.heifBitdepth = options.bitdepth;
1294
- } else {
1295
- throw is.invalidParameterError('bitdepth', '8, 10 or 12', options.bitdepth);
1296
- }
1297
- }
1298
- if (is.defined(options.tune)) {
1299
- if (is.string(options.tune) && is.inArray(options.tune, ['auto', 'iq', 'psnr', 'ssim'])) {
1300
- if (this.options.heifLossless && options.tune === 'iq') {
1301
- this.options.heifTune = 'ssim';
1302
- } else {
1303
- this.options.heifTune = options.tune;
1304
- }
1305
- } else {
1306
- throw is.invalidParameterError('tune', 'one of: auto, iq, psnr, ssim', options.tune);
1307
- }
1308
- }
1309
- } else {
1310
- throw is.invalidParameterError('options', 'Object', options);
1311
- }
1312
- return this._updateFormatOut('heif', options);
1313
- }
1314
-
1315
- /**
1316
- * Use these JPEG-XL (JXL) options for output image.
1317
- *
1318
- * This feature is experimental, please do not use in production systems.
1319
- *
1320
- * Requires libvips compiled with support for libjxl.
1321
- * The prebuilt binaries do not include this - see
1322
- * {@link /install/#custom-libvips installing a custom libvips}.
1323
- *
1324
- * @since 0.31.3
1325
- *
1326
- * @param {Object} [options] - output options
1327
- * @param {number} [options.distance=1.0] - maximum encoding error, between 0 (highest quality) and 15 (lowest quality)
1328
- * @param {number} [options.quality] - calculate `distance` based on JPEG-like quality, between 1 and 100, overrides distance if specified
1329
- * @param {number} [options.decodingTier=0] - target decode speed tier, between 0 (highest quality) and 4 (lowest quality)
1330
- * @param {boolean} [options.lossless=false] - use lossless compression
1331
- * @param {number} [options.effort=7] - CPU effort, between 1 (fastest) and 9 (slowest)
1332
- * @param {number} [options.loop=0] - number of animation iterations, use 0 for infinite animation
1333
- * @param {number|number[]} [options.delay] - delay(s) between animation frames (in milliseconds)
1334
- * @returns {Sharp}
1335
- * @throws {Error} Invalid options
1336
- */
1337
- function jxl (options) {
1338
- if (is.object(options)) {
1339
- if (is.defined(options.quality)) {
1340
- if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
1341
- // https://github.com/libjxl/libjxl/blob/0aeea7f180bafd6893c1db8072dcb67d2aa5b03d/tools/cjxl_main.cc#L640-L644
1342
- this.options.jxlDistance = options.quality >= 30
1343
- ? 0.1 + (100 - options.quality) * 0.09
1344
- : 53 / 3000 * options.quality * options.quality - 23 / 20 * options.quality + 25;
1345
- } else {
1346
- throw is.invalidParameterError('quality', 'integer between 1 and 100', options.quality);
1347
- }
1348
- } else if (is.defined(options.distance)) {
1349
- if (is.number(options.distance) && is.inRange(options.distance, 0, 15)) {
1350
- this.options.jxlDistance = options.distance;
1351
- } else {
1352
- throw is.invalidParameterError('distance', 'number between 0.0 and 15.0', options.distance);
1353
- }
1354
- }
1355
- if (is.defined(options.decodingTier)) {
1356
- if (is.integer(options.decodingTier) && is.inRange(options.decodingTier, 0, 4)) {
1357
- this.options.jxlDecodingTier = options.decodingTier;
1358
- } else {
1359
- throw is.invalidParameterError('decodingTier', 'integer between 0 and 4', options.decodingTier);
1360
- }
1361
- }
1362
- if (is.defined(options.lossless)) {
1363
- if (is.bool(options.lossless)) {
1364
- this.options.jxlLossless = options.lossless;
1365
- } else {
1366
- throw is.invalidParameterError('lossless', 'boolean', options.lossless);
1367
- }
1368
- }
1369
- if (is.defined(options.effort)) {
1370
- if (is.integer(options.effort) && is.inRange(options.effort, 1, 9)) {
1371
- this.options.jxlEffort = options.effort;
1372
- } else {
1373
- throw is.invalidParameterError('effort', 'integer between 1 and 9', options.effort);
1374
- }
1375
- }
1376
- }
1377
- trySetAnimationOptions(options, this.options);
1378
- return this._updateFormatOut('jxl', options);
1379
- }
1380
-
1381
- /**
1382
- * Force output to be raw, uncompressed pixel data.
1383
- * Pixel ordering is left-to-right, top-to-bottom, without padding.
1384
- * Channel ordering will be RGB or RGBA for non-greyscale colourspaces.
1385
- *
1386
- * @example
1387
- * // Extract raw, unsigned 8-bit RGB pixel data from JPEG input
1388
- * const { data, info } = await sharp('input.jpg')
1389
- * .raw()
1390
- * .toBuffer({ resolveWithObject: true });
1391
- *
1392
- * @example
1393
- * // Extract alpha channel as raw, unsigned 16-bit pixel data from PNG input
1394
- * const data = await sharp('input.png')
1395
- * .ensureAlpha()
1396
- * .extractChannel(3)
1397
- * .toColourspace('b-w')
1398
- * .raw({ depth: 'ushort' })
1399
- * .toBuffer();
1400
- *
1401
- * @param {Object} [options] - output options
1402
- * @param {string} [options.depth='uchar'] - bit depth, one of: char, uchar (default), short, ushort, int, uint, float, complex, double, dpcomplex
1403
- * @returns {Sharp}
1404
- * @throws {Error} Invalid options
1405
- */
1406
- function raw (options) {
1407
- if (is.object(options)) {
1408
- if (is.defined(options.depth)) {
1409
- if (is.string(options.depth) && is.inArray(options.depth,
1410
- ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'float', 'complex', 'double', 'dpcomplex']
1411
- )) {
1412
- this.options.rawDepth = options.depth;
1413
- } else {
1414
- throw is.invalidParameterError('depth', 'one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex', options.depth);
1415
- }
1416
- }
1417
- }
1418
- return this._updateFormatOut('raw');
1419
- }
1420
-
1421
- /**
1422
- * Use tile-based deep zoom (image pyramid) output.
1423
- *
1424
- * Set the format and options for tile images via the `toFormat`, `jpeg`, `png` or `webp` functions.
1425
- * Use a `.zip` or `.szi` file extension with `toFile` to write to a compressed archive file format.
1426
- *
1427
- * The container will be set to `zip` when the output is a Buffer or Stream, otherwise it will default to `fs`.
1428
- *
1429
- * @example
1430
- * sharp('input.tiff')
1431
- * .png()
1432
- * .tile({
1433
- * size: 512
1434
- * })
1435
- * .toFile('output.dz', function(err, info) {
1436
- * // output.dzi is the Deep Zoom XML definition
1437
- * // output_files contains 512x512 tiles grouped by zoom level
1438
- * });
1439
- *
1440
- * @example
1441
- * const zipFileWithTiles = await sharp(input)
1442
- * .tile({ basename: "tiles" })
1443
- * .toBuffer();
1444
- *
1445
- * @example
1446
- * const iiififier = sharp().tile({ layout: "iiif" });
1447
- * readableStream
1448
- * .pipe(iiififier)
1449
- * .pipe(writeableStream);
1450
- *
1451
- * @param {Object} [options]
1452
- * @param {number} [options.size=256] tile size in pixels, a value between 1 and 8192.
1453
- * @param {number} [options.overlap=0] tile overlap in pixels, a value between 0 and 8192.
1454
- * @param {number} [options.angle=0] tile angle of rotation, must be a multiple of 90.
1455
- * @param {string|Object} [options.background={r: 255, g: 255, b: 255, alpha: 1}] - background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to white without transparency.
1456
- * @param {string} [options.depth] how deep to make the pyramid, possible values are `onepixel`, `onetile` or `one`, default based on layout.
1457
- * @param {number} [options.skipBlanks=-1] Threshold to skip tile generation. Range is 0-255 for 8-bit images, 0-65535 for 16-bit images. Default is 5 for `google` layout, -1 (no skip) otherwise.
1458
- * @param {string} [options.container='fs'] tile container, with value `fs` (filesystem) or `zip` (compressed file).
1459
- * @param {string} [options.layout='dz'] filesystem layout, possible values are `dz`, `iiif`, `iiif3`, `zoomify` or `google`.
1460
- * @param {boolean} [options.centre=false] centre image in tile.
1461
- * @param {boolean} [options.center=false] alternative spelling of centre.
1462
- * @param {string} [options.id='https://example.com/iiif'] when `layout` is `iiif`/`iiif3`, sets the `@id`/`id` attribute of `info.json`
1463
- * @param {string} [options.basename] the name of the directory within the zip file when container is `zip`.
1464
- * @returns {Sharp}
1465
- * @throws {Error} Invalid parameters
1466
- */
1467
- function tile (options) {
1468
- if (is.object(options)) {
1469
- // Size of square tiles, in pixels
1470
- if (is.defined(options.size)) {
1471
- if (is.integer(options.size) && is.inRange(options.size, 1, 8192)) {
1472
- this.options.tileSize = options.size;
1473
- } else {
1474
- throw is.invalidParameterError('size', 'integer between 1 and 8192', options.size);
1475
- }
1476
- }
1477
- // Overlap of tiles, in pixels
1478
- if (is.defined(options.overlap)) {
1479
- if (is.integer(options.overlap) && is.inRange(options.overlap, 0, 8192)) {
1480
- if (options.overlap > this.options.tileSize) {
1481
- throw is.invalidParameterError('overlap', `<= size (${this.options.tileSize})`, options.overlap);
1482
- }
1483
- this.options.tileOverlap = options.overlap;
1484
- } else {
1485
- throw is.invalidParameterError('overlap', 'integer between 0 and 8192', options.overlap);
1486
- }
1487
- }
1488
- // Container
1489
- if (is.defined(options.container)) {
1490
- if (is.string(options.container) && is.inArray(options.container, ['fs', 'zip'])) {
1491
- this.options.tileContainer = options.container;
1492
- } else {
1493
- throw is.invalidParameterError('container', 'one of: fs, zip', options.container);
1494
- }
1495
- }
1496
- // Layout
1497
- if (is.defined(options.layout)) {
1498
- if (is.string(options.layout) && is.inArray(options.layout, ['dz', 'google', 'iiif', 'iiif3', 'zoomify'])) {
1499
- this.options.tileLayout = options.layout;
1500
- } else {
1501
- throw is.invalidParameterError('layout', 'one of: dz, google, iiif, iiif3, zoomify', options.layout);
1502
- }
1503
- }
1504
- // Angle of rotation,
1505
- if (is.defined(options.angle)) {
1506
- if (is.integer(options.angle) && !(options.angle % 90)) {
1507
- this.options.tileAngle = options.angle;
1508
- } else {
1509
- throw is.invalidParameterError('angle', 'positive/negative multiple of 90', options.angle);
1510
- }
1511
- }
1512
- // Background colour
1513
- this._setBackgroundColourOption('tileBackground', options.background);
1514
- // Depth of tiles
1515
- if (is.defined(options.depth)) {
1516
- if (is.string(options.depth) && is.inArray(options.depth, ['onepixel', 'onetile', 'one'])) {
1517
- this.options.tileDepth = options.depth;
1518
- } else {
1519
- throw is.invalidParameterError('depth', 'one of: onepixel, onetile, one', options.depth);
1520
- }
1521
- }
1522
- // Threshold to skip blank tiles
1523
- if (is.defined(options.skipBlanks)) {
1524
- if (is.integer(options.skipBlanks) && is.inRange(options.skipBlanks, -1, 65535)) {
1525
- this.options.tileSkipBlanks = options.skipBlanks;
1526
- } else {
1527
- throw is.invalidParameterError('skipBlanks', 'integer between -1 and 255/65535', options.skipBlanks);
1528
- }
1529
- } else if (is.defined(options.layout) && options.layout === 'google') {
1530
- this.options.tileSkipBlanks = 5;
1531
- }
1532
- // Center image in tile
1533
- const centre = is.bool(options.center) ? options.center : options.centre;
1534
- if (is.defined(centre)) {
1535
- this._setBooleanOption('tileCentre', centre);
1536
- }
1537
- // @id attribute for IIIF layout
1538
- if (is.defined(options.id)) {
1539
- if (is.string(options.id)) {
1540
- this.options.tileId = options.id;
1541
- } else {
1542
- throw is.invalidParameterError('id', 'string', options.id);
1543
- }
1544
- }
1545
- // Basename for zip container
1546
- if (is.defined(options.basename)) {
1547
- if (is.string(options.basename)) {
1548
- this.options.tileBasename = options.basename;
1549
- } else {
1550
- throw is.invalidParameterError('basename', 'string', options.basename);
1551
- }
1552
- }
1553
- }
1554
- // Format
1555
- if (is.inArray(this.options.formatOut, ['jpeg', 'png', 'webp'])) {
1556
- this.options.tileFormat = this.options.formatOut;
1557
- } else if (this.options.formatOut !== 'input') {
1558
- throw is.invalidParameterError('format', 'one of: jpeg, png, webp', this.options.formatOut);
1559
- }
1560
- return this._updateFormatOut('dz');
1561
- }
1562
-
1563
- /**
1564
- * Set a timeout for processing, in seconds.
1565
- * Use a value of zero to continue processing indefinitely, the default behaviour.
1566
- *
1567
- * The clock starts when libvips opens an input image for processing.
1568
- * Time spent waiting for a libuv thread to become available is not included.
1569
- *
1570
- * @example
1571
- * // Ensure processing takes no longer than 3 seconds
1572
- * try {
1573
- * const data = await sharp(input)
1574
- * .blur(1000)
1575
- * .timeout({ seconds: 3 })
1576
- * .toBuffer();
1577
- * } catch (err) {
1578
- * if (err.message.includes('timeout')) { ... }
1579
- * }
1580
- *
1581
- * @since 0.29.2
1582
- *
1583
- * @param {Object} options
1584
- * @param {number} options.seconds - Number of seconds after which processing will be stopped
1585
- * @returns {Sharp}
1586
- */
1587
- function timeout (options) {
1588
- if (!is.plainObject(options)) {
1589
- throw is.invalidParameterError('options', 'object', options);
1590
- }
1591
- if (is.integer(options.seconds) && is.inRange(options.seconds, 0, 3600)) {
1592
- this.options.timeoutSeconds = options.seconds;
1593
- } else {
1594
- throw is.invalidParameterError('seconds', 'integer between 0 and 3600', options.seconds);
1595
- }
1596
- return this;
1597
- }
1598
-
1599
- /**
1600
- * Update the output format unless options.force is false,
1601
- * in which case revert to input format.
1602
- * @private
1603
- * @param {string} formatOut
1604
- * @param {Object} [options]
1605
- * @param {boolean} [options.force=true] - force output format, otherwise attempt to use input format
1606
- * @returns {Sharp}
1607
- */
1608
- function _updateFormatOut (formatOut, options) {
1609
- if (!(is.object(options) && options.force === false)) {
1610
- this.options.formatOut = formatOut;
1611
- }
1612
- return this;
1613
- }
1614
-
1615
- /**
1616
- * Update a boolean attribute of the this.options Object.
1617
- * @private
1618
- * @param {string} key
1619
- * @param {boolean} val
1620
- * @throws {Error} Invalid key
1621
- */
1622
- function _setBooleanOption (key, val) {
1623
- if (is.bool(val)) {
1624
- this.options[key] = val;
1625
- } else {
1626
- throw is.invalidParameterError(key, 'boolean', val);
1627
- }
1628
- }
1629
-
1630
- /**
1631
- * Called by a WriteableStream to notify us it is ready for data.
1632
- * @private
1633
- */
1634
- function _read () {
1635
- if (!this.options.streamOut) {
1636
- this.options.streamOut = true;
1637
- const stack = Error();
1638
- this._pipeline(undefined, stack);
1639
- }
1640
- }
1641
-
1642
- /**
1643
- * Invoke the C++ image processing pipeline
1644
- * Supports callback, stream and promise variants
1645
- * @private
1646
- */
1647
- function _pipeline (callback, stack) {
1648
- if (typeof callback === 'function') {
1649
- // output=file/buffer
1650
- if (this._isStreamInput()) {
1651
- // output=file/buffer, input=stream
1652
- this._whenStreamInFinished(() => {
1653
- this._flattenBufferIn();
1654
- sharp.pipeline(this.options, (err, data, info) => {
1655
- if (err) {
1656
- callback(is.nativeError(err, stack));
1657
- } else {
1658
- callback(null, data, info);
1659
- }
1660
- });
1661
- });
1662
- } else {
1663
- // output=file/buffer, input=file/buffer
1664
- sharp.pipeline(this.options, (err, data, info) => {
1665
- if (err) {
1666
- callback(is.nativeError(err, stack));
1667
- } else {
1668
- callback(null, data, info);
1669
- }
1670
- });
1671
- }
1672
- return this;
1673
- } else if (this.options.streamOut) {
1674
- // output=stream
1675
- if (this._isStreamInput()) {
1676
- // output=stream, input=stream
1677
- this._whenStreamInFinished(() => {
1678
- this._flattenBufferIn();
1679
- sharp.pipeline(this.options, (err, data, info) => {
1680
- if (err) {
1681
- this.emit('error', is.nativeError(err, stack));
1682
- } else {
1683
- this.emit('info', info);
1684
- this.push(data);
1685
- }
1686
- this.push(null);
1687
- this.on('end', () => this.emit('close'));
1688
- });
1689
- });
1690
- } else {
1691
- // output=stream, input=file/buffer
1692
- sharp.pipeline(this.options, (err, data, info) => {
1693
- if (err) {
1694
- this.emit('error', is.nativeError(err, stack));
1695
- } else {
1696
- this.emit('info', info);
1697
- this.push(data);
1698
- }
1699
- this.push(null);
1700
- this.on('end', () => this.emit('close'));
1701
- });
1702
- }
1703
- return this;
1704
- } else {
1705
- // output=promise
1706
- if (this._isStreamInput()) {
1707
- // output=promise, input=stream
1708
- return new Promise((resolve, reject) => {
1709
- this._whenStreamInFinished(() => {
1710
- this._flattenBufferIn();
1711
- sharp.pipeline(this.options, (err, data, info) => {
1712
- if (err) {
1713
- reject(is.nativeError(err, stack));
1714
- } else {
1715
- if (this.options.resolveWithObject) {
1716
- resolve({ data, info });
1717
- } else {
1718
- resolve(data);
1719
- }
1720
- }
1721
- });
1722
- });
1723
- });
1724
- } else {
1725
- // output=promise, input=file/buffer
1726
- return new Promise((resolve, reject) => {
1727
- sharp.pipeline(this.options, (err, data, info) => {
1728
- if (err) {
1729
- reject(is.nativeError(err, stack));
1730
- } else {
1731
- if (this.options.resolveWithObject) {
1732
- resolve({ data, info });
1733
- } else {
1734
- resolve(data);
1735
- }
1736
- }
1737
- });
1738
- });
1739
- }
1740
- }
1741
- }
1742
-
1743
- /**
1744
- * Decorate the Sharp prototype with output-related functions.
1745
- * @module Sharp
1746
- * @private
1747
- */
1748
- module.exports = (Sharp) => {
1749
- Object.assign(Sharp.prototype, {
1750
- // Public
1751
- toFile,
1752
- toBuffer,
1753
- toUint8Array,
1754
- withDensity,
1755
- keepExif,
1756
- withExif,
1757
- withExifMerge,
1758
- keepIccProfile,
1759
- withIccProfile,
1760
- keepGainMap,
1761
- withGainMap,
1762
- keepXmp,
1763
- withXmp,
1764
- keepMetadata,
1765
- withMetadata,
1766
- toFormat,
1767
- jpeg,
1768
- jp2,
1769
- png,
1770
- webp,
1771
- tiff,
1772
- avif,
1773
- heif,
1774
- jxl,
1775
- gif,
1776
- raw,
1777
- tile,
1778
- timeout,
1779
- // Private
1780
- _updateFormatOut,
1781
- _setBooleanOption,
1782
- _read,
1783
- _pipeline
1784
- });
1785
- };