Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pnpm/fetch

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnpm/fetch - npm Package Compare versions

Comparing version 4.2.5 to 5.0.0

14

lib/fetch.js

@@ -33,9 +33,8 @@ "use strict";

async function fetchRetry(url, opts = {}) {
var _a, _b, _c, _d, _e;
const retryOpts = (_a = opts.retry) !== null && _a !== void 0 ? _a : {};
const maxRetries = (_b = retryOpts.retries) !== null && _b !== void 0 ? _b : 2;
const retryOpts = opts.retry ?? {};
const maxRetries = retryOpts.retries ?? 2;
const op = (0, retry_1.operation)({
factor: (_c = retryOpts.factor) !== null && _c !== void 0 ? _c : 10,
maxTimeout: (_d = retryOpts.maxTimeout) !== null && _d !== void 0 ? _d : 60000,
minTimeout: (_e = retryOpts.minTimeout) !== null && _e !== void 0 ? _e : 10000,
factor: retryOpts.factor ?? 10,
maxTimeout: retryOpts.maxTimeout ?? 60000,
minTimeout: retryOpts.minTimeout ?? 10000,
randomize: false,

@@ -46,3 +45,2 @@ retries: maxRetries,

return await new Promise((resolve, reject) => op.attempt(async (attempt) => {
var _a;
try {

@@ -70,3 +68,3 @@ // this will be retried

maxRetries,
method: (_a = opts.method) !== null && _a !== void 0 ? _a : 'GET',
method: opts.method ?? 'GET',
timeout,

@@ -73,0 +71,0 @@ url: url.toString(),

@@ -38,8 +38,7 @@ "use strict";

function fetchWithAgent(url, opts) {
var _a, _b;
const agent = (0, npm_registry_agent_1.default)(url.toString(), {
...opts.agentOptions,
strictSsl: (_a = opts.agentOptions.strictSsl) !== null && _a !== void 0 ? _a : true,
strictSsl: opts.agentOptions.strictSsl ?? true,
}); // eslint-disable-line
const headers = (_b = opts.headers) !== null && _b !== void 0 ? _b : {};
const headers = opts.headers ?? {};
headers['connection'] = agent ? 'keep-alive' : 'close';

@@ -54,7 +53,6 @@ return (0, fetch_1.default)(url, {

return async (url, opts) => {
var _a, _b, _c;
const headers = {
'user-agent': USER_AGENT,
...getHeaders({
auth: opts === null || opts === void 0 ? void 0 : opts.authHeaderValue,
auth: opts?.authHeaderValue,
fullMetadata: defaultOpts.fullMetadata,

@@ -71,3 +69,3 @@ userAgent: defaultOpts.userAgent,

...opts,
strictSsl: (_a = defaultOpts.strictSsl) !== null && _a !== void 0 ? _a : true,
strictSsl: defaultOpts.strictSsl ?? true,
}; // eslint-disable-line

@@ -79,7 +77,7 @@ // We should pass a URL object to node-fetch till this is not resolved:

// if verifying integrity, node-fetch must not decompress
compress: (_b = opts === null || opts === void 0 ? void 0 : opts.compress) !== null && _b !== void 0 ? _b : false,
compress: opts?.compress ?? false,
headers,
redirect: 'manual',
retry: opts === null || opts === void 0 ? void 0 : opts.retry,
timeout: (_c = opts === null || opts === void 0 ? void 0 : opts.timeout) !== null && _c !== void 0 ? _c : 60000,
retry: opts?.retry,
timeout: opts?.timeout ?? 60000,
});

@@ -86,0 +84,0 @@ if (!(0, fetch_1.isRedirect)(response.status) || redirects >= MAX_FOLLOWED_REDIRECTS) {

{
"name": "@pnpm/fetch",
"version": "4.2.5",
"version": "5.0.0",
"description": "node-fetch with retries",

@@ -12,7 +12,7 @@ "main": "lib/index.js",

"engines": {
"node": ">=12.17"
"node": ">=14.19"
},
"repository": "https://github.com/pnpm/pnpm/blob/main/packages/fetch",
"keywords": [
"pnpm6",
"pnpm7",
"fetch",

@@ -30,5 +30,5 @@ "npm"

"dependencies": {
"@pnpm/core-loggers": "6.1.4",
"@pnpm/fetching-types": "2.2.1",
"@pnpm/npm-registry-agent": "5.0.2",
"@pnpm/core-loggers": "7.0.0",
"@pnpm/fetching-types": "3.0.0",
"@pnpm/npm-registry-agent": "6.0.0",
"@zkochan/retry": "^0.2.0",

@@ -38,3 +38,3 @@ "node-fetch": "3.0.0-beta.9"

"devDependencies": {
"@pnpm/fetch": "4.2.5",
"@pnpm/fetch": "5.0.0",
"@pnpm/logger": "^4.0.0",

@@ -45,2 +45,5 @@ "cpy-cli": "^3.1.1",

"funding": "https://opencollective.com/pnpm",
"exports": {
".": "./lib/index.js"
},
"scripts": {

@@ -47,0 +50,0 @@ "lint": "eslint src/**/*.ts test/**/*.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc