@whatwg-node/node-fetch 0.6.0 → 0.7.0-alpha-20241108113501-c93849fd55fb01e4f4787f610e52c67ea08ced92
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 +17 -0
- package/cjs/TextEncoderDecoderStream.js +44 -0
- package/cjs/index.js +4 -1
- package/esm/Blob.js +17 -0
- package/esm/TextEncoderDecoderStream.js +39 -0
- package/esm/index.js +1 -0
- package/package.json +1 -1
- package/typings/Blob.d.cts +4 -0
- package/typings/Blob.d.ts +4 -0
- package/typings/TextEncoderDecoderStream.d.cts +14 -0
- package/typings/TextEncoderDecoderStream.d.ts +14 -0
- package/typings/index.d.cts +1 -0
- package/typings/index.d.ts +1 -0
package/cjs/Blob.js
CHANGED
@@ -185,6 +185,23 @@ class PonyfillBlob {
|
|
185
185
|
return this._text;
|
186
186
|
});
|
187
187
|
}
|
188
|
+
_json = null;
|
189
|
+
json() {
|
190
|
+
if (this._json) {
|
191
|
+
return (0, utils_js_1.fakePromise)(this._json);
|
192
|
+
}
|
193
|
+
return this.text().then(text => {
|
194
|
+
this._json = JSON.parse(text);
|
195
|
+
return this._json;
|
196
|
+
});
|
197
|
+
}
|
198
|
+
_formData = null;
|
199
|
+
formData() {
|
200
|
+
if (this._formData) {
|
201
|
+
return (0, utils_js_1.fakePromise)(this._formData);
|
202
|
+
}
|
203
|
+
throw new Error('Not implemented');
|
204
|
+
}
|
188
205
|
get size() {
|
189
206
|
if (this._size == null) {
|
190
207
|
this._size = 0;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.PonyfillTextEncoderStream = exports.PonyfillTextDecoderStream = void 0;
|
4
|
+
const TextEncoderDecoder_js_1 = require("./TextEncoderDecoder.js");
|
5
|
+
const TransformStream_js_1 = require("./TransformStream.js");
|
6
|
+
class PonyfillTextDecoderStream extends TransformStream_js_1.PonyfillTransformStream {
|
7
|
+
textDecoder;
|
8
|
+
constructor(encoding, options) {
|
9
|
+
super({
|
10
|
+
transform: (chunk, controller) => {
|
11
|
+
controller.enqueue(this.textDecoder.decode(chunk, { stream: true }));
|
12
|
+
},
|
13
|
+
});
|
14
|
+
this.textDecoder = new TextEncoderDecoder_js_1.PonyfillTextDecoder(encoding, options);
|
15
|
+
}
|
16
|
+
get encoding() {
|
17
|
+
return this.textDecoder.encoding;
|
18
|
+
}
|
19
|
+
get fatal() {
|
20
|
+
return this.textDecoder.fatal;
|
21
|
+
}
|
22
|
+
get ignoreBOM() {
|
23
|
+
return this.textDecoder.ignoreBOM;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
exports.PonyfillTextDecoderStream = PonyfillTextDecoderStream;
|
27
|
+
class PonyfillTextEncoderStream extends TransformStream_js_1.PonyfillTransformStream {
|
28
|
+
textEncoder;
|
29
|
+
constructor(encoding) {
|
30
|
+
super({
|
31
|
+
transform: (chunk, controller) => {
|
32
|
+
controller.enqueue(this.textEncoder.encode(chunk));
|
33
|
+
},
|
34
|
+
});
|
35
|
+
this.textEncoder = new TextEncoderDecoder_js_1.PonyfillTextEncoder(encoding);
|
36
|
+
}
|
37
|
+
get encoding() {
|
38
|
+
return this.textEncoder.encoding;
|
39
|
+
}
|
40
|
+
encode(input) {
|
41
|
+
return this.textEncoder.encode(input);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
exports.PonyfillTextEncoderStream = PonyfillTextEncoderStream;
|
package/cjs/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.IteratorObject = 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;
|
3
|
+
exports.TextEncoderStream = exports.TextDecoderStream = exports.IteratorObject = 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;
|
4
4
|
var fetch_js_1 = require("./fetch.js");
|
5
5
|
Object.defineProperty(exports, "fetch", { enumerable: true, get: function () { return fetch_js_1.fetchPonyfill; } });
|
6
6
|
var Headers_js_1 = require("./Headers.js");
|
@@ -37,3 +37,6 @@ var DecompressionStream_js_1 = require("./DecompressionStream.js");
|
|
37
37
|
Object.defineProperty(exports, "DecompressionStream", { enumerable: true, get: function () { return DecompressionStream_js_1.PonyfillDecompressionStream; } });
|
38
38
|
var IteratorObject_js_1 = require("./IteratorObject.js");
|
39
39
|
Object.defineProperty(exports, "IteratorObject", { enumerable: true, get: function () { return IteratorObject_js_1.PonyfillIteratorObject; } });
|
40
|
+
var TextEncoderDecoderStream_js_1 = require("./TextEncoderDecoderStream.js");
|
41
|
+
Object.defineProperty(exports, "TextDecoderStream", { enumerable: true, get: function () { return TextEncoderDecoderStream_js_1.PonyfillTextDecoderStream; } });
|
42
|
+
Object.defineProperty(exports, "TextEncoderStream", { enumerable: true, get: function () { return TextEncoderDecoderStream_js_1.PonyfillTextEncoderStream; } });
|
package/esm/Blob.js
CHANGED
@@ -174,6 +174,23 @@ export class PonyfillBlob {
|
|
174
174
|
return this._text;
|
175
175
|
});
|
176
176
|
}
|
177
|
+
_json = null;
|
178
|
+
json() {
|
179
|
+
if (this._json) {
|
180
|
+
return fakePromise(this._json);
|
181
|
+
}
|
182
|
+
return this.text().then(text => {
|
183
|
+
this._json = JSON.parse(text);
|
184
|
+
return this._json;
|
185
|
+
});
|
186
|
+
}
|
187
|
+
_formData = null;
|
188
|
+
formData() {
|
189
|
+
if (this._formData) {
|
190
|
+
return fakePromise(this._formData);
|
191
|
+
}
|
192
|
+
throw new Error('Not implemented');
|
193
|
+
}
|
177
194
|
get size() {
|
178
195
|
if (this._size == null) {
|
179
196
|
this._size = 0;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { PonyfillTextDecoder, PonyfillTextEncoder } from './TextEncoderDecoder.js';
|
2
|
+
import { PonyfillTransformStream } from './TransformStream.js';
|
3
|
+
export class PonyfillTextDecoderStream extends PonyfillTransformStream {
|
4
|
+
textDecoder;
|
5
|
+
constructor(encoding, options) {
|
6
|
+
super({
|
7
|
+
transform: (chunk, controller) => {
|
8
|
+
controller.enqueue(this.textDecoder.decode(chunk, { stream: true }));
|
9
|
+
},
|
10
|
+
});
|
11
|
+
this.textDecoder = new PonyfillTextDecoder(encoding, options);
|
12
|
+
}
|
13
|
+
get encoding() {
|
14
|
+
return this.textDecoder.encoding;
|
15
|
+
}
|
16
|
+
get fatal() {
|
17
|
+
return this.textDecoder.fatal;
|
18
|
+
}
|
19
|
+
get ignoreBOM() {
|
20
|
+
return this.textDecoder.ignoreBOM;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
export class PonyfillTextEncoderStream extends PonyfillTransformStream {
|
24
|
+
textEncoder;
|
25
|
+
constructor(encoding) {
|
26
|
+
super({
|
27
|
+
transform: (chunk, controller) => {
|
28
|
+
controller.enqueue(this.textEncoder.encode(chunk));
|
29
|
+
},
|
30
|
+
});
|
31
|
+
this.textEncoder = new PonyfillTextEncoder(encoding);
|
32
|
+
}
|
33
|
+
get encoding() {
|
34
|
+
return this.textEncoder.encoding;
|
35
|
+
}
|
36
|
+
encode(input) {
|
37
|
+
return this.textEncoder.encode(input);
|
38
|
+
}
|
39
|
+
}
|
package/esm/index.js
CHANGED
@@ -15,3 +15,4 @@ export { PonyfillTransformStream as TransformStream } from './TransformStream.js
|
|
15
15
|
export { PonyfillCompressionStream as CompressionStream } from './CompressionStream.js';
|
16
16
|
export { PonyfillDecompressionStream as DecompressionStream } from './DecompressionStream.js';
|
17
17
|
export { PonyfillIteratorObject as IteratorObject } from './IteratorObject.js';
|
18
|
+
export { PonyfillTextDecoderStream as TextDecoderStream, PonyfillTextEncoderStream as TextEncoderStream, } from './TextEncoderDecoderStream.js';
|
package/package.json
CHANGED
package/typings/Blob.d.cts
CHANGED
@@ -46,6 +46,10 @@ export declare class PonyfillBlob implements Blob {
|
|
46
46
|
bytes(): Promise<Uint8Array>;
|
47
47
|
_text: string | null;
|
48
48
|
text(): Promise<string>;
|
49
|
+
_json: any;
|
50
|
+
json(): Promise<any>;
|
51
|
+
_formData: FormData | null;
|
52
|
+
formData(): Promise<FormData>;
|
49
53
|
get size(): number;
|
50
54
|
stream(): any;
|
51
55
|
slice(): any;
|
package/typings/Blob.d.ts
CHANGED
@@ -46,6 +46,10 @@ export declare class PonyfillBlob implements Blob {
|
|
46
46
|
bytes(): Promise<Uint8Array>;
|
47
47
|
_text: string | null;
|
48
48
|
text(): Promise<string>;
|
49
|
+
_json: any;
|
50
|
+
json(): Promise<any>;
|
51
|
+
_formData: FormData | null;
|
52
|
+
formData(): Promise<FormData>;
|
49
53
|
get size(): number;
|
50
54
|
stream(): any;
|
51
55
|
slice(): any;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { PonyfillTransformStream } from './TransformStream.cjs';
|
2
|
+
export declare class PonyfillTextDecoderStream extends PonyfillTransformStream implements TextDecoderStream {
|
3
|
+
private textDecoder;
|
4
|
+
constructor(encoding?: BufferEncoding, options?: TextDecoderOptions);
|
5
|
+
get encoding(): string;
|
6
|
+
get fatal(): boolean;
|
7
|
+
get ignoreBOM(): boolean;
|
8
|
+
}
|
9
|
+
export declare class PonyfillTextEncoderStream extends PonyfillTransformStream implements TextEncoderStream {
|
10
|
+
private textEncoder;
|
11
|
+
constructor(encoding?: BufferEncoding);
|
12
|
+
get encoding(): string;
|
13
|
+
encode(input: string): Uint8Array;
|
14
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { PonyfillTransformStream } from './TransformStream.js';
|
2
|
+
export declare class PonyfillTextDecoderStream extends PonyfillTransformStream implements TextDecoderStream {
|
3
|
+
private textDecoder;
|
4
|
+
constructor(encoding?: BufferEncoding, options?: TextDecoderOptions);
|
5
|
+
get encoding(): string;
|
6
|
+
get fatal(): boolean;
|
7
|
+
get ignoreBOM(): boolean;
|
8
|
+
}
|
9
|
+
export declare class PonyfillTextEncoderStream extends PonyfillTransformStream implements TextEncoderStream {
|
10
|
+
private textEncoder;
|
11
|
+
constructor(encoding?: BufferEncoding);
|
12
|
+
get encoding(): string;
|
13
|
+
encode(input: string): Uint8Array;
|
14
|
+
}
|
package/typings/index.d.cts
CHANGED
@@ -15,3 +15,4 @@ export { PonyfillTransformStream as TransformStream } from './TransformStream.cj
|
|
15
15
|
export { PonyfillCompressionStream as CompressionStream } from './CompressionStream.cjs';
|
16
16
|
export { PonyfillDecompressionStream as DecompressionStream } from './DecompressionStream.cjs';
|
17
17
|
export { PonyfillIteratorObject as IteratorObject } from './IteratorObject.cjs';
|
18
|
+
export { PonyfillTextDecoderStream as TextDecoderStream, PonyfillTextEncoderStream as TextEncoderStream, } from './TextEncoderDecoderStream.cjs';
|
package/typings/index.d.ts
CHANGED
@@ -15,3 +15,4 @@ export { PonyfillTransformStream as TransformStream } from './TransformStream.js
|
|
15
15
|
export { PonyfillCompressionStream as CompressionStream } from './CompressionStream.js';
|
16
16
|
export { PonyfillDecompressionStream as DecompressionStream } from './DecompressionStream.js';
|
17
17
|
export { PonyfillIteratorObject as IteratorObject } from './IteratorObject.js';
|
18
|
+
export { PonyfillTextDecoderStream as TextDecoderStream, PonyfillTextEncoderStream as TextEncoderStream, } from './TextEncoderDecoderStream.js';
|