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

@whatwg-node/node-fetch

Package Overview
Dependencies
Maintainers
1
Versions
509
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@whatwg-node/node-fetch - npm Package Compare versions

Comparing version 0.5.18-alpha-20240726144438-d85e825aca3e8ac57c7758d5ec88ed5c27358fcc to 0.5.18-rc-20240726145209-474dafd2879bb3a918b26a9edf5abd1276235ab4

2

cjs/Blob.js

@@ -56,3 +56,3 @@ "use strict";

class PonyfillBlob {
constructor(blobParts, options) {
constructor(blobParts = [], options) {
this.blobParts = blobParts;

@@ -59,0 +59,0 @@ this._size = null;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DecompressionStream = exports.CompressionStream = exports.TransformStream = exports.WritableStream = exports.URLSearchParams = exports.URL = exports.btoa = exports.TextDecoder = exports.TextEncoder = exports.Blob = exports.FormData = exports.File = exports.ReadableStream = exports.Response = exports.Request = exports.Body = exports.Headers = exports.fetch = exports.patchReadableFromWeb = void 0;
var utils_js_1 = require("./utils.js");
Object.defineProperty(exports, "patchReadableFromWeb", { enumerable: true, get: function () { return utils_js_1.patchReadableFromWeb; } });
exports.DecompressionStream = exports.CompressionStream = exports.TransformStream = exports.WritableStream = exports.URLSearchParams = exports.URL = exports.btoa = exports.TextDecoder = exports.TextEncoder = exports.Blob = exports.FormData = exports.File = exports.ReadableStream = exports.Response = exports.Request = exports.Body = exports.Headers = exports.fetch = void 0;
var fetch_js_1 = require("./fetch.js");

@@ -7,0 +5,0 @@ Object.defineProperty(exports, "fetch", { enumerable: true, get: function () { return fetch_js_1.fetchPonyfill; } });

"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -56,3 +55,2 @@ exports.PonyfillReadableStream = void 0;

this.locked = false;
this[_a] = 'ReadableStream';
if (underlyingSource instanceof PonyfillReadableStream && underlyingSource.readable != null) {

@@ -190,5 +188,4 @@ this.readable = underlyingSource.readable;

exports.PonyfillReadableStream = PonyfillReadableStream;
_a = Symbol.toStringTag;
function isPonyfillWritableStream(obj) {
return obj?.writable != null;
}
"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -12,3 +11,2 @@ exports.PonyfillResponse = void 0;

super(body || null, init);
this[_a] = 'Response';
this.headers =

@@ -77,2 +75,1 @@ init?.headers && (0, Headers_js_1.isHeadersLike)(init.headers)

exports.PonyfillResponse = PonyfillResponse;
_a = Symbol.toStringTag;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.patchReadableFromWeb = patchReadableFromWeb;
exports.getHeadersObj = getHeadersObj;

@@ -9,28 +8,5 @@ exports.defaultHeadersSerializer = defaultHeadersSerializer;

exports.isNodeReadable = isNodeReadable;
const stream_1 = require("stream");
function isHeadersInstance(obj) {
return obj?.forEach != null;
}
function patchReadableFromWeb() {
try {
const originalReadableFromWeb = stream_1.Readable.fromWeb;
if (originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') {
stream_1.Readable.fromWeb = function ReadableFromWebPatchedByWhatWgNode(stream) {
if (stream.readable != null) {
return stream.readable;
}
return originalReadableFromWeb(stream);
};
if (typeof jest === 'object' && typeof afterEach === 'function') {
// To relax jest, we should remove the patch after each test
afterEach(() => {
stream_1.Readable.fromWeb = originalReadableFromWeb;
});
}
}
}
catch (e) {
console.warn('Could not patch Readable.fromWeb, so this might break Readable.fromWeb usage with the whatwg-node and the integrations like Fastify', e);
}
}
function getHeadersObj(headers) {

@@ -37,0 +13,0 @@ if (headers == null || !isHeadersInstance(headers)) {

@@ -45,3 +45,3 @@ /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */

export class PonyfillBlob {
constructor(blobParts, options) {
constructor(blobParts = [], options) {
this.blobParts = blobParts;

@@ -48,0 +48,0 @@ this._size = null;

@@ -1,2 +0,1 @@

export { patchReadableFromWeb } from './utils.js';
export { fetchPonyfill as fetch } from './fetch.js';

@@ -3,0 +2,0 @@ export { PonyfillHeaders as Headers } from './Headers.js';

@@ -1,2 +0,1 @@

var _a;
import { Readable } from 'stream';

@@ -53,3 +52,2 @@ function createController(desiredSize, readable) {

this.locked = false;
this[_a] = 'ReadableStream';
if (underlyingSource instanceof PonyfillReadableStream && underlyingSource.readable != null) {

@@ -186,5 +184,4 @@ this.readable = underlyingSource.readable;

}
_a = Symbol.toStringTag;
function isPonyfillWritableStream(obj) {
return obj?.writable != null;
}

@@ -1,2 +0,1 @@

var _a;
import { STATUS_CODES } from 'http';

@@ -9,3 +8,2 @@ import { PonyfillBody } from './Body.js';

super(body || null, init);
this[_a] = 'Response';
this.headers =

@@ -73,2 +71,1 @@ init?.headers && isHeadersLike(init.headers)

}
_a = Symbol.toStringTag;

@@ -1,27 +0,4 @@

import { Readable } from 'stream';
function isHeadersInstance(obj) {
return obj?.forEach != null;
}
export function patchReadableFromWeb() {
try {
const originalReadableFromWeb = Readable.fromWeb;
if (originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') {
Readable.fromWeb = function ReadableFromWebPatchedByWhatWgNode(stream) {
if (stream.readable != null) {
return stream.readable;
}
return originalReadableFromWeb(stream);
};
if (typeof jest === 'object' && typeof afterEach === 'function') {
// To relax jest, we should remove the patch after each test
afterEach(() => {
Readable.fromWeb = originalReadableFromWeb;
});
}
}
}
catch (e) {
console.warn('Could not patch Readable.fromWeb, so this might break Readable.fromWeb usage with the whatwg-node and the integrations like Fastify', e);
}
}
export function getHeadersObj(headers) {

@@ -28,0 +5,0 @@ if (headers == null || !isHeadersInstance(headers)) {

{
"name": "@whatwg-node/node-fetch",
"version": "0.5.18-alpha-20240726144438-d85e825aca3e8ac57c7758d5ec88ed5c27358fcc",
"version": "0.5.18-rc-20240726145209-474dafd2879bb3a918b26a9edf5abd1276235ab4",
"description": "Fetch API implementation for Node",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -42,3 +42,3 @@ interface BlobOptions {

private _size;
constructor(blobParts: BlobPart[], options?: BlobOptions);
constructor(blobParts?: BlobPart[], options?: BlobOptions);
_buffer: Buffer | null;

@@ -45,0 +45,0 @@ buffer(): Promise<Buffer>;

@@ -1,2 +0,1 @@

export { patchReadableFromWeb } from './utils.js';
export { fetchPonyfill as fetch } from './fetch.js';

@@ -3,0 +2,0 @@ export { PonyfillHeaders as Headers } from './Headers.js';

@@ -19,3 +19,2 @@ import { Readable } from 'stream';

static [Symbol.hasInstance](instance: unknown): instance is PonyfillReadableStream<unknown>;
[Symbol.toStringTag]: string;
}

@@ -22,3 +22,2 @@ import { BodyPonyfillInit, PonyfillBody, PonyfillBodyOptions } from './Body.js';

static json<T = any>(data: T, init?: ResponsePonyfilInit): PonyfillResponse<T>;
[Symbol.toStringTag]: string;
}
import { Readable } from 'stream';
export declare function patchReadableFromWeb(): void;
export declare function getHeadersObj(headers: Headers): Record<string, string>;

@@ -4,0 +3,0 @@ export declare function defaultHeadersSerializer(headers: Headers, onContentLength?: (value: string) => void): string[];

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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