MCPcopy Create free account
hub / github.com/npm/cli / parseGraphRecursive

Function parseGraphRecursive

workspaces/arborist/test/isolated-mode.js:2842–2853  ·  view source on GitHub ↗
(key, deps)

Source from the content-addressed store, hash-verified

2840}
2841
2842function parseGraphRecursive (key, deps) {
2843 if (isLoopToken(key)) {
2844 return key
2845 }
2846 const name = /^(.[^@]*)@/.exec(key)[1]
2847 const version = /^.[^@]*@([^ ]*)/.exec(key)[1]
2848 const workspace = / \(workspace\)/.test(key)
2849 const peer = / \(peer\)/.test(key)
2850 const normalizedDeps = typeof deps === 'string' ? { [deps]: {} } : deps
2851 const dependencies = Object.entries(normalizedDeps).map(([key, value]) => parseGraphRecursive(key, value))
2852 return { name, version, workspace, peer, dependencies }
2853}
2854
2855tap.test('undeclared workspaces are not hoisted to root node_modules', async t => {
2856 // Regression test: all workspace packages were unconditionally symlinked into root node_modules/.

Callers 1

parseGraphFunction · 0.85

Calls 2

isLoopTokenFunction · 0.85
execMethod · 0.45

Tested by

no test coverage detected