CodeVetter · Repo Unpack · Extension points
yarnpkg/berry
The Plugin type is the primary extension contract, with factories assembling runtime integrations. Typed configuration augmentation and ordered hooks allow cross-cutting behavior without expanding command implementations. Build profiles, shell builtins, and documentation plugins provide additional extension surfaces.
- A Plugin can contribute configuration, command classes, fetchers, linkers, resolvers, and hooks; plugin-constraints demonstrates ConfigurationValueMap augmentation with typed settings and defaults.
- CLI commands plug into each plugin’s commands array; initCommands iterates activated plugins and registers every contributed class with Clipanion.
- Configuration.makeResolver constructs plugin resolver instances behind VirtualResolver and WorkspaceResolver; NpmSemverResolver demonstrates supportsDescriptor/supportsLocator, candidate selection, satisfying checks, and metadata resolution.
- Configuration.makeFetcher composes builtin virtual/workspace fetchers with plugin fetchers; NpmSemverFetcher shows the cache loader pattern and filesystem/release/checksum result contract.
- New installation layouts implement Linker package/location lookup and makeInstaller; Installer separates installPackage, dependency attachment, finalization, retained fetch lifetimes, and migratable custom state.
- Hooks can modify script environments, wrap script/network execution, reduce dependency descriptors, and validate installs; triggerHook and reduceHook await contributors sequentially in plugin iteration order.
- Builder supports additional --plugin entries and named profiles; findPlugins accepts profile combinations separated by '+', validates them against manifest bundles, and deduplicates contributions.
- The portable shell accepts custom builtins, filesystem, environment, variables, and glob behavior; documentation extends separately through remark plugins, generated CLI docs, and TypeDoc entries discovered from package exports.