@revizly/sharp 0.34.4-revizly1 → 0.34.4-revizly10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/install/check.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
4
  try {
7
5
  const { useGlobalLibvips, globalLibvipsVersion, log, spawnRebuild } = require('../lib/libvips');
8
6
 
@@ -12,14 +10,14 @@ try {
12
10
  try {
13
11
  const addonApi = require('node-addon-api');
14
12
  log(`Found node-addon-api ${addonApi.version || ''}`);
15
- } catch (err) {
13
+ } catch (_err) {
16
14
  log('Please add node-addon-api to your dependencies');
17
15
  return;
18
16
  }
19
17
  try {
20
18
  const gyp = require('node-gyp');
21
19
  log(`Found node-gyp ${gyp().version}`);
22
- } catch (err) {
20
+ } catch (_err) {
23
21
  log('Please add node-gyp to your dependencies');
24
22
  return;
25
23
  }
package/lib/channel.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
4
  const is = require('./is');
7
5
 
8
6
  /**
package/lib/colour.js CHANGED
@@ -1,9 +1,7 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
- const color = require('color');
4
+ const color = require('@img/colour');
7
5
  const is = require('./is');
8
6
 
9
7
  /**
package/lib/composite.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
4
  const is = require('./is');
7
5
 
8
6
  /**
@@ -1,8 +1,6 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
4
  const util = require('node:util');
7
5
  const stream = require('node:stream');
8
6
  const is = require('./is');
@@ -205,6 +203,7 @@ const debuglog = util.debuglog('sharp');
205
203
  * @throws {Error} Invalid parameters
206
204
  */
207
205
  const Sharp = function (input, options) {
206
+ // biome-ignore lint/complexity/noArguments: constructor factory
208
207
  if (arguments.length === 1 && !is.defined(input)) {
209
208
  throw new Error('Invalid input');
210
209
  }
package/lib/index.d.ts CHANGED
@@ -27,7 +27,7 @@
27
27
 
28
28
  /// <reference types="node" />
29
29
 
30
- import { Duplex } from 'stream';
30
+ import type { Duplex } from 'node:stream';
31
31
 
32
32
  //#region Constructor functions
33
33
 
package/lib/index.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
4
  const Sharp = require('./constructor');
7
5
  require('./input')(Sharp);
8
6
  require('./resize')(Sharp);
package/lib/input.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
4
  const is = require('./is');
7
5
  const sharp = require('./sharp');
8
6
 
@@ -54,7 +52,7 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
54
52
  const inputDescriptor = {
55
53
  autoOrient: false,
56
54
  failOn: 'warning',
57
- limitInputPixels: Math.pow(0x3FFF, 2),
55
+ limitInputPixels: 0x3FFF ** 2,
58
56
  ignoreIcc: false,
59
57
  unlimited: false,
60
58
  sequentialRead: true
@@ -150,7 +148,7 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
150
148
  if (is.defined(inputOptions.limitInputPixels)) {
151
149
  if (is.bool(inputOptions.limitInputPixels)) {
152
150
  inputDescriptor.limitInputPixels = inputOptions.limitInputPixels
153
- ? Math.pow(0x3FFF, 2)
151
+ ? 0x3FFF ** 2
154
152
  : 0;
155
153
  } else if (is.integer(inputOptions.limitInputPixels) && is.inRange(inputOptions.limitInputPixels, 0, Number.MAX_SAFE_INTEGER)) {
156
154
  inputDescriptor.limitInputPixels = inputOptions.limitInputPixels;
@@ -513,7 +511,7 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
513
511
  }
514
512
  }
515
513
  } else if (is.defined(inputOptions)) {
516
- throw new Error('Invalid input options ' + inputOptions);
514
+ throw new Error(`Invalid input options ${inputOptions}`);
517
515
  }
518
516
  return inputDescriptor;
519
517
  }
@@ -525,10 +523,8 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
525
523
  * @param {string} encoding - unused
526
524
  * @param {Function} callback
527
525
  */
528
- function _write (chunk, encoding, callback) {
529
- /* istanbul ignore else */
526
+ function _write (chunk, _encoding, callback) {
530
527
  if (Array.isArray(this.options.input.buffer)) {
531
- /* istanbul ignore else */
532
528
  if (is.buffer(chunk)) {
533
529
  if (this.options.input.buffer.length === 0) {
534
530
  this.on('finish', () => {
package/lib/is.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
4
  /**
7
5
  * Is this value defined and not null?
8
6
  * @private
package/lib/libvips.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
4
  const { spawnSync } = require('node:child_process');
7
5
  const { createHash } = require('node:crypto');
8
6
  const semverCoerce = require('semver/functions/coerce');
@@ -12,8 +10,8 @@ const detectLibc = require('detect-libc');
12
10
 
13
11
  const { config, engines, optionalDependencies } = require('../package.json');
14
12
 
15
- const minimumLibvipsVersionLabelled = process.env.npm_package_config_libvips || /* istanbul ignore next */
16
- config.libvips;
13
+ /* node:coverage ignore next */
14
+ const minimumLibvipsVersionLabelled = process.env.npm_package_config_libvips || config.libvips;
17
15
  const minimumLibvipsVersion = semverCoerce(minimumLibvipsVersionLabelled).version;
18
16
 
19
17
  const prebuiltPlatforms = [
@@ -36,17 +34,16 @@ const log = (item) => {
36
34
  }
37
35
  };
38
36
 
39
- /* istanbul ignore next */
37
+ /* node:coverage ignore next */
40
38
  const runtimeLibc = () => detectLibc.isNonGlibcLinuxSync() ? detectLibc.familySync() : '';
41
39
 
42
40
  const runtimePlatformArch = () => `${process.platform}${runtimeLibc()}-${process.arch}`;
43
41
 
44
- /* istanbul ignore next */
45
42
  const buildPlatformArch = () => {
43
+ /* node:coverage ignore next 3 */
46
44
  if (isEmscripten()) {
47
45
  return 'wasm32';
48
46
  }
49
- /* eslint camelcase: ["error", { allow: ["^npm_config_"] }] */
50
47
  const { npm_config_arch, npm_config_platform, npm_config_libc } = process.env;
51
48
  const libc = typeof npm_config_libc === 'string' ? npm_config_libc : runtimeLibc();
52
49
  return `${npm_config_platform || process.platform}${libc}-${npm_config_arch || process.arch}`;
@@ -56,19 +53,19 @@ const buildSharpLibvipsIncludeDir = () => {
56
53
  try {
57
54
  return require(`@revizly/sharp-libvips-dev-${buildPlatformArch()}/include`);
58
55
  } catch {
56
+ /* node:coverage ignore next 5 */
59
57
  try {
60
58
  return require('@revizly/sharp-libvips-dev/include');
61
59
  } catch {}
62
60
  }
63
- /* istanbul ignore next */
64
61
  return '';
65
62
  };
66
63
 
67
64
  const buildSharpLibvipsCPlusPlusDir = () => {
65
+ /* node:coverage ignore next 4 */
68
66
  try {
69
67
  return require('@revizly/sharp-libvips-dev/cplusplus');
70
68
  } catch {}
71
- /* istanbul ignore next */
72
69
  return '';
73
70
  };
74
71
 
@@ -76,16 +73,17 @@ const buildSharpLibvipsLibDir = () => {
76
73
  try {
77
74
  return require(`@revizly/sharp-libvips-dev-${buildPlatformArch()}/lib`);
78
75
  } catch {
76
+ /* node:coverage ignore next 5 */
79
77
  try {
80
78
  return require(`@revizly/sharp-libvips-${buildPlatformArch()}/lib`);
81
79
  } catch {}
82
80
  }
83
- /* istanbul ignore next */
84
81
  return '';
85
82
  };
86
83
 
84
+ /* node:coverage disable */
85
+
87
86
  const isUnsupportedNodeRuntime = () => {
88
- /* istanbul ignore next */
89
87
  if (process.release?.name === 'node' && process.versions) {
90
88
  if (!semverSatisfies(process.versions.node, engines.node)) {
91
89
  return { found: process.versions.node, expected: engines.node };
@@ -93,14 +91,12 @@ const isUnsupportedNodeRuntime = () => {
93
91
  }
94
92
  };
95
93
 
96
- /* istanbul ignore next */
97
94
  const isEmscripten = () => {
98
95
  const { CC } = process.env;
99
- return Boolean(CC && CC.endsWith('/emcc'));
96
+ return Boolean(CC?.endsWith('/emcc'));
100
97
  };
101
98
 
102
99
  const isRosetta = () => {
103
- /* istanbul ignore next */
104
100
  if (process.platform === 'darwin' && process.arch === 'x64') {
105
101
  const translated = spawnSync('sysctl sysctl.proc_translated', spawnSyncOptions).stdout;
106
102
  return (translated || '').trim() === 'sysctl.proc_translated: 1';
@@ -108,6 +104,8 @@ const isRosetta = () => {
108
104
  return false;
109
105
  };
110
106
 
107
+ /* node:coverage enable */
108
+
111
109
  const sha512 = (s) => createHash('sha512').update(s).digest('hex');
112
110
 
113
111
  const yarnLocator = () => {
@@ -121,7 +119,8 @@ const yarnLocator = () => {
121
119
  return '';
122
120
  };
123
121
 
124
- /* istanbul ignore next */
122
+ /* node:coverage disable */
123
+
125
124
  const spawnRebuild = () =>
126
125
  spawnSync(`node-gyp rebuild --directory=src ${isEmscripten() ? '--nodedir=emscripten' : ''}`, {
127
126
  ...spawnSyncOptions,
@@ -137,16 +136,17 @@ const globalLibvipsVersion = () => {
137
136
  PKG_CONFIG_PATH: pkgConfigPath()
138
137
  }
139
138
  }).stdout;
140
- /* istanbul ignore next */
141
139
  return (globalLibvipsVersion || '').trim();
142
140
  } else {
143
141
  return '';
144
142
  }
145
143
  };
146
144
 
147
- /* istanbul ignore next */
145
+ /* node:coverage enable */
146
+
148
147
  const pkgConfigPath = () => {
149
148
  if (process.platform !== 'win32') {
149
+ /* node:coverage ignore next 4 */
150
150
  const brewPkgConfigPath = spawnSync(
151
151
  'which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',
152
152
  spawnSyncOptions
@@ -178,13 +178,13 @@ const useGlobalLibvips = (logger) => {
178
178
  if (Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS) === true) {
179
179
  return skipSearch(true, 'SHARP_FORCE_GLOBAL_LIBVIPS', logger);
180
180
  }
181
- /* istanbul ignore next */
181
+ /* node:coverage ignore next 3 */
182
182
  if (isRosetta()) {
183
183
  return skipSearch(false, 'Rosetta', logger);
184
184
  }
185
185
  const globalVipsVersion = globalLibvipsVersion();
186
- return !!globalVipsVersion && /* istanbul ignore next */
187
- semverGreaterThanOrEqualTo(globalVipsVersion, minimumLibvipsVersion);
186
+ /* node:coverage ignore next */
187
+ return !!globalVipsVersion && semverGreaterThanOrEqualTo(globalVipsVersion, minimumLibvipsVersion);
188
188
  };
189
189
 
190
190
  module.exports = {
package/lib/operation.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
4
  const is = require('./is');
7
5
 
8
6
  /**
package/lib/output.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
4
  const path = require('node:path');
7
5
  const is = require('./is');
8
6
  const sharp = require('./sharp');
@@ -845,7 +843,6 @@ function gif (options) {
845
843
  return this._updateFormatOut('gif', options);
846
844
  }
847
845
 
848
- /* istanbul ignore next */
849
846
  /**
850
847
  * Use these JP2 options for output image.
851
848
  *
@@ -880,6 +877,7 @@ function gif (options) {
880
877
  * @throws {Error} Invalid options
881
878
  */
882
879
  function jp2 (options) {
880
+ /* node:coverage ignore next 41 */
883
881
  if (!this.constructor.format.jp2k.output.buffer) {
884
882
  throw errJp2Save();
885
883
  }
@@ -1502,7 +1500,6 @@ function _setBooleanOption (key, val) {
1502
1500
  * @private
1503
1501
  */
1504
1502
  function _read () {
1505
- /* istanbul ignore else */
1506
1503
  if (!this.options.streamOut) {
1507
1504
  this.options.streamOut = true;
1508
1505
  const stack = Error();
package/lib/resize.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
4
  const is = require('./is');
7
5
 
8
6
  /**
package/lib/sharp.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
4
  // Inspects the runtime environment and exports the relevant sharp.node binary
7
5
 
8
6
  const { familySync, versionSync } = require('detect-libc');
@@ -17,6 +15,8 @@ const paths = [
17
15
  '@revizly/sharp-wasm32/sharp.node'
18
16
  ];
19
17
 
18
+ /* node:coverage disable */
19
+
20
20
  let path, sharp;
21
21
  const errors = [];
22
22
  for (path of paths) {
@@ -24,12 +24,10 @@ for (path of paths) {
24
24
  sharp = require(path);
25
25
  break;
26
26
  } catch (err) {
27
- /* istanbul ignore next */
28
27
  errors.push(err);
29
28
  }
30
29
  }
31
30
 
32
- /* istanbul ignore next */
33
31
  if (sharp && path.startsWith('@img/sharp-linux-x64') && !sharp._isUsingX64V2()) {
34
32
  const err = new Error('Prebuilt binaries for linux-x64 require v2 microarchitecture');
35
33
  err.code = 'Unsupported CPU';
@@ -37,7 +35,6 @@ if (sharp && path.startsWith('@img/sharp-linux-x64') && !sharp._isUsingX64V2())
37
35
  sharp = null;
38
36
  }
39
37
 
40
- /* istanbul ignore next */
41
38
  if (sharp) {
42
39
  module.exports = sharp;
43
40
  } else {
@@ -88,7 +85,7 @@ if (sharp) {
88
85
  ` Found ${libcFound}`,
89
86
  ` Requires ${libcRequires}`
90
87
  );
91
- } catch (errEngines) {}
88
+ } catch (_errEngines) {}
92
89
  }
93
90
  if (isLinux && /\/snap\/core[0-9]{2}/.test(messages)) {
94
91
  help.push(
package/lib/utility.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- 'use strict';
5
-
6
4
  const events = require('node:events');
7
5
  const detectLibc = require('detect-libc');
8
6
 
@@ -57,7 +55,7 @@ const interpolators = {
57
55
  let versions = {
58
56
  vips: libvipsVersion.semver
59
57
  };
60
- /* istanbul ignore next */
58
+ /* node:coverage ignore next 15 */
61
59
  if (!libvipsVersion.isGlobal) {
62
60
  if (!libvipsVersion.isWasm) {
63
61
  try {
@@ -75,7 +73,7 @@ if (!libvipsVersion.isGlobal) {
75
73
  }
76
74
  versions.sharp = require('../package.json').version;
77
75
 
78
- /* istanbul ignore next */
76
+ /* node:coverage ignore next 5 */
79
77
  if (versions.heif && format.heif) {
80
78
  // Prebuilt binaries provide AV1
81
79
  format.heif.input.fileSuffix = ['.avif'];
@@ -150,7 +148,7 @@ cache(true);
150
148
  function concurrency (concurrency) {
151
149
  return sharp.concurrency(is.integer(concurrency) ? concurrency : null);
152
150
  }
153
- /* istanbul ignore next */
151
+ /* node:coverage ignore next 7 */
154
152
  if (detectLibc.familySync() === detectLibc.GLIBC && !sharp._isUsingJemalloc()) {
155
153
  // Reduce default concurrency to 1 when using glibc memory allocator
156
154
  sharp.concurrency(1);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@revizly/sharp",
3
3
  "description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",
4
- "version": "0.34.4-revizly1",
4
+ "version": "0.34.4-revizly10",
5
5
  "author": "Lovell Fuller <npm@lovell.info>",
6
6
  "homepage": "https://sharp.pixelplumbing.com",
7
7
  "contributors": [
@@ -94,12 +94,13 @@
94
94
  "scripts": {
95
95
  "install": "node install/check.js",
96
96
  "clean": "rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",
97
- "test": "npm run test-lint && npm run test-unit && npm run test-licensing && npm run test-types",
98
- "test-lint": "semistandard && cpplint",
99
- "test-unit": "nyc --reporter=lcov --reporter=text --check-coverage --branches=100 mocha",
100
- "test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;LGPL-3.0-or-later;MIT\"",
97
+ "test": "npm run lint && npm run test-unit",
98
+ "lint": "npm run lint-cpp && npm run lint-js && npm run lint-types",
99
+ "lint-cpp": "cpplint --quiet src/*.h src/*.cc",
100
+ "lint-js": "biome lint",
101
+ "lint-types": "tsd --files ./test/types/sharp.test-d.ts",
101
102
  "test-leak": "./test/leak/leak.sh",
102
- "test-types": "tsd",
103
+ "test-unit": "node --experimental-test-coverage test/unit.mjs",
103
104
  "package-from-local-build": "node npm/from-local-build.js",
104
105
  "package-release-notes": "node npm/release-notes.js",
105
106
  "docs-build": "node docs/build.mjs",
@@ -137,33 +138,30 @@
137
138
  "vips"
138
139
  ],
139
140
  "dependencies": {
140
- "color": "^4.2.3",
141
- "detect-libc": "^2.0.4",
141
+ "@img/colour": "^1.0.0",
142
+ "detect-libc": "^2.1.0",
142
143
  "semver": "^7.7.2"
143
144
  },
144
145
  "optionalDependencies": {
145
- "@revizly/sharp-libvips-linux-arm64": "1.0.21",
146
- "@revizly/sharp-libvips-linux-x64": "1.0.21",
147
- "@revizly/sharp-linux-arm64": "0.34.1-revizly12",
148
- "@revizly/sharp-linux-x64": "0.34.1-revizly12"
146
+ "@revizly/sharp-libvips-linux-arm64": "1.0.23",
147
+ "@revizly/sharp-libvips-linux-x64": "1.0.23",
148
+ "@revizly/sharp-linux-arm64": "0.34.4-revizly8",
149
+ "@revizly/sharp-linux-x64": "0.34.4-revizly8"
149
150
  },
150
151
  "devDependencies": {
151
- "@emnapi/runtime": "^1.4.5",
152
- "@revizly/sharp-libvips-dev": "1.0.21",
152
+ "@biomejs/biome": "^2.2.4",
153
+ "@cpplint/cli": "^0.1.0",
154
+ "@emnapi/runtime": "^1.5.0",
155
+ "@revizly/sharp-libvips-dev": "1.0.23",
153
156
  "@types/node": "*",
154
- "cc": "^3.0.1",
155
- "emnapi": "^1.4.5",
157
+ "emnapi": "^1.5.0",
156
158
  "exif-reader": "^2.0.2",
157
159
  "extract-zip": "^2.0.1",
158
160
  "icc": "^3.0.0",
159
161
  "jsdoc-to-markdown": "^9.1.2",
160
- "license-checker": "^25.0.1",
161
- "mocha": "^11.7.1",
162
162
  "node-addon-api": "^8.5.0",
163
- "node-gyp": "^11.4.1",
164
- "nyc": "^17.1.0",
165
- "semistandard": "^17.0.0",
166
- "tar-fs": "^3.1.0",
163
+ "node-gyp": "^11.4.2",
164
+ "tar-fs": "^3.1.1",
167
165
  "tsd": "^0.33.0"
168
166
  },
169
167
  "license": "Apache-2.0",
@@ -171,28 +169,15 @@
171
169
  "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
172
170
  },
173
171
  "config": {
174
- "libvips": ">=8.17.1"
172
+ "libvips": ">=8.17.2"
175
173
  },
176
174
  "funding": {
177
175
  "url": "https://opencollective.com/libvips"
178
176
  },
179
- "semistandard": {
180
- "env": [
181
- "mocha"
182
- ]
183
- },
184
177
  "cc": {
185
178
  "linelength": "120",
186
179
  "filter": [
187
180
  "build/include"
188
181
  ]
189
- },
190
- "nyc": {
191
- "include": [
192
- "lib"
193
- ]
194
- },
195
- "tsd": {
196
- "directory": "test/types/"
197
182
  }
198
183
  }
package/src/binding.gyp CHANGED
@@ -168,6 +168,7 @@
168
168
  # Ensure runtime linking is relative to sharp.node
169
169
  '-Wl,-rpath,\'@loader_path/../../sharp-libvips-<(platform_and_arch)/lib\'',
170
170
  '-Wl,-rpath,\'@loader_path/../../../sharp-libvips-<(platform_and_arch)/<(sharp_libvips_version)/lib\'',
171
+ '-Wl,-rpath,\'@loader_path/../node_modules/@revizly/sharp-libvips-<(platform_and_arch)/lib\'',
171
172
  '-Wl,-rpath,\'@loader_path/../../node_modules/@revizly/sharp-libvips-<(platform_and_arch)/lib\'',
172
173
  '-Wl,-rpath,\'@loader_path/../../../node_modules/@revizly/sharp-libvips-<(platform_and_arch)/lib\'',
173
174
  '-Wl,-rpath,\'@loader_path/../../../../../@revizly-sharp-libvips-<(platform_and_arch)-npm-<(sharp_libvips_version)-<(sharp_libvips_yarn_locator)/node_modules/@revizly/sharp-libvips-<(platform_and_arch)/lib\''
package/src/common.cc CHANGED
@@ -1,18 +1,20 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ #include <algorithm>
4
5
  #include <cstdlib>
6
+ #include <map>
7
+ #include <mutex>
8
+ #include <queue>
5
9
  #include <string>
6
- #include <string.h>
10
+ #include <tuple>
11
+ #include <utility>
7
12
  #include <vector>
8
- #include <queue>
9
- #include <map>
10
- #include <mutex> // NOLINT(build/c++11)
11
13
 
12
14
  #include <napi.h>
13
15
  #include <vips/vips8>
14
16
 
15
- #include "common.h"
17
+ #include "./common.h"
16
18
 
17
19
  using vips::VImage;
18
20
 
@@ -396,6 +398,7 @@ namespace sharp {
396
398
  imageType == ImageType::JPEG ||
397
399
  imageType == ImageType::PNG ||
398
400
  imageType == ImageType::SVG ||
401
+ imageType == ImageType::TIFF ||
399
402
  imageType == ImageType::HEIF;
400
403
  }
401
404
 
@@ -420,14 +423,14 @@ namespace sharp {
420
423
  ->set("high_bitdepth", descriptor->svgHighBitdepth);
421
424
  break;
422
425
  case ImageType::TIFF:
423
- option->set("tiffSubifd", descriptor->tiffSubifd);
426
+ option->set("subifd", descriptor->tiffSubifd);
424
427
  break;
425
428
  case ImageType::PDF:
426
429
  option->set("dpi", descriptor->density)
427
430
  ->set("background", descriptor->pdfBackground);
428
431
  break;
429
432
  case ImageType::OPENSLIDE:
430
- option->set("openSlideLevel", descriptor->openSlideLevel);
433
+ option->set("level", descriptor->openSlideLevel);
431
434
  break;
432
435
  case ImageType::JP2:
433
436
  option->set("oneshot", descriptor->jp2Oneshot);
package/src/common.h CHANGED
@@ -4,10 +4,11 @@
4
4
  #ifndef SRC_COMMON_H_
5
5
  #define SRC_COMMON_H_
6
6
 
7
+ #include <atomic>
7
8
  #include <string>
8
9
  #include <tuple>
10
+ #include <utility>
9
11
  #include <vector>
10
- #include <atomic>
11
12
 
12
13
  #include <napi.h>
13
14
  #include <vips/vips8>
@@ -16,8 +17,8 @@
16
17
 
17
18
  #if (VIPS_MAJOR_VERSION < 8) || \
18
19
  (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 17) || \
19
- (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 17 && VIPS_MICRO_VERSION < 1)
20
- #error "libvips version 8.17.1+ is required - please see https://sharp.pixelplumbing.com/install"
20
+ (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 17 && VIPS_MICRO_VERSION < 2)
21
+ #error "libvips version 8.17.2+ is required - please see https://sharp.pixelplumbing.com/install"
21
22
  #endif
22
23
 
23
24
  #if defined(__has_include)
@@ -30,7 +31,7 @@ using vips::VImage;
30
31
 
31
32
  namespace sharp {
32
33
 
33
- struct InputDescriptor { // NOLINT(runtime/indentation_namespace)
34
+ struct InputDescriptor {
34
35
  std::string name;
35
36
  std::string file;
36
37
  bool autoOrient;
package/src/metadata.cc CHANGED
@@ -1,15 +1,17 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ #include <cmath>
4
5
  #include <numeric>
6
+ #include <string>
7
+ #include <utility>
5
8
  #include <vector>
6
- #include <cmath>
7
9
 
8
10
  #include <napi.h>
9
11
  #include <vips/vips8>
10
12
 
11
- #include "common.h"
12
- #include "metadata.h"
13
+ #include "./common.h"
14
+ #include "./metadata.h"
13
15
 
14
16
  static void* readPNGComment(VipsImage *image, const char *field, GValue *value, void *p);
15
17
 
@@ -261,11 +263,11 @@ class MetadataWorker : public Napi::AsyncWorker {
261
263
  info.Set("iptc", Napi::Buffer<char>::NewOrCopy(env, baton->iptc, baton->iptcLength, sharp::FreeCallback));
262
264
  }
263
265
  if (baton->xmpLength > 0) {
264
- info.Set("xmp", Napi::Buffer<char>::NewOrCopy(env, baton->xmp, baton->xmpLength, sharp::FreeCallback));
265
266
  if (g_utf8_validate(static_cast<char const *>(baton->xmp), baton->xmpLength, nullptr)) {
266
267
  info.Set("xmpAsString",
267
268
  Napi::String::New(env, static_cast<char const *>(baton->xmp), baton->xmpLength));
268
269
  }
270
+ info.Set("xmp", Napi::Buffer<char>::NewOrCopy(env, baton->xmp, baton->xmpLength, sharp::FreeCallback));
269
271
  }
270
272
  if (baton->tifftagPhotoshopLength > 0) {
271
273
  info.Set("tifftagPhotoshop",
package/src/metadata.h CHANGED
@@ -5,6 +5,7 @@
5
5
  #define SRC_METADATA_H_
6
6
 
7
7
  #include <string>
8
+ #include <vector>
8
9
  #include <napi.h>
9
10
 
10
11
  #include "./common.h"
package/src/operations.cc CHANGED
@@ -8,8 +8,8 @@
8
8
  #include <vector>
9
9
  #include <vips/vips8>
10
10
 
11
- #include "common.h"
12
- #include "operations.h"
11
+ #include "./common.h"
12
+ #include "./operations.h"
13
13
 
14
14
  using vips::VImage;
15
15
  using vips::VError;
package/src/operations.h CHANGED
@@ -8,6 +8,7 @@
8
8
  #include <functional>
9
9
  #include <memory>
10
10
  #include <tuple>
11
+ #include <vector>
11
12
  #include <vips/vips8>
12
13
 
13
14
  using vips::VImage;
package/src/pipeline.cc CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  #include <algorithm>
5
5
  #include <cmath>
6
- #include <filesystem>
6
+ #include <filesystem> // NOLINT(build/c++17)
7
7
  #include <map>
8
8
  #include <memory>
9
9
  #include <numeric>
@@ -17,9 +17,9 @@
17
17
  #include <vips/vips8>
18
18
  #include <napi.h>
19
19
 
20
- #include "common.h"
21
- #include "operations.h"
22
- #include "pipeline.h"
20
+ #include "./common.h"
21
+ #include "./operations.h"
22
+ #include "./pipeline.h"
23
23
 
24
24
  class PipelineWorker : public Napi::AsyncWorker {
25
25
  public:
package/src/pipeline.h CHANGED
@@ -6,8 +6,8 @@
6
6
 
7
7
  #include <memory>
8
8
  #include <string>
9
- #include <vector>
10
9
  #include <unordered_map>
10
+ #include <vector>
11
11
 
12
12
  #include <napi.h>
13
13
  #include <vips/vips8>
package/src/sharp.cc CHANGED
@@ -1,16 +1,16 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- #include <mutex> // NOLINT(build/c++11)
4
+ #include <mutex>
5
5
 
6
6
  #include <napi.h>
7
7
  #include <vips/vips8>
8
8
 
9
- #include "common.h"
10
- #include "metadata.h"
11
- #include "pipeline.h"
12
- #include "utilities.h"
13
- #include "stats.h"
9
+ #include "./common.h"
10
+ #include "./metadata.h"
11
+ #include "./pipeline.h"
12
+ #include "./stats.h"
13
+ #include "./utilities.h"
14
14
 
15
15
  Napi::Object init(Napi::Env env, Napi::Object exports) {
16
16
  static std::once_flag sharp_vips_init_once;
package/src/stats.cc CHANGED
@@ -1,15 +1,16 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ #include <iostream>
4
5
  #include <numeric>
6
+ #include <string>
5
7
  #include <vector>
6
- #include <iostream>
7
8
 
8
9
  #include <napi.h>
9
10
  #include <vips/vips8>
10
11
 
11
- #include "common.h"
12
- #include "stats.h"
12
+ #include "./common.h"
13
+ #include "./stats.h"
13
14
 
14
15
  class StatsWorker : public Napi::AsyncWorker {
15
16
  public:
package/src/stats.h CHANGED
@@ -5,6 +5,7 @@
5
5
  #define SRC_STATS_H_
6
6
 
7
7
  #include <string>
8
+ #include <vector>
8
9
  #include <napi.h>
9
10
 
10
11
  #include "./common.h"
@@ -24,7 +25,7 @@ struct ChannelStats {
24
25
 
25
26
  ChannelStats(int minVal, int maxVal, double sumVal, double squaresSumVal,
26
27
  double meanVal, double stdevVal, int minXVal, int minYVal, int maxXVal, int maxYVal):
27
- min(minVal), max(maxVal), sum(sumVal), squaresSum(squaresSumVal),
28
+ min(minVal), max(maxVal), sum(sumVal), squaresSum(squaresSumVal), // NOLINT(build/include_what_you_use)
28
29
  mean(meanVal), stdev(stdevVal), minX(minXVal), minY(minYVal), maxX(maxXVal), maxY(maxYVal) {}
29
30
  };
30
31
 
package/src/utilities.cc CHANGED
@@ -2,16 +2,16 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  #include <cmath>
5
- #include <string>
6
5
  #include <cstdio>
6
+ #include <string>
7
7
 
8
8
  #include <napi.h>
9
9
  #include <vips/vips8>
10
10
  #include <vips/vector.h>
11
11
 
12
- #include "common.h"
13
- #include "operations.h"
14
- #include "utilities.h"
12
+ #include "./common.h"
13
+ #include "./operations.h"
14
+ #include "./utilities.h"
15
15
 
16
16
  /*
17
17
  Get and set cache limits