@whatwg-node/node-fetch 0.5.18 → 0.5.19-alpha-20240729084111-e77361f66f389f0ddd518a2a7b9c3226357369c4
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/cjs/Blob.js +6 -3
- package/cjs/Body.js +14 -10
- package/cjs/File.js +3 -1
- package/cjs/FormData.js +1 -3
- package/cjs/Headers.js +5 -3
- package/cjs/ReadableStream.js +2 -1
- package/cjs/Request.js +18 -3
- package/cjs/Response.js +6 -0
- package/cjs/TextEncoderDecoder.js +4 -2
- package/cjs/TransformStream.js +3 -0
- package/cjs/URL.js +2 -1
- package/cjs/URLSearchParams.js +1 -0
- package/cjs/WritableStream.js +2 -1
- package/esm/Blob.js +6 -3
- package/esm/Body.js +14 -10
- package/esm/File.js +3 -1
- package/esm/FormData.js +1 -3
- package/esm/Headers.js +5 -3
- package/esm/ReadableStream.js +2 -1
- package/esm/Request.js +18 -3
- package/esm/Response.js +6 -0
- package/esm/TextEncoderDecoder.js +4 -2
- package/esm/TransformStream.js +3 -0
- package/esm/URL.js +2 -1
- package/esm/URLSearchParams.js +1 -0
- package/esm/WritableStream.js +2 -1
- package/package.json +2 -3
package/cjs/Blob.js
CHANGED
@@ -53,11 +53,12 @@ function isArrayBuffer(obj) {
|
|
53
53
|
// Will be removed after v14 reaches EOL
|
54
54
|
// Needed because v14 doesn't have .stream() implemented
|
55
55
|
class PonyfillBlob {
|
56
|
+
blobParts;
|
57
|
+
type;
|
58
|
+
encoding;
|
59
|
+
_size = null;
|
56
60
|
constructor(blobParts = [], options) {
|
57
61
|
this.blobParts = blobParts;
|
58
|
-
this._size = null;
|
59
|
-
this._buffer = null;
|
60
|
-
this._text = null;
|
61
62
|
this.type = options?.type || 'application/octet-stream';
|
62
63
|
this.encoding = options?.encoding || 'utf8';
|
63
64
|
this._size = options?.size || null;
|
@@ -65,6 +66,7 @@ class PonyfillBlob {
|
|
65
66
|
return blobParts[0];
|
66
67
|
}
|
67
68
|
}
|
69
|
+
_buffer = null;
|
68
70
|
buffer() {
|
69
71
|
if (this._buffer) {
|
70
72
|
return (0, utils_js_1.fakePromise)(this._buffer);
|
@@ -157,6 +159,7 @@ class PonyfillBlob {
|
|
157
159
|
}
|
158
160
|
return this.buffer();
|
159
161
|
}
|
162
|
+
_text = null;
|
160
163
|
text() {
|
161
164
|
if (this._text) {
|
162
165
|
return (0, utils_js_1.fakePromise)(this._text);
|
package/cjs/Body.js
CHANGED
@@ -19,19 +19,14 @@ var BodyInitType;
|
|
19
19
|
BodyInitType["Buffer"] = "Buffer";
|
20
20
|
})(BodyInitType || (BodyInitType = {}));
|
21
21
|
class PonyfillBody {
|
22
|
+
bodyInit;
|
23
|
+
options;
|
24
|
+
bodyUsed = false;
|
25
|
+
contentType = null;
|
26
|
+
contentLength = null;
|
22
27
|
constructor(bodyInit, options = {}) {
|
23
28
|
this.bodyInit = bodyInit;
|
24
29
|
this.options = options;
|
25
|
-
this.bodyUsed = false;
|
26
|
-
this.contentType = null;
|
27
|
-
this.contentLength = null;
|
28
|
-
this._bodyFactory = () => null;
|
29
|
-
this._generatedBody = null;
|
30
|
-
this._chunks = null;
|
31
|
-
this._blob = null;
|
32
|
-
this._formData = null;
|
33
|
-
this._json = null;
|
34
|
-
this._text = null;
|
35
30
|
const { bodyFactory, contentType, contentLength, bodyType, buffer } = processBodyInit(bodyInit);
|
36
31
|
this._bodyFactory = bodyFactory;
|
37
32
|
this.contentType = contentType;
|
@@ -39,6 +34,10 @@ class PonyfillBody {
|
|
39
34
|
this.bodyType = bodyType;
|
40
35
|
this._buffer = buffer;
|
41
36
|
}
|
37
|
+
bodyType;
|
38
|
+
_bodyFactory = () => null;
|
39
|
+
_generatedBody = null;
|
40
|
+
_buffer;
|
42
41
|
generateBody() {
|
43
42
|
if (this._generatedBody?.readable?.destroyed && this._buffer) {
|
44
43
|
this._generatedBody.readable = stream_1.Readable.from(this._buffer);
|
@@ -76,6 +75,7 @@ class PonyfillBody {
|
|
76
75
|
}
|
77
76
|
return null;
|
78
77
|
}
|
78
|
+
_chunks = null;
|
79
79
|
_collectChunksFromReadable() {
|
80
80
|
if (this._chunks) {
|
81
81
|
return (0, utils_js_1.fakePromise)(this._chunks);
|
@@ -97,6 +97,7 @@ class PonyfillBody {
|
|
97
97
|
});
|
98
98
|
});
|
99
99
|
}
|
100
|
+
_blob = null;
|
100
101
|
blob() {
|
101
102
|
if (this._blob) {
|
102
103
|
return (0, utils_js_1.fakePromise)(this._blob);
|
@@ -120,6 +121,7 @@ class PonyfillBody {
|
|
120
121
|
return this._blob;
|
121
122
|
});
|
122
123
|
}
|
124
|
+
_formData = null;
|
123
125
|
formData(opts) {
|
124
126
|
if (this._formData) {
|
125
127
|
return (0, utils_js_1.fakePromise)(this._formData);
|
@@ -228,6 +230,7 @@ class PonyfillBody {
|
|
228
230
|
arrayBuffer() {
|
229
231
|
return this.buffer();
|
230
232
|
}
|
233
|
+
_json = null;
|
231
234
|
json() {
|
232
235
|
if (this._json) {
|
233
236
|
return (0, utils_js_1.fakePromise)(this._json);
|
@@ -245,6 +248,7 @@ class PonyfillBody {
|
|
245
248
|
return this._json;
|
246
249
|
});
|
247
250
|
}
|
251
|
+
_text = null;
|
248
252
|
text() {
|
249
253
|
if (this._text) {
|
250
254
|
return (0, utils_js_1.fakePromise)(this._text);
|
package/cjs/File.js
CHANGED
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PonyfillFile = void 0;
|
4
4
|
const Blob_js_1 = require("./Blob.js");
|
5
5
|
class PonyfillFile extends Blob_js_1.PonyfillBlob {
|
6
|
+
name;
|
7
|
+
lastModified;
|
6
8
|
constructor(fileBits, name, options) {
|
7
9
|
super(fileBits, options);
|
8
10
|
this.name = name;
|
9
|
-
this.webkitRelativePath = '';
|
10
11
|
this.lastModified = options?.lastModified || Date.now();
|
11
12
|
}
|
13
|
+
webkitRelativePath = '';
|
12
14
|
}
|
13
15
|
exports.PonyfillFile = PonyfillFile;
|
package/cjs/FormData.js
CHANGED
@@ -4,9 +4,7 @@ exports.PonyfillFormData = void 0;
|
|
4
4
|
exports.getStreamFromFormData = getStreamFromFormData;
|
5
5
|
const ReadableStream_js_1 = require("./ReadableStream.js");
|
6
6
|
class PonyfillFormData {
|
7
|
-
|
8
|
-
this.map = new Map();
|
9
|
-
}
|
7
|
+
map = new Map();
|
10
8
|
append(name, value, fileName) {
|
11
9
|
let values = this.map.get(name);
|
12
10
|
if (!values) {
|
package/cjs/Headers.js
CHANGED
@@ -7,11 +7,13 @@ function isHeadersLike(headers) {
|
|
7
7
|
return headers?.get && headers?.forEach;
|
8
8
|
}
|
9
9
|
class PonyfillHeaders {
|
10
|
+
headersInit;
|
11
|
+
_map;
|
12
|
+
objectNormalizedKeysOfHeadersInit = [];
|
13
|
+
objectOriginalKeysOfHeadersInit = [];
|
14
|
+
_setCookies = [];
|
10
15
|
constructor(headersInit) {
|
11
16
|
this.headersInit = headersInit;
|
12
|
-
this.objectNormalizedKeysOfHeadersInit = [];
|
13
|
-
this.objectOriginalKeysOfHeadersInit = [];
|
14
|
-
this._setCookies = [];
|
15
17
|
}
|
16
18
|
// perf: we don't need to build `this.map` for Requests, as we can access the headers directly
|
17
19
|
_get(key) {
|
package/cjs/ReadableStream.js
CHANGED
@@ -50,8 +50,8 @@ function isReadableStream(obj) {
|
|
50
50
|
return obj?.getReader != null;
|
51
51
|
}
|
52
52
|
class PonyfillReadableStream {
|
53
|
+
readable;
|
53
54
|
constructor(underlyingSource) {
|
54
|
-
this.locked = false;
|
55
55
|
if (underlyingSource instanceof PonyfillReadableStream && underlyingSource.readable != null) {
|
56
56
|
this.readable = underlyingSource.readable;
|
57
57
|
}
|
@@ -127,6 +127,7 @@ class PonyfillReadableStream {
|
|
127
127
|
this.readable.destroy(reason);
|
128
128
|
return Promise.resolve();
|
129
129
|
}
|
130
|
+
locked = false;
|
130
131
|
getReader(_options) {
|
131
132
|
const iterator = this.readable[Symbol.asyncIterator]();
|
132
133
|
this.locked = true;
|
package/cjs/Request.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
var _a;
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
3
|
exports.PonyfillRequest = void 0;
|
5
4
|
const http_1 = require("http");
|
@@ -33,7 +32,6 @@ class PonyfillRequest extends Body_js_1.PonyfillBody {
|
|
33
32
|
requestInit = options;
|
34
33
|
}
|
35
34
|
super(bodyInit, options);
|
36
|
-
this[_a] = 'Request';
|
37
35
|
this.cache = requestInit?.cache || 'default';
|
38
36
|
this.credentials = requestInit?.credentials || 'same-origin';
|
39
37
|
this.headers =
|
@@ -79,6 +77,22 @@ class PonyfillRequest extends Body_js_1.PonyfillBody {
|
|
79
77
|
}
|
80
78
|
this._agent = requestInit?.agent;
|
81
79
|
}
|
80
|
+
headersSerializer;
|
81
|
+
cache;
|
82
|
+
credentials;
|
83
|
+
destination;
|
84
|
+
headers;
|
85
|
+
integrity;
|
86
|
+
keepalive;
|
87
|
+
method;
|
88
|
+
mode;
|
89
|
+
priority;
|
90
|
+
redirect;
|
91
|
+
referrer;
|
92
|
+
referrerPolicy;
|
93
|
+
url;
|
94
|
+
duplex;
|
95
|
+
_agent;
|
82
96
|
get agent() {
|
83
97
|
if (this._agent != null) {
|
84
98
|
return this._agent;
|
@@ -94,6 +108,7 @@ class PonyfillRequest extends Body_js_1.PonyfillBody {
|
|
94
108
|
return https_1.globalAgent;
|
95
109
|
}
|
96
110
|
}
|
111
|
+
_signal;
|
97
112
|
get signal() {
|
98
113
|
// Create a new signal only if needed
|
99
114
|
// Because the creation of signal is expensive
|
@@ -105,6 +120,6 @@ class PonyfillRequest extends Body_js_1.PonyfillBody {
|
|
105
120
|
clone() {
|
106
121
|
return this;
|
107
122
|
}
|
123
|
+
[Symbol.toStringTag] = 'Request';
|
108
124
|
}
|
109
125
|
exports.PonyfillRequest = PonyfillRequest;
|
110
|
-
_a = Symbol.toStringTag;
|
package/cjs/Response.js
CHANGED
@@ -6,6 +6,7 @@ const Body_js_1 = require("./Body.js");
|
|
6
6
|
const Headers_js_1 = require("./Headers.js");
|
7
7
|
const JSON_CONTENT_TYPE = 'application/json; charset=utf-8';
|
8
8
|
class PonyfillResponse extends Body_js_1.PonyfillBody {
|
9
|
+
headers;
|
9
10
|
constructor(body, init) {
|
10
11
|
super(body || null, init);
|
11
12
|
this.headers =
|
@@ -39,6 +40,11 @@ class PonyfillResponse extends Body_js_1.PonyfillBody {
|
|
39
40
|
get ok() {
|
40
41
|
return this.status >= 200 && this.status < 300;
|
41
42
|
}
|
43
|
+
status;
|
44
|
+
statusText;
|
45
|
+
url;
|
46
|
+
redirected;
|
47
|
+
type;
|
42
48
|
clone() {
|
43
49
|
return this;
|
44
50
|
}
|
@@ -4,6 +4,7 @@ exports.PonyfillTextDecoder = exports.PonyfillTextEncoder = void 0;
|
|
4
4
|
exports.PonyfillBtoa = PonyfillBtoa;
|
5
5
|
const utils_js_1 = require("./utils.js");
|
6
6
|
class PonyfillTextEncoder {
|
7
|
+
encoding;
|
7
8
|
constructor(encoding = 'utf-8') {
|
8
9
|
this.encoding = encoding;
|
9
10
|
}
|
@@ -21,10 +22,11 @@ class PonyfillTextEncoder {
|
|
21
22
|
}
|
22
23
|
exports.PonyfillTextEncoder = PonyfillTextEncoder;
|
23
24
|
class PonyfillTextDecoder {
|
25
|
+
encoding;
|
26
|
+
fatal = false;
|
27
|
+
ignoreBOM = false;
|
24
28
|
constructor(encoding = 'utf-8', options) {
|
25
29
|
this.encoding = encoding;
|
26
|
-
this.fatal = false;
|
27
|
-
this.ignoreBOM = false;
|
28
30
|
if (options) {
|
29
31
|
this.fatal = options.fatal || false;
|
30
32
|
this.ignoreBOM = options.ignoreBOM || false;
|
package/cjs/TransformStream.js
CHANGED
@@ -5,6 +5,9 @@ const node_stream_1 = require("node:stream");
|
|
5
5
|
const ReadableStream_js_1 = require("./ReadableStream.js");
|
6
6
|
const WritableStream_js_1 = require("./WritableStream.js");
|
7
7
|
class PonyfillTransformStream {
|
8
|
+
transform;
|
9
|
+
writable;
|
10
|
+
readable;
|
8
11
|
constructor(transformer) {
|
9
12
|
if (transformer instanceof node_stream_1.Transform) {
|
10
13
|
this.transform = transformer;
|
package/cjs/URL.js
CHANGED
@@ -27,6 +27,7 @@ class PonyfillURL extends fast_url_parser_1.default {
|
|
27
27
|
get origin() {
|
28
28
|
return `${this.protocol}//${this.host}`;
|
29
29
|
}
|
30
|
+
_searchParams;
|
30
31
|
get searchParams() {
|
31
32
|
if (!this._searchParams) {
|
32
33
|
this._searchParams = new URLSearchParams_js_1.PonyfillURLSearchParams(this.query);
|
@@ -51,6 +52,7 @@ class PonyfillURL extends fast_url_parser_1.default {
|
|
51
52
|
toJSON() {
|
52
53
|
return this.toString();
|
53
54
|
}
|
55
|
+
static blobRegistry = new Map();
|
54
56
|
static createObjectURL(blob) {
|
55
57
|
const blobUrl = `blob:whatwgnode:${(0, crypto_1.randomUUID)()}`;
|
56
58
|
this.blobRegistry.set(blobUrl, blob);
|
@@ -69,4 +71,3 @@ class PonyfillURL extends fast_url_parser_1.default {
|
|
69
71
|
}
|
70
72
|
}
|
71
73
|
exports.PonyfillURL = PonyfillURL;
|
72
|
-
PonyfillURL.blobRegistry = new Map();
|
package/cjs/URLSearchParams.js
CHANGED
package/cjs/WritableStream.js
CHANGED
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PonyfillWritableStream = void 0;
|
4
4
|
const stream_1 = require("stream");
|
5
5
|
class PonyfillWritableStream {
|
6
|
+
writable;
|
6
7
|
constructor(underlyingSink) {
|
7
|
-
this.locked = false;
|
8
8
|
if (underlyingSink instanceof stream_1.Writable) {
|
9
9
|
this.writable = underlyingSink;
|
10
10
|
}
|
@@ -166,5 +166,6 @@ class PonyfillWritableStream {
|
|
166
166
|
resolve();
|
167
167
|
});
|
168
168
|
}
|
169
|
+
locked = false;
|
169
170
|
}
|
170
171
|
exports.PonyfillWritableStream = PonyfillWritableStream;
|
package/esm/Blob.js
CHANGED
@@ -42,11 +42,12 @@ export function isArrayBuffer(obj) {
|
|
42
42
|
// Will be removed after v14 reaches EOL
|
43
43
|
// Needed because v14 doesn't have .stream() implemented
|
44
44
|
export class PonyfillBlob {
|
45
|
+
blobParts;
|
46
|
+
type;
|
47
|
+
encoding;
|
48
|
+
_size = null;
|
45
49
|
constructor(blobParts = [], options) {
|
46
50
|
this.blobParts = blobParts;
|
47
|
-
this._size = null;
|
48
|
-
this._buffer = null;
|
49
|
-
this._text = null;
|
50
51
|
this.type = options?.type || 'application/octet-stream';
|
51
52
|
this.encoding = options?.encoding || 'utf8';
|
52
53
|
this._size = options?.size || null;
|
@@ -54,6 +55,7 @@ export class PonyfillBlob {
|
|
54
55
|
return blobParts[0];
|
55
56
|
}
|
56
57
|
}
|
58
|
+
_buffer = null;
|
57
59
|
buffer() {
|
58
60
|
if (this._buffer) {
|
59
61
|
return fakePromise(this._buffer);
|
@@ -146,6 +148,7 @@ export class PonyfillBlob {
|
|
146
148
|
}
|
147
149
|
return this.buffer();
|
148
150
|
}
|
151
|
+
_text = null;
|
149
152
|
text() {
|
150
153
|
if (this._text) {
|
151
154
|
return fakePromise(this._text);
|
package/esm/Body.js
CHANGED
@@ -15,19 +15,14 @@ var BodyInitType;
|
|
15
15
|
BodyInitType["Buffer"] = "Buffer";
|
16
16
|
})(BodyInitType || (BodyInitType = {}));
|
17
17
|
export class PonyfillBody {
|
18
|
+
bodyInit;
|
19
|
+
options;
|
20
|
+
bodyUsed = false;
|
21
|
+
contentType = null;
|
22
|
+
contentLength = null;
|
18
23
|
constructor(bodyInit, options = {}) {
|
19
24
|
this.bodyInit = bodyInit;
|
20
25
|
this.options = options;
|
21
|
-
this.bodyUsed = false;
|
22
|
-
this.contentType = null;
|
23
|
-
this.contentLength = null;
|
24
|
-
this._bodyFactory = () => null;
|
25
|
-
this._generatedBody = null;
|
26
|
-
this._chunks = null;
|
27
|
-
this._blob = null;
|
28
|
-
this._formData = null;
|
29
|
-
this._json = null;
|
30
|
-
this._text = null;
|
31
26
|
const { bodyFactory, contentType, contentLength, bodyType, buffer } = processBodyInit(bodyInit);
|
32
27
|
this._bodyFactory = bodyFactory;
|
33
28
|
this.contentType = contentType;
|
@@ -35,6 +30,10 @@ export class PonyfillBody {
|
|
35
30
|
this.bodyType = bodyType;
|
36
31
|
this._buffer = buffer;
|
37
32
|
}
|
33
|
+
bodyType;
|
34
|
+
_bodyFactory = () => null;
|
35
|
+
_generatedBody = null;
|
36
|
+
_buffer;
|
38
37
|
generateBody() {
|
39
38
|
if (this._generatedBody?.readable?.destroyed && this._buffer) {
|
40
39
|
this._generatedBody.readable = Readable.from(this._buffer);
|
@@ -72,6 +71,7 @@ export class PonyfillBody {
|
|
72
71
|
}
|
73
72
|
return null;
|
74
73
|
}
|
74
|
+
_chunks = null;
|
75
75
|
_collectChunksFromReadable() {
|
76
76
|
if (this._chunks) {
|
77
77
|
return fakePromise(this._chunks);
|
@@ -93,6 +93,7 @@ export class PonyfillBody {
|
|
93
93
|
});
|
94
94
|
});
|
95
95
|
}
|
96
|
+
_blob = null;
|
96
97
|
blob() {
|
97
98
|
if (this._blob) {
|
98
99
|
return fakePromise(this._blob);
|
@@ -116,6 +117,7 @@ export class PonyfillBody {
|
|
116
117
|
return this._blob;
|
117
118
|
});
|
118
119
|
}
|
120
|
+
_formData = null;
|
119
121
|
formData(opts) {
|
120
122
|
if (this._formData) {
|
121
123
|
return fakePromise(this._formData);
|
@@ -224,6 +226,7 @@ export class PonyfillBody {
|
|
224
226
|
arrayBuffer() {
|
225
227
|
return this.buffer();
|
226
228
|
}
|
229
|
+
_json = null;
|
227
230
|
json() {
|
228
231
|
if (this._json) {
|
229
232
|
return fakePromise(this._json);
|
@@ -241,6 +244,7 @@ export class PonyfillBody {
|
|
241
244
|
return this._json;
|
242
245
|
});
|
243
246
|
}
|
247
|
+
_text = null;
|
244
248
|
text() {
|
245
249
|
if (this._text) {
|
246
250
|
return fakePromise(this._text);
|
package/esm/File.js
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
import { PonyfillBlob } from './Blob.js';
|
2
2
|
export class PonyfillFile extends PonyfillBlob {
|
3
|
+
name;
|
4
|
+
lastModified;
|
3
5
|
constructor(fileBits, name, options) {
|
4
6
|
super(fileBits, options);
|
5
7
|
this.name = name;
|
6
|
-
this.webkitRelativePath = '';
|
7
8
|
this.lastModified = options?.lastModified || Date.now();
|
8
9
|
}
|
10
|
+
webkitRelativePath = '';
|
9
11
|
}
|
package/esm/FormData.js
CHANGED
package/esm/Headers.js
CHANGED
@@ -3,11 +3,13 @@ export function isHeadersLike(headers) {
|
|
3
3
|
return headers?.get && headers?.forEach;
|
4
4
|
}
|
5
5
|
export class PonyfillHeaders {
|
6
|
+
headersInit;
|
7
|
+
_map;
|
8
|
+
objectNormalizedKeysOfHeadersInit = [];
|
9
|
+
objectOriginalKeysOfHeadersInit = [];
|
10
|
+
_setCookies = [];
|
6
11
|
constructor(headersInit) {
|
7
12
|
this.headersInit = headersInit;
|
8
|
-
this.objectNormalizedKeysOfHeadersInit = [];
|
9
|
-
this.objectOriginalKeysOfHeadersInit = [];
|
10
|
-
this._setCookies = [];
|
11
13
|
}
|
12
14
|
// perf: we don't need to build `this.map` for Requests, as we can access the headers directly
|
13
15
|
_get(key) {
|
package/esm/ReadableStream.js
CHANGED
@@ -47,8 +47,8 @@ function isReadableStream(obj) {
|
|
47
47
|
return obj?.getReader != null;
|
48
48
|
}
|
49
49
|
export class PonyfillReadableStream {
|
50
|
+
readable;
|
50
51
|
constructor(underlyingSource) {
|
51
|
-
this.locked = false;
|
52
52
|
if (underlyingSource instanceof PonyfillReadableStream && underlyingSource.readable != null) {
|
53
53
|
this.readable = underlyingSource.readable;
|
54
54
|
}
|
@@ -124,6 +124,7 @@ export class PonyfillReadableStream {
|
|
124
124
|
this.readable.destroy(reason);
|
125
125
|
return Promise.resolve();
|
126
126
|
}
|
127
|
+
locked = false;
|
127
128
|
getReader(_options) {
|
128
129
|
const iterator = this.readable[Symbol.asyncIterator]();
|
129
130
|
this.locked = true;
|
package/esm/Request.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
var _a;
|
2
1
|
import { globalAgent as httpGlobalAgent } from 'http';
|
3
2
|
import { globalAgent as httpsGlobalAgent } from 'https';
|
4
3
|
import { PonyfillBody } from './Body.js';
|
@@ -30,7 +29,6 @@ export class PonyfillRequest extends PonyfillBody {
|
|
30
29
|
requestInit = options;
|
31
30
|
}
|
32
31
|
super(bodyInit, options);
|
33
|
-
this[_a] = 'Request';
|
34
32
|
this.cache = requestInit?.cache || 'default';
|
35
33
|
this.credentials = requestInit?.credentials || 'same-origin';
|
36
34
|
this.headers =
|
@@ -76,6 +74,22 @@ export class PonyfillRequest extends PonyfillBody {
|
|
76
74
|
}
|
77
75
|
this._agent = requestInit?.agent;
|
78
76
|
}
|
77
|
+
headersSerializer;
|
78
|
+
cache;
|
79
|
+
credentials;
|
80
|
+
destination;
|
81
|
+
headers;
|
82
|
+
integrity;
|
83
|
+
keepalive;
|
84
|
+
method;
|
85
|
+
mode;
|
86
|
+
priority;
|
87
|
+
redirect;
|
88
|
+
referrer;
|
89
|
+
referrerPolicy;
|
90
|
+
url;
|
91
|
+
duplex;
|
92
|
+
_agent;
|
79
93
|
get agent() {
|
80
94
|
if (this._agent != null) {
|
81
95
|
return this._agent;
|
@@ -91,6 +105,7 @@ export class PonyfillRequest extends PonyfillBody {
|
|
91
105
|
return httpsGlobalAgent;
|
92
106
|
}
|
93
107
|
}
|
108
|
+
_signal;
|
94
109
|
get signal() {
|
95
110
|
// Create a new signal only if needed
|
96
111
|
// Because the creation of signal is expensive
|
@@ -102,5 +117,5 @@ export class PonyfillRequest extends PonyfillBody {
|
|
102
117
|
clone() {
|
103
118
|
return this;
|
104
119
|
}
|
120
|
+
[Symbol.toStringTag] = 'Request';
|
105
121
|
}
|
106
|
-
_a = Symbol.toStringTag;
|
package/esm/Response.js
CHANGED
@@ -3,6 +3,7 @@ import { PonyfillBody } from './Body.js';
|
|
3
3
|
import { isHeadersLike, PonyfillHeaders } from './Headers.js';
|
4
4
|
const JSON_CONTENT_TYPE = 'application/json; charset=utf-8';
|
5
5
|
export class PonyfillResponse extends PonyfillBody {
|
6
|
+
headers;
|
6
7
|
constructor(body, init) {
|
7
8
|
super(body || null, init);
|
8
9
|
this.headers =
|
@@ -36,6 +37,11 @@ export class PonyfillResponse extends PonyfillBody {
|
|
36
37
|
get ok() {
|
37
38
|
return this.status >= 200 && this.status < 300;
|
38
39
|
}
|
40
|
+
status;
|
41
|
+
statusText;
|
42
|
+
url;
|
43
|
+
redirected;
|
44
|
+
type;
|
39
45
|
clone() {
|
40
46
|
return this;
|
41
47
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { isArrayBufferView } from './utils.js';
|
2
2
|
export class PonyfillTextEncoder {
|
3
|
+
encoding;
|
3
4
|
constructor(encoding = 'utf-8') {
|
4
5
|
this.encoding = encoding;
|
5
6
|
}
|
@@ -16,10 +17,11 @@ export class PonyfillTextEncoder {
|
|
16
17
|
}
|
17
18
|
}
|
18
19
|
export class PonyfillTextDecoder {
|
20
|
+
encoding;
|
21
|
+
fatal = false;
|
22
|
+
ignoreBOM = false;
|
19
23
|
constructor(encoding = 'utf-8', options) {
|
20
24
|
this.encoding = encoding;
|
21
|
-
this.fatal = false;
|
22
|
-
this.ignoreBOM = false;
|
23
25
|
if (options) {
|
24
26
|
this.fatal = options.fatal || false;
|
25
27
|
this.ignoreBOM = options.ignoreBOM || false;
|
package/esm/TransformStream.js
CHANGED
@@ -2,6 +2,9 @@ import { Transform } from 'node:stream';
|
|
2
2
|
import { PonyfillReadableStream } from './ReadableStream.js';
|
3
3
|
import { PonyfillWritableStream } from './WritableStream.js';
|
4
4
|
export class PonyfillTransformStream {
|
5
|
+
transform;
|
6
|
+
writable;
|
7
|
+
readable;
|
5
8
|
constructor(transformer) {
|
6
9
|
if (transformer instanceof Transform) {
|
7
10
|
this.transform = transformer;
|
package/esm/URL.js
CHANGED
@@ -23,6 +23,7 @@ export class PonyfillURL extends FastUrl {
|
|
23
23
|
get origin() {
|
24
24
|
return `${this.protocol}//${this.host}`;
|
25
25
|
}
|
26
|
+
_searchParams;
|
26
27
|
get searchParams() {
|
27
28
|
if (!this._searchParams) {
|
28
29
|
this._searchParams = new PonyfillURLSearchParams(this.query);
|
@@ -47,6 +48,7 @@ export class PonyfillURL extends FastUrl {
|
|
47
48
|
toJSON() {
|
48
49
|
return this.toString();
|
49
50
|
}
|
51
|
+
static blobRegistry = new Map();
|
50
52
|
static createObjectURL(blob) {
|
51
53
|
const blobUrl = `blob:whatwgnode:${randomUUID()}`;
|
52
54
|
this.blobRegistry.set(blobUrl, blob);
|
@@ -64,4 +66,3 @@ export class PonyfillURL extends FastUrl {
|
|
64
66
|
return (this.blobRegistry.get(url) || resolveObjectURL(url));
|
65
67
|
}
|
66
68
|
}
|
67
|
-
PonyfillURL.blobRegistry = new Map();
|
package/esm/URLSearchParams.js
CHANGED
package/esm/WritableStream.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Writable } from 'stream';
|
2
2
|
export class PonyfillWritableStream {
|
3
|
+
writable;
|
3
4
|
constructor(underlyingSink) {
|
4
|
-
this.locked = false;
|
5
5
|
if (underlyingSink instanceof Writable) {
|
6
6
|
this.writable = underlyingSink;
|
7
7
|
}
|
@@ -163,4 +163,5 @@ export class PonyfillWritableStream {
|
|
163
163
|
resolve();
|
164
164
|
});
|
165
165
|
}
|
166
|
+
locked = false;
|
166
167
|
}
|
package/package.json
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@whatwg-node/node-fetch",
|
3
|
-
"version": "0.5.
|
3
|
+
"version": "0.5.19-alpha-20240729084111-e77361f66f389f0ddd518a2a7b9c3226357369c4",
|
4
4
|
"description": "Fetch API implementation for Node",
|
5
5
|
"sideEffects": false,
|
6
6
|
"dependencies": {
|
7
7
|
"@kamilkisiela/fast-url-parser": "^1.1.4",
|
8
|
-
"@whatwg-node/events": "^0.1.0",
|
9
8
|
"busboy": "^1.6.0",
|
10
9
|
"fast-querystring": "^1.1.1",
|
11
10
|
"tslib": "^2.6.3"
|
@@ -18,7 +17,7 @@
|
|
18
17
|
"author": "Arda TANRIKULU <ardatanrikulu@gmail.com>",
|
19
18
|
"license": "MIT",
|
20
19
|
"engines": {
|
21
|
-
"node": ">=
|
20
|
+
"node": ">=18.0.0"
|
22
21
|
},
|
23
22
|
"main": "cjs/index.js",
|
24
23
|
"module": "esm/index.js",
|