@whatwg-node/node-fetch 0.7.11-rc-20250224102947-56cbafa57aa3a2d5c97ffcd44f35cb98d37c47a3 → 0.7.12-alpha-20250225102211-278c6478ea45ec6f3c81c9f91295113accf29346
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/utils.js +3 -37
- package/esm/utils.js +1 -36
- package/package.json +3 -2
- package/typings/utils.d.cts +1 -1
- package/typings/utils.d.ts +1 -1
package/cjs/utils.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.fakePromise = void 0;
|
3
4
|
exports.getHeadersObj = getHeadersObj;
|
4
5
|
exports.defaultHeadersSerializer = defaultHeadersSerializer;
|
5
|
-
exports.fakePromise = fakePromise;
|
6
6
|
exports.isArrayBufferView = isArrayBufferView;
|
7
7
|
exports.isNodeReadable = isNodeReadable;
|
8
8
|
exports.createDeferredPromise = createDeferredPromise;
|
@@ -27,42 +27,8 @@ function defaultHeadersSerializer(headers, onContentLength) {
|
|
27
27
|
});
|
28
28
|
return headerArray;
|
29
29
|
}
|
30
|
-
|
31
|
-
|
32
|
-
}
|
33
|
-
function fakePromise(value) {
|
34
|
-
if (isPromise(value)) {
|
35
|
-
return value;
|
36
|
-
}
|
37
|
-
// Write a fake promise to avoid the promise constructor
|
38
|
-
// being called with `new Promise` in the browser.
|
39
|
-
return {
|
40
|
-
then(resolve) {
|
41
|
-
if (resolve) {
|
42
|
-
const callbackResult = resolve(value);
|
43
|
-
if (isPromise(callbackResult)) {
|
44
|
-
return callbackResult;
|
45
|
-
}
|
46
|
-
return fakePromise(callbackResult);
|
47
|
-
}
|
48
|
-
return this;
|
49
|
-
},
|
50
|
-
catch() {
|
51
|
-
return this;
|
52
|
-
},
|
53
|
-
finally(cb) {
|
54
|
-
if (cb) {
|
55
|
-
const callbackResult = cb();
|
56
|
-
if (isPromise(callbackResult)) {
|
57
|
-
return callbackResult.then(() => value);
|
58
|
-
}
|
59
|
-
return fakePromise(value);
|
60
|
-
}
|
61
|
-
return this;
|
62
|
-
},
|
63
|
-
[Symbol.toStringTag]: 'Promise',
|
64
|
-
};
|
65
|
-
}
|
30
|
+
var promise_helpers_1 = require("@whatwg-node/promise-helpers");
|
31
|
+
Object.defineProperty(exports, "fakePromise", { enumerable: true, get: function () { return promise_helpers_1.fakePromise; } });
|
66
32
|
function isArrayBufferView(obj) {
|
67
33
|
return obj != null && obj.buffer != null && obj.byteLength != null && obj.byteOffset != null;
|
68
34
|
}
|
package/esm/utils.js
CHANGED
@@ -17,42 +17,7 @@ export function defaultHeadersSerializer(headers, onContentLength) {
|
|
17
17
|
});
|
18
18
|
return headerArray;
|
19
19
|
}
|
20
|
-
|
21
|
-
return val?.then != null;
|
22
|
-
}
|
23
|
-
export function fakePromise(value) {
|
24
|
-
if (isPromise(value)) {
|
25
|
-
return value;
|
26
|
-
}
|
27
|
-
// Write a fake promise to avoid the promise constructor
|
28
|
-
// being called with `new Promise` in the browser.
|
29
|
-
return {
|
30
|
-
then(resolve) {
|
31
|
-
if (resolve) {
|
32
|
-
const callbackResult = resolve(value);
|
33
|
-
if (isPromise(callbackResult)) {
|
34
|
-
return callbackResult;
|
35
|
-
}
|
36
|
-
return fakePromise(callbackResult);
|
37
|
-
}
|
38
|
-
return this;
|
39
|
-
},
|
40
|
-
catch() {
|
41
|
-
return this;
|
42
|
-
},
|
43
|
-
finally(cb) {
|
44
|
-
if (cb) {
|
45
|
-
const callbackResult = cb();
|
46
|
-
if (isPromise(callbackResult)) {
|
47
|
-
return callbackResult.then(() => value);
|
48
|
-
}
|
49
|
-
return fakePromise(value);
|
50
|
-
}
|
51
|
-
return this;
|
52
|
-
},
|
53
|
-
[Symbol.toStringTag]: 'Promise',
|
54
|
-
};
|
55
|
-
}
|
20
|
+
export { fakePromise } from '@whatwg-node/promise-helpers';
|
56
21
|
export function isArrayBufferView(obj) {
|
57
22
|
return obj != null && obj.buffer != null && obj.byteLength != null && obj.byteOffset != null;
|
58
23
|
}
|
package/package.json
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "@whatwg-node/node-fetch",
|
3
|
-
"version": "0.7.
|
3
|
+
"version": "0.7.12-alpha-20250225102211-278c6478ea45ec6f3c81c9f91295113accf29346",
|
4
4
|
"description": "Fetch API implementation for Node",
|
5
5
|
"sideEffects": false,
|
6
6
|
"dependencies": {
|
7
|
-
"@whatwg-node/disposablestack": "
|
7
|
+
"@whatwg-node/disposablestack": "0.0.6-alpha-20250225102211-278c6478ea45ec6f3c81c9f91295113accf29346",
|
8
|
+
"@whatwg-node/promise-helpers": "0.0.1-alpha-20250225102211-278c6478ea45ec6f3c81c9f91295113accf29346",
|
8
9
|
"busboy": "^1.6.0",
|
9
10
|
"tslib": "^2.6.3"
|
10
11
|
},
|
package/typings/utils.d.cts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Readable } from 'node:stream';
|
2
2
|
export declare function getHeadersObj(headers: Headers): Record<string, string>;
|
3
3
|
export declare function defaultHeadersSerializer(headers: Headers, onContentLength?: (value: string) => void): string[];
|
4
|
-
export
|
4
|
+
export { fakePromise } from '@whatwg-node/promise-helpers';
|
5
5
|
export declare function isArrayBufferView(obj: any): obj is ArrayBufferView;
|
6
6
|
export declare function isNodeReadable(obj: any): obj is Readable;
|
7
7
|
export interface DeferredPromise<T = void> {
|
package/typings/utils.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Readable } from 'node:stream';
|
2
2
|
export declare function getHeadersObj(headers: Headers): Record<string, string>;
|
3
3
|
export declare function defaultHeadersSerializer(headers: Headers, onContentLength?: (value: string) => void): string[];
|
4
|
-
export
|
4
|
+
export { fakePromise } from '@whatwg-node/promise-helpers';
|
5
5
|
export declare function isArrayBufferView(obj: any): obj is ArrayBufferView;
|
6
6
|
export declare function isNodeReadable(obj: any): obj is Readable;
|
7
7
|
export interface DeferredPromise<T = void> {
|