mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-24 07:38:12 -05:00
feat: allow loading preResolution, importPackage, and fetchers from local pnpmfile (#9450)
This commit is contained in:
6
.changeset/mighty-horses-love.md
Normal file
6
.changeset/mighty-horses-love.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/pnpmfile": minor
|
||||
"pnpm": minor
|
||||
---
|
||||
|
||||
Allow loading the `preResolution`, `importPackage`, and `fetchers` hooks from local pnpmfile.
|
||||
@@ -72,15 +72,15 @@ export function requireHooks (
|
||||
|
||||
// `importPackage`, `preResolution` and `fetchers` can only be defined via a global pnpmfile
|
||||
|
||||
cookedHooks.importPackage = globalHooks.importPackage
|
||||
cookedHooks.importPackage = hooks.importPackage ?? globalHooks.importPackage
|
||||
|
||||
const preResolutionHook = globalHooks.preResolution
|
||||
const preResolutionHook = hooks.preResolution ?? globalHooks.preResolution
|
||||
|
||||
cookedHooks.preResolution = preResolutionHook
|
||||
? (ctx: PreResolutionHookContext) => preResolutionHook(ctx, createPreResolutionHookLogger(prefix))
|
||||
: undefined
|
||||
|
||||
cookedHooks.fetchers = globalHooks.fetchers
|
||||
cookedHooks.fetchers = hooks.fetchers ?? globalHooks.fetchers
|
||||
if (hooks.updateConfig != null) {
|
||||
const updateConfig = hooks.updateConfig
|
||||
cookedHooks.updateConfig = (config) => {
|
||||
|
||||
Reference in New Issue
Block a user