Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Sep 21, 2023
1 parent 04cc947 commit 61af22a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
1 change: 0 additions & 1 deletion packages/compiler-sfc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"devDependencies": {
"@babel/types": "^7.22.19",
"@types/estree": "^0.0.52",
"@types/lru-cache": "^5.1.1",
"@vue/consolidate": "^0.17.3",
"hash-sum": "^2.0.0",
"lru-cache": "^10.0.1",
Expand Down
12 changes: 6 additions & 6 deletions packages/compiler-sfc/src/cache.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import LRU from 'lru-cache'
import { LRUCache } from 'lru-cache'

export function createCache<T>(size = 500): Map<string, T> & { max?: number } {
export function createCache<T extends {}>(
max = 500
): Map<string, T> | LRUCache<string, T> {
if (__GLOBAL__ || __ESM_BROWSER__) {
return new Map<string, T>()
}
const cache = new LRU(size)
// @ts-expect-error
cache.delete = cache.del.bind(cache)
return cache as any as Map<string, T>
const cache = new LRUCache<string, T>({ max })
return cache
}
7 changes: 0 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 61af22a

Please sign in to comment.