@@ -11,7 +11,6 @@ import { Registries } from '@teambit/pkg.entities.registry';
11
11
import { getAuthConfig } from '@teambit/pkg.config.auth' ;
12
12
import {
13
13
ResolvedPackageVersion ,
14
- NPM_REGISTRY ,
15
14
PackageManagerProxyConfig ,
16
15
PackageManagerNetworkConfig ,
17
16
} from '@teambit/dependency-resolver' ;
@@ -41,11 +40,6 @@ import { readConfig } from './read-config';
41
40
const installsRunning : Record < string , Promise < any > > = { } ;
42
41
const cafsLocker = new Map < string , number > ( ) ;
43
42
44
- type RegistriesMap = {
45
- default : string ;
46
- [ registryName : string ] : string ;
47
- } ;
48
-
49
43
async function createStoreController (
50
44
options : {
51
45
rootDir : string ;
@@ -142,7 +136,6 @@ export async function getPeerDependencyIssues(
142
136
rootDir : rootDir as ProjectRootDir ,
143
137
} ) ;
144
138
}
145
- const registriesMap = getRegistriesMap ( opts . registries ) ;
146
139
const storeController = await createStoreController ( {
147
140
...opts ,
148
141
rootDir : opts . rootDir ,
@@ -154,7 +147,7 @@ export async function getPeerDependencyIssues(
154
147
storeDir : storeController . dir ,
155
148
overrides : opts . overrides ,
156
149
peersSuffixMaxLength : 1000 ,
157
- registries : registriesMap ,
150
+ registries : opts . registries . toMap ( ) ,
158
151
virtualStoreDirMaxLength : VIRTUAL_STORE_DIR_MAX_LENGTH ,
159
152
} ) ;
160
153
}
@@ -236,7 +229,6 @@ export async function install(
236
229
const { allProjects, packagesToBuild } = groupPkgs ( manifestsByPaths , {
237
230
update : options ?. updateAll ,
238
231
} ) ;
239
- const registriesMap = getRegistriesMap ( registries ) ;
240
232
const authConfig = getAuthConfig ( registries ) ;
241
233
const storeController = await createStoreController ( {
242
234
rootDir,
@@ -269,7 +261,7 @@ export async function install(
269
261
lockfileOnly : options . lockfileOnly ?? false ,
270
262
modulesCacheMaxAge : Infinity , // pnpm should never prune the virtual store. Bit does it on its own.
271
263
neverBuiltDependencies : options . neverBuiltDependencies ,
272
- registries : registriesMap ,
264
+ registries : registries . toMap ( ) ,
273
265
resolutionMode : 'highest' ,
274
266
rawConfig : authConfig ,
275
267
hooks : { readPackage } ,
@@ -528,8 +520,7 @@ export async function resolveRemoteVersion(
528
520
} ;
529
521
try {
530
522
const parsedPackage = parsePackageName ( packageName ) ;
531
- const registriesMap = getRegistriesMap ( registries ) ;
532
- const registry = pickRegistryForPackage ( registriesMap , parsedPackage . name ) ;
523
+ const registry = pickRegistryForPackage ( registries . toMap ( ) , parsedPackage . name ) ;
533
524
const wantedDep : WantedDependency = {
534
525
alias : parsedPackage . name ,
535
526
pref : parsedPackage . version ,
@@ -574,17 +565,6 @@ export async function resolveRemoteVersion(
574
565
}
575
566
}
576
567
577
- export function getRegistriesMap ( registries : Registries ) : RegistriesMap {
578
- const registriesMap = {
579
- default : registries . defaultRegistry . uri || NPM_REGISTRY ,
580
- } ;
581
-
582
- Object . entries ( registries . scopes ) . forEach ( ( [ registryName , registry ] ) => {
583
- registriesMap [ `@${ registryName } ` ] = registry . uri ;
584
- } ) ;
585
- return registriesMap ;
586
- }
587
-
588
568
async function addDepsRequiringBuildToLockfile ( rootDir : string , depsRequiringBuild : string [ ] ) {
589
569
const lockfile = await readWantedLockfile ( rootDir , { ignoreIncompatible : true } ) as BitLockfile ;
590
570
if ( lockfile == null ) return
0 commit comments