@kaciras-blog/image
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -9,3 +9,3 @@ import path from "path"; | ||
function resolveFixture(name: string) { | ||
return path.join(__dirname, "fixtures", name) | ||
return path.join(__dirname, "fixtures", name); | ||
} | ||
@@ -70,3 +70,3 @@ | ||
it("has bad compression ratio in GIF", async() => { | ||
it("has bad compression ratio in GIF", async () => { | ||
const buffer = await fs.readFile(resolveFixture("animated.gif")); | ||
@@ -73,0 +73,0 @@ const result = await sharp(buffer, { pages: -1 }) |
@@ -12,6 +12,2 @@ "use strict"; | ||
const buffer = fs_extra_1.default.readFileSync(path_1.default.join(__dirname, "fixtures", "tile_16x16.png")); | ||
const transparent8x8 = Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAgAAAA" + | ||
"ICAYAAADED76LAAAACXBIWXMAAAsSAA" + | ||
"ALEgHS3X78AAAADUlEQVQY02NgGAUgA" + | ||
"AABCAABzu35wgAAAABJRU5ErkJggg==", "base64"); | ||
it("should pass metadata to preset function", () => { | ||
@@ -33,3 +29,3 @@ const filter = crop_filter_1.default({ | ||
const pixels = await sharp_1.default(cropped).raw().toBuffer(); | ||
expect(pixels.length).toBe(256); | ||
expect(pixels).toHaveLength(256); | ||
pixels.forEach(bit8 => expect(bit8).toBe(0)); | ||
@@ -39,3 +35,3 @@ }); | ||
const filter = crop_filter_1.default({}); | ||
expect(filter(buffer, "_")).rejects.toBeInstanceOf(errors_1.FilterArgumentError); | ||
return expect(filter(buffer, "_")).rejects.toBeInstanceOf(errors_1.FilterArgumentError); | ||
}); | ||
@@ -47,4 +43,4 @@ it("should throws on bad data", () => { | ||
const badData = Buffer.from("invalid"); | ||
expect(filter(badData, "test")).rejects.toBeInstanceOf(errors_1.BadImageError); | ||
return expect(filter(badData, "test")).rejects.toBeInstanceOf(errors_1.BadImageError); | ||
}); | ||
//# sourceMappingURL=crop-filter-tests.js.map |
@@ -9,8 +9,2 @@ import fs from "fs-extra"; | ||
const transparent8x8 = Buffer.from( | ||
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAA" + | ||
"ICAYAAADED76LAAAACXBIWXMAAAsSAA" + | ||
"ALEgHS3X78AAAADUlEQVQY02NgGAUgA" + | ||
"AABCAABzu35wgAAAABJRU5ErkJggg==", "base64"); | ||
it("should pass metadata to preset function", () => { | ||
@@ -36,3 +30,3 @@ const filter = PresetCropFilter({ | ||
expect(pixels.length).toBe(256); // 8(width) x 8(height) x 4(RGBA) | ||
expect(pixels).toHaveLength(256); // 8(width) x 8(height) x 4(RGBA) | ||
pixels.forEach(bit8 => expect(bit8).toBe(0)); // all pixels are rgba(0,0,0,0) | ||
@@ -43,3 +37,3 @@ }); | ||
const filter = PresetCropFilter({}); | ||
expect(filter(buffer, "_")).rejects.toBeInstanceOf(FilterArgumentError); | ||
return expect(filter(buffer, "_")).rejects.toBeInstanceOf(FilterArgumentError); | ||
}); | ||
@@ -52,3 +46,3 @@ | ||
const badData = Buffer.from("invalid"); | ||
expect(filter(badData, "test")).rejects.toBeInstanceOf(BadImageError); | ||
return expect(filter(badData, "test")).rejects.toBeInstanceOf(BadImageError); | ||
}); |
@@ -66,3 +66,3 @@ import { join } from "path"; | ||
if (isPng(buffer)) { | ||
candidates.push(input.webp({ lossless: true }).toBuffer()) | ||
candidates.push(input.webp({ lossless: true }).toBuffer()); | ||
} | ||
@@ -69,0 +69,0 @@ |
{ | ||
"name": "@kaciras-blog/image", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "Image processing library for Kaciras Blog", | ||
@@ -22,4 +22,4 @@ "license": "MIT", | ||
"mozjpeg": "^7.0.0", | ||
"sharp": "^0.27.2", | ||
"svgo": "^2.2.1" | ||
"sharp": "^0.28.0", | ||
"svgo": "^2.3.0" | ||
}, | ||
@@ -30,4 +30,4 @@ "devDependencies": { | ||
"@types/mozjpeg": "^5.0.0", | ||
"@types/sharp": "^0.27.1", | ||
"@types/svgo": "^2.0.0", | ||
"@types/sharp": "^0.27.2", | ||
"@types/svgo": "^2.3.0", | ||
"file-type": "^16.3.0" | ||
@@ -38,3 +38,3 @@ }, | ||
}, | ||
"gitHead": "b3f7e283413bacd00cbfb960484f6c5940e4721f" | ||
"gitHead": "66bad9e0c6cab87c3d501fdac20a0b10ee5bc904" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4291332
1549
+ Addedsharp@0.28.3(transitive)
- Removedarray-flatten@3.0.0(transitive)
- Removeddecompress-response@6.0.0(transitive)
- Removedmimic-response@3.1.0(transitive)
- Removedsharp@0.27.2(transitive)
- Removedsimple-get@4.0.1(transitive)
Updatedsharp@^0.28.0
Updatedsvgo@^2.3.0