Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
@yarnpkg/pnp
Advanced tools
@yarnpkg/pnp is a package that provides Plug'n'Play (PnP) functionality for Yarn, a popular JavaScript package manager. PnP is a feature that eliminates the need for a node_modules directory by resolving dependencies directly from the Yarn cache, leading to faster installs and more efficient disk usage.
Dependency Resolution
This feature allows you to resolve the path to a dependency without needing a node_modules directory. The code sample demonstrates how to resolve the path to the 'lodash' package.
const { resolveToUnqualified, resolveUnqualified } = require('@yarnpkg/pnp');
const unqualifiedPath = resolveToUnqualified('lodash', __filename);
const qualifiedPath = resolveUnqualified(unqualifiedPath, 'lodash');
console.log(qualifiedPath);
Package Information
This feature provides detailed information about a specific package, such as its location and dependencies. The code sample shows how to retrieve information for the 'lodash' package.
const { getPackageInformation } = require('@yarnpkg/pnp');
const packageLocator = { name: 'lodash', reference: '4.17.21' };
const packageInfo = getPackageInformation(packageLocator);
console.log(packageInfo);
Custom Resolvers
This feature allows you to create custom resolvers for specific packages. The code sample demonstrates how to create a custom resolver for a package named 'custom-package'.
const { makeResolver } = require('@yarnpkg/pnp');
const customResolver = makeResolver({
resolveToUnqualified: (request, issuer) => {
if (request === 'custom-package') {
return '/path/to/custom-package';
}
return null;
}
});
console.log(customResolver.resolveToUnqualified('custom-package', __filename));
npm is the default package manager for Node.js. Unlike @yarnpkg/pnp, npm uses a node_modules directory to store dependencies, which can lead to slower installs and more disk usage.
pnpm is a fast, disk space-efficient package manager. It uses a content-addressable file system to store all files from all module directories in a single place, which is somewhat similar to PnP's approach of avoiding node_modules.
Rush is a scalable monorepo manager for the web. It supports multiple package managers, including Yarn with PnP, and focuses on managing large repositories with many projects.
3.2.1
node_modules
directory, when node-modules
linker is activesupportedArchitectures
FAQs
Unknown package
The npm package @yarnpkg/pnp receives a total of 153,874 weekly downloads. As such, @yarnpkg/pnp popularity was classified as popular.
We found that @yarnpkg/pnp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.