@whatwg-node/fetch 0.2.9 → 0.3.2
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/CHANGELOG.md +20 -0
- package/dist/create-node-ponyfill.js +10 -7
- package/dist/deno-ponyfill.ts +2 -0
- package/dist/global-ponyfill.js +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/node-ponyfill.js +1 -0
- package/package.json +1 -1
- package/tests/btoa.spec.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @whatwg-node/fetch
|
|
2
2
|
|
|
3
|
+
## 0.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`982fa96`](https://github.com/ardatan/whatwg-node/commit/982fa96b09af404a21154098499202bfd29c2054) Thanks [@ardatan](https://github.com/ardatan)! - fix(ponyfill/btoa): handle incoming value as binary encoding
|
|
8
|
+
|
|
9
|
+
## 0.3.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`a3bc171`](https://github.com/ardatan/whatwg-node/commit/a3bc17120fbdf641e4363d08ba79955005f5b3d6) Thanks [@ardatan](https://github.com/ardatan)! - fix btoa ponyfill
|
|
14
|
+
|
|
15
|
+
## 0.3.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [`8a431d3`](https://github.com/ardatan/whatwg-node/commit/8a431d309271c0d1ff7248ec26afe293ccc01bf6) Thanks [@ardatan](https://github.com/ardatan)! - Add "btoa" ponyfill for Node 14
|
|
20
|
+
|
|
21
|
+
* [`8a431d3`](https://github.com/ardatan/whatwg-node/commit/8a431d309271c0d1ff7248ec26afe293ccc01bf6) Thanks [@ardatan](https://github.com/ardatan)! - Support different encodings in TextEncoder and TextDecoder
|
|
22
|
+
|
|
3
23
|
## 0.2.9
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -58,19 +58,22 @@ module.exports = function createNodePonyfill(opts = {}) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
ponyfills.
|
|
61
|
+
ponyfills.btoa = globalThis.btoa
|
|
62
|
+
if (!ponyfills.btoa) {
|
|
63
|
+
ponyfills.btoa = function btoa(data) {
|
|
64
|
+
return Buffer.from(data, 'binary').toString('base64');
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
ponyfills.TextEncoder = function TextEncoder(encoding = 'utf-8') {
|
|
62
69
|
return {
|
|
63
70
|
encode(str) {
|
|
64
|
-
return Buffer.from(str,
|
|
71
|
+
return Buffer.from(str, encoding);
|
|
65
72
|
}
|
|
66
73
|
}
|
|
67
74
|
}
|
|
68
75
|
|
|
69
|
-
ponyfills.TextDecoder = function TextDecoder(
|
|
70
|
-
let encoding = 'utf-8'
|
|
71
|
-
if (opts && opts.encoding) {
|
|
72
|
-
encoding = opts.encoding
|
|
73
|
-
}
|
|
76
|
+
ponyfills.TextDecoder = function TextDecoder(encoding = 'utf-8') {
|
|
74
77
|
return {
|
|
75
78
|
decode(buf) {
|
|
76
79
|
return Buffer.from(buf).toString(encoding);
|
package/dist/deno-ponyfill.ts
CHANGED
|
@@ -10,6 +10,7 @@ const TransformStream = globalThis.TransformStream;
|
|
|
10
10
|
const Blob = globalThis.Blob;
|
|
11
11
|
const File = globalThis.File;
|
|
12
12
|
const crypto = globalThis.crypto;
|
|
13
|
+
const btoa = globalThis.btoa;
|
|
13
14
|
const TextDecoder = globalThis.TextDecoder;
|
|
14
15
|
const TextEncoder = globalThis.TextEncoder;
|
|
15
16
|
const Event = globalThis.Event;
|
|
@@ -29,6 +30,7 @@ export {
|
|
|
29
30
|
Blob,
|
|
30
31
|
File,
|
|
31
32
|
crypto,
|
|
33
|
+
btoa,
|
|
32
34
|
TextDecoder,
|
|
33
35
|
TextEncoder,
|
|
34
36
|
Event,
|
package/dist/global-ponyfill.js
CHANGED
|
@@ -10,6 +10,7 @@ module.exports.TransformStream = globalThis.TransformStream;
|
|
|
10
10
|
module.exports.Blob = globalThis.Blob;
|
|
11
11
|
module.exports.File = globalThis.File;
|
|
12
12
|
module.exports.crypto = globalThis.crypto;
|
|
13
|
+
module.exports.btoa = globalThis.btoa;
|
|
13
14
|
module.exports.TextEncoder = globalThis.TextEncoder;
|
|
14
15
|
module.exports.TextDecoder = globalThis.TextDecoder;
|
|
15
16
|
module.exports.Event = globalThis.Event;
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ declare const _TransformStream: typeof TransformStream;
|
|
|
12
12
|
declare const _Blob: typeof Blob;
|
|
13
13
|
declare const _File: typeof File;
|
|
14
14
|
declare const _crypto: typeof crypto;
|
|
15
|
+
declare const _btoa: typeof btoa;
|
|
15
16
|
declare const _TextEncoder: typeof TextEncoder;
|
|
16
17
|
declare const _TextDecoder: typeof TextDecoder;
|
|
17
18
|
declare const _Event: typeof Event;
|
|
@@ -30,6 +31,7 @@ declare module "@whatwg-node/fetch" {
|
|
|
30
31
|
export const Blob: typeof _Blob;
|
|
31
32
|
export const File: typeof _File;
|
|
32
33
|
export const crypto: typeof _crypto;
|
|
34
|
+
export const btoa: typeof _btoa;
|
|
33
35
|
export const TextDecoder: typeof _TextDecoder;
|
|
34
36
|
export const TextEncoder: typeof _TextEncoder;
|
|
35
37
|
export const Event: typeof _Event;
|
|
@@ -62,7 +64,8 @@ declare module "@whatwg-node/fetch" {
|
|
|
62
64
|
TransformStream: typeof _TransformStream,
|
|
63
65
|
Blob: typeof _Blob,
|
|
64
66
|
File: typeof _File,
|
|
65
|
-
crypto: typeof _crypto
|
|
67
|
+
crypto: typeof _crypto,
|
|
68
|
+
btoa: typeof _btoa,
|
|
66
69
|
TextEncoder: typeof _TextEncoder,
|
|
67
70
|
TextDecoder: typeof _TextDecoder,
|
|
68
71
|
Event: typeof _Event,
|
package/dist/node-ponyfill.js
CHANGED
|
@@ -14,6 +14,7 @@ module.exports.TransformStream = ponyfills.TransformStream;
|
|
|
14
14
|
module.exports.Blob = ponyfills.Blob;
|
|
15
15
|
module.exports.File = ponyfills.File;
|
|
16
16
|
module.exports.crypto = ponyfills.crypto;
|
|
17
|
+
module.exports.btoa = ponyfills.btoa;
|
|
17
18
|
module.exports.TextEncoder = ponyfills.TextEncoder;
|
|
18
19
|
module.exports.TextDecoder = ponyfills.TextDecoder;
|
|
19
20
|
module.exports.Event = ponyfills.Event;
|
package/package.json
CHANGED