Skip to content

Commit aec6961

Browse files
committed
fix: upgrade file-type dep to fix eval security warning
1 parent b6b0e41 commit aec6961

File tree

3 files changed

+89
-55
lines changed

3 files changed

+89
-55
lines changed

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@jimp/utils": "workspace:*",
2121
"await-to-js": "^3.0.0",
2222
"exif-parser": "^0.1.12",
23-
"file-type": "^16.0.0",
23+
"file-type": "^20.1.0",
2424
"mime": "3"
2525
},
2626
"devDependencies": {

packages/core/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Bitmap, Format, JimpClass, Edge } from "@jimp/types";
22
import { cssColorToHex, scan, scanIterator } from "@jimp/utils";
3-
import fileType from "file-type/core.js";
43
import { to } from "await-to-js";
54
import { existsSync, readFile, writeFile } from "@jimp/file-ops";
65
import mime from "mime/lite.js";
@@ -334,7 +333,8 @@ export function createJimp<
334333
const actualBuffer =
335334
buffer instanceof ArrayBuffer ? bufferFromArrayBuffer(buffer) : buffer;
336335

337-
const mime = await fileType.fromBuffer(actualBuffer);
336+
const { fileTypeFromBuffer } = await import("file-type/core");
337+
const mime = await fileTypeFromBuffer(actualBuffer);
338338

339339
if (!mime || !mime.mime) {
340340
throw new Error("Could not find MIME for Buffer");

pnpm-lock.yaml

Lines changed: 86 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)