Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

Commit 691f71b

Browse files
committed
fixup! addressed CR
1 parent 5c50c0a commit 691f71b

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

lib/add-rm-pkg-deps.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ const addSingle = ({pkg, spec, saveBundle, saveType, path}) => {
5454

5555
pkg[type] = pkg[type] || {}
5656
if (rawSpec !== '' || pkg[type][name] === undefined) {
57-
// if we're in global mode, file specs are based on cwd, not arb path
57+
// file specs are based on arb path, directories specs
58+
// are normalized during build-ideal-tree instead
5859
pkg[type][name] = specType === 'file'
5960
? `file:${relpath(path, fetchSpec)}`
6061
: (rawSpec || '*')

lib/arborist/build-ideal-tree.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ const _globalStyle = Symbol('globalStyle')
8080
const _globalRootNode = Symbol('globalRootNode')
8181
const _isVulnerable = Symbol.for('isVulnerable')
8282
const _usePackageLock = Symbol.for('usePackageLock')
83-
const _rpcache = Symbol('realpathCache')
84-
const _stcache = Symbol('statCache')
83+
const _rpcache = Symbol.for('realpathCache')
84+
const _stcache = Symbol.for('statCache')
8585
const _followSymlinkPath = Symbol('followSymlinkPath')
8686
const _retrieveSpecName = Symbol('retrieveSpecName')
8787

@@ -139,8 +139,8 @@ module.exports = cls => class IdealTreeBuilder extends cls {
139139
// caches for cached realpath calls
140140
const cwd = process.cwd()
141141
// assume that the cwd is real enough for our purposes
142-
this[_rpcache] = new Map([[ cwd, cwd ]])
143-
this[_stcache] = new Map()
142+
this[_rpcache] = this[_rpcache] || new Map([[ cwd, cwd ]])
143+
this[_stcache] = this[_stcache] || new Map()
144144
}
145145

146146
get explicitRequests () {
@@ -377,7 +377,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
377377
}
378378

379379
async [_followSymlinkPath] (spec, currpath) {
380-
if(spec.type === 'directory') {
380+
if (spec.type === 'directory') {
381381
const real = await (
382382
realpath(spec.fetchSpec, this[_rpcache], this[_stcache])
383383
// TODO: create synthetic test case to simulate realpath failure

lib/arborist/load-actual.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ const _findMissingEdges = Symbol('findMissingEdges')
2424
const _findFSParents = Symbol('findFSParents')
2525

2626
const _actualTreeLoaded = Symbol('actualTreeLoaded')
27-
const _rpcache = Symbol('realpathCache')
28-
const _stcache = Symbol('statCache')
27+
const _rpcache = Symbol.for('realpathCache')
28+
const _stcache = Symbol.for('statCache')
2929
const _topNodes = Symbol('linkTargets')
3030
const _cache = Symbol('nodeLoadingCache')
3131
const _loadActual = Symbol('loadActual')

0 commit comments

Comments
 (0)