From f5a253f69f9a2d6a141839675d0e32f145471afd Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 20 Oct 2023 10:37:39 +0800 Subject: [PATCH] chore(deps): update lru-cache to v10 ref #9267 --- packages/compiler-sfc/package.json | 3 +-- packages/compiler-sfc/src/cache.ts | 11 +++++------ pnpm-lock.yaml | 11 ++--------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/packages/compiler-sfc/package.json b/packages/compiler-sfc/package.json index a985b60315d..6d4a99e23fd 100644 --- a/packages/compiler-sfc/package.json +++ b/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", diff --git a/packages/compiler-sfc/src/cache.ts b/packages/compiler-sfc/src/cache.ts index 36d240810c7..f04b231f6d9 100644 --- a/packages/compiler-sfc/src/cache.ts +++ b/packages/compiler-sfc/src/cache.ts @@ -1,11 +1,10 @@ -import LRU from 'lru-cache' +import { LRUCache } from 'lru-cache' -export function createCache(size = 500): Map & { max?: number } { +export function createCache( + max = 500 +): Map | LRUCache { if (__GLOBAL__ || __ESM_BROWSER__) { return new Map() } - const cache = new LRU(size) - // @ts-expect-error - cache.delete = cache.del.bind(cache) - return cache as any as Map + return new LRUCache({ max }) } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 03aee7ec301..bfd39cc2dbf 100644 --- a/pnpm-lock.yaml +++ b/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