Skip to content

Commit 0a552a1

Browse files
committed
fix
1 parent dcca710 commit 0a552a1

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

packages/compiler-sfc/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
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",
5251
"lru-cache": "^10.0.1",

packages/compiler-sfc/src/cache.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
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+
size = 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+
const cache = new LRUCache<string, T>({
10+
max: size
11+
})
12+
return cache
1113
}

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)