Skip to content

Commit 4e852ad

Browse files
committed
docs: document new hooks
1 parent e3cb991 commit 4e852ad

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

docs/pnpmfile.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,43 @@ module.exports = {
137137
There are none - anything that can be done with the lockfile can be modified via
138138
this function, and you can even extend the lockfile's functionality.
139139

140+
### `hooks.preResolution(options): Promise<void>`
141+
142+
This hook is executed after reading and parsing the lockfiles of the project, but before resolving dependencies. It allows modifications to the lockfile objects.
143+
144+
#### Arguments
145+
146+
* `options.existsCurrentLockfile` - A boolean that is true if the lockfile at `node_modules/.pnpm/lock.yaml` exists.
147+
* `options.currentLockfile` - The lockfile object from `node_modules/.pnpm/lock.yaml`.
148+
* `options.existsNonEmptyWantedLockfile` - A boolean that is true if the lockfile at `pnpm-lock.yaml` exists.
149+
* `options.wantedLockfile` - The lockfile object from `pnpm-lock.yaml`.
150+
* `options.lockfileDir` - The directory where the wanted lockfile is found.
151+
* `options.storeDir` - The location of the store directory.
152+
* `options.registries` - A map of scopes to registry URLs.
153+
154+
### `hooks.importPackage(destinationDir, options): Promise<string | undefined>`
155+
156+
This hook allows to change how packages are written to `node_modules`. The return value is optional and states what method was used for importing the dependency, e.g.: clone, hardlink.
157+
158+
#### Arguments
159+
160+
* `destinationDir` - The destination directory where the package should be written.
161+
* `options.disableRelinkLocalDirDeps`
162+
* `options.filesMap`
163+
* `options.force`
164+
* `options.resolvedFrom`
165+
* `options.keepModulesDir`
166+
167+
### `hooks.fetchers`
168+
169+
This hook allows to override the fetchers that are used for different types of dependencies. It is an object that may have the following fields:
170+
171+
* `localTarball`
172+
* `remoteTarball`
173+
* `gitHostedTarball`
174+
* `directory`
175+
* `git`
176+
140177
## Related Configuration
141178

142179
### ignore-pnpmfile

0 commit comments

Comments
 (0)