Skip to content

Commit f5a253f

Browse files
committed
chore(deps): update lru-cache to v10
ref #9267
1 parent 856dadb commit f5a253f

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

packages/compiler-sfc/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@
4646
"devDependencies": {
4747
"@babel/types": "^7.22.19",
4848
"@types/estree": "^0.0.52",
49-
"@types/lru-cache": "^5.1.1",
5049
"@vue/consolidate": "^0.17.3",
5150
"hash-sum": "^2.0.0",
52-
"lru-cache": "^5.1.1",
51+
"lru-cache": "^10.0.1",
5352
"merge-source-map": "^1.1.0",
5453
"minimatch": "^9.0.3",
5554
"postcss-modules": "^4.3.1",

packages/compiler-sfc/src/cache.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import LRU from 'lru-cache'
1+
import { LRUCache } from 'lru-cache'
22

3-
export function createCache<T>(size = 500): Map<string, T> & { max?: number } {
3+
export function createCache<T extends {}>(
4+
max = 500
5+
): Map<string, T> | LRUCache<string, T> {
46
if (__GLOBAL__ || __ESM_BROWSER__) {
57
return new Map<string, T>()
68
}
7-
const cache = new LRU(size)
8-
// @ts-expect-error
9-
cache.delete = cache.del.bind(cache)
10-
return cache as any as Map<string, T>
9+
return new LRUCache({ max })
1110
}

pnpm-lock.yaml

+2-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)