Explorar o código

chore(deps): update lru-cache to v10

ref #9267
Evan You %!s(int64=2) %!d(string=hai) anos
pai
achega
f5a253f69f
Modificáronse 3 ficheiros con 8 adicións e 17 borrados
  1. 1 2
      packages/compiler-sfc/package.json
  2. 5 6
      packages/compiler-sfc/src/cache.ts
  3. 2 9
      pnpm-lock.yaml

+ 1 - 2
packages/compiler-sfc/package.json

@@ -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",

+ 5 - 6
packages/compiler-sfc/src/cache.ts

@@ -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 })
 }

+ 2 - 9
pnpm-lock.yaml

@@ -223,9 +223,6 @@ importers:
       '@types/estree':
         specifier: ^0.0.52
         version: 0.0.52
-      '@types/lru-cache':
-        specifier: ^5.1.1
-        version: 5.1.1
       '@vue/consolidate':
         specifier: ^0.17.3
         version: 0.17.3
@@ -233,8 +230,8 @@ importers:
         specifier: ^2.0.0
         version: 2.0.0
       lru-cache:
-        specifier: ^5.1.1
-        version: 5.1.1
+        specifier: ^10.0.1
+        version: 10.0.1
       merge-source-map:
         specifier: ^1.1.0
         version: 1.1.0
@@ -1584,10 +1581,6 @@ packages:
     resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==}
     dev: true
 
-  /@types/lru-cache@5.1.1:
-    resolution: {integrity: sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw==}
-    dev: true
-
   /@types/node@18.18.5:
     resolution: {integrity: sha512-4slmbtwV59ZxitY4ixUZdy1uRLf9eSIvBWPQxNjhHYWEtn0FryfKpyS2cvADYXTayWdKEIsJengncrVvkI4I6A==}
     dev: true