@revizly/sharp 0.35.0-revizly41 → 0.35.0-revizly43
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/dist/composite.cjs +6 -6
- package/dist/composite.mjs +6 -6
- package/dist/index.d.cts +7 -5
- package/dist/index.d.mts +7 -5
- package/dist/output.cjs +8 -12
- package/dist/output.mjs +8 -12
- package/lib/index.d.ts +7 -5
- package/package.json +14 -9
- package/src/common.h +2 -2
package/dist/composite.cjs
CHANGED
|
@@ -113,8 +113,8 @@ const blend = {
|
|
|
113
113
|
* @param {Boolean} [images[].autoOrient=false] - set to true to use EXIF orientation data, if present, to orient the image.
|
|
114
114
|
* @param {String} [images[].blend='over'] - how to blend this image with the image below.
|
|
115
115
|
* @param {String} [images[].gravity='centre'] - gravity at which to place the overlay.
|
|
116
|
-
* @param {Number} [images[].top] - the pixel offset from the top edge.
|
|
117
|
-
* @param {Number} [images[].left] - the pixel offset from the left edge.
|
|
116
|
+
* @param {Number} [images[].top] - the pixel offset from the top edge, an integer between -100000000 and 100000000.
|
|
117
|
+
* @param {Number} [images[].left] - the pixel offset from the left edge, an integer between -100000000 and 100000000.
|
|
118
118
|
* @param {Boolean} [images[].tile=false] - set to true to repeat the overlay image across the entire image with the given `gravity`.
|
|
119
119
|
* @param {Boolean} [images[].premultiplied=false] - set to true to avoid premultiplying the image below. Equivalent to the `--premultiplied` vips option.
|
|
120
120
|
* @param {Number} [images[].density=72] - number representing the DPI for vector overlay image.
|
|
@@ -163,17 +163,17 @@ function composite (images) {
|
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
if (is.defined(image.left)) {
|
|
166
|
-
if (is.integer(image.left)) {
|
|
166
|
+
if (is.integer(image.left) && is.inRange(image.left, -100000000, 100000000)) {
|
|
167
167
|
composite.left = image.left;
|
|
168
168
|
} else {
|
|
169
|
-
throw is.invalidParameterError('left', 'integer', image.left);
|
|
169
|
+
throw is.invalidParameterError('left', 'integer between -100000000 and 100000000', image.left);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
if (is.defined(image.top)) {
|
|
173
|
-
if (is.integer(image.top)) {
|
|
173
|
+
if (is.integer(image.top) && is.inRange(image.top, -100000000, 100000000)) {
|
|
174
174
|
composite.top = image.top;
|
|
175
175
|
} else {
|
|
176
|
-
throw is.invalidParameterError('top', 'integer', image.top);
|
|
176
|
+
throw is.invalidParameterError('top', 'integer between -100000000 and 100000000', image.top);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
if (is.defined(image.top) !== is.defined(image.left)) {
|
package/dist/composite.mjs
CHANGED
|
@@ -113,8 +113,8 @@ const blend = {
|
|
|
113
113
|
* @param {Boolean} [images[].autoOrient=false] - set to true to use EXIF orientation data, if present, to orient the image.
|
|
114
114
|
* @param {String} [images[].blend='over'] - how to blend this image with the image below.
|
|
115
115
|
* @param {String} [images[].gravity='centre'] - gravity at which to place the overlay.
|
|
116
|
-
* @param {Number} [images[].top] - the pixel offset from the top edge.
|
|
117
|
-
* @param {Number} [images[].left] - the pixel offset from the left edge.
|
|
116
|
+
* @param {Number} [images[].top] - the pixel offset from the top edge, an integer between -100000000 and 100000000.
|
|
117
|
+
* @param {Number} [images[].left] - the pixel offset from the left edge, an integer between -100000000 and 100000000.
|
|
118
118
|
* @param {Boolean} [images[].tile=false] - set to true to repeat the overlay image across the entire image with the given `gravity`.
|
|
119
119
|
* @param {Boolean} [images[].premultiplied=false] - set to true to avoid premultiplying the image below. Equivalent to the `--premultiplied` vips option.
|
|
120
120
|
* @param {Number} [images[].density=72] - number representing the DPI for vector overlay image.
|
|
@@ -163,17 +163,17 @@ function composite (images) {
|
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
if (is.defined(image.left)) {
|
|
166
|
-
if (is.integer(image.left)) {
|
|
166
|
+
if (is.integer(image.left) && is.inRange(image.left, -100000000, 100000000)) {
|
|
167
167
|
composite.left = image.left;
|
|
168
168
|
} else {
|
|
169
|
-
throw is.invalidParameterError('left', 'integer', image.left);
|
|
169
|
+
throw is.invalidParameterError('left', 'integer between -100000000 and 100000000', image.left);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
if (is.defined(image.top)) {
|
|
173
|
-
if (is.integer(image.top)) {
|
|
173
|
+
if (is.integer(image.top) && is.inRange(image.top, -100000000, 100000000)) {
|
|
174
174
|
composite.top = image.top;
|
|
175
175
|
} else {
|
|
176
|
-
throw is.invalidParameterError('top', 'integer', image.top);
|
|
176
|
+
throw is.invalidParameterError('top', 'integer between -100000000 and 100000000', image.top);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
if (is.defined(image.top) !== is.defined(image.left)) {
|
package/dist/index.d.cts
CHANGED
|
@@ -658,25 +658,27 @@ declare namespace sharp {
|
|
|
658
658
|
* @param callback Callback function called on completion with three arguments (err, buffer, info).
|
|
659
659
|
* @returns A sharp instance that can be used to chain operations
|
|
660
660
|
*/
|
|
661
|
-
toBuffer(callback: (err: Error, buffer: Buffer
|
|
661
|
+
toBuffer(callback: (err: Error, buffer: Buffer<ArrayBuffer>, info: OutputInfo) => void): Sharp;
|
|
662
662
|
|
|
663
663
|
/**
|
|
664
664
|
* Write output to a Buffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported.
|
|
665
665
|
* By default, the format will match the input image, except SVG input which becomes PNG output.
|
|
666
|
+
* The underlying `ArrayBuffer` may be marked as non-transferable by some JavaScript runtimes.
|
|
666
667
|
* @param options resolve options
|
|
667
668
|
* @param options.resolveWithObject Resolve the Promise with an Object containing data and info properties instead of resolving only with data.
|
|
668
669
|
* @returns A promise that resolves with the Buffer data.
|
|
669
670
|
*/
|
|
670
|
-
toBuffer(options?: { resolveWithObject: false }): Promise<Buffer
|
|
671
|
+
toBuffer(options?: { resolveWithObject: false }): Promise<Buffer<ArrayBuffer>>;
|
|
671
672
|
|
|
672
673
|
/**
|
|
673
674
|
* Write output to a Buffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported.
|
|
674
675
|
* By default, the format will match the input image, except SVG input which becomes PNG output.
|
|
676
|
+
* The underlying `ArrayBuffer` may be marked as non-transferable by some JavaScript runtimes.
|
|
675
677
|
* @param options resolve options
|
|
676
678
|
* @param options.resolveWithObject Resolve the Promise with an Object containing data and info properties instead of resolving only with data.
|
|
677
679
|
* @returns A promise that resolves with an object containing the Buffer data and an info object containing the output image format, size (bytes), width, height and channels
|
|
678
680
|
*/
|
|
679
|
-
toBuffer(options: { resolveWithObject: true }): Promise<{ data: Buffer
|
|
681
|
+
toBuffer(options: { resolveWithObject: true }): Promise<{ data: Buffer<ArrayBuffer>; info: OutputInfo }>;
|
|
680
682
|
|
|
681
683
|
/**
|
|
682
684
|
* Write output to a Uint8Array backed by a transferable ArrayBuffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported.
|
|
@@ -1695,9 +1697,9 @@ declare namespace sharp {
|
|
|
1695
1697
|
blend?: Blend | undefined;
|
|
1696
1698
|
/** gravity at which to place the overlay. (optional, default 'centre') */
|
|
1697
1699
|
gravity?: Gravity | undefined;
|
|
1698
|
-
/** the pixel offset from the top edge. */
|
|
1700
|
+
/** the pixel offset from the top edge, an integer between -100000000 and 100000000. */
|
|
1699
1701
|
top?: number | undefined;
|
|
1700
|
-
/** the pixel offset from the left edge. */
|
|
1702
|
+
/** the pixel offset from the left edge, an integer between -100000000 and 100000000. */
|
|
1701
1703
|
left?: number | undefined;
|
|
1702
1704
|
/** set to true to repeat the overlay image across the entire image with the given gravity. (optional, default false) */
|
|
1703
1705
|
tile?: boolean | undefined;
|
package/dist/index.d.mts
CHANGED
|
@@ -652,25 +652,27 @@ export interface Sharp extends Duplex {
|
|
|
652
652
|
* @param callback Callback function called on completion with three arguments (err, buffer, info).
|
|
653
653
|
* @returns A sharp instance that can be used to chain operations
|
|
654
654
|
*/
|
|
655
|
-
toBuffer(callback: (err: Error, buffer: Buffer
|
|
655
|
+
toBuffer(callback: (err: Error, buffer: Buffer<ArrayBuffer>, info: OutputInfo) => void): Sharp;
|
|
656
656
|
|
|
657
657
|
/**
|
|
658
658
|
* Write output to a Buffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported.
|
|
659
659
|
* By default, the format will match the input image, except SVG input which becomes PNG output.
|
|
660
|
+
* The underlying `ArrayBuffer` may be marked as non-transferable by some JavaScript runtimes.
|
|
660
661
|
* @param options resolve options
|
|
661
662
|
* @param options.resolveWithObject Resolve the Promise with an Object containing data and info properties instead of resolving only with data.
|
|
662
663
|
* @returns A promise that resolves with the Buffer data.
|
|
663
664
|
*/
|
|
664
|
-
toBuffer(options?: { resolveWithObject: false }): Promise<Buffer
|
|
665
|
+
toBuffer(options?: { resolveWithObject: false }): Promise<Buffer<ArrayBuffer>>;
|
|
665
666
|
|
|
666
667
|
/**
|
|
667
668
|
* Write output to a Buffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported.
|
|
668
669
|
* By default, the format will match the input image, except SVG input which becomes PNG output.
|
|
670
|
+
* The underlying `ArrayBuffer` may be marked as non-transferable by some JavaScript runtimes.
|
|
669
671
|
* @param options resolve options
|
|
670
672
|
* @param options.resolveWithObject Resolve the Promise with an Object containing data and info properties instead of resolving only with data.
|
|
671
673
|
* @returns A promise that resolves with an object containing the Buffer data and an info object containing the output image format, size (bytes), width, height and channels
|
|
672
674
|
*/
|
|
673
|
-
toBuffer(options: { resolveWithObject: true }): Promise<{ data: Buffer
|
|
675
|
+
toBuffer(options: { resolveWithObject: true }): Promise<{ data: Buffer<ArrayBuffer>; info: OutputInfo }>;
|
|
674
676
|
|
|
675
677
|
/**
|
|
676
678
|
* Write output to a Uint8Array backed by a transferable ArrayBuffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported.
|
|
@@ -1689,9 +1691,9 @@ export interface OverlayOptions extends SharpOptions {
|
|
|
1689
1691
|
blend?: Blend | undefined;
|
|
1690
1692
|
/** gravity at which to place the overlay. (optional, default 'centre') */
|
|
1691
1693
|
gravity?: Gravity | undefined;
|
|
1692
|
-
/** the pixel offset from the top edge. */
|
|
1694
|
+
/** the pixel offset from the top edge, an integer between -100000000 and 100000000. */
|
|
1693
1695
|
top?: number | undefined;
|
|
1694
|
-
/** the pixel offset from the left edge. */
|
|
1696
|
+
/** the pixel offset from the left edge, an integer between -100000000 and 100000000. */
|
|
1695
1697
|
left?: number | undefined;
|
|
1696
1698
|
/** set to true to repeat the overlay image across the entire image with the given gravity. (optional, default false) */
|
|
1697
1699
|
tile?: boolean | undefined;
|
package/dist/output.cjs
CHANGED
|
@@ -113,24 +113,20 @@ function toFile (fileOut, callback) {
|
|
|
113
113
|
* Animated output will also contain `pageHeight` and `pages`.
|
|
114
114
|
* May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text.
|
|
115
115
|
*
|
|
116
|
-
*
|
|
116
|
+
* The underlying `ArrayBuffer` may be marked as non-transferable by some JavaScript runtimes.
|
|
117
|
+
* Use {@link #touint8array toUint8Array} for a guaranteed transferable `ArrayBuffer`.
|
|
117
118
|
*
|
|
118
|
-
*
|
|
119
|
-
* sharp(input)
|
|
120
|
-
* .toBuffer((err, data, info) => { ... });
|
|
119
|
+
* A `Promise` is returned when `callback` is not provided.
|
|
121
120
|
*
|
|
122
121
|
* @example
|
|
123
|
-
* sharp(input)
|
|
124
|
-
* .
|
|
125
|
-
* .
|
|
126
|
-
* .catch(err => { ... });
|
|
122
|
+
* const data = await sharp(input)
|
|
123
|
+
* .png()
|
|
124
|
+
* .toBuffer();
|
|
127
125
|
*
|
|
128
126
|
* @example
|
|
129
|
-
* sharp(input)
|
|
127
|
+
* const { data, info } = await sharp(input)
|
|
130
128
|
* .png()
|
|
131
|
-
* .toBuffer({ resolveWithObject: true })
|
|
132
|
-
* .then(({ data, info }) => { ... })
|
|
133
|
-
* .catch(err => { ... });
|
|
129
|
+
* .toBuffer({ resolveWithObject: true });
|
|
134
130
|
*
|
|
135
131
|
* @example
|
|
136
132
|
* const { data, info } = await sharp('my-image.jpg')
|
package/dist/output.mjs
CHANGED
|
@@ -113,24 +113,20 @@ function toFile (fileOut, callback) {
|
|
|
113
113
|
* Animated output will also contain `pageHeight` and `pages`.
|
|
114
114
|
* May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text.
|
|
115
115
|
*
|
|
116
|
-
*
|
|
116
|
+
* The underlying `ArrayBuffer` may be marked as non-transferable by some JavaScript runtimes.
|
|
117
|
+
* Use {@link #touint8array toUint8Array} for a guaranteed transferable `ArrayBuffer`.
|
|
117
118
|
*
|
|
118
|
-
*
|
|
119
|
-
* sharp(input)
|
|
120
|
-
* .toBuffer((err, data, info) => { ... });
|
|
119
|
+
* A `Promise` is returned when `callback` is not provided.
|
|
121
120
|
*
|
|
122
121
|
* @example
|
|
123
|
-
* sharp(input)
|
|
124
|
-
* .
|
|
125
|
-
* .
|
|
126
|
-
* .catch(err => { ... });
|
|
122
|
+
* const data = await sharp(input)
|
|
123
|
+
* .png()
|
|
124
|
+
* .toBuffer();
|
|
127
125
|
*
|
|
128
126
|
* @example
|
|
129
|
-
* sharp(input)
|
|
127
|
+
* const { data, info } = await sharp(input)
|
|
130
128
|
* .png()
|
|
131
|
-
* .toBuffer({ resolveWithObject: true })
|
|
132
|
-
* .then(({ data, info }) => { ... })
|
|
133
|
-
* .catch(err => { ... });
|
|
129
|
+
* .toBuffer({ resolveWithObject: true });
|
|
134
130
|
*
|
|
135
131
|
* @example
|
|
136
132
|
* const { data, info } = await sharp('my-image.jpg')
|
package/lib/index.d.ts
CHANGED
|
@@ -658,25 +658,27 @@ declare namespace sharp {
|
|
|
658
658
|
* @param callback Callback function called on completion with three arguments (err, buffer, info).
|
|
659
659
|
* @returns A sharp instance that can be used to chain operations
|
|
660
660
|
*/
|
|
661
|
-
toBuffer(callback: (err: Error, buffer: Buffer
|
|
661
|
+
toBuffer(callback: (err: Error, buffer: Buffer<ArrayBuffer>, info: OutputInfo) => void): Sharp;
|
|
662
662
|
|
|
663
663
|
/**
|
|
664
664
|
* Write output to a Buffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported.
|
|
665
665
|
* By default, the format will match the input image, except SVG input which becomes PNG output.
|
|
666
|
+
* The underlying `ArrayBuffer` may be marked as non-transferable by some JavaScript runtimes.
|
|
666
667
|
* @param options resolve options
|
|
667
668
|
* @param options.resolveWithObject Resolve the Promise with an Object containing data and info properties instead of resolving only with data.
|
|
668
669
|
* @returns A promise that resolves with the Buffer data.
|
|
669
670
|
*/
|
|
670
|
-
toBuffer(options?: { resolveWithObject: false }): Promise<Buffer
|
|
671
|
+
toBuffer(options?: { resolveWithObject: false }): Promise<Buffer<ArrayBuffer>>;
|
|
671
672
|
|
|
672
673
|
/**
|
|
673
674
|
* Write output to a Buffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported.
|
|
674
675
|
* By default, the format will match the input image, except SVG input which becomes PNG output.
|
|
676
|
+
* The underlying `ArrayBuffer` may be marked as non-transferable by some JavaScript runtimes.
|
|
675
677
|
* @param options resolve options
|
|
676
678
|
* @param options.resolveWithObject Resolve the Promise with an Object containing data and info properties instead of resolving only with data.
|
|
677
679
|
* @returns A promise that resolves with an object containing the Buffer data and an info object containing the output image format, size (bytes), width, height and channels
|
|
678
680
|
*/
|
|
679
|
-
toBuffer(options: { resolveWithObject: true }): Promise<{ data: Buffer
|
|
681
|
+
toBuffer(options: { resolveWithObject: true }): Promise<{ data: Buffer<ArrayBuffer>; info: OutputInfo }>;
|
|
680
682
|
|
|
681
683
|
/**
|
|
682
684
|
* Write output to a Uint8Array backed by a transferable ArrayBuffer. JPEG, PNG, WebP, AVIF, TIFF, GIF and RAW output are supported.
|
|
@@ -1695,9 +1697,9 @@ declare namespace sharp {
|
|
|
1695
1697
|
blend?: Blend | undefined;
|
|
1696
1698
|
/** gravity at which to place the overlay. (optional, default 'centre') */
|
|
1697
1699
|
gravity?: Gravity | undefined;
|
|
1698
|
-
/** the pixel offset from the top edge. */
|
|
1700
|
+
/** the pixel offset from the top edge, an integer between -100000000 and 100000000. */
|
|
1699
1701
|
top?: number | undefined;
|
|
1700
|
-
/** the pixel offset from the left edge. */
|
|
1702
|
+
/** the pixel offset from the left edge, an integer between -100000000 and 100000000. */
|
|
1701
1703
|
left?: number | undefined;
|
|
1702
1704
|
/** set to true to repeat the overlay image across the entire image with the given gravity. (optional, default false) */
|
|
1703
1705
|
tile?: boolean | undefined;
|
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.35.0-
|
|
4
|
+
"version": "0.35.0-revizly43",
|
|
5
5
|
"author": "Lovell Fuller <npm@lovell.info>",
|
|
6
6
|
"homepage": "https://sharp.pixelplumbing.com",
|
|
7
7
|
"contributors": [
|
|
@@ -163,25 +163,30 @@
|
|
|
163
163
|
"semver": "^7.8.5"
|
|
164
164
|
},
|
|
165
165
|
"optionalDependencies": {
|
|
166
|
-
"@revizly/sharp-libvips-linux-arm64": "1.0.
|
|
167
|
-
"@revizly/sharp-libvips-linux-x64": "1.0.
|
|
168
|
-
"@revizly/sharp-linux-arm64": "0.35.0-
|
|
169
|
-
"@revizly/sharp-linux-x64": "0.35.0-
|
|
166
|
+
"@revizly/sharp-libvips-linux-arm64": "1.0.44",
|
|
167
|
+
"@revizly/sharp-libvips-linux-x64": "1.0.44",
|
|
168
|
+
"@revizly/sharp-linux-arm64": "0.35.0-revizly43",
|
|
169
|
+
"@revizly/sharp-linux-x64": "0.35.0-revizly43"
|
|
170
|
+
},
|
|
171
|
+
"peerDependenciesMeta": {
|
|
172
|
+
"@types/node": {
|
|
173
|
+
"optional": true
|
|
174
|
+
}
|
|
170
175
|
},
|
|
171
176
|
"devDependencies": {
|
|
172
177
|
"@biomejs/biome": "^2.5.1",
|
|
173
178
|
"@cpplint/cli": "^0.1.0",
|
|
174
179
|
"@emnapi/runtime": "^1.11.1",
|
|
175
|
-
"@revizly/sharp-libvips-dev": "1.0.
|
|
180
|
+
"@revizly/sharp-libvips-dev": "1.0.44",
|
|
176
181
|
"@types/node": "*",
|
|
177
182
|
"emnapi": "^1.11.1",
|
|
178
183
|
"exif-reader": "^2.0.3",
|
|
179
184
|
"extract-zip": "^2.0.1",
|
|
180
185
|
"icc": "^4.0.0",
|
|
181
|
-
"node-addon-api": "^8.
|
|
186
|
+
"node-addon-api": "^8.9.0",
|
|
182
187
|
"node-gyp": "^12.4.0",
|
|
183
188
|
"publint": "^0.3.21",
|
|
184
|
-
"tar-fs": "^3.1.
|
|
189
|
+
"tar-fs": "^3.1.3",
|
|
185
190
|
"tsd": "^0.33.0"
|
|
186
191
|
},
|
|
187
192
|
"license": "Apache-2.0",
|
|
@@ -189,7 +194,7 @@
|
|
|
189
194
|
"node": ">=20.9.0"
|
|
190
195
|
},
|
|
191
196
|
"config": {
|
|
192
|
-
"libvips": ">=8.18.
|
|
197
|
+
"libvips": ">=8.18.4"
|
|
193
198
|
},
|
|
194
199
|
"funding": {
|
|
195
200
|
"url": "https://opencollective.com/libvips"
|
package/src/common.h
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
|
|
20
20
|
#if (VIPS_MAJOR_VERSION < 8) || \
|
|
21
21
|
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 18) || \
|
|
22
|
-
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 18 && VIPS_MICRO_VERSION <
|
|
23
|
-
#error "libvips version 8.18.
|
|
22
|
+
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 18 && VIPS_MICRO_VERSION < 4)
|
|
23
|
+
#error "libvips version 8.18.4+ is required - please see https://sharp.pixelplumbing.com/install"
|
|
24
24
|
#endif
|
|
25
25
|
|
|
26
26
|
#if defined(__has_include)
|