feat(config.reader): export getNetworkConfigs and getDefaultCreds#11471
Conversation
Expose the helpers that build the `configByUri` registry-config map from a flat rawConfig-style auth dict so that downstream consumers (e.g. third-party clients of `@pnpm/installing.client` / `@pnpm/store.connection-manager`) can produce the same configByUri shape pnpm itself uses, without re-implementing the parsing logic.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR exposes three previously internal utilities from ChangesPublic API Exports
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR makes existing, internally-used network/auth parsing helpers from @pnpm/config.reader available via the package’s public entrypoint, so downstream packages can build a configByUri map (and default creds) without re-implementing pnpm’s npmrc auth parsing logic.
Changes:
- Re-export
getNetworkConfigs,getDefaultCreds, and theNetworkConfigstype fromconfig/reader/src/index.ts. - Add a changeset to publish
@pnpm/config.readeras a minor version bump reflecting the new public exports.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| config/reader/src/index.ts | Re-exports network config helpers/types from the public module entrypoint. |
| .changeset/export-network-configs.md | Declares a minor release and documents the newly exported API surface. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…1471) Expose the helpers that build the `configByUri` registry-config map from a flat rawConfig-style auth dict so that downstream consumers (e.g. third-party clients of `@pnpm/installing.client` / `@pnpm/store.connection-manager`) can produce the same configByUri shape pnpm itself uses, without re-implementing the parsing logic.
Summary
getNetworkConfigs,getDefaultCreds, and theNetworkConfigstype from@pnpm/config.reader.getNetworkConfigs.tsand are used internally bygetConfigto buildpnpmConfig.configByUri. They're shipped tolib/but blocked from deep imports by the package'sexportsfield.Motivation
Downstream consumers of
@pnpm/installing.clientand@pnpm/store.connection-managerneed to provide aconfigByUri: Record<string, RegistryConfig>argument. The only way to derive that map from a flat npmrc-style auth dict (the shape returned by, e.g., bit'sgetAuthConfig) is to re-implement pnpm's parsing logic, which keeps drifting out of sync with the canonical implementation. Exporting the existing helpers lets consumers stay aligned with pnpm's behaviour for free.Test plan
pnpm --filter @pnpm/config.reader run compile— passes (lint warning is pre-existing).@pnpm/config.readerrelease).Summary by CodeRabbit
@pnpm/config.readerwith new exports:getNetworkConfigsandgetDefaultCredsfunctions, plus theNetworkConfigstype.