@revizly/sharp 0.33.4-revizly2 → 0.33.4-revizly4
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 +1 -1
- package/lib/libvips.js +8 -6
- package/lib/output.js +2 -0
- package/lib/utility.js +7 -0
- package/package.json +10 -9
- package/src/pipeline.cc +9 -0
- package/src/pipeline.h +4 -0
package/install/check.js
CHANGED
@@ -30,7 +30,7 @@ try {
|
|
30
30
|
}
|
31
31
|
};
|
32
32
|
|
33
|
-
if (useGlobalLibvips()) {
|
33
|
+
if (useGlobalLibvips(log)) {
|
34
34
|
buildFromSource(`Detected globally-installed libvips v${globalLibvipsVersion()}`);
|
35
35
|
} else if (process.env.npm_config_build_from_source) {
|
36
36
|
buildFromSource('Detected --build-from-source flag');
|
package/lib/libvips.js
CHANGED
@@ -162,21 +162,23 @@ const pkgConfigPath = () => {
|
|
162
162
|
}
|
163
163
|
};
|
164
164
|
|
165
|
-
const skipSearch = (status, reason) => {
|
166
|
-
|
165
|
+
const skipSearch = (status, reason, logger) => {
|
166
|
+
if (logger) {
|
167
|
+
logger(`Detected ${reason}, skipping search for globally-installed libvips`);
|
168
|
+
}
|
167
169
|
return status;
|
168
170
|
};
|
169
171
|
|
170
|
-
const useGlobalLibvips = () => {
|
172
|
+
const useGlobalLibvips = (logger) => {
|
171
173
|
if (Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS) === true) {
|
172
|
-
return skipSearch(false, 'SHARP_IGNORE_GLOBAL_LIBVIPS');
|
174
|
+
return skipSearch(false, 'SHARP_IGNORE_GLOBAL_LIBVIPS', logger);
|
173
175
|
}
|
174
176
|
if (Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS) === true) {
|
175
|
-
return skipSearch(true, 'SHARP_FORCE_GLOBAL_LIBVIPS');
|
177
|
+
return skipSearch(true, 'SHARP_FORCE_GLOBAL_LIBVIPS', logger);
|
176
178
|
}
|
177
179
|
/* istanbul ignore next */
|
178
180
|
if (isRosetta()) {
|
179
|
-
return skipSearch(false, 'Rosetta');
|
181
|
+
return skipSearch(false, 'Rosetta', logger);
|
180
182
|
}
|
181
183
|
const globalVipsVersion = globalLibvipsVersion();
|
182
184
|
return !!globalVipsVersion && /* istanbul ignore next */
|
package/lib/output.js
CHANGED
@@ -65,6 +65,7 @@ const bitdepthFromColourCount = (colours) => 1 << 31 - Math.clz32(Math.ceil(Math
|
|
65
65
|
* `channels` and `premultiplied` (indicating if premultiplication was used).
|
66
66
|
* When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
|
67
67
|
* When using the attention crop strategy also contains `attentionX` and `attentionY`, the focal point of the cropped region.
|
68
|
+
* Animated output will also contain `pageHeight` and `pages`.
|
68
69
|
* May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text.
|
69
70
|
* @returns {Promise<Object>} - when no callback is provided
|
70
71
|
* @throws {Error} Invalid parameters
|
@@ -109,6 +110,7 @@ function toFile (fileOut, callback) {
|
|
109
110
|
* - `info` contains the output image `format`, `size` (bytes), `width`, `height`,
|
110
111
|
* `channels` and `premultiplied` (indicating if premultiplication was used).
|
111
112
|
* When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
|
113
|
+
* Animated output will also contain `pageHeight` and `pages`.
|
112
114
|
* May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text.
|
113
115
|
*
|
114
116
|
* A `Promise` is returned when `callback` is not provided.
|
package/lib/utility.js
CHANGED
@@ -75,6 +75,13 @@ if (!libvipsVersion.isGlobal) {
|
|
75
75
|
}
|
76
76
|
versions.sharp = require('../package.json').version;
|
77
77
|
|
78
|
+
/* istanbul ignore next */
|
79
|
+
if (versions.heif && format.heif) {
|
80
|
+
// Prebuilt binaries provide AV1
|
81
|
+
format.heif.input.fileSuffix = ['.avif'];
|
82
|
+
format.heif.output.alias = ['avif'];
|
83
|
+
}
|
84
|
+
|
78
85
|
/**
|
79
86
|
* Gets or, when options are provided, sets the limits of _libvips'_ operation cache.
|
80
87
|
* Existing entries in the cache will be trimmed after any change in limits.
|
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.33.4-
|
4
|
+
"version": "0.33.4-revizly4",
|
5
5
|
"author": "Lovell Fuller <npm@lovell.info>",
|
6
6
|
"homepage": "https://sharp.pixelplumbing.com",
|
7
7
|
"contributors": [
|
@@ -88,7 +88,8 @@
|
|
88
88
|
"Mart Jansink <m.jansink@gmail.com>",
|
89
89
|
"Lachlan Newman <lachnewman007@gmail.com>",
|
90
90
|
"Dennis Beatty <dennis@dcbeatty.com>",
|
91
|
-
"Ingvar Stepanyan <me@rreverser.com>"
|
91
|
+
"Ingvar Stepanyan <me@rreverser.com>",
|
92
|
+
"Don Denton <don@happycollision.com>"
|
92
93
|
],
|
93
94
|
"scripts": {
|
94
95
|
"install": "node install/check",
|
@@ -141,18 +142,18 @@
|
|
141
142
|
"semver": "^7.6.0"
|
142
143
|
},
|
143
144
|
"optionalDependencies": {
|
144
|
-
"@revizly/sharp-libvips-linux-arm64": "1.0.
|
145
|
-
"@revizly/sharp-libvips-linux-x64": "1.0.
|
146
|
-
"@revizly/sharp-linux-arm64": "0.33.4-
|
147
|
-
"@revizly/sharp-linux-x64": "0.33.4-
|
145
|
+
"@revizly/sharp-libvips-linux-arm64": "1.0.6",
|
146
|
+
"@revizly/sharp-libvips-linux-x64": "1.0.6",
|
147
|
+
"@revizly/sharp-linux-arm64": "0.33.4-revizly3",
|
148
|
+
"@revizly/sharp-linux-x64": "0.33.4-revizly3"
|
148
149
|
},
|
149
150
|
"devDependencies": {
|
150
|
-
"@emnapi/runtime": "^1.
|
151
|
-
"@revizly/sharp-libvips-dev": "1.0.
|
151
|
+
"@emnapi/runtime": "^1.2.0",
|
152
|
+
"@revizly/sharp-libvips-dev": "1.0.6",
|
152
153
|
"@types/node": "*",
|
153
154
|
"async": "^3.2.5",
|
154
155
|
"cc": "^3.0.1",
|
155
|
-
"emnapi": "^1.
|
156
|
+
"emnapi": "^1.2.0",
|
156
157
|
"exif-reader": "^2.0.1",
|
157
158
|
"extract-zip": "^2.0.1",
|
158
159
|
"icc": "^3.0.0",
|
package/src/pipeline.cc
CHANGED
@@ -849,6 +849,11 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
849
849
|
image = sharp::SetAnimationProperties(
|
850
850
|
image, nPages, targetPageHeight, baton->delay, baton->loop);
|
851
851
|
|
852
|
+
if (image.get_typeof(VIPS_META_PAGE_HEIGHT) == G_TYPE_INT) {
|
853
|
+
baton->pageHeightOut = image.get_int(VIPS_META_PAGE_HEIGHT);
|
854
|
+
baton->pagesOut = image.get_int(VIPS_META_N_PAGES);
|
855
|
+
}
|
856
|
+
|
852
857
|
// Output
|
853
858
|
sharp::SetTimeout(image, baton->timeoutSeconds);
|
854
859
|
if (baton->fileOut.empty()) {
|
@@ -1284,6 +1289,10 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
1284
1289
|
if (baton->input->textAutofitDpi) {
|
1285
1290
|
info.Set("textAutofitDpi", static_cast<uint32_t>(baton->input->textAutofitDpi));
|
1286
1291
|
}
|
1292
|
+
if (baton->pageHeightOut) {
|
1293
|
+
info.Set("pageHeight", static_cast<int32_t>(baton->pageHeightOut));
|
1294
|
+
info.Set("pages", static_cast<int32_t>(baton->pagesOut));
|
1295
|
+
}
|
1287
1296
|
|
1288
1297
|
if (baton->bufferOutLength > 0) {
|
1289
1298
|
// Add buffer size to info
|
package/src/pipeline.h
CHANGED
@@ -43,6 +43,8 @@ struct PipelineBaton {
|
|
43
43
|
std::string fileOut;
|
44
44
|
void *bufferOut;
|
45
45
|
size_t bufferOutLength;
|
46
|
+
int pageHeightOut;
|
47
|
+
int pagesOut;
|
46
48
|
std::vector<Composite *> composite;
|
47
49
|
std::vector<sharp::InputDescriptor *> joinChannelIn;
|
48
50
|
int topOffsetPre;
|
@@ -226,6 +228,8 @@ struct PipelineBaton {
|
|
226
228
|
PipelineBaton():
|
227
229
|
input(nullptr),
|
228
230
|
bufferOutLength(0),
|
231
|
+
pageHeightOut(0),
|
232
|
+
pagesOut(0),
|
229
233
|
topOffsetPre(-1),
|
230
234
|
topOffsetPost(-1),
|
231
235
|
channels(0),
|