feat: allow loading preResolution, importPackage, and fetchers from local pnpmfile (#9450)

This commit is contained in:
Zoltan Kochan authored and GitHub committed 2025-04-23 12:11:08 +02:00
1 parent 7a2d7a18ed
commit e5c58f093f
2 files changed
+9 -3

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
---
"@pnpm/pnpmfile": minor
"pnpm": minor
---
Allow loading the `preResolution`, `importPackage`, and `fetchers` hooks from local pnpmfile.
+3 -3
View File
@@ -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) => {