sharp 0.32.5 → 0.32.6
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/lib/index.d.ts +46 -0
- package/lib/operation.js +1 -5
- package/lib/output.js +3 -2
- package/package.json +15 -15
- package/src/common.h +2 -2
- package/src/pipeline.cc +4 -2
package/lib/index.d.ts
CHANGED
|
@@ -139,6 +139,52 @@ declare namespace sharp {
|
|
|
139
139
|
*/
|
|
140
140
|
function simd(enable?: boolean): boolean;
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Block libvips operations at runtime.
|
|
144
|
+
*
|
|
145
|
+
* This is in addition to the `VIPS_BLOCK_UNTRUSTED` environment variable,
|
|
146
|
+
* which when set will block all "untrusted" operations.
|
|
147
|
+
*
|
|
148
|
+
* @since 0.32.4
|
|
149
|
+
*
|
|
150
|
+
* @example <caption>Block all TIFF input.</caption>
|
|
151
|
+
* sharp.block({
|
|
152
|
+
* operation: ['VipsForeignLoadTiff']
|
|
153
|
+
* });
|
|
154
|
+
*
|
|
155
|
+
* @param {Object} options
|
|
156
|
+
* @param {Array<string>} options.operation - List of libvips low-level operation names to block.
|
|
157
|
+
*/
|
|
158
|
+
function block(options: { operation: string[] }): void;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Unblock libvips operations at runtime.
|
|
162
|
+
*
|
|
163
|
+
* This is useful for defining a list of allowed operations.
|
|
164
|
+
*
|
|
165
|
+
* @since 0.32.4
|
|
166
|
+
*
|
|
167
|
+
* @example <caption>Block all input except WebP from the filesystem.</caption>
|
|
168
|
+
* sharp.block({
|
|
169
|
+
* operation: ['VipsForeignLoad']
|
|
170
|
+
* });
|
|
171
|
+
* sharp.unblock({
|
|
172
|
+
* operation: ['VipsForeignLoadWebpFile']
|
|
173
|
+
* });
|
|
174
|
+
*
|
|
175
|
+
* @example <caption>Block all input except JPEG and PNG from a Buffer or Stream.</caption>
|
|
176
|
+
* sharp.block({
|
|
177
|
+
* operation: ['VipsForeignLoad']
|
|
178
|
+
* });
|
|
179
|
+
* sharp.unblock({
|
|
180
|
+
* operation: ['VipsForeignLoadJpegBuffer', 'VipsForeignLoadPngBuffer']
|
|
181
|
+
* });
|
|
182
|
+
*
|
|
183
|
+
* @param {Object} options
|
|
184
|
+
* @param {Array<string>} options.operation - List of libvips low-level operation names to unblock.
|
|
185
|
+
*/
|
|
186
|
+
function unblock(options: { operation: string[] }): void;
|
|
187
|
+
|
|
142
188
|
//#endregion
|
|
143
189
|
|
|
144
190
|
const gravity: GravityEnum;
|
package/lib/operation.js
CHANGED
|
@@ -19,7 +19,7 @@ const is = require('./is');
|
|
|
19
19
|
* If no angle is provided, it is determined from the EXIF data.
|
|
20
20
|
* Mirroring is supported and may infer the use of a flip operation.
|
|
21
21
|
*
|
|
22
|
-
* The use of `rotate`
|
|
22
|
+
* The use of `rotate` without an angle will remove the EXIF `Orientation` tag, if any.
|
|
23
23
|
*
|
|
24
24
|
* Only one rotation can occur per pipeline.
|
|
25
25
|
* Previous calls to `rotate` in the same pipeline will be ignored.
|
|
@@ -83,8 +83,6 @@ function rotate (angle, options) {
|
|
|
83
83
|
* Mirror the image vertically (up-down) about the x-axis.
|
|
84
84
|
* This always occurs before rotation, if any.
|
|
85
85
|
*
|
|
86
|
-
* The use of `flip` implies the removal of the EXIF `Orientation` tag, if any.
|
|
87
|
-
*
|
|
88
86
|
* This operation does not work correctly with multi-page images.
|
|
89
87
|
*
|
|
90
88
|
* @example
|
|
@@ -102,8 +100,6 @@ function flip (flip) {
|
|
|
102
100
|
* Mirror the image horizontally (left-right) about the y-axis.
|
|
103
101
|
* This always occurs before rotation, if any.
|
|
104
102
|
*
|
|
105
|
-
* The use of `flop` implies the removal of the EXIF `Orientation` tag, if any.
|
|
106
|
-
*
|
|
107
103
|
* @example
|
|
108
104
|
* const output = await sharp(input).flop().toBuffer();
|
|
109
105
|
*
|
package/lib/output.js
CHANGED
|
@@ -162,8 +162,8 @@ function toBuffer (options, callback) {
|
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
* Include all metadata (EXIF, XMP, IPTC) from the input image in the output image.
|
|
165
|
-
* This will also convert to and add a web-friendly sRGB ICC profile
|
|
166
|
-
* output profile is provided.
|
|
165
|
+
* This will also convert to and add a web-friendly sRGB ICC profile if appropriate,
|
|
166
|
+
* unless a custom output profile is provided.
|
|
167
167
|
*
|
|
168
168
|
* The default behaviour, when `withMetadata` is not used, is to convert to the device-independent
|
|
169
169
|
* sRGB colour space and strip all metadata, including the removal of any ICC profile.
|
|
@@ -1046,6 +1046,7 @@ function jxl (options) {
|
|
|
1046
1046
|
*
|
|
1047
1047
|
* @param {Object} [options] - output options
|
|
1048
1048
|
* @param {string} [options.depth='uchar'] - bit depth, one of: char, uchar (default), short, ushort, int, uint, float, complex, double, dpcomplex
|
|
1049
|
+
* @returns {Sharp}
|
|
1049
1050
|
* @throws {Error} Invalid options
|
|
1050
1051
|
*/
|
|
1051
1052
|
function raw (options) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "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.32.
|
|
4
|
+
"version": "0.32.6",
|
|
5
5
|
"author": "Lovell Fuller <npm@lovell.info>",
|
|
6
6
|
"homepage": "https://github.com/lovell/sharp",
|
|
7
7
|
"contributors": [
|
|
@@ -153,25 +153,25 @@
|
|
|
153
153
|
"mocha": "^10.2.0",
|
|
154
154
|
"mock-fs": "^5.2.0",
|
|
155
155
|
"nyc": "^15.1.0",
|
|
156
|
-
"prebuild": "
|
|
156
|
+
"prebuild": "^12.0.0",
|
|
157
157
|
"semistandard": "^16.0.1",
|
|
158
|
-
"tsd": "^0.
|
|
158
|
+
"tsd": "^0.29.0"
|
|
159
159
|
},
|
|
160
160
|
"license": "Apache-2.0",
|
|
161
161
|
"config": {
|
|
162
|
-
"libvips": "8.14.
|
|
162
|
+
"libvips": "8.14.5",
|
|
163
163
|
"integrity": {
|
|
164
|
-
"darwin-arm64v8": "sha512-
|
|
165
|
-
"darwin-x64": "sha512-
|
|
166
|
-
"linux-arm64v8": "sha512-
|
|
167
|
-
"linux-armv6": "sha512-
|
|
168
|
-
"linux-armv7": "sha512-
|
|
169
|
-
"linux-x64": "sha512-
|
|
170
|
-
"linuxmusl-arm64v8": "sha512-
|
|
171
|
-
"linuxmusl-x64": "sha512-
|
|
172
|
-
"win32-arm64v8": "sha512-
|
|
173
|
-
"win32-ia32": "sha512-
|
|
174
|
-
"win32-x64": "sha512-
|
|
164
|
+
"darwin-arm64v8": "sha512-1QZzICfCJd4wAO0P6qmYI5e5VFMt9iCE4QgefI8VMMbdSzjIXA9L/ARN6pkMQPZ3h20Y9RtJ2W1skgCsvCIccw==",
|
|
165
|
+
"darwin-x64": "sha512-sMIKMYXsdU9FlIfztj6Kt/SfHlhlDpP0Ups7ftVFqwjaszmYmpI9y/d/q3mLb4jrzuSiSUEislSWCwBnW7MPTw==",
|
|
166
|
+
"linux-arm64v8": "sha512-CD8owELzkDumaom+O3jJ8fKamILAQdj+//KK/VNcHK3sngUcFpdjx36C8okwbux9sml/T7GTB/gzpvReDrAejQ==",
|
|
167
|
+
"linux-armv6": "sha512-wk6IPHatDFVWKJy7lI1TJezHGHPQut1wF2bwx256KlZwXUQU3fcVcMpV1zxXjgLFewHq2+uhyMkoSGBPahWzlA==",
|
|
168
|
+
"linux-armv7": "sha512-HEZC9KYtkmBK5rUR2MqBhrVarnQVZ/TwLUeLkKq0XuoM2pc/eXI6N0Fh5NGEFwdXI2XE8g1ySf+OYS6DDi+xCQ==",
|
|
169
|
+
"linux-x64": "sha512-SlFWrITSW5XVUkaFPQOySAaSGXnhkGJCj8X2wGYYta9hk5piZldQyMp4zwy0z6UeRu1qKTKtZvmq28W3Gnh9xA==",
|
|
170
|
+
"linuxmusl-arm64v8": "sha512-ga9iX7WUva3sG/VsKkOD318InLlCfPIztvzCZKZ2/+izQXRbQi8VoXWMHgEN4KHACv45FTl7mJ/8CRqUzhS8wQ==",
|
|
171
|
+
"linuxmusl-x64": "sha512-yeaHnpfee1hrZLok2l4eFceHzlfq8gN3QOu0R4Mh8iMK5O5vAUu97bdtxeZZeJJvHw8tfh2/msGi0qysxKN8bw==",
|
|
172
|
+
"win32-arm64v8": "sha512-kR91hy9w1+GEXK56hLh51+hBCBo7T+ijM4Slkmvb/2PsYZySq5H7s61n99iDYl6kTJP2y9sW5Xcvm3uuXDaDgg==",
|
|
173
|
+
"win32-ia32": "sha512-HrnofEbzHNpHJ0vVnjsTj5yfgVdcqdWshXuwFO2zc8xlEjA83BvXZ0lVj9MxPxkxJ2ta+/UlLr+CFzc5bOceMw==",
|
|
174
|
+
"win32-x64": "sha512-BwKckinJZ0Fu/EcunqiLPwOLEBWp4xf8GV7nvmVuKKz5f6B+GxoA2k9aa2wueqv4r4RJVgV/aWXZWFKOIjre/Q=="
|
|
175
175
|
},
|
|
176
176
|
"runtime": "napi",
|
|
177
177
|
"target": 7
|
package/src/common.h
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
#if (VIPS_MAJOR_VERSION < 8) || \
|
|
17
17
|
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 14) || \
|
|
18
|
-
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 14 && VIPS_MICRO_VERSION <
|
|
19
|
-
#error "libvips version 8.14.
|
|
18
|
+
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 14 && VIPS_MICRO_VERSION < 5)
|
|
19
|
+
#error "libvips version 8.14.5+ is required - please see https://sharp.pixelplumbing.com/install"
|
|
20
20
|
#endif
|
|
21
21
|
|
|
22
22
|
#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))
|
package/src/pipeline.cc
CHANGED
|
@@ -326,7 +326,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
326
326
|
try {
|
|
327
327
|
image = image.icc_transform(processingProfile, VImage::option()
|
|
328
328
|
->set("embedded", TRUE)
|
|
329
|
-
->set("depth", image.interpretation()
|
|
329
|
+
->set("depth", sharp::Is16Bit(image.interpretation()) ? 16 : 8)
|
|
330
330
|
->set("intent", VIPS_INTENT_PERCEPTUAL));
|
|
331
331
|
} catch(...) {
|
|
332
332
|
sharp::VipsWarningCallback(nullptr, G_LOG_LEVEL_WARNING, "Invalid embedded profile", nullptr);
|
|
@@ -653,7 +653,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
653
653
|
if (across != 0 || down != 0) {
|
|
654
654
|
int left;
|
|
655
655
|
int top;
|
|
656
|
-
compositeImage = compositeImage.replicate(across, down);
|
|
656
|
+
compositeImage = sharp::StaySequential(compositeImage, access).replicate(across, down);
|
|
657
657
|
if (composite->hasOffset) {
|
|
658
658
|
std::tie(left, top) = sharp::CalculateCrop(
|
|
659
659
|
compositeImage.width(), compositeImage.height(), image.width(), image.height(),
|
|
@@ -763,6 +763,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
763
763
|
if (baton->withMetadata && sharp::HasProfile(image) && baton->withMetadataIcc.empty()) {
|
|
764
764
|
image = image.icc_transform("srgb", VImage::option()
|
|
765
765
|
->set("embedded", TRUE)
|
|
766
|
+
->set("depth", sharp::Is16Bit(image.interpretation()) ? 16 : 8)
|
|
766
767
|
->set("intent", VIPS_INTENT_PERCEPTUAL));
|
|
767
768
|
}
|
|
768
769
|
}
|
|
@@ -794,6 +795,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
794
795
|
VImage::option()
|
|
795
796
|
->set("input_profile", processingProfile)
|
|
796
797
|
->set("embedded", TRUE)
|
|
798
|
+
->set("depth", sharp::Is16Bit(image.interpretation()) ? 16 : 8)
|
|
797
799
|
->set("intent", VIPS_INTENT_PERCEPTUAL));
|
|
798
800
|
}
|
|
799
801
|
// Override EXIF Orientation tag
|