snapshot: update deps

This commit is contained in:
Koushik Dutta
2023-12-27 20:11:45 -08:00
parent e5a549db6a
commit 3dfb2db02a
3 changed files with 722 additions and 759 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/snapshot",
"version": "0.2.22",
"version": "0.2.23",
"description": "Snapshot Plugin for Scrypted",
"scripts": {
"scrypted-setup-project": "scrypted-setup-project",
@@ -35,14 +35,14 @@
},
"dependencies": {
"@koush/axios-digest-auth": "^0.8.5",
"@types/node": "^18.16.18",
"@types/node": "^20.10.5",
"axios": "^1.4.0",
"sharp": "^0.32.6",
"whatwg-mimetype": "^3.0.0"
"sharp": "^0.33.1",
"whatwg-mimetype": "^4.0.0"
},
"devDependencies": {
"@scrypted/common": "file:../../common",
"@scrypted/sdk": "file:../../sdk",
"@types/whatwg-mimetype": "^3.0.0"
"@types/whatwg-mimetype": "^3.0.2"
}
}

View File

@@ -8,6 +8,8 @@ export function loadSharp() {
hasLoadedSharp = true;
try {
sharpInstance = require('sharp');
// not exposed by sharp but it exists.
(sharpInstance.kernel as any).linear = 'linear';
console.log('sharp loaded');
}
catch (e) {
@@ -58,8 +60,27 @@ export class VipsImage implements Image {
});
}
if (options?.resize) {
let kernel: string;
switch (options?.resize.filter) {
case 'bilinear':
kernel = 'linear';
break;
case 'lanczos':
kernel = 'lanczos2';
break;
case 'mitchell':
kernel = 'mitchell';
break;
case 'nearest':
kernel = 'nearest';
break;
default:
kernel = 'linear';
break
}
transformed.resize(typeof options.resize.width === 'number' ? Math.floor(options.resize.width) : undefined, typeof options.resize.height === 'number' ? Math.floor(options.resize.height) : undefined, {
fit: "cover",
kernel: kernel as any,
});
}