@whatwg-node/node-fetch 0.5.11-alpha-20240327142620-7e48e923e7d5db8190d1a60110883d229f7d893c → 0.5.11-rc-20240426123347-cab1f2d198b4b41c6a8951d576f361aac1c34e6d

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,20 +1,7 @@
1
1
  "use strict";
2
- var _a;
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.PonyfillReadableStream = void 0;
5
4
  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
- }
18
5
  function createController(desiredSize, readable) {
19
6
  let chunks = [];
20
7
  let _closed = false;
@@ -65,7 +52,6 @@ function isReadableStream(obj) {
65
52
  class PonyfillReadableStream {
66
53
  constructor(underlyingSource) {
67
54
  this.locked = false;
68
- this[_a] = 'ReadableStream';
69
55
  if (underlyingSource instanceof PonyfillReadableStream && underlyingSource.readable != null) {
70
56
  this.readable = underlyingSource.readable;
71
57
  }
@@ -186,4 +172,3 @@ class PonyfillReadableStream {
186
172
  }
187
173
  }
188
174
  exports.PonyfillReadableStream = PonyfillReadableStream;
189
- _a = Symbol.toStringTag;
package/cjs/Response.js CHANGED
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- var _a;
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.PonyfillResponse = void 0;
5
4
  const http_1 = require("http");
@@ -9,7 +8,6 @@ const JSON_CONTENT_TYPE = 'application/json; charset=utf-8';
9
8
  class PonyfillResponse extends Body_js_1.PonyfillBody {
10
9
  constructor(body, init) {
11
10
  super(body || null, init);
12
- this[_a] = 'Response';
13
11
  this.headers =
14
12
  init?.headers && (0, Headers_js_1.isHeadersLike)(init.headers)
15
13
  ? init.headers
@@ -73,4 +71,3 @@ class PonyfillResponse extends Body_js_1.PonyfillBody {
73
71
  }
74
72
  }
75
73
  exports.PonyfillResponse = PonyfillResponse;
76
- _a = Symbol.toStringTag;
@@ -87,6 +87,7 @@ function fetchNodeHttp(fetchRequest) {
87
87
  }
88
88
  });
89
89
  }
90
+ nodeResponse.once('error', reject);
90
91
  const ponyfillResponse = new Response_js_1.PonyfillResponse(responseBody, {
91
92
  status: nodeResponse.statusCode,
92
93
  statusText: nodeResponse.statusMessage,
@@ -1,17 +1,4 @@
1
- var _a;
2
1
  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
- }
15
2
  function createController(desiredSize, readable) {
16
3
  let chunks = [];
17
4
  let _closed = false;
@@ -62,7 +49,6 @@ function isReadableStream(obj) {
62
49
  export class PonyfillReadableStream {
63
50
  constructor(underlyingSource) {
64
51
  this.locked = false;
65
- this[_a] = 'ReadableStream';
66
52
  if (underlyingSource instanceof PonyfillReadableStream && underlyingSource.readable != null) {
67
53
  this.readable = underlyingSource.readable;
68
54
  }
@@ -182,4 +168,3 @@ export class PonyfillReadableStream {
182
168
  return isReadableStream(instance);
183
169
  }
184
170
  }
185
- _a = Symbol.toStringTag;
package/esm/Response.js CHANGED
@@ -1,4 +1,3 @@
1
- var _a;
2
1
  import { STATUS_CODES } from 'http';
3
2
  import { PonyfillBody } from './Body.js';
4
3
  import { isHeadersLike, PonyfillHeaders } from './Headers.js';
@@ -6,7 +5,6 @@ const JSON_CONTENT_TYPE = 'application/json; charset=utf-8';
6
5
  export class PonyfillResponse extends PonyfillBody {
7
6
  constructor(body, init) {
8
7
  super(body || null, init);
9
- this[_a] = 'Response';
10
8
  this.headers =
11
9
  init?.headers && isHeadersLike(init.headers)
12
10
  ? init.headers
@@ -69,4 +67,3 @@ export class PonyfillResponse extends PonyfillBody {
69
67
  return new PonyfillResponse(JSON.stringify(data), init);
70
68
  }
71
69
  }
72
- _a = Symbol.toStringTag;
@@ -84,6 +84,7 @@ export function fetchNodeHttp(fetchRequest) {
84
84
  }
85
85
  });
86
86
  }
87
+ nodeResponse.once('error', reject);
87
88
  const ponyfillResponse = new PonyfillResponse(responseBody, {
88
89
  status: nodeResponse.statusCode,
89
90
  statusText: nodeResponse.statusMessage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.5.11-alpha-20240327142620-7e48e923e7d5db8190d1a60110883d229f7d893c",
3
+ "version": "0.5.11-rc-20240426123347-cab1f2d198b4b41c6a8951d576f361aac1c34e6d",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {
@@ -17,5 +17,4 @@ 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;
21
20
  }
@@ -17,5 +17,4 @@ 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;
21
20
  }
@@ -19,5 +19,4 @@ 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;
23
22
  }
@@ -19,5 +19,4 @@ 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;
23
22
  }