@revizly/sharp 0.35.0-revizly28 → 0.35.0-revizly29

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.
@@ -3,8 +3,8 @@
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
6
- const is = require('./is');
7
- const sharp = require('./sharp');
6
+ const is = require('./is.cjs');
7
+ const sharp = require('./sharp.cjs');
8
8
 
9
9
  /**
10
10
  * Justification alignment
@@ -24,7 +24,7 @@ const align = {
24
24
 
25
25
  const inputStreamParameters = [
26
26
  // Limits and error handling
27
- 'failOn', 'limitInputPixels', 'unlimited',
27
+ 'failOn', 'limitInputPixels', 'limitInputChannels', 'unlimited',
28
28
  // Format-generic
29
29
  'animated', 'autoOrient', 'density', 'ignoreIcc', 'page', 'pages', 'sequentialRead',
30
30
  // Format-specific
@@ -55,6 +55,7 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
55
55
  autoOrient: false,
56
56
  failOn: 'warning',
57
57
  limitInputPixels: 0x3FFF ** 2,
58
+ limitInputChannels: 5,
58
59
  ignoreIcc: false,
59
60
  unlimited: false,
60
61
  sequentialRead: true
@@ -150,6 +151,16 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
150
151
  throw is.invalidParameterError('limitInputPixels', 'positive integer', inputOptions.limitInputPixels);
151
152
  }
152
153
  }
154
+ // limitInputChannels
155
+ if (is.defined(inputOptions.limitInputChannels)) {
156
+ if (is.bool(inputOptions.limitInputChannels)) {
157
+ inputDescriptor.limitInputChannels = inputOptions.limitInputChannels ? 5 : 0;
158
+ } else if (is.integer(inputOptions.limitInputChannels) && is.inRange(inputOptions.limitInputChannels, 0, Number.MAX_SAFE_INTEGER)) {
159
+ inputDescriptor.limitInputChannels = inputOptions.limitInputChannels;
160
+ } else {
161
+ throw is.invalidParameterError('limitInputChannels', 'positive integer', inputOptions.limitInputChannels);
162
+ }
163
+ }
153
164
  // unlimited
154
165
  if (is.defined(inputOptions.unlimited)) {
155
166
  if (is.bool(inputOptions.unlimited)) {