@whatwg-node/node-fetch 0.5.10-rc-20240322104646-be249624c8221126a95d35c5a84debd73cfdfe12 → 0.5.11-alpha-20240327142620-7e48e923e7d5db8190d1a60110883d229f7d893c

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.
@@ -1,7 +1,20 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.PonyfillReadableStream = void 0;
4
5
  const stream_1 = require("stream");
6
+ try {
7
+ const originalReadableFromWeb = stream_1.Readable.fromWeb;
8
+ stream_1.Readable.fromWeb = function fromWeb(stream) {
9
+ if (stream instanceof PonyfillReadableStream) {
10
+ return stream.readable;
11
+ }
12
+ return originalReadableFromWeb(stream);
13
+ };
14
+ }
15
+ catch (e) {
16
+ console.warn('Could not patch Readable.fromWeb, so this might break Readable.fromWeb usage with the whatwg-node and the integrations like Fastify', e);
17
+ }
5
18
  function createController(desiredSize, readable) {
6
19
  let chunks = [];
7
20
  let _closed = false;
@@ -52,6 +65,7 @@ function isReadableStream(obj) {
52
65
  class PonyfillReadableStream {
53
66
  constructor(underlyingSource) {
54
67
  this.locked = false;
68
+ this[_a] = 'ReadableStream';
55
69
  if (underlyingSource instanceof PonyfillReadableStream && underlyingSource.readable != null) {
56
70
  this.readable = underlyingSource.readable;
57
71
  }
@@ -172,3 +186,4 @@ class PonyfillReadableStream {
172
186
  }
173
187
  }
174
188
  exports.PonyfillReadableStream = PonyfillReadableStream;
189
+ _a = Symbol.toStringTag;
package/cjs/Response.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.PonyfillResponse = void 0;
4
5
  const http_1 = require("http");
@@ -8,6 +9,7 @@ const JSON_CONTENT_TYPE = 'application/json; charset=utf-8';
8
9
  class PonyfillResponse extends Body_js_1.PonyfillBody {
9
10
  constructor(body, init) {
10
11
  super(body || null, init);
12
+ this[_a] = 'Response';
11
13
  this.headers =
12
14
  init?.headers && (0, Headers_js_1.isHeadersLike)(init.headers)
13
15
  ? init.headers
@@ -71,3 +73,4 @@ class PonyfillResponse extends Body_js_1.PonyfillBody {
71
73
  }
72
74
  }
73
75
  exports.PonyfillResponse = PonyfillResponse;
76
+ _a = Symbol.toStringTag;
@@ -1,4 +1,17 @@
1
+ var _a;
1
2
  import { Readable } from 'stream';
3
+ try {
4
+ const originalReadableFromWeb = Readable.fromWeb;
5
+ Readable.fromWeb = function fromWeb(stream) {
6
+ if (stream instanceof PonyfillReadableStream) {
7
+ return stream.readable;
8
+ }
9
+ return originalReadableFromWeb(stream);
10
+ };
11
+ }
12
+ catch (e) {
13
+ console.warn('Could not patch Readable.fromWeb, so this might break Readable.fromWeb usage with the whatwg-node and the integrations like Fastify', e);
14
+ }
2
15
  function createController(desiredSize, readable) {
3
16
  let chunks = [];
4
17
  let _closed = false;
@@ -49,6 +62,7 @@ function isReadableStream(obj) {
49
62
  export class PonyfillReadableStream {
50
63
  constructor(underlyingSource) {
51
64
  this.locked = false;
65
+ this[_a] = 'ReadableStream';
52
66
  if (underlyingSource instanceof PonyfillReadableStream && underlyingSource.readable != null) {
53
67
  this.readable = underlyingSource.readable;
54
68
  }
@@ -168,3 +182,4 @@ export class PonyfillReadableStream {
168
182
  return isReadableStream(instance);
169
183
  }
170
184
  }
185
+ _a = Symbol.toStringTag;
package/esm/Response.js CHANGED
@@ -1,3 +1,4 @@
1
+ var _a;
1
2
  import { STATUS_CODES } from 'http';
2
3
  import { PonyfillBody } from './Body.js';
3
4
  import { isHeadersLike, PonyfillHeaders } from './Headers.js';
@@ -5,6 +6,7 @@ const JSON_CONTENT_TYPE = 'application/json; charset=utf-8';
5
6
  export class PonyfillResponse extends PonyfillBody {
6
7
  constructor(body, init) {
7
8
  super(body || null, init);
9
+ this[_a] = 'Response';
8
10
  this.headers =
9
11
  init?.headers && isHeadersLike(init.headers)
10
12
  ? init.headers
@@ -67,3 +69,4 @@ export class PonyfillResponse extends PonyfillBody {
67
69
  return new PonyfillResponse(JSON.stringify(data), init);
68
70
  }
69
71
  }
72
+ _a = Symbol.toStringTag;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.5.10-rc-20240322104646-be249624c8221126a95d35c5a84debd73cfdfe12",
3
+ "version": "0.5.11-alpha-20240327142620-7e48e923e7d5db8190d1a60110883d229f7d893c",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {
@@ -17,4 +17,5 @@ export declare class PonyfillReadableStream<T> implements ReadableStream<T> {
17
17
  readable: ReadableStream<T2>;
18
18
  }): ReadableStream<T2>;
19
19
  static [Symbol.hasInstance](instance: unknown): instance is PonyfillReadableStream<unknown>;
20
+ [Symbol.toStringTag]: string;
20
21
  }
@@ -17,4 +17,5 @@ export declare class PonyfillReadableStream<T> implements ReadableStream<T> {
17
17
  readable: ReadableStream<T2>;
18
18
  }): ReadableStream<T2>;
19
19
  static [Symbol.hasInstance](instance: unknown): instance is PonyfillReadableStream<unknown>;
20
+ [Symbol.toStringTag]: string;
20
21
  }
@@ -19,4 +19,5 @@ export declare class PonyfillResponse<TJSON = any> extends PonyfillBody<TJSON> i
19
19
  static error(): PonyfillResponse<any>;
20
20
  static redirect(url: string, status?: number): PonyfillResponse<any>;
21
21
  static json<T = any>(data: T, init?: ResponsePonyfilInit): PonyfillResponse<T>;
22
+ [Symbol.toStringTag]: string;
22
23
  }
@@ -19,4 +19,5 @@ export declare class PonyfillResponse<TJSON = any> extends PonyfillBody<TJSON> i
19
19
  static error(): PonyfillResponse<any>;
20
20
  static redirect(url: string, status?: number): PonyfillResponse<any>;
21
21
  static json<T = any>(data: T, init?: ResponsePonyfilInit): PonyfillResponse<T>;
22
+ [Symbol.toStringTag]: string;
22
23
  }