@@ -7,7 +7,7 @@ import { NpmRegistryService, NpmRegistryConfigEntry, NpmRegistryConfig } from ".
7
7
8
8
type RequestConfig = {
9
9
workspaceId : string ;
10
- npmRegistryConfig : NpmRegistryConfig ;
10
+ npmRegistries : NpmRegistryConfig ;
11
11
}
12
12
13
13
type InnerRequestConfig = {
@@ -92,15 +92,15 @@ export async function fetchRegistryWithConfig(request: ServerRequest, response:
92
92
return response . status ( 400 ) . send ( "Missing workspaceId and/or npmRegistryConfig" ) ;
93
93
}
94
94
95
- const { npmRegistryConfig} : RequestConfig = request . body ;
95
+ const { npmRegistries : npmRegistryConfig } : RequestConfig = request . body ;
96
96
97
97
const registry = NpmRegistryService . getRegistryEntryForPackageWithConfig ( pathPackageInfo . packageId , npmRegistryConfig ) ;
98
98
99
99
const registryResponse = await fetchFromRegistry ( path , registry ) ;
100
100
if ( ! registryResponse . ok ) {
101
101
return response . status ( registryResponse . status ) . send ( await registryResponse . text ( ) ) ;
102
102
}
103
- response . json ( await registryResponse . json ( ) ) ;
103
+ response . send ( await registryResponse . text ( ) ) ;
104
104
} catch ( error ) {
105
105
logger . error ( "Error fetching registry" , error ) ;
106
106
response . status ( 500 ) . send ( "Internal server error" ) ;
@@ -149,7 +149,7 @@ export async function fetchPackageFileWithConfig(request: ServerRequest, respons
149
149
return response . status ( 400 ) . send ( "Missing workspaceId and/or npmRegistryConfig" ) ;
150
150
}
151
151
152
- const { workspaceId, npmRegistryConfig} : RequestConfig = request . body ;
152
+ const { workspaceId, npmRegistries : npmRegistryConfig } : RequestConfig = request . body ;
153
153
const registryConfig : NpmRegistryConfig = npmRegistryConfig ;
154
154
const registry = NpmRegistryService . getRegistryEntryForPackageWithConfig ( pathPackageInfo . packageId , registryConfig ) ;
155
155
@@ -246,7 +246,7 @@ async function fetchPackageFileInner(request: ServerRequest, response: ServerRes
246
246
247
247
function parsePackageInfoFromPath ( path : string ) : { packageId : string , organization : string , name : string , version : string , file : string } | undefined {
248
248
//@ts -ignore - regex groups
249
- const packageInfoRegex = / ^ \/ ? (?< packageId > (?: @ (?< organization > [ a - z 0 - 9 - ~ ] [ a - z 0 - 9 - ._ ~ ] * ) \/ ) ? (?< name > [ a - z 0 - 9 - ~ ] [ a - z 0 - 9 - ._ ~ ] * ) ) (?: @ (?< version > [ - a - z 0 - 9 > < = _ . ^ ~ ] + ) ) ? \/ (?< file > [ ^ \r \n ] * ) ? $ / ;
249
+ const packageInfoRegex = / ^ \/ ? (?< packageId > (?: @ (?< organization > [ a - z 0 - 9 - ~ ] [ a - z 0 - 9 - ._ ~ ] * ) \/ ) ? (?< name > [ a - z 0 - 9 - ~ ] [ a - z 0 - 9 - ._ ~ ] * ) ) (?: @ (?< version > [ - a - z 0 - 9 > < = _ . ^ ~ ] + ) ) ? ( \/ (?< file > [ ^ \r \n ] * ) ) ? $ / ;
250
250
const matches = path . match ( packageInfoRegex ) ;
251
251
if ( ! matches ?. groups ) {
252
252
return ;
0 commit comments