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.5.0 to 0.6.0

2

package.json

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

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

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

@@ -1,2 +0,1 @@

import os from 'os';

@@ -14,20 +13,47 @@ import mod from 'module';

// eslint-disable-next-line prefer-destructuring
const globalPaths = mod.globalPaths;
const globalPackages = Object.keys(dirs)
.reduce((acc, manager) => acc.concat(dirs[manager].packages), [])
.concat(mod.globalPaths.slice(0, -1));
.concat(globalPaths.slice(0, -1));
const globalBinaries = globalPackages.map((x) => {
// tweak the NVM dirs,
// We should not append `.bin` to the `./node/vX.X.X/lib/node_modules`
// but instead the bins are in the `./node/vX.X.X/bin`
const start = path.join(HOMEDIR, '.nvm', 'versions', 'node');
const end = path.join('lib', '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];
if (x.startsWith(start) && x.endsWith(end)) {
// So we up until `./node/vX.X.X` and join bin
return path.join(path.dirname(path.dirname(x)), 'bin');
}
return path.join(x, '.bin');
});
// So we dirname two times and then join "pnpm-global/1/node_modules"
const nvmVersion = path.dirname(path.dirname(nvmCurrent));
// Another note is that this node_modules directory don't have `.bin` dir
// inside of it, similar to the NVM's `vX.X.X/lib/node_modules` one.
// PNPM uses the default Npm/NVM global bin directory and
// as far as I know, it cannot be changed.
// Only the pnpm-store path can be changed.
const pnpmGlobal = path.join(nvmVersion, 'pnpm-global', '1', 'node_modules');
const globalBinaries = globalPackages
.concat(pnpmGlobal)
.map((x) => {
// Exclude from joining/appending `.bin`, because it uses
// the npm's global bin which we already have and handle.
if (x.includes('pnpm-global')) {
return null;
}
// tweak the NVM dirs,
// We should not append `.bin` to the `./node/vX.X.X/lib/node_modules`
// but instead the bins are in the `./node/vX.X.X/bin`
const start = path.join(HOMEDIR, '.nvm', 'versions', 'node');
const end = path.join('lib', 'node_modules');
if (x.startsWith(start) && x.endsWith(end)) {
// So we up until `./node/vX.X.X` and join bin
return path.join(path.dirname(path.dirname(x)), 'bin');
}
return path.join(x, '.bin');
})
.filter(Boolean);
const globalModules = {

@@ -34,0 +60,0 @@ packages: globalPackages,

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