@revizly/sharp 0.35.0-revizly36 → 0.35.0-revizly38
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/README.md +1 -1
- package/dist/index.d.cts +19 -0
- package/dist/index.d.mts +1965 -1899
- package/dist/operation.cjs +8 -5
- package/dist/operation.mjs +8 -5
- package/dist/output.cjs +1 -3
- package/dist/output.mjs +1 -3
- package/dist/sharp.cjs +8 -4
- package/dist/sharp.mjs +8 -4
- package/lib/index.d.ts +19 -0
- package/package.json +8 -8
package/dist/operation.cjs
CHANGED
|
@@ -424,10 +424,10 @@ function blur (options) {
|
|
|
424
424
|
function dilate (width) {
|
|
425
425
|
if (!is.defined(width)) {
|
|
426
426
|
this.options.dilateWidth = 1;
|
|
427
|
-
} else if (is.integer(width) && width
|
|
427
|
+
} else if (is.integer(width) && is.inRange(width, 1, 65536)) {
|
|
428
428
|
this.options.dilateWidth = width;
|
|
429
429
|
} else {
|
|
430
|
-
throw is.invalidParameterError('
|
|
430
|
+
throw is.invalidParameterError('width', 'integer between 1 and 65536', width);
|
|
431
431
|
}
|
|
432
432
|
return this;
|
|
433
433
|
}
|
|
@@ -447,10 +447,10 @@ function dilate (width) {
|
|
|
447
447
|
function erode (width) {
|
|
448
448
|
if (!is.defined(width)) {
|
|
449
449
|
this.options.erodeWidth = 1;
|
|
450
|
-
} else if (is.integer(width) && width
|
|
450
|
+
} else if (is.integer(width) && is.inRange(width, 1, 65536)) {
|
|
451
451
|
this.options.erodeWidth = width;
|
|
452
452
|
} else {
|
|
453
|
-
throw is.invalidParameterError('
|
|
453
|
+
throw is.invalidParameterError('width', 'integer between 1 and 65536', width);
|
|
454
454
|
}
|
|
455
455
|
return this;
|
|
456
456
|
}
|
|
@@ -862,10 +862,13 @@ function recomb (inputMatrix) {
|
|
|
862
862
|
if (inputMatrix.length !== 3 && inputMatrix.length !== 4) {
|
|
863
863
|
throw is.invalidParameterError('inputMatrix', '3x3 or 4x4 array', inputMatrix.length);
|
|
864
864
|
}
|
|
865
|
-
const recombMatrix = inputMatrix.flat()
|
|
865
|
+
const recombMatrix = inputMatrix.flat();
|
|
866
866
|
if (recombMatrix.length !== 9 && recombMatrix.length !== 16) {
|
|
867
867
|
throw is.invalidParameterError('inputMatrix', 'cardinality of 9 or 16', recombMatrix.length);
|
|
868
868
|
}
|
|
869
|
+
if (!recombMatrix.every(is.number)) {
|
|
870
|
+
throw is.invalidParameterError('inputMatrix', 'array of numbers', recombMatrix);
|
|
871
|
+
}
|
|
869
872
|
this.options.recombMatrix = recombMatrix;
|
|
870
873
|
return this;
|
|
871
874
|
}
|
package/dist/operation.mjs
CHANGED
|
@@ -424,10 +424,10 @@ function blur (options) {
|
|
|
424
424
|
function dilate (width) {
|
|
425
425
|
if (!is.defined(width)) {
|
|
426
426
|
this.options.dilateWidth = 1;
|
|
427
|
-
} else if (is.integer(width) && width
|
|
427
|
+
} else if (is.integer(width) && is.inRange(width, 1, 65536)) {
|
|
428
428
|
this.options.dilateWidth = width;
|
|
429
429
|
} else {
|
|
430
|
-
throw is.invalidParameterError('
|
|
430
|
+
throw is.invalidParameterError('width', 'integer between 1 and 65536', width);
|
|
431
431
|
}
|
|
432
432
|
return this;
|
|
433
433
|
}
|
|
@@ -447,10 +447,10 @@ function dilate (width) {
|
|
|
447
447
|
function erode (width) {
|
|
448
448
|
if (!is.defined(width)) {
|
|
449
449
|
this.options.erodeWidth = 1;
|
|
450
|
-
} else if (is.integer(width) && width
|
|
450
|
+
} else if (is.integer(width) && is.inRange(width, 1, 65536)) {
|
|
451
451
|
this.options.erodeWidth = width;
|
|
452
452
|
} else {
|
|
453
|
-
throw is.invalidParameterError('
|
|
453
|
+
throw is.invalidParameterError('width', 'integer between 1 and 65536', width);
|
|
454
454
|
}
|
|
455
455
|
return this;
|
|
456
456
|
}
|
|
@@ -862,10 +862,13 @@ function recomb (inputMatrix) {
|
|
|
862
862
|
if (inputMatrix.length !== 3 && inputMatrix.length !== 4) {
|
|
863
863
|
throw is.invalidParameterError('inputMatrix', '3x3 or 4x4 array', inputMatrix.length);
|
|
864
864
|
}
|
|
865
|
-
const recombMatrix = inputMatrix.flat()
|
|
865
|
+
const recombMatrix = inputMatrix.flat();
|
|
866
866
|
if (recombMatrix.length !== 9 && recombMatrix.length !== 16) {
|
|
867
867
|
throw is.invalidParameterError('inputMatrix', 'cardinality of 9 or 16', recombMatrix.length);
|
|
868
868
|
}
|
|
869
|
+
if (!recombMatrix.every(is.number)) {
|
|
870
|
+
throw is.invalidParameterError('inputMatrix', 'array of numbers', recombMatrix);
|
|
871
|
+
}
|
|
869
872
|
this.options.recombMatrix = recombMatrix;
|
|
870
873
|
return this;
|
|
871
874
|
}
|
package/dist/output.cjs
CHANGED
|
@@ -929,7 +929,7 @@ function gif (options) {
|
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
if (is.defined(options.effort)) {
|
|
932
|
-
if (is.
|
|
932
|
+
if (is.integer(options.effort) && is.inRange(options.effort, 1, 10)) {
|
|
933
933
|
this.options.gifEffort = options.effort;
|
|
934
934
|
} else {
|
|
935
935
|
throw is.invalidParameterError('effort', 'integer between 1 and 10', options.effort);
|
|
@@ -1207,8 +1207,6 @@ function tiff (options) {
|
|
|
1207
1207
|
*
|
|
1208
1208
|
* AVIF image sequences are not supported.
|
|
1209
1209
|
*
|
|
1210
|
-
* When using Windows ARM64, this feature requires a CPU with ARM64v8.4 or later.
|
|
1211
|
-
*
|
|
1212
1210
|
* @example
|
|
1213
1211
|
* const data = await sharp(input)
|
|
1214
1212
|
* .avif({ effort: 2 })
|
package/dist/output.mjs
CHANGED
|
@@ -929,7 +929,7 @@ function gif (options) {
|
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
if (is.defined(options.effort)) {
|
|
932
|
-
if (is.
|
|
932
|
+
if (is.integer(options.effort) && is.inRange(options.effort, 1, 10)) {
|
|
933
933
|
this.options.gifEffort = options.effort;
|
|
934
934
|
} else {
|
|
935
935
|
throw is.invalidParameterError('effort', 'integer between 1 and 10', options.effort);
|
|
@@ -1207,8 +1207,6 @@ function tiff (options) {
|
|
|
1207
1207
|
*
|
|
1208
1208
|
* AVIF image sequences are not supported.
|
|
1209
1209
|
*
|
|
1210
|
-
* When using Windows ARM64, this feature requires a CPU with ARM64v8.4 or later.
|
|
1211
|
-
*
|
|
1212
1210
|
* @example
|
|
1213
1211
|
* const data = await sharp(input)
|
|
1214
1212
|
* .avif({ effort: 2 })
|
package/dist/sharp.cjs
CHANGED
|
@@ -82,11 +82,8 @@ if (!sharp) {
|
|
|
82
82
|
case "linux-wasm32":
|
|
83
83
|
sharp = require("@img/sharp-webcontainers-wasm32/sharp.node");
|
|
84
84
|
break;
|
|
85
|
-
default:
|
|
86
|
-
sharp = require("@img/sharp-wasm32/sharp.node");
|
|
87
|
-
break;
|
|
88
85
|
}
|
|
89
|
-
if (["linux-x64", "linuxmusl-x64"].includes(runtimePlatform) && !sharp._isUsingX64V2()) {
|
|
86
|
+
if (sharp && ["linux-x64", "linuxmusl-x64"].includes(runtimePlatform) && !sharp._isUsingX64V2()) {
|
|
90
87
|
const err = new Error("Prebuilt binaries for Linux x64 require v2 microarchitecture");
|
|
91
88
|
err.code = "Unsupported CPU";
|
|
92
89
|
errors.push(err);
|
|
@@ -96,6 +93,13 @@ if (!sharp) {
|
|
|
96
93
|
errors.push(err);
|
|
97
94
|
}
|
|
98
95
|
}
|
|
96
|
+
if (!sharp) {
|
|
97
|
+
try {
|
|
98
|
+
sharp = require("@img/sharp-wasm32/sharp.node");
|
|
99
|
+
} catch (err) {
|
|
100
|
+
errors.push(err);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
99
103
|
|
|
100
104
|
if (!sharp) {
|
|
101
105
|
const [isLinux, isMacOs, isWindows] = ["linux", "darwin", "win32"].map((os) => runtimePlatform.startsWith(os));
|
package/dist/sharp.mjs
CHANGED
|
@@ -82,11 +82,8 @@ if (!sharp) {
|
|
|
82
82
|
case "linux-wasm32":
|
|
83
83
|
sharp = require("@img/sharp-webcontainers-wasm32/sharp.node");
|
|
84
84
|
break;
|
|
85
|
-
default:
|
|
86
|
-
sharp = require("@img/sharp-wasm32/sharp.node");
|
|
87
|
-
break;
|
|
88
85
|
}
|
|
89
|
-
if (["linux-x64", "linuxmusl-x64"].includes(runtimePlatform) && !sharp._isUsingX64V2()) {
|
|
86
|
+
if (sharp && ["linux-x64", "linuxmusl-x64"].includes(runtimePlatform) && !sharp._isUsingX64V2()) {
|
|
90
87
|
const err = new Error("Prebuilt binaries for Linux x64 require v2 microarchitecture");
|
|
91
88
|
err.code = "Unsupported CPU";
|
|
92
89
|
errors.push(err);
|
|
@@ -96,6 +93,13 @@ if (!sharp) {
|
|
|
96
93
|
errors.push(err);
|
|
97
94
|
}
|
|
98
95
|
}
|
|
96
|
+
if (!sharp) {
|
|
97
|
+
try {
|
|
98
|
+
sharp = require("@img/sharp-wasm32/sharp.node");
|
|
99
|
+
} catch (err) {
|
|
100
|
+
errors.push(err);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
99
103
|
|
|
100
104
|
if (!sharp) {
|
|
101
105
|
const [isLinux, isMacOs, isWindows] = ["linux", "darwin", "win32"].map((os) => runtimePlatform.startsWith(os));
|
package/lib/index.d.ts
CHANGED
|
@@ -1187,6 +1187,23 @@ declare namespace sharp {
|
|
|
1187
1187
|
|
|
1188
1188
|
type Unit = 'inch' | 'cm';
|
|
1189
1189
|
|
|
1190
|
+
type MediaType =
|
|
1191
|
+
'application/pdf' |
|
|
1192
|
+
'image/avif' |
|
|
1193
|
+
'image/fits' |
|
|
1194
|
+
'image/gif' |
|
|
1195
|
+
'image/heic' |
|
|
1196
|
+
'image/jp2' |
|
|
1197
|
+
'image/jpeg' |
|
|
1198
|
+
'image/jxl' |
|
|
1199
|
+
'image/png' |
|
|
1200
|
+
'image/svg+xml' |
|
|
1201
|
+
'image/tiff' |
|
|
1202
|
+
'image/vnd.radiance' |
|
|
1203
|
+
'image/webp' |
|
|
1204
|
+
'image/x-exr' |
|
|
1205
|
+
'image/x-portable-pixmap';
|
|
1206
|
+
|
|
1190
1207
|
interface WriteableMetadata {
|
|
1191
1208
|
/** Number of pixels per inch (DPI) */
|
|
1192
1209
|
density?: number | undefined;
|
|
@@ -1280,6 +1297,8 @@ declare namespace sharp {
|
|
|
1280
1297
|
comments?: CommentsMetadata[] | undefined;
|
|
1281
1298
|
/** HDR gain map, if present */
|
|
1282
1299
|
gainMap?: GainMapMetadata | undefined;
|
|
1300
|
+
/** Media Type (MIME Type) */
|
|
1301
|
+
mediaType?: MediaType | undefined;
|
|
1283
1302
|
}
|
|
1284
1303
|
|
|
1285
1304
|
interface LevelMetadata {
|
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-revizly38",
|
|
5
5
|
"author": "Lovell Fuller <npm@lovell.info>",
|
|
6
6
|
"homepage": "https://sharp.pixelplumbing.com",
|
|
7
7
|
"contributors": [
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"lint-cpp": "cpplint --quiet src/*.h src/*.cc",
|
|
103
103
|
"lint-js": "biome lint",
|
|
104
104
|
"lint-publish": "publint --strict",
|
|
105
|
-
"lint-types": "tsd --files ./test/types/sharp.test-d.
|
|
105
|
+
"lint-types": "tsd --files ./test/types/sharp.test-d.{cts,mts}",
|
|
106
106
|
"test-leak": "./test/leak/leak.sh",
|
|
107
107
|
"test-unit": "node --experimental-test-coverage test/unit.mjs",
|
|
108
108
|
"package-from-local-build": "node npm/from-local-build.js",
|
|
@@ -163,16 +163,16 @@
|
|
|
163
163
|
"semver": "^7.8.4"
|
|
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.40",
|
|
167
|
+
"@revizly/sharp-libvips-linux-x64": "1.0.40",
|
|
168
|
+
"@revizly/sharp-linux-arm64": "0.35.0-revizly38",
|
|
169
|
+
"@revizly/sharp-linux-x64": "0.35.0-revizly38"
|
|
170
170
|
},
|
|
171
171
|
"devDependencies": {
|
|
172
|
-
"@biomejs/biome": "^2.
|
|
172
|
+
"@biomejs/biome": "^2.5.0",
|
|
173
173
|
"@cpplint/cli": "^0.1.0",
|
|
174
174
|
"@emnapi/runtime": "^1.11.0",
|
|
175
|
-
"@revizly/sharp-libvips-dev": "1.0.
|
|
175
|
+
"@revizly/sharp-libvips-dev": "1.0.40",
|
|
176
176
|
"@types/node": "*",
|
|
177
177
|
"emnapi": "^1.11.0",
|
|
178
178
|
"exif-reader": "^2.0.3",
|