Skip to content

Commit

Permalink
chore: Updated dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShogunPanda committed Dec 20, 2023
1 parent 3dc6f00 commit 3a93a2f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@
},
"dependencies": {
"image-size": "^1.0.2",
"undici": "^5.26.5"
"undici": "^6.1.0"
},
"devDependencies": {
"@cowtech/eslint-config": "^8.10.0",
"@swc/cli": "^0.1.62",
"@swc/core": "^1.3.94",
"@types/node": "^20.8.7",
"@types/tap": "^15.0.10",
"@cowtech/eslint-config": "^9.0.0",
"@swc/cli": "^0.1.63",
"@swc/core": "^1.3.101",
"@types/node": "^20.10.5",
"@types/tap": "^15.0.11",
"c8": "^8.0.1",
"chokidar": "^3.5.3",
"concurrently": "^8.2.2",
"prettier": "^3.0.3",
"tap": "^18.5.2",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
"prettier": "^3.1.1",
"tap": "^18.6.1",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
},
"engines": {
"node": ">= 18.18.0"
Expand Down
11 changes: 6 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import EventEmitter from 'node:events'
import { type Stream, type Writable, type WritableOptions } from 'node:stream'
import { type Callback, ensurePromiseCallback } from './callback.js'
import { ensurePromiseCallback, type Callback } from './callback.js'
import { handleData, handleError, toStream } from './internals.js'
import { defaultOptions, FastImageError, type ImageInfo, type Options } from './models.js'
import { FastImageError, defaultOptions, type ImageInfo, type Options } from './models.js'
import { FastImageStream } from './stream.js'

export { defaultOptions, FastImageError } from './models.js'
export { FastImageError, defaultOptions } from './models.js'

export async function info(
source: string | Stream | Buffer,
Expand Down Expand Up @@ -40,7 +40,7 @@ export async function info(
finished = handleData(buffer, headers, threshold, start, aborter, callback)
})

stream.on('error', error => {
stream.on('error', (error: FastImageError) => {
callback(handleError(error, url!))
})

Expand All @@ -55,7 +55,8 @@ export async function info(

return promise!
} catch (error) {
callback(error)
// eslint-disable-next-line n/no-callback-literal
callback(error as Error)
return promise!
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/internals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function toStream(
if ((error as FastImageError).code === 'FASTIMAGE_URL_ERROR') {
throw error
} else if (url) {
throw handleError(error, url)
throw handleError(error as FastImageError, url)
}

// Parsing failed. Treat as local file
Expand Down
6 changes: 3 additions & 3 deletions src/stream.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import EventEmitter from 'node:events'
import { Writable, type WritableOptions } from 'node:stream'
import { handleData } from './internals.js'
import { defaultOptions, FastImageError, type Options } from './models.js'
import { FastImageError, defaultOptions, type Options } from './models.js'

export class FastImageStream extends Writable {
buffer: Buffer
Expand Down Expand Up @@ -39,13 +39,13 @@ export class FastImageStream extends Writable {
)
}

_write(chunk: any, _e: BufferEncoding, cb: (error?: Error | null) => void): void {
_write(chunk: Buffer, _e: BufferEncoding, cb: (error?: Error | null) => void): void {
this.analyze(chunk)
cb()
}

/* c8 ignore start */
_writev(chunks: { chunk: any }[], cb: (error?: Error | null) => void): void {
_writev(chunks: { chunk: Buffer }[], cb: (error?: Error | null) => void): void {
for (const { chunk } of chunks) {
this.analyze(chunk)
}
Expand Down

0 comments on commit 3a93a2f

Please sign in to comment.