Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

all-module-paths

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

all-module-paths - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

2

package.json

@@ -35,3 +35,3 @@ {

"typings": "src/index.d.ts",
"version": "0.6.0",
"version": "0.7.0",
"repository": "tunnckoCoreLabs/all-module-paths",

@@ -38,0 +38,0 @@ "homepage": "https://github.com/tunnckoCoreLabs/all-module-paths",

@@ -13,17 +13,27 @@ import os from 'os';

// Maximum up to the home directory
// eslint-disable-next-line prefer-destructuring
const globalPaths = mod.globalPaths;
const globalPaths = mod.globalPaths
.filter((x) => x.startsWith(HOMEDIR))
.filter((x) => {
const fp = path.join('pnpm-global', '1', 'node_modules');
const globalPackages = Object.keys(dirs)
.reduce((acc, manager) => acc.concat(dirs[manager].packages), [])
.concat(globalPaths.slice(0, -1));
return (x.includes(fp) && x.endsWith(fp)) || !x.includes(fp);
})
.filter((x) => !x.includes(path.join('pnpm-global', 'node_modules')));
// Note: Be careful, if node changes the positions order
// Basically the last element of the globalPaths array
// is the `~/.nvm/versions/node/v10.13.0/lib/node_modules`
const nvmCurrent = globalPaths[globalPaths.length - 1];
// is always the `~/.nvm/versions/node/v10.13.0/lib/node_modules`
// or, strangely, `~/.nvm/versions/node/v10.13.0/lib/node`
const nvmModules = globalPaths[globalPaths.length - 1];
// So we dirname two times and then join "pnpm-global/1/node_modules"
const nvmVersion = path.dirname(path.dirname(nvmCurrent));
const nvmCurrent = path.dirname(path.dirname(nvmModules));
// Intentionally getting the NVM_DIR that way,
// Take care! Might not be cross-platform and
// probably better way is to be reading the env.
const nvmDir = path.dirname(path.dirname(path.dirname(nvmCurrent)));
// Another note is that this node_modules directory don't have `.bin` dir

@@ -34,6 +44,29 @@ // inside of it, similar to the NVM's `vX.X.X/lib/node_modules` one.

// Only the pnpm-store path can be changed.
const pnpmGlobal = path.join(nvmVersion, 'pnpm-global', '1', 'node_modules');
const pnpmGlobal = path.join(nvmCurrent, 'pnpm-global', '1', 'node_modules');
// Always first all the "official" global paths,
// it's mostly always a short array of few items paths.
// That ensures that the nvm's global dir is always last item.
// We also filtering out the `vX.X.X/node_modules`, because such never exist.
const globalPackages = globalPaths
.filter((x) => !x.endsWith(path.join(nvmCurrent, 'node_modules')))
.filter((x) => {
if (!x.startsWith(nvmDir)) {
return true;
}
const start = x.startsWith(nvmDir);
return (
(start && x.endsWith(pnpmGlobal)) ||
x.includes(path.join(nvmCurrent, 'lib'))
);
})
.slice(0, -1)
.concat(
Object.keys(dirs).reduce(
(acc, manager) => acc.concat(dirs[manager].packages),
[],
),
);
const globalBinaries = globalPackages
.concat(pnpmGlobal)
.map((x) => {

@@ -40,0 +73,0 @@ // Exclude from joining/appending `.bin`, because it uses

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc