com.jimuwd.xian.registry-proxy 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +0 -5
- package/package.json +1 -1
- package/src/index.ts +0 -5
package/dist/index.js
CHANGED
|
@@ -58,7 +58,6 @@ function normalizeUrl(url) {
|
|
|
58
58
|
}
|
|
59
59
|
function resolvePath(path) {
|
|
60
60
|
const resolved = path.startsWith('~/') ? join(homedir(), path.slice(2)) : resolve(path);
|
|
61
|
-
console.debug(`Resolved path: ${path} -> ${resolved}`);
|
|
62
61
|
return resolved;
|
|
63
62
|
}
|
|
64
63
|
function removeRegistryPrefix(tarballUrl, registries) {
|
|
@@ -176,7 +175,6 @@ export async function startProxyServer(proxyConfigPath, localYarnConfigPath, glo
|
|
|
176
175
|
const headers = token ? { Authorization: `Bearer ${token}` } : undefined;
|
|
177
176
|
const response = await fetch(targetUrl, { headers });
|
|
178
177
|
console.log(`Response from ${url}: ${response.status} ${response.statusText}`);
|
|
179
|
-
console.debug(`Response headers from ${url}:`, Object.fromEntries(response.headers.entries()));
|
|
180
178
|
return response.ok ? response : null;
|
|
181
179
|
}
|
|
182
180
|
catch (e) {
|
|
@@ -195,7 +193,6 @@ export async function startProxyServer(proxyConfigPath, localYarnConfigPath, glo
|
|
|
195
193
|
return;
|
|
196
194
|
}
|
|
197
195
|
const contentType = successResponse.headers.get('Content-Type') || 'application/octet-stream';
|
|
198
|
-
console.debug(`Content-Type: ${contentType}`);
|
|
199
196
|
if (contentType.includes('application/json')) {
|
|
200
197
|
try {
|
|
201
198
|
const data = await successResponse.json();
|
|
@@ -231,7 +228,6 @@ export async function startProxyServer(proxyConfigPath, localYarnConfigPath, glo
|
|
|
231
228
|
'Content-Type': successResponse.headers.get('Content-Type'),
|
|
232
229
|
'Content-Length': successResponse.headers.get('Content-Length'),
|
|
233
230
|
};
|
|
234
|
-
console.debug(`Streaming response with headers:`, safeHeaders);
|
|
235
231
|
res.writeHead(successResponse.status, safeHeaders);
|
|
236
232
|
successResponse.body.pipe(res).on('error', (err) => {
|
|
237
233
|
console.error(`Stream error for ${relativePath}:`, err);
|
|
@@ -244,7 +240,6 @@ export async function startProxyServer(proxyConfigPath, localYarnConfigPath, glo
|
|
|
244
240
|
const { key, cert } = proxyConfig.https;
|
|
245
241
|
const keyPath = resolvePath(key);
|
|
246
242
|
const certPath = resolvePath(cert);
|
|
247
|
-
console.debug(`Loading HTTPS key: ${keyPath}, cert: ${certPath}`);
|
|
248
243
|
try {
|
|
249
244
|
await fsPromises.access(keyPath);
|
|
250
245
|
await fsPromises.access(certPath);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -77,7 +77,6 @@ function normalizeUrl(url: string): string {
|
|
|
77
77
|
|
|
78
78
|
function resolvePath(path: string): string {
|
|
79
79
|
const resolved = path.startsWith('~/') ? join(homedir(), path.slice(2)) : resolve(path);
|
|
80
|
-
console.debug(`Resolved path: ${path} -> ${resolved}`);
|
|
81
80
|
return resolved;
|
|
82
81
|
}
|
|
83
82
|
|
|
@@ -215,7 +214,6 @@ export async function startProxyServer(
|
|
|
215
214
|
const headers = token ? { Authorization: `Bearer ${token}` } : undefined;
|
|
216
215
|
const response = await fetch(targetUrl, { headers });
|
|
217
216
|
console.log(`Response from ${url}: ${response.status} ${response.statusText}`);
|
|
218
|
-
console.debug(`Response headers from ${url}:`, Object.fromEntries(response.headers.entries()));
|
|
219
217
|
return response.ok ? response : null;
|
|
220
218
|
} catch (e) {
|
|
221
219
|
console.error(`Failed to fetch from ${url}:`, e);
|
|
@@ -234,7 +232,6 @@ export async function startProxyServer(
|
|
|
234
232
|
}
|
|
235
233
|
|
|
236
234
|
const contentType = successResponse.headers.get('Content-Type') || 'application/octet-stream';
|
|
237
|
-
console.debug(`Content-Type: ${contentType}`);
|
|
238
235
|
if (contentType.includes('application/json')) {
|
|
239
236
|
try {
|
|
240
237
|
const data = await successResponse.json() as PackageData;
|
|
@@ -268,7 +265,6 @@ export async function startProxyServer(
|
|
|
268
265
|
'Content-Type': successResponse.headers.get('Content-Type'),
|
|
269
266
|
'Content-Length': successResponse.headers.get('Content-Length'),
|
|
270
267
|
};
|
|
271
|
-
console.debug(`Streaming response with headers:`, safeHeaders);
|
|
272
268
|
res.writeHead(successResponse.status, safeHeaders);
|
|
273
269
|
successResponse.body.pipe(res).on('error', (err:any) => {
|
|
274
270
|
console.error(`Stream error for ${relativePath}:`, err);
|
|
@@ -282,7 +278,6 @@ export async function startProxyServer(
|
|
|
282
278
|
const { key, cert } = proxyConfig.https;
|
|
283
279
|
const keyPath = resolvePath(key);
|
|
284
280
|
const certPath = resolvePath(cert);
|
|
285
|
-
console.debug(`Loading HTTPS key: ${keyPath}, cert: ${certPath}`);
|
|
286
281
|
try {
|
|
287
282
|
await fsPromises.access(keyPath);
|
|
288
283
|
await fsPromises.access(certPath);
|