From 9908ed4d6bc80cf3000ada580ea7b95284ed568d Mon Sep 17 00:00:00 2001 From: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> Date: Thu, 1 Dec 2022 08:58:26 +0800 Subject: [PATCH] review --- .../package.json | 2 +- .../src/index.ts | 2 +- yarn.lock | 37 ++++++++++++++----- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/packages/babel-helper-compilation-targets/package.json b/packages/babel-helper-compilation-targets/package.json index a283249a6d20..3f925b8467e0 100644 --- a/packages/babel-helper-compilation-targets/package.json +++ b/packages/babel-helper-compilation-targets/package.json @@ -25,7 +25,7 @@ "@babel/compat-data": "workspace:^", "@babel/helper-validator-option": "workspace:^", "browserslist": "^4.21.3", - "lru-cache": "^5.1.1", + "lru-cache": "condition:BABEL_8_BREAKING ? ^7.14.1 : ^5.1.1", "semver": "condition:BABEL_8_BREAKING ? ^7.3.4 : ^6.3.0" }, "peerDependencies": { diff --git a/packages/babel-helper-compilation-targets/src/index.ts b/packages/babel-helper-compilation-targets/src/index.ts index ba0f830d5a0d..f93194611deb 100644 --- a/packages/babel-helper-compilation-targets/src/index.ts +++ b/packages/babel-helper-compilation-targets/src/index.ts @@ -170,7 +170,7 @@ function resolveTargets(queries: Browsers, env?: string): Targets { return getLowestVersions(resolved); } -const targetsCache = new LruCache(64); +const targetsCache = new LruCache({ max: 64 }); function resolveTargetsCached(queries: Browsers, env?: string): Targets { const cacheKey = typeof queries === "string" ? queries : queries.join() + env; diff --git a/yarn.lock b/yarn.lock index c300c84c21e8..e940a46144e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -555,7 +555,7 @@ __metadata: "@types/lru-cache": ^5.1.1 "@types/semver": ^5.5.0 browserslist: ^4.21.3 - lru-cache: ^5.1.1 + lru-cache: "condition:BABEL_8_BREAKING ? ^7.14.1 : ^5.1.1" semver: "condition:BABEL_8_BREAKING ? ^7.3.4 : ^6.3.0" peerDependencies: "@babel/core": ^7.0.0 @@ -11168,6 +11168,32 @@ fsevents@^1.2.7: languageName: node linkType: hard +"lru-cache-BABEL_8_BREAKING-false@npm:lru-cache@^5.1.1, lru-cache@npm:^5.1.1": + version: 5.1.1 + resolution: "lru-cache@npm:5.1.1" + dependencies: + yallist: ^3.0.2 + checksum: c154ae1cbb0c2206d1501a0e94df349653c92c8cbb25236d7e85190bcaf4567a03ac6eb43166fabfa36fd35623694da7233e88d9601fbf411a9a481d85dbd2cb + languageName: node + linkType: hard + +"lru-cache-BABEL_8_BREAKING-true@npm:lru-cache@^7.14.1": + version: 7.14.1 + resolution: "lru-cache@npm:7.14.1" + checksum: d72c6713c6a6d86836a7a6523b3f1ac6764768cca47ec99341c3e76db06aacd4764620e5e2cda719a36848785a52a70e531822dc2b33fb071fa709683746c104 + languageName: node + linkType: hard + +"lru-cache@condition:BABEL_8_BREAKING ? ^7.14.1 : ^5.1.1": + version: 0.0.0-condition-86c673 + resolution: "lru-cache@condition:BABEL_8_BREAKING?^7.14.1:^5.1.1#86c673" + dependencies: + lru-cache-BABEL_8_BREAKING-false: "npm:lru-cache@^5.1.1" + lru-cache-BABEL_8_BREAKING-true: "npm:lru-cache@^7.14.1" + checksum: 9a90e9b7fff14a71bd363ac5e40cea193f2da3380ca92d012589d3da49cc6af9c9a8399fc59b57b206e62753347ff4d77769a1e3bc0dd5550f3a8225a1a78a9a + languageName: node + linkType: hard + "lru-cache@npm:^4.0.1": version: 4.1.5 resolution: "lru-cache@npm:4.1.5" @@ -11178,15 +11204,6 @@ fsevents@^1.2.7: languageName: node linkType: hard -"lru-cache@npm:^5.1.1": - version: 5.1.1 - resolution: "lru-cache@npm:5.1.1" - dependencies: - yallist: ^3.0.2 - checksum: c154ae1cbb0c2206d1501a0e94df349653c92c8cbb25236d7e85190bcaf4567a03ac6eb43166fabfa36fd35623694da7233e88d9601fbf411a9a481d85dbd2cb - languageName: node - linkType: hard - "lru-cache@npm:^6.0.0": version: 6.0.0 resolution: "lru-cache@npm:6.0.0"