Skip to content

Commit

Permalink
chore(deps): update lru-cache to v10
Browse files Browse the repository at this point in the history
ref #9267
  • Loading branch information
yyx990803 committed Oct 20, 2023
1 parent 856dadb commit f5a253f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
3 changes: 1 addition & 2 deletions packages/compiler-sfc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@
"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": "^5.1.1",
"lru-cache": "^10.0.1",
"merge-source-map": "^1.1.0",
"minimatch": "^9.0.3",
"postcss-modules": "^4.3.1",
Expand Down
11 changes: 5 additions & 6 deletions packages/compiler-sfc/src/cache.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
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>
return new LRUCache({ max })
}
11 changes: 2 additions & 9 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 f5a253f

Please sign in to comment.