MCPcopy Create free account
hub / github.com/EvoMap/evolver / _scanVersionedNodeModules

Function _scanVersionedNodeModules

src/adapters/scripts/_runtimePaths.js:40–59  ·  view source on GitHub ↗
(versionsDir, subdir, out)

Source from the content-addressed store, hash-verified

38// active version is preferred when a user has multiple Node versions
39// installed.
40function _scanVersionedNodeModules(versionsDir, subdir, out) {
41 let entries;
42 try {
43 entries = fs.readdirSync(versionsDir, { withFileTypes: true });
44 } catch {
45 return;
46 }
47 const dirs = entries
48 .filter((e) => e.isDirectory && e.isDirectory())
49 .map((e) => {
50 const full = path.join(versionsDir, e.name);
51 let mtime = 0;
52 try { mtime = fs.statSync(full).mtimeMs; } catch {}
53 return { full, mtime };
54 })
55 .sort((a, b) => b.mtime - a.mtime);
56 for (const d of dirs) {
57 out.push(path.join(d.full, subdir, 'node_modules'));
58 }
59}
60
61// Build the require.resolve paths array. All entries are user/system-scoped
62// install roots — process.cwd() is intentionally excluded for the same

Callers 1

_buildInstallSearchPathsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected