From 6927a92ad3b0eeed9845e65165704f8ab6a8a9e5 Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 27 Mar 2025 14:16:16 -0400 Subject: [PATCH] Improve comments in linker plugin --- .yarn/plugins/linker.cjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.yarn/plugins/linker.cjs b/.yarn/plugins/linker.cjs index 9172a206..cf7181f9 100644 --- a/.yarn/plugins/linker.cjs +++ b/.yarn/plugins/linker.cjs @@ -9,6 +9,9 @@ module.exports = { name: "linker", factory: (require) => ({ hooks: { + // Yarn's plugin system is very light on documentation. The best we have + // for this hook is simply the type definition in + // https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-core/sources/Plugin.ts registerPackageExtensions: async (config, registerPackageExtension) => { const { structUtils } = require("@yarnpkg/core"); const { parseSyml } = require("@yarnpkg/parsers"); @@ -56,10 +59,11 @@ module.exports = { structUtils.parseDescriptor(`${name}@*`, true).identHash, ); + // Extend our own package's dependencies with these local overrides registerPackageExtension(selfDescriptor, { dependencies: overrides }); // Filter out the original dependencies from the package spec so Yarn - // knows to override them + // actually respects the overrides const filterDependencies = (original) => { const pkg = structUtils.copyPackage(original); pkg.dependencies = new Map( @@ -70,7 +74,7 @@ module.exports = { return pkg; }; - // Patch Yarn's own normalizePackage method with the above filter + // Patch Yarn's own normalizePackage method to use the above filter const originalNormalizePackage = config.normalizePackage; config.normalizePackage = function (pkg, extensions) { return originalNormalizePackage.call(