com.jimuwd.xian.registry-proxy 1.0.37 → 1.0.38

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 CHANGED
@@ -192,7 +192,9 @@ async function writeSuccessfulResponse(registryInfo, targetUrl, res, response, r
192
192
  const tarball = data.versions[version]?.dist?.tarball;
193
193
  if (tarball) {
194
194
  const path = removeRegistryPrefix(tarball, registryInfos);
195
- data.versions[version].dist.tarball = `${baseUrl}${path}${new URL(tarball).search || ''}`;
195
+ const proxiedTarballUrl = `${baseUrl}${path}${new URL(tarball).search || ''}`;
196
+ data.versions[version].dist.tarball = proxiedTarballUrl;
197
+ console.log("proxiedTarballUrl", proxiedTarballUrl);
196
198
  }
197
199
  }
198
200
  }
@@ -316,7 +318,7 @@ export async function startProxyServer(proxyConfigPath, localYarnConfigPath, glo
316
318
  proxyPort = address.port;
317
319
  const portFile = join(process.env.PROJECT_ROOT || process.cwd(), '.registry-proxy-port');
318
320
  writeFile(portFile, proxyPort.toString()).catch(e => console.error('Failed to write port file:', e));
319
- console.log(`Proxy server running on ${proxyInfo.https ? 'https' : 'http'}://localhost:${proxyPort}${basePathPrefixedWithSlash}`);
321
+ console.log(`Proxy server running on ${proxyInfo.https ? 'https' : 'http'}://localhost:${proxyPort}${basePathPrefixedWithSlash === '/' ? '' : basePathPrefixedWithSlash}`);
320
322
  resolve(server);
321
323
  });
322
324
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.jimuwd.xian.registry-proxy",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "type": "module",
5
5
  "description": "A lightweight npm registry proxy with fallback support",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -261,7 +261,9 @@ async function writeSuccessfulResponse(
261
261
  const tarball = data.versions[version]?.dist?.tarball;
262
262
  if (tarball) {
263
263
  const path = removeRegistryPrefix(tarball, registryInfos);
264
- data.versions[version]!.dist!.tarball = `${baseUrl}${path}${new URL(tarball).search || ''}`;
264
+ const proxiedTarballUrl = `${baseUrl}${path}${new URL(tarball).search || ''}`;
265
+ data.versions[version]!.dist!.tarball = proxiedTarballUrl;
266
+ console.log("proxiedTarballUrl", proxiedTarballUrl);
265
267
  }
266
268
  }
267
269
  }
@@ -394,7 +396,7 @@ export async function startProxyServer(
394
396
  proxyPort = address.port;
395
397
  const portFile = join(process.env.PROJECT_ROOT || process.cwd(), '.registry-proxy-port');
396
398
  writeFile(portFile, proxyPort.toString()).catch(e => console.error('Failed to write port file:', e));
397
- console.log(`Proxy server running on ${proxyInfo.https ? 'https' : 'http'}://localhost:${proxyPort}${basePathPrefixedWithSlash}`);
399
+ console.log(`Proxy server running on ${proxyInfo.https ? 'https' : 'http'}://localhost:${proxyPort}${basePathPrefixedWithSlash === '/' ? '' : basePathPrefixedWithSlash}`);
398
400
  resolve(server);
399
401
  });
400
402
  });