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

dependency-path

Package Overview
Dependencies
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dependency-path - npm Package Compare versions

Comparing version 9.0.0 to 9.1.0

4

lib/index.d.ts

@@ -23,1 +23,5 @@ import { Registries } from '@pnpm/types';

export declare function depPathToFilename(depPath: string): string;
export declare function createPeersFolderSuffix(peers: Array<{
name: string;
version: string;
}>): string;

33

lib/index.js

@@ -6,5 +6,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.depPathToFilename = exports.parse = exports.refToRelative = exports.relative = exports.getRegistryByPackageName = exports.refToAbsolute = exports.tryGetPackageId = exports.resolve = exports.isAbsolute = void 0;
exports.createPeersFolderSuffix = exports.depPathToFilename = exports.parse = exports.refToRelative = exports.relative = exports.getRegistryByPackageName = exports.refToAbsolute = exports.tryGetPackageId = exports.resolve = exports.isAbsolute = void 0;
const crypto_1 = __importDefault(require("crypto"));
const encode_registry_1 = __importDefault(require("encode-registry"));
const rfc4648_1 = require("rfc4648");
const semver_1 = __importDefault(require("semver"));

@@ -19,3 +20,4 @@ function isAbsolute(dependencyPath) {

if (resolutionLocation[1] === '@') {
const scope = resolutionLocation.substr(1, resolutionLocation.indexOf('/', 1) - 1);
const slashIndex = resolutionLocation.indexOf('/', 1);
const scope = resolutionLocation.slice(1, slashIndex !== -1 ? slashIndex : 0);
registryUrl = registries[scope] || registries.default;

@@ -38,3 +40,3 @@ }

if (underscoreIndex !== -1) {
return resolve(registries, relDepPath.substr(0, underscoreIndex));
return resolve(registries, relDepPath.slice(0, underscoreIndex));
}

@@ -61,3 +63,3 @@ return resolve(registries, relDepPath);

return registries.default;
const scope = packageName.substr(0, packageName.indexOf('/'));
const scope = packageName.substring(0, packageName.indexOf('/'));
return registries[scope] || registries.default;

@@ -69,3 +71,3 @@ }

if (absoluteResolutionLoc.startsWith(`${registryName}/`)) {
return absoluteResolutionLoc.substr(absoluteResolutionLoc.indexOf('/'));
return absoluteResolutionLoc.slice(absoluteResolutionLoc.indexOf('/'));
}

@@ -132,3 +134,3 @@ return absoluteResolutionLoc;

if (filename.length > 120 || filename !== filename.toLowerCase() && !filename.startsWith('file+')) {
return `${filename.substring(0, 50)}_${crypto_1.default.createHash('md5').update(filename).digest('hex')}`;
return `${filename.substring(0, 50)}_${createBase32Hash(filename)}`;
}

@@ -144,6 +146,23 @@ return filename;

const index = depPath.lastIndexOf('/');
return `${depPath.substring(0, index)}@${depPath.substr(index + 1)}`;
return `${depPath.substring(0, index)}@${depPath.slice(index + 1)}`;
}
return depPath.replace(':', '+');
}
function createPeersFolderSuffix(peers) {
const folderName = peers.map(({ name, version }) => `${name.replace('/', '+')}@${version}`).sort().join('+');
// We don't want the folder name to get too long.
// Otherwise, an ENAMETOOLONG error might happen.
// see: https://github.com/pnpm/pnpm/issues/977
//
// A bigger limit might be fine but the base32 encoded md5 hash will be 26 symbols,
// so for consistency's sake, we go with 26.
if (folderName.length > 26) {
return `_${createBase32Hash(folderName)}`;
}
return `_${folderName}`;
}
exports.createPeersFolderSuffix = createPeersFolderSuffix;
function createBase32Hash(str) {
return rfc4648_1.base32.stringify(crypto_1.default.createHash('md5').update(str).digest()).replace(/(=+)$/, '').toLowerCase();
}
//# sourceMappingURL=index.js.map
{
"name": "dependency-path",
"version": "9.0.0",
"version": "9.1.0",
"description": "Utilities for working with symlinked node_modules",

@@ -29,2 +29,3 @@ "main": "lib/index.js",

"encode-registry": "^3.0.0",
"rfc4648": "^1.5.1",
"semver": "^7.3.4"

@@ -34,3 +35,3 @@ },

"@types/semver": "^7.3.4",
"dependency-path": "9.0.0"
"dependency-path": "9.1.0"
},

@@ -37,0 +38,0 @@ "funding": "https://opencollective.com/pnpm",

Sorry, the diff of this file is not supported yet

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