🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

sharp

Package Overview
Dependencies
Maintainers
1
Versions
189
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sharp - npm Package Compare versions

Comparing version
0.34.4
to
0.34.5-rc.0
+38
install/build.js
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
const {
useGlobalLibvips,
globalLibvipsVersion,
log,
spawnRebuild,
} = require('../lib/libvips');
log('Attempting to build from source via node-gyp');
log('See https://sharp.pixelplumbing.com/install#building-from-source');
try {
const addonApi = require('node-addon-api');
log(`Found node-addon-api ${addonApi.version || ''}`);
} catch (_err) {
log('Please add node-addon-api to your dependencies');
process.exit(1);
}
try {
const gyp = require('node-gyp');
log(`Found node-gyp ${gyp().version}`);
} catch (_err) {
log('Please add node-gyp to your dependencies');
process.exit(1);
}
if (useGlobalLibvips(log)) {
log(`Detected globally-installed libvips v${globalLibvipsVersion()}`);
}
const status = spawnRebuild();
if (status !== 0) {
process.exit(status);
}
+7
-34

@@ -1,37 +0,10 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
try {
const { useGlobalLibvips, globalLibvipsVersion, log, spawnRebuild } = require('../lib/libvips');
const buildFromSource = (msg) => {
log(msg);
log('Attempting to build from source via node-gyp');
try {
const addonApi = require('node-addon-api');
log(`Found node-addon-api ${addonApi.version || ''}`);
} catch (err) {
log('Please add node-addon-api to your dependencies');
return;
}
try {
const gyp = require('node-gyp');
log(`Found node-gyp ${gyp().version}`);
} catch (err) {
log('Please add node-gyp to your dependencies');
return;
}
log('See https://sharp.pixelplumbing.com/install#building-from-source');
const status = spawnRebuild();
if (status !== 0) {
process.exit(status);
}
};
if (useGlobalLibvips(log)) {
buildFromSource(`Detected globally-installed libvips v${globalLibvipsVersion()}`);
} else if (process.env.npm_config_build_from_source) {
buildFromSource('Detected --build-from-source flag');
const { useGlobalLibvips } = require('../lib/libvips');
if (useGlobalLibvips() || process.env.npm_config_build_from_source) {
process.exit(1);
}

@@ -38,0 +11,0 @@ } catch (err) {

@@ -1,6 +0,6 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const is = require('./is');

@@ -21,3 +21,3 @@

*
* See also {@link /api-operation#flatten|flatten}.
* See also {@link /api-operation/#flatten flatten}.
*

@@ -167,3 +167,3 @@ * @example

*/
module.exports = function (Sharp) {
module.exports = (Sharp) => {
Object.assign(Sharp.prototype, {

@@ -170,0 +170,0 @@ // Public instance functions

@@ -1,6 +0,6 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const color = require('@img/colour');

@@ -72,3 +72,3 @@ const is = require('./is');

* All operations will use this colourspace before converting to the output colourspace,
* as defined by {@link #tocolourspace|toColourspace}.
* as defined by {@link #tocolourspace toColourspace}.
*

@@ -84,3 +84,3 @@ * @since 0.29.0

*
* @param {string} [colourspace] - pipeline colourspace e.g. `rgb16`, `scrgb`, `lab`, `grey16` [...](https://github.com/libvips/libvips/blob/41cff4e9d0838498487a00623462204eb10ee5b8/libvips/iofuncs/enumtypes.c#L774)
* @param {string} [colourspace] - pipeline colourspace e.g. `rgb16`, `scrgb`, `lab`, `grey16` [...](https://www.libvips.org/API/current/enum.Interpretation.html)
* @returns {Sharp}

@@ -117,3 +117,3 @@ * @throws {Error} Invalid parameters

*
* @param {string} [colourspace] - output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://github.com/libvips/libvips/blob/3c0bfdf74ce1dc37a6429bed47fa76f16e2cd70a/libvips/iofuncs/enumtypes.c#L777-L794)
* @param {string} [colourspace] - output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://www.libvips.org/API/current/enum.Interpretation.html)
* @returns {Sharp}

@@ -147,3 +147,6 @@ * @throws {Error} Invalid parameters

function _getBackgroundColourOption (value) {
if (is.object(value) || is.string(value)) {
if (
is.object(value) ||
(is.string(value) && value.length >= 3 && value.length <= 200)
) {
const colour = color(value);

@@ -179,3 +182,3 @@ return [

*/
module.exports = function (Sharp) {
module.exports = (Sharp) => {
Object.assign(Sharp.prototype, {

@@ -182,0 +185,0 @@ // Public

@@ -1,6 +0,6 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const is = require('./is');

@@ -59,3 +59,3 @@

* More information about blend modes can be found at
* https://www.libvips.org/API/current/libvips-conversion.html#VipsBlendMode
* https://www.libvips.org/API/current/enum.BlendMode.html
* and https://www.cairographics.org/operators/

@@ -127,4 +127,4 @@ *

* @param {boolean} [images[].animated=false] - Set to `true` to read all frames/pages of an animated image.
* @param {string} [images[].failOn='warning'] - @see {@link /api-constructor#parameters|constructor parameters}
* @param {number|boolean} [images[].limitInputPixels=268402689] - @see {@link /api-constructor#parameters|constructor parameters}
* @param {string} [images[].failOn='warning'] - @see {@link /api-constructor/ constructor parameters}
* @param {number|boolean} [images[].limitInputPixels=268402689] - @see {@link /api-constructor/ constructor parameters}
* @returns {Sharp}

@@ -211,5 +211,5 @@ * @throws {Error} Invalid parameters

*/
module.exports = function (Sharp) {
module.exports = (Sharp) => {
Sharp.prototype.composite = composite;
Sharp.blend = blend;
};

@@ -1,6 +0,6 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const util = require('node:util');

@@ -15,2 +15,6 @@ const stream = require('node:stream');

const queueListener = (queueLength) => {
Sharp.queue.emit('change', queueLength);
};
/**

@@ -209,2 +213,3 @@ * Constructor factory to create an instance of `sharp`, to which further methods are chained.

const Sharp = function (input, options) {
// biome-ignore lint/complexity/noArguments: constructor factory
if (arguments.length === 1 && !is.defined(input)) {

@@ -358,2 +363,3 @@ throw new Error('Invalid input');

tiffCompression: 'jpeg',
tiffBigtiff: false,
tiffPredictor: 'horizontal',

@@ -402,5 +408,3 @@ tiffPyramid: false,

// Function to notify of queue length changes
queueListener: function (queueLength) {
Sharp.queue.emit('change', queueLength);
}
queueListener
};

@@ -407,0 +411,0 @@ this.options.input = this._createInputDescriptor(input, options, { allowStream: true });

@@ -1,6 +0,6 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const Sharp = require('./constructor');

@@ -7,0 +7,0 @@ require('./input')(Sharp);

@@ -1,6 +0,6 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const is = require('./is');

@@ -57,3 +57,3 @@ const sharp = require('./sharp');

failOn: 'warning',
limitInputPixels: Math.pow(0x3FFF, 2),
limitInputPixels: 0x3FFF ** 2,
ignoreIcc: false,

@@ -154,3 +154,3 @@ unlimited: false,

inputDescriptor.limitInputPixels = inputOptions.limitInputPixels
? Math.pow(0x3FFF, 2)
? 0x3FFF ** 2
: 0;

@@ -518,3 +518,3 @@ } else if (is.integer(inputOptions.limitInputPixels) && is.inRange(inputOptions.limitInputPixels, 0, Number.MAX_SAFE_INTEGER)) {

} else if (is.defined(inputOptions)) {
throw new Error('Invalid input options ' + inputOptions);
throw new Error(`Invalid input options ${inputOptions}`);
}

@@ -531,6 +531,4 @@ return inputDescriptor;

*/
function _write (chunk, encoding, callback) {
/* istanbul ignore else */
function _write (chunk, _encoding, callback) {
if (Array.isArray(this.options.input.buffer)) {
/* istanbul ignore else */
if (is.buffer(chunk)) {

@@ -579,3 +577,3 @@ if (this.options.input.buffer.length === 0) {

* Dimensions in the response will respect the `page` and `pages` properties of the
* {@link /api-constructor#parameters|constructor parameters}.
* {@link /api-constructor/ constructor parameters}.
*

@@ -588,5 +586,5 @@ * A `Promise` is returned when `callback` is not provided.

* - `height`: Number of pixels high (EXIF orientation is not taken into consideration, see example below)
* - `space`: Name of colour space interpretation e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://www.libvips.org/API/current/VipsImage.html#VipsInterpretation)
* - `space`: Name of colour space interpretation e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://www.libvips.org/API/current/enum.Interpretation.html)
* - `channels`: Number of bands e.g. `3` for sRGB, `4` for CMYK
* - `depth`: Name of pixel depth format e.g. `uchar`, `char`, `ushort`, `float` [...](https://www.libvips.org/API/current/VipsImage.html#VipsBandFormat)
* - `depth`: Name of pixel depth format e.g. `uchar`, `char`, `ushort`, `float` [...](https://www.libvips.org/API/current/enum.BandFormat.html)
* - `density`: Number of pixels per inch (DPI), if present

@@ -803,3 +801,3 @@ * - `chromaSubsampling`: String containing JPEG chroma subsampling, `4:2:0` or `4:4:4` for RGB, `4:2:0:4` or `4:4:4:4` for CMYK

*/
module.exports = function (Sharp) {
module.exports = (Sharp) => {
Object.assign(Sharp.prototype, {

@@ -806,0 +804,0 @@ // Private

+19
-45

@@ -1,6 +0,6 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
/**

@@ -10,5 +10,3 @@ * Is this value defined and not null?

*/
const defined = function (val) {
return typeof val !== 'undefined' && val !== null;
};
const defined = (val) => typeof val !== 'undefined' && val !== null;

@@ -19,5 +17,3 @@ /**

*/
const object = function (val) {
return typeof val === 'object';
};
const object = (val) => typeof val === 'object';

@@ -28,5 +24,3 @@ /**

*/
const plainObject = function (val) {
return Object.prototype.toString.call(val) === '[object Object]';
};
const plainObject = (val) => Object.prototype.toString.call(val) === '[object Object]';

@@ -37,5 +31,3 @@ /**

*/
const fn = function (val) {
return typeof val === 'function';
};
const fn = (val) => typeof val === 'function';

@@ -46,5 +38,3 @@ /**

*/
const bool = function (val) {
return typeof val === 'boolean';
};
const bool = (val) => typeof val === 'boolean';

@@ -55,5 +45,3 @@ /**

*/
const buffer = function (val) {
return val instanceof Buffer;
};
const buffer = (val) => val instanceof Buffer;

@@ -64,3 +52,3 @@ /**

*/
const typedArray = function (val) {
const typedArray = (val) => {
if (defined(val)) {

@@ -88,5 +76,3 @@ switch (val.constructor) {

*/
const arrayBuffer = function (val) {
return val instanceof ArrayBuffer;
};
const arrayBuffer = (val) => val instanceof ArrayBuffer;

@@ -97,5 +83,3 @@ /**

*/
const string = function (val) {
return typeof val === 'string' && val.length > 0;
};
const string = (val) => typeof val === 'string' && val.length > 0;

@@ -106,5 +90,3 @@ /**

*/
const number = function (val) {
return typeof val === 'number' && !Number.isNaN(val);
};
const number = (val) => typeof val === 'number' && !Number.isNaN(val);

@@ -115,5 +97,3 @@ /**

*/
const integer = function (val) {
return Number.isInteger(val);
};
const integer = (val) => Number.isInteger(val);

@@ -124,5 +104,3 @@ /**

*/
const inRange = function (val, min, max) {
return val >= min && val <= max;
};
const inRange = (val, min, max) => val >= min && val <= max;

@@ -133,5 +111,3 @@ /**

*/
const inArray = function (val, list) {
return list.includes(val);
};
const inArray = (val, list) => list.includes(val);

@@ -147,7 +123,5 @@ /**

*/
const invalidParameterError = function (name, expected, actual) {
return new Error(
const invalidParameterError = (name, expected, actual) => new Error(
`Expected ${expected} for ${name} but received ${actual} of type ${typeof actual}`
);
};

@@ -162,3 +136,3 @@ /**

*/
const nativeError = function (native, context) {
const nativeError = (native, context) => {
context.message = native.message;

@@ -165,0 +139,0 @@ return context;

@@ -1,6 +0,6 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const { spawnSync } = require('node:child_process');

@@ -15,4 +15,4 @@ const { createHash } = require('node:crypto');

const minimumLibvipsVersionLabelled = process.env.npm_package_config_libvips || /* istanbul ignore next */
config.libvips;
/* node:coverage ignore next */
const minimumLibvipsVersionLabelled = process.env.npm_package_config_libvips || config.libvips;
const minimumLibvipsVersion = semverCoerce(minimumLibvipsVersionLabelled).version;

@@ -22,3 +22,3 @@

'darwin-arm64', 'darwin-x64',
'linux-arm', 'linux-arm64', 'linux-ppc64', 'linux-s390x', 'linux-x64',
'linux-arm', 'linux-arm64', 'linux-ppc64', 'linux-riscv64', 'linux-s390x', 'linux-x64',
'linuxmusl-arm64', 'linuxmusl-x64',

@@ -41,3 +41,3 @@ 'win32-arm64', 'win32-ia32', 'win32-x64'

/* istanbul ignore next */
/* node:coverage ignore next */
const runtimeLibc = () => detectLibc.isNonGlibcLinuxSync() ? detectLibc.familySync() : '';

@@ -47,8 +47,7 @@

/* istanbul ignore next */
const buildPlatformArch = () => {
/* node:coverage ignore next 3 */
if (isEmscripten()) {
return 'wasm32';
}
/* eslint camelcase: ["error", { allow: ["^npm_config_"] }] */
const { npm_config_arch, npm_config_platform, npm_config_libc } = process.env;

@@ -63,2 +62,3 @@ const libc = typeof npm_config_libc === 'string' ? npm_config_libc : runtimeLibc();

} catch {
/* node:coverage ignore next 5 */
try {

@@ -68,3 +68,2 @@ return require('@img/sharp-libvips-dev/include');

}
/* istanbul ignore next */
return '';

@@ -74,6 +73,6 @@ };

const buildSharpLibvipsCPlusPlusDir = () => {
/* node:coverage ignore next 4 */
try {
return require('@img/sharp-libvips-dev/cplusplus');
} catch {}
/* istanbul ignore next */
return '';

@@ -86,2 +85,3 @@ };

} catch {
/* node:coverage ignore next 5 */
try {

@@ -91,8 +91,8 @@ return require(`@img/sharp-libvips-${buildPlatformArch()}/lib`);

}
/* istanbul ignore next */
return '';
};
/* node:coverage disable */
const isUnsupportedNodeRuntime = () => {
/* istanbul ignore next */
if (process.release?.name === 'node' && process.versions) {

@@ -105,10 +105,8 @@ if (!semverSatisfies(process.versions.node, engines.node)) {

/* istanbul ignore next */
const isEmscripten = () => {
const { CC } = process.env;
return Boolean(CC && CC.endsWith('/emcc'));
return Boolean(CC?.endsWith('/emcc'));
};
const isRosetta = () => {
/* istanbul ignore next */
if (process.platform === 'darwin' && process.arch === 'x64') {

@@ -121,2 +119,4 @@ const translated = spawnSync('sysctl sysctl.proc_translated', spawnSyncOptions).stdout;

/* node:coverage enable */
const sha512 = (s) => createHash('sha512').update(s).digest('hex');

@@ -135,3 +135,4 @@

/* istanbul ignore next */
/* node:coverage disable */
const spawnRebuild = () =>

@@ -152,3 +153,2 @@ spawnSync(`node-gyp rebuild --directory=src ${isEmscripten() ? '--nodedir=emscripten' : ''}`, {

}).stdout;
/* istanbul ignore next */
return (globalLibvipsVersion || '').trim();

@@ -160,5 +160,7 @@ } else {

/* istanbul ignore next */
/* node:coverage enable */
const pkgConfigPath = () => {
if (process.platform !== 'win32') {
/* node:coverage ignore next 4 */
const brewPkgConfigPath = spawnSync(

@@ -195,3 +197,3 @@ 'which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',

}
/* istanbul ignore next */
/* node:coverage ignore next 3 */
if (isRosetta()) {

@@ -201,4 +203,4 @@ return skipSearch(false, 'Rosetta', logger);

const globalVipsVersion = globalLibvipsVersion();
return !!globalVipsVersion && /* istanbul ignore next */
semverGreaterThanOrEqualTo(globalVipsVersion, minimumLibvipsVersion);
/* node:coverage ignore next */
return !!globalVipsVersion && semverGreaterThanOrEqualTo(globalVipsVersion, minimumLibvipsVersion);
};

@@ -205,0 +207,0 @@

@@ -1,6 +0,6 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const is = require('./is');

@@ -242,3 +242,3 @@

*
* See {@link https://www.libvips.org/API/current/libvips-convolution.html#vips-sharpen|libvips sharpen} operation.
* See {@link https://www.libvips.org/API/current/method.Image.sharpen.html libvips sharpen} operation.
*

@@ -489,3 +489,3 @@ * @example

*
* See also {@link /api-channel#removealpha|removeAlpha}.
* See also {@link /api-channel#removealpha removeAlpha}.
*

@@ -665,3 +665,3 @@ * @example

* Perform contrast limiting adaptive histogram equalization
* {@link https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE|CLAHE}.
* {@link https://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE CLAHE}.
*

@@ -748,5 +748,3 @@ * This will, in general, enhance the clarity of the image by bringing out darker details.

if (!is.integer(kernel.scale)) {
kernel.scale = kernel.kernel.reduce(function (a, b) {
return a + b;
}, 0);
kernel.scale = kernel.kernel.reduce((a, b) => a + b, 0);
}

@@ -996,3 +994,3 @@ // Clip scale to a minimum value of 1

*/
module.exports = function (Sharp) {
module.exports = (Sharp) => {
Object.assign(Sharp.prototype, {

@@ -999,0 +997,0 @@ autoOrient,

@@ -1,6 +0,6 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const path = require('node:path');

@@ -46,3 +46,3 @@ const is = require('./is');

* By default all metadata will be removed, which includes EXIF-based orientation.
* See {@link #withmetadata|withMetadata} for control over this.
* See {@link #withmetadata withMetadata} for control over this.
*

@@ -101,3 +101,3 @@ * The caller is responsible for ensuring directory structures and permissions exist.

*
* Use {@link #toformat|toFormat} or one of the format-specific functions such as {@link jpeg}, {@link png} etc. to set the output format.
* 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.
*

@@ -107,3 +107,3 @@ * If no explicit format is set, the output format will match the input image, except SVG input which becomes PNG output.

* By default all metadata will be removed, which includes EXIF-based orientation.
* See {@link #withmetadata|withMetadata} for control over this.
* See {@link #withmetadata withMetadata} for control over this.
*

@@ -262,3 +262,3 @@ * `callback`, if present, gets three arguments `(err, data, info)` where:

*
* Where necessary, will attempt to convert the output colour space to match the profile.
* When input and output colour spaces differ, use with {@link /api-colour/#tocolourspace toColourspace} and optionally {@link /api-colour/#pipelinecolourspace pipelineColourspace}.
*

@@ -272,2 +272,9 @@ * @since 0.33.0

*
* @example
* const cmykOutputWithIccProfile = await sharp(cmykInputWithIccProfile)
* .pipelineColourspace('cmyk')
* .toColourspace('cmyk')
* .keepIccProfile()
* .toBuffer();
*
* @returns {Sharp}

@@ -573,3 +580,3 @@ */

* For 16 bits per pixel output, convert to `rgb16` via
* {@link /api-colour#tocolourspace|toColourspace}.
* {@link /api-colour/#tocolourspace toColourspace}.
*

@@ -854,3 +861,2 @@ * @example

/* istanbul ignore next */
/**

@@ -861,3 +867,3 @@ * Use these JP2 options for output image.

* The prebuilt binaries do not include this - see
* {@link https://sharp.pixelplumbing.com/install#custom-libvips installing a custom libvips}.
* {@link /install#custom-libvips installing a custom libvips}.
*

@@ -891,2 +897,3 @@ * @example

function jp2 (options) {
/* node:coverage ignore next 41 */
if (!this.constructor.format.jp2k.output.buffer) {

@@ -971,3 +978,3 @@ throw errJp2Save();

*
* The `density` can be set in pixels/inch via {@link #withmetadata|withMetadata}
* The `density` can be set in pixels/inch via {@link #withmetadata withMetadata}
* instead of providing `xres` and `yres` in pixels/mm.

@@ -989,2 +996,3 @@ *

* @param {string} [options.compression='jpeg'] - compression options: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k
* @param {boolean} [options.bigtiff=false] - use BigTIFF variant (has no effect when compression is none)
* @param {string} [options.predictor='horizontal'] - compression predictor options: none, horizontal, float

@@ -1068,2 +1076,6 @@ * @param {boolean} [options.pyramid=false] - write an image pyramid

}
// bigtiff
if (is.defined(options.bigtiff)) {
this._setBooleanOption('tiffBigtiff', options.bigtiff);
}
// predictor

@@ -1204,3 +1216,3 @@ if (is.defined(options.predictor)) {

* The prebuilt binaries do not include this - see
* {@link https://sharp.pixelplumbing.com/install#custom-libvips installing a custom libvips}.
* {@link /install/#custom-libvips installing a custom libvips}.
*

@@ -1518,3 +1530,2 @@ * @since 0.31.3

function _read () {
/* istanbul ignore else */
if (!this.options.streamOut) {

@@ -1636,3 +1647,3 @@ this.options.streamOut = true;

*/
module.exports = function (Sharp) {
module.exports = (Sharp) => {
Object.assign(Sharp.prototype, {

@@ -1639,0 +1650,0 @@ // Public

@@ -1,6 +0,6 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const is = require('./is');

@@ -582,3 +582,3 @@

*/
module.exports = function (Sharp) {
module.exports = (Sharp) => {
Object.assign(Sharp.prototype, {

@@ -585,0 +585,0 @@ resize,

@@ -1,6 +0,6 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
// Inspects the runtime environment and exports the relevant sharp.node binary

@@ -20,2 +20,4 @@

/* node:coverage disable */
let path, sharp;

@@ -28,3 +30,2 @@ const errors = [];

} catch (err) {
/* istanbul ignore next */
errors.push(err);

@@ -34,3 +35,2 @@ }

/* istanbul ignore next */
if (sharp && path.startsWith('@img/sharp-linux-x64') && !sharp._isUsingX64V2()) {

@@ -43,3 +43,2 @@ const err = new Error('Prebuilt binaries for linux-x64 require v2 microarchitecture');

/* istanbul ignore next */
if (sharp) {

@@ -95,3 +94,3 @@ module.exports = sharp;

);
} catch (errEngines) {}
} catch (_errEngines) {}
}

@@ -98,0 +97,0 @@ if (isLinux && /\/snap\/core[0-9]{2}/.test(messages)) {

@@ -1,6 +0,6 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const events = require('node:events');

@@ -60,3 +60,3 @@ const detectLibc = require('detect-libc');

};
/* istanbul ignore next */
/* node:coverage ignore next 15 */
if (!libvipsVersion.isGlobal) {

@@ -79,3 +79,3 @@ if (!libvipsVersion.isWasm) {

/* istanbul ignore next */
/* node:coverage ignore next 5 */
if (versions.heif && format.heif) {

@@ -141,3 +141,3 @@ // Prebuilt binaries provide AV1

* :::note
* Further {@link /performance|control over performance} is available.
* Further {@link /performance/ control over performance} is available.
* :::

@@ -156,3 +156,3 @@ *

}
/* istanbul ignore next */
/* node:coverage ignore next 7 */
if (detectLibc.familySync() === detectLibc.GLIBC && !sharp._isUsingJemalloc()) {

@@ -284,3 +284,3 @@ // Reduce default concurrency to 1 when using glibc memory allocator

*/
module.exports = function (Sharp) {
module.exports = (Sharp) => {
Sharp.cache = cache;

@@ -287,0 +287,0 @@ Sharp.concurrency = concurrency;

{
"name": "sharp",
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",
"version": "0.34.4",
"version": "0.34.5-rc.0",
"author": "Lovell Fuller <npm@lovell.info>",

@@ -95,10 +95,12 @@ "homepage": "https://sharp.pixelplumbing.com",

"scripts": {
"install": "node install/check.js",
"build": "node install/build.js",
"install": "node install/check.js || npm run build",
"clean": "rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",
"test": "npm run test-lint && npm run test-unit && npm run test-licensing && npm run test-types",
"test-lint": "semistandard && cpplint",
"test-unit": "nyc --reporter=lcov --reporter=text --check-coverage --branches=100 mocha",
"test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;LGPL-3.0-or-later;MIT\"",
"test": "npm run lint && npm run test-unit",
"lint": "npm run lint-cpp && npm run lint-js && npm run lint-types",
"lint-cpp": "cpplint --quiet src/*.h src/*.cc",
"lint-js": "biome lint",
"lint-types": "tsd --files ./test/types/sharp.test-d.ts",
"test-leak": "./test/leak/leak.sh",
"test-types": "tsd",
"test-unit": "node --experimental-test-coverage test/unit.mjs",
"package-from-local-build": "node npm/from-local-build.js",

@@ -142,49 +144,48 @@ "package-release-notes": "node npm/release-notes.js",

"@img/colour": "^1.0.0",
"detect-libc": "^2.1.0",
"semver": "^7.7.2"
"detect-libc": "^2.1.2",
"semver": "^7.7.3"
},
"optionalDependencies": {
"@img/sharp-darwin-arm64": "0.34.4",
"@img/sharp-darwin-x64": "0.34.4",
"@img/sharp-libvips-darwin-arm64": "1.2.3",
"@img/sharp-libvips-darwin-x64": "1.2.3",
"@img/sharp-libvips-linux-arm": "1.2.3",
"@img/sharp-libvips-linux-arm64": "1.2.3",
"@img/sharp-libvips-linux-ppc64": "1.2.3",
"@img/sharp-libvips-linux-s390x": "1.2.3",
"@img/sharp-libvips-linux-x64": "1.2.3",
"@img/sharp-libvips-linuxmusl-arm64": "1.2.3",
"@img/sharp-libvips-linuxmusl-x64": "1.2.3",
"@img/sharp-linux-arm": "0.34.4",
"@img/sharp-linux-arm64": "0.34.4",
"@img/sharp-linux-ppc64": "0.34.4",
"@img/sharp-linux-s390x": "0.34.4",
"@img/sharp-linux-x64": "0.34.4",
"@img/sharp-linuxmusl-arm64": "0.34.4",
"@img/sharp-linuxmusl-x64": "0.34.4",
"@img/sharp-wasm32": "0.34.4",
"@img/sharp-win32-arm64": "0.34.4",
"@img/sharp-win32-ia32": "0.34.4",
"@img/sharp-win32-x64": "0.34.4"
"@img/sharp-darwin-arm64": "0.34.5-rc.0",
"@img/sharp-darwin-x64": "0.34.5-rc.0",
"@img/sharp-libvips-darwin-arm64": "1.2.4",
"@img/sharp-libvips-darwin-x64": "1.2.4",
"@img/sharp-libvips-linux-arm": "1.2.4",
"@img/sharp-libvips-linux-arm64": "1.2.4",
"@img/sharp-libvips-linux-ppc64": "1.2.4",
"@img/sharp-libvips-linux-riscv64": "1.2.4",
"@img/sharp-libvips-linux-s390x": "1.2.4",
"@img/sharp-libvips-linux-x64": "1.2.4",
"@img/sharp-libvips-linuxmusl-arm64": "1.2.4",
"@img/sharp-libvips-linuxmusl-x64": "1.2.4",
"@img/sharp-linux-arm": "0.34.5-rc.0",
"@img/sharp-linux-arm64": "0.34.5-rc.0",
"@img/sharp-linux-ppc64": "0.34.5-rc.0",
"@img/sharp-linux-riscv64": "0.34.5-rc.0",
"@img/sharp-linux-s390x": "0.34.5-rc.0",
"@img/sharp-linux-x64": "0.34.5-rc.0",
"@img/sharp-linuxmusl-arm64": "0.34.5-rc.0",
"@img/sharp-linuxmusl-x64": "0.34.5-rc.0",
"@img/sharp-wasm32": "0.34.5-rc.0",
"@img/sharp-win32-arm64": "0.34.5-rc.0",
"@img/sharp-win32-ia32": "0.34.5-rc.0",
"@img/sharp-win32-x64": "0.34.5-rc.0"
},
"devDependencies": {
"@emnapi/runtime": "^1.5.0",
"@img/sharp-libvips-dev": "1.2.3",
"@img/sharp-libvips-dev-wasm32": "1.2.3",
"@img/sharp-libvips-win32-arm64": "1.2.3",
"@img/sharp-libvips-win32-ia32": "1.2.3",
"@img/sharp-libvips-win32-x64": "1.2.3",
"@biomejs/biome": "^2.3.4",
"@cpplint/cli": "^0.1.0",
"@emnapi/runtime": "^1.7.0",
"@img/sharp-libvips-dev": "1.2.4",
"@img/sharp-libvips-dev-wasm32": "1.2.4",
"@img/sharp-libvips-win32-arm64": "1.2.4",
"@img/sharp-libvips-win32-ia32": "1.2.4",
"@img/sharp-libvips-win32-x64": "1.2.4",
"@types/node": "*",
"cc": "^3.0.1",
"emnapi": "^1.5.0",
"emnapi": "^1.7.0",
"exif-reader": "^2.0.2",
"extract-zip": "^2.0.1",
"icc": "^3.0.0",
"jsdoc-to-markdown": "^9.1.2",
"license-checker": "^25.0.1",
"mocha": "^11.7.2",
"jsdoc-to-markdown": "^9.1.3",
"node-addon-api": "^8.5.0",
"node-gyp": "^11.4.2",
"nyc": "^17.1.0",
"semistandard": "^17.0.0",
"node-gyp": "^11.5.0",
"tar-fs": "^3.1.1",

@@ -198,3 +199,3 @@ "tsd": "^0.33.0"

"config": {
"libvips": ">=8.17.2"
"libvips": ">=8.17.3"
},

@@ -204,7 +205,2 @@ "funding": {

},
"semistandard": {
"env": [
"mocha"
]
},
"cc": {

@@ -215,11 +211,3 @@ "linelength": "120",

]
},
"nyc": {
"include": [
"lib"
]
},
"tsd": {
"directory": "test/types/"
}
}

@@ -1,11 +0,15 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
#include <algorithm>
#include <cstdlib>
#include <map>
#include <mutex>
#include <queue>
#include <string>
#include <string.h>
#include <tuple>
#include <utility>
#include <vector>
#include <queue>
#include <map>
#include <mutex> // NOLINT(build/c++11)

@@ -15,3 +19,3 @@ #include <napi.h>

#include "common.h"
#include "./common.h"

@@ -18,0 +22,0 @@ using vips::VImage;

@@ -1,3 +0,5 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/

@@ -7,6 +9,7 @@ #ifndef SRC_COMMON_H_

#include <atomic>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <atomic>

@@ -20,4 +23,4 @@ #include <napi.h>

(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 17) || \
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 17 && VIPS_MICRO_VERSION < 2)
#error "libvips version 8.17.2+ is required - please see https://sharp.pixelplumbing.com/install"
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 17 && VIPS_MICRO_VERSION < 3)
#error "libvips version 8.17.3+ is required - please see https://sharp.pixelplumbing.com/install"
#endif

@@ -35,3 +38,3 @@

struct InputDescriptor { // NOLINT(runtime/indentation_namespace)
struct InputDescriptor {
std::string name;

@@ -38,0 +41,0 @@ std::string file;

@@ -1,7 +0,11 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
#include <cmath>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#include <cmath>

@@ -11,4 +15,4 @@ #include <napi.h>

#include "common.h"
#include "metadata.h"
#include "./common.h"
#include "./metadata.h"

@@ -219,6 +223,6 @@ static void* readPNGComment(VipsImage *image, const char *field, GValue *value, void *p);

Napi::Array levels = Napi::Array::New(env, static_cast<size_t>(baton->levels.size()));
for (std::pair<int, int> const &l : baton->levels) {
for (const auto& [width, height] : baton->levels) {
Napi::Object level = Napi::Object::New(env);
level.Set("width", l.first);
level.Set("height", l.second);
level.Set("width", width);
level.Set("height", height);
levels.Set(i++, level);

@@ -280,6 +284,6 @@ }

Napi::Array comments = Napi::Array::New(env, baton->comments.size());
for (auto &c : baton->comments) {
for (const auto& [keyword, text] : baton->comments) {
Napi::Object comment = Napi::Object::New(env);
comment.Set("keyword", c.first);
comment.Set("text", c.second);
comment.Set("keyword", keyword);
comment.Set("text", text);
comments.Set(i++, comment);

@@ -286,0 +290,0 @@ }

@@ -1,3 +0,5 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/

@@ -8,2 +10,3 @@ #ifndef SRC_METADATA_H_

#include <string>
#include <vector>
#include <napi.h>

@@ -10,0 +13,0 @@

@@ -1,3 +0,5 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/

@@ -11,4 +13,4 @@ #include <algorithm>

#include "common.h"
#include "operations.h"
#include "./common.h"
#include "./operations.h"

@@ -15,0 +17,0 @@ using vips::VImage;

@@ -1,3 +0,5 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/

@@ -11,2 +13,3 @@ #ifndef SRC_OPERATIONS_H_

#include <tuple>
#include <vector>
#include <vips/vips8>

@@ -13,0 +16,0 @@

@@ -1,3 +0,5 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/

@@ -9,4 +11,4 @@ #ifndef SRC_PIPELINE_H_

#include <string>
#include <unordered_map>
#include <vector>
#include <unordered_map>

@@ -179,2 +181,3 @@ #include <napi.h>

VipsForeignTiffCompression tiffCompression;
bool tiffBigtiff;
VipsForeignTiffPredictor tiffPredictor;

@@ -202,2 +205,3 @@ bool tiffPyramid;

std::string err;
bool errUseWarning;
int keepMetadata;

@@ -356,2 +360,3 @@ int withMetadataOrientation;

tiffCompression(VIPS_FOREIGN_TIFF_COMPRESSION_JPEG),
tiffBigtiff(false),
tiffPredictor(VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL),

@@ -378,2 +383,3 @@ tiffPyramid(false),

rawDepth(VIPS_FORMAT_UCHAR),
errUseWarning(false),
keepMetadata(0),

@@ -380,0 +386,0 @@ withMetadataOrientation(-1),

@@ -1,5 +0,7 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
#include <mutex> // NOLINT(build/c++11)
#include <mutex>

@@ -9,7 +11,7 @@ #include <napi.h>

#include "common.h"
#include "metadata.h"
#include "pipeline.h"
#include "utilities.h"
#include "stats.h"
#include "./common.h"
#include "./metadata.h"
#include "./pipeline.h"
#include "./stats.h"
#include "./utilities.h"

@@ -16,0 +18,0 @@ Napi::Object init(Napi::Env env, Napi::Object exports) {

@@ -1,7 +0,10 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <iostream>

@@ -11,4 +14,4 @@ #include <napi.h>

#include "common.h"
#include "stats.h"
#include "./common.h"
#include "./stats.h"

@@ -15,0 +18,0 @@ class StatsWorker : public Napi::AsyncWorker {

@@ -1,3 +0,5 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/

@@ -8,2 +10,3 @@ #ifndef SRC_STATS_H_

#include <string>
#include <vector>
#include <napi.h>

@@ -28,3 +31,3 @@

double meanVal, double stdevVal, int minXVal, int minYVal, int maxXVal, int maxYVal):
min(minVal), max(maxVal), sum(sumVal), squaresSum(squaresSumVal),
min(minVal), max(maxVal), sum(sumVal), squaresSum(squaresSumVal), // NOLINT(build/include_what_you_use)
mean(meanVal), stdev(stdevVal), minX(minXVal), minY(minYVal), maxX(maxXVal), maxY(maxYVal) {}

@@ -31,0 +34,0 @@ };

@@ -1,7 +0,9 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/
#include <cmath>
#include <cstdio>
#include <string>
#include <cstdio>

@@ -12,5 +14,5 @@ #include <napi.h>

#include "common.h"
#include "operations.h"
#include "utilities.h"
#include "./common.h"
#include "./operations.h"
#include "./utilities.h"

@@ -17,0 +19,0 @@ /*

@@ -1,3 +0,5 @@

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
/*!
Copyright 2013 Lovell Fuller and others.
SPDX-License-Identifier: Apache-2.0
*/

@@ -4,0 +6,0 @@ #ifndef SRC_UTILITIES_H_

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display