* feat: replace a config This is a test commit to see if CI fails * feat: `strictPatches` * docs: future instruction * feat: `strictPatches` → `allowPatchFailure` * docs(changeset): correction * test: getOptionsFromRootManifest * fix: allowFailure * feat: groupPatchedDependencies * fix: update code after merge * fix: star spec * feat: error on invalid ranges * fix: eslint * docs: change task * feat(patching): version ranges * fix: `verifyPatches` * refactor: move types to `@pnpm/patching.types` * docs(changeset): add missing package * refactor: move `verifyPatches` to `@pnpm/patching.config` * test: fix * feat: change error message of unused patches * refactor: exact options into an interface * test(patching): version range * test(patching): allowPatchFailure * docs: change wording * docs: change wording * test(patching): version range error * test(patching): legacy behavior * test: don't use star * test(patching): strict versionless * test: strictPatches * chore(deps): `@pnpm/logger` must be peer * docs: fix grammar * refactor: rename `blank` to `all` * refactor: use string * refactor: use array for `PatchGroup.range` * refactor: stop re-exporting `allPatchKeys` * feat: re-export `PatchGroupRangeItem` * refactor: move error creation into a class * docs: replace "versionless" with "name-only" * docs: coherent wordings * test: exact version overrides range conflict * test: tweak * docs: consistent wordings * docs: correct wordings * refactor: rename `allowPatchFailure` to `ignorePatchFailures` * feat: replace `strictPatches` with `ignorePatchFailures` * docs: legacy behavior * feat: introduce `allowUnusedPatches` * docs(changeset): update * docs: remove outdated comment * docs: backward-compatibility
@pnpm/core
Fast, disk space efficient installation engine. Used by pnpm
Install
Install it via npm.
pnpm add @pnpm/core
It also depends on @pnpm/logger version 1, so install it as well via:
pnpm add @pnpm/logger@1
API
mutateModules(importers, options)
TODO
link(linkFromPkgs, linkToModules, [options])
Create symbolic links from the linked packages to the target package's node_modules (and its node_modules/.bin).
Arguments:
linkFromPkgs- String[] - paths to the packages that should be linked.linkToModules- String - path to the dependent package'snode_modulesdirectory.options.reporter- Function - A function that listens for logs.
linkToGlobal(linkFrom, options)
Create a symbolic link from the specified package to the global node_modules.
Arguments:
linkFrom- String - path to the package that should be linked.globalDir- String - path to the global directory.options.reporter- Function - A function that listens for logs.
linkFromGlobal(pkgNames, linkTo, options)
Create symbolic links from the global pkgNames to the linkTo/node_modules folder.
Arguments:
pkgNames- String[] - packages to link.linkTo- String - package to link to.globalDir- String - path to the global directory.options.reporter- Function - A function that listens for logs.
storeStatus([options])
Return the list of modified dependencies.
Arguments:
options.reporter- Function - A function that listens for logs.
Returns: Promise<string[]> - the paths to the modified packages of the current project. The paths contain the location of packages in the store,
not in the projects node_modules folder.
storePrune([options])
Remove unreferenced packages from the store.
Hooks
Hooks are functions that can step into the installation process.
readPackage(pkg: Manifest): Manifest | Promise<Manifest>
This hook is called with every dependency's manifest information.
The modified manifest returned by this hook is then used by @pnpm/core during installation.
An async function is supported.
Example:
const { installPkgs } = require('@pnpm/core')
installPkgs({
hooks: {readPackage}
})
function readPackage (pkg) {
if (pkg.name === 'foo') {
pkg.dependencies = {
bar: '^2.0.0',
}
}
return pkg
}
afterAllResolved(lockfile: Lockfile): Lockfile | Promise<Lockfile>
This hook is called after all dependencies are resolved. It receives and returns the resolved lockfile object. An async function is supported.