Skip to content

Commit 8dd0b11

Browse files
author
Guillaume Chau
committed
fix: expire env maps, closes vuejs#1906
1 parent a115151 commit 8dd0b11

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/@vue/cli-shared-utils/lib/env.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
const { execSync } = require('child_process')
22
const fs = require('fs')
33
const path = require('path')
4+
const LRU = require('lru-cache')
45

56
let _hasYarn
6-
const _yarnProjects = new Map()
7+
const _yarnProjects = new LRU({
8+
max: 10,
9+
maxAge: 1000
10+
})
711
let _hasGit
8-
const _gitProjects = new Map()
12+
const _gitProjects = new LRU({
13+
max: 10,
14+
maxAge: 1000
15+
})
916

1017
// env detection
1118
exports.hasYarn = () => {

packages/@vue/cli-shared-utils/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"execa": "^0.10.0",
2424
"joi": "^13.0.0",
2525
"launch-editor": "^2.2.1",
26+
"lru-cache": "^4.1.3",
2627
"node-ipc": "^9.1.1",
2728
"opn": "^5.3.0",
2829
"ora": "^2.1.0",

0 commit comments

Comments
 (0)