From 25ba4b39df87ef2e0dd50d2057de605b3ebe3a64 Mon Sep 17 00:00:00 2001 From: Lubos Date: Wed, 25 Dec 2024 06:24:47 +0100 Subject: [PATCH 1/2] fix: do not use buffer type as generic --- lib/index.ts | 2 +- lib/parsers/binary.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 9fb4cd58..836f97f0 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -13,7 +13,7 @@ import { fileResolver } from "./resolvers/file.js"; interface ResolvedInput { path: string; - schema: string | JSONSchema | Buffer | Awaited | undefined; + schema: string | JSONSchema | Buffer | Awaited | undefined; type: 'file' | 'json' | 'url'; } diff --git a/lib/parsers/binary.ts b/lib/parsers/binary.ts index ca6f0779..63eaf374 100644 --- a/lib/parsers/binary.ts +++ b/lib/parsers/binary.ts @@ -5,7 +5,7 @@ const BINARY_REGEXP = /\.(jpeg|jpg|gif|png|bmp|ico)$/i; export const binaryParser: Plugin = { canHandle: (file: FileInfo) => Buffer.isBuffer(file.data) && BINARY_REGEXP.test(file.url), - handler: (file: FileInfo): Buffer => Buffer.isBuffer(file.data) + handler: (file: FileInfo): Buffer => Buffer.isBuffer(file.data) ? file.data // This will reject if data is anything other than a string or typed array : Buffer.from(file.data), From 1754059ef593d50d72c9dc852d52126203230855 Mon Sep 17 00:00:00 2001 From: Lubos Date: Wed, 25 Dec 2024 06:24:49 +0100 Subject: [PATCH 2/2] 0.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 08e1fd8f..8ec4bc48 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/json-schema-ref-parser", - "version": "0.0.1", + "version": "0.0.2", "description": "Parse, Resolve, and Dereference JSON Schema $ref pointers", "homepage": "https://heyapi.dev/", "repository": {