Skip to content

Commit c6d1825

Browse files
committed
refactor: rename defaultPeerDependencies to envPeerDependencies
These are the peer deps from the component's env (selfPolicy), not "defaults" in any meaningful sense. Rename the variable and method to reflect what they actually are.
1 parent 8a31b24 commit c6d1825

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

scopes/dependencies/dependency-resolver/manifest/workspace-manifest-factory.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,18 +215,18 @@ export class WorkspaceManifestFactory {
215215
);
216216
});
217217

218-
const defaultPeerDependencies = await this._getDefaultPeerDependencies(component, packageNames);
219-
// When includeAllEnvPeers is true, use ALL default peer deps to ensure consistent
218+
const envPeerDependencies = await this._getEnvPeerDependencies(component, packageNames);
219+
// When includeAllEnvPeers is true, use ALL env peer deps to ensure consistent
220220
// peer dependency contexts across all components. Otherwise, pnpm creates separate
221221
// "injected" copies in .pnpm/ for components with different peer sets, causing
222222
// TypeScript to see duplicate types from different physical paths.
223223
// When false, only include peer deps that the component actually uses, to avoid
224224
// writing unnecessary deps to the generated install manifest.
225225
let peerDepsForManifest: Record<string, string>;
226226
if (includeAllEnvPeers) {
227-
peerDepsForManifest = defaultPeerDependencies;
227+
peerDepsForManifest = envPeerDependencies;
228228
} else {
229-
peerDepsForManifest = pickBy(defaultPeerDependencies, (_val, pkgName) => {
229+
peerDepsForManifest = pickBy(envPeerDependencies, (_val, pkgName) => {
230230
return (
231231
depManifestBeforeFiltering.dependencies[pkgName] ||
232232
depManifestBeforeFiltering.devDependencies[pkgName] ||
@@ -243,8 +243,8 @@ export class WorkspaceManifestFactory {
243243
// the component don't have react-dom as peer dependency, but when we install the dependencies in the workspace,
244244
// it will install the latest version of react-dom which may not be compatible with the version of react that my-comp
245245
// is using, and it may cause issues in the workspace.
246-
if (peerDepsForManifest.react && defaultPeerDependencies['react-dom']) {
247-
peerDepsForManifest['react-dom'] = defaultPeerDependencies['react-dom'];
246+
if (peerDepsForManifest.react && envPeerDependencies['react-dom']) {
247+
peerDepsForManifest['react-dom'] = envPeerDependencies['react-dom'];
248248
}
249249
}
250250

@@ -274,7 +274,7 @@ export class WorkspaceManifestFactory {
274274
return result;
275275
}
276276

277-
private async _getDefaultPeerDependencies(
277+
private async _getEnvPeerDependencies(
278278
component: Component,
279279
packageNamesFromWorkspace: string[]
280280
): Promise<Record<string, string>> {

0 commit comments

Comments
 (0)