Skip to content

Commit d4de9d3

Browse files
committed
feat!: update dependencies
1 parent 37f09b0 commit d4de9d3

4 files changed

Lines changed: 2014 additions & 2129 deletions

File tree

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"hasha": "^5.2.2",
3131
"image-meta": "^0.1.1",
3232
"is-https": "^4.0.0",
33-
"lru-cache": "^6.0.0",
34-
"node-fetch": "^2.6.7",
33+
"lru-cache": "^7.10.0",
34+
"node-fetch-native": "^0.1.4",
3535
"p-limit": "^3.1.0",
3636
"rc9": "^1.2.2",
3737
"requrl": "^3.0.2",
@@ -43,7 +43,7 @@
4343
"@babel/preset-env": "latest",
4444
"@babel/preset-typescript": "latest",
4545
"@cyrilf/vue-dat-gui": "latest",
46-
"@nuxt/test-utils": "latest",
46+
"@nuxt/test-utils": "^0.2.2",
4747
"@nuxt/types": "latest",
4848
"@nuxt/typescript-build": "latest",
4949
"@nuxt/typescript-runtime": "latest",
@@ -58,6 +58,7 @@
5858
"babel-eslint": "latest",
5959
"eslint": "latest",
6060
"jest": "latest",
61+
"jest-environment-jsdom": "^28.1.1",
6162
"jsdom": "latest",
6263
"jsdom-global": "latest",
6364
"mkdist": "latest",

src/generate.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ import { promisify } from 'util'
44
import stream from 'stream'
55
import { mkdirp } from 'fs-extra'
66
import { dirname, join, relative, basename, trimExt } from 'upath'
7-
import fetch from 'node-fetch'
7+
import { fetch } from 'node-fetch-native'
88
import { joinURL, hasProtocol, parseURL, withoutTrailingSlash } from 'ufo'
99
import pLimit from 'p-limit'
1010
import { ModuleOptions, MapToStatic, ResolvedImage } from './types'
1111
import { hash, logger, guessExt } from './utils'
1212

13-
const pipeline = promisify(stream.pipeline)
14-
1513
export function setupStaticGeneration (nuxt: any, options: ModuleOptions) {
1614
const staticImages: Record<string, string> = {} // url ~> hashed file name
1715

@@ -50,13 +48,14 @@ export function setupStaticGeneration (nuxt: any, options: ModuleOptions) {
5048
})
5149
}
5250

51+
const pipeline = promisify(stream.pipeline)
5352
async function downloadImage ({ url, name, outDir }: { url: string, name: string, outDir: string }) {
5453
try {
5554
const response = await fetch(url)
5655
if (!response.ok) { throw new Error(`Unexpected response ${response.statusText}`) }
5756
const dstFile = join(outDir, name)
5857
await mkdirp(dirname(dstFile))
59-
await pipeline(response.body, createWriteStream(dstFile))
58+
await pipeline(response.body as any, createWriteStream(dstFile))
6059
logger.success('Generated static image ' + relative(process.cwd(), dstFile))
6160
} catch (error: any) {
6261
logger.error(error?.message)

src/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const imageModule: Module<ModuleOptions> = async function imageModule (moduleOpt
8888
setupStaticGeneration(nuxt, options)
8989
})
9090

91-
const cache = new LruCache()
91+
const cache = new LruCache({ max: 1000 })
9292
nuxt.hook('vue-renderer:context', (ssrContext: any) => {
9393
ssrContext.cache = cache
9494
})

0 commit comments

Comments
 (0)