com.jimuwd.xian.registry-proxy 1.0.91 → 1.0.92

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -179,6 +179,7 @@ async function fetchFromRegistry(registry, targetUrl, reqFromDownstreamClient, l
179
179
  }
180
180
  }
181
181
  async function writeResponseToDownstreamClient(registryInfo, targetUrl, resToDownstreamClient, upstreamResponse, reqFromDownstreamClient, proxyInfo, proxyPort, registryInfos) {
182
+ logger.info(`Writing upstream registry server ${registryInfo.normalizedRegistryUrl}'s 2xx ok response to downstream ${reqFromDownstreamClient.headers.from} ${reqFromDownstreamClient.headers["user-agent"]}`);
182
183
  if (!upstreamResponse.ok)
183
184
  throw new Error("Only 2xx upstream response is supported");
184
185
  try {
@@ -381,6 +382,11 @@ export async function startProxyServer(proxyConfigPath, localYarnConfigPath, glo
381
382
  return promisedServer;
382
383
  }
383
384
  if (import.meta.url === `file://${process.argv[1]}`) {
385
+ // 确保进程捕获异常
386
+ process.on('uncaughtException', (err) => {
387
+ logger.error('Fatal error:', err);
388
+ process.exit(1);
389
+ });
384
390
  const [, , configPath, localYarnPath, globalYarnPath, port] = process.argv;
385
391
  startProxyServer(configPath, localYarnPath, globalYarnPath, parseInt(port, 10) || 0).catch(err => {
386
392
  logger.error('Failed to start server:', err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.jimuwd.xian.registry-proxy",
3
- "version": "1.0.91",
3
+ "version": "1.0.92",
4
4
  "description": "A lightweight npm registry proxy with fallback support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",