@wevu/web-apis 1.2.21 → 1.2.22
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/dist/{fetch-CETKuRWs.mjs → fetch-DlXT0r06.mjs} +3 -2
- package/dist/fetch.mjs +1 -1
- package/dist/http.d.mts +4 -2
- package/dist/http.mjs +4 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/websocket.mjs +1 -1
- package/dist/xhr.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { f as isUrlInstance, l as normalizeHeaderName, n as cloneArrayBuffer, o as encodeText, p as isUrlSearchParamsInstance, r as cloneArrayBufferView } from "./shared-B_5_ZEFl.mjs";
|
|
2
|
-
import { HeadersPolyfill, ResponsePolyfill } from "./http.mjs";
|
|
3
|
-
import { resolveRequestMiniProgramOptions } from "./networkDefaults.mjs";
|
|
4
2
|
import { FormDataPolyfill } from "./web.mjs";
|
|
3
|
+
import { HeadersPolyfill, RequestPolyfill, ResponsePolyfill, getRequestBodyValue } from "./http.mjs";
|
|
4
|
+
import { resolveRequestMiniProgramOptions } from "./networkDefaults.mjs";
|
|
5
5
|
import { wpi } from "@wevu/api";
|
|
6
6
|
//#region src/multipart.ts
|
|
7
7
|
const CRLF = "\r\n";
|
|
@@ -135,6 +135,7 @@ function isFormDataInstance(value) {
|
|
|
135
135
|
async function extractRequestBodyFromInput(input) {
|
|
136
136
|
if (!input || typeof input.clone !== "function") return;
|
|
137
137
|
if (input.bodyUsed) throw new TypeError("Failed to execute fetch: request body is already used");
|
|
138
|
+
if (input instanceof RequestPolyfill) return getRequestBodyValue(input);
|
|
138
139
|
const cloned = input.clone();
|
|
139
140
|
if (cloned?.arrayBuffer) return cloned.arrayBuffer();
|
|
140
141
|
if (cloned?.text) return cloned.text();
|
package/dist/fetch.mjs
CHANGED
package/dist/http.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { URLPolyfill } from "./url.mjs";
|
|
2
|
+
import { FormDataPolyfill } from "./web.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/http.d.ts
|
|
4
5
|
type HeaderRecord = Record<string, string>;
|
|
@@ -17,7 +18,8 @@ declare class HeadersPolyfill {
|
|
|
17
18
|
values(): ArrayIterator<string>;
|
|
18
19
|
[Symbol.iterator](): ArrayIterator<[string, string]>;
|
|
19
20
|
}
|
|
20
|
-
type RequestBodyLike = string | ArrayBuffer | ArrayBufferView | Blob | null | undefined;
|
|
21
|
+
type RequestBodyLike = string | ArrayBuffer | ArrayBufferView | Blob | FormData | FormDataPolyfill | null | undefined;
|
|
22
|
+
declare function getRequestBodyValue(request?: RequestPolyfill): RequestBodyLike;
|
|
21
23
|
declare class RequestPolyfill {
|
|
22
24
|
readonly url: string;
|
|
23
25
|
readonly method: string;
|
|
@@ -54,4 +56,4 @@ declare class ResponsePolyfill {
|
|
|
54
56
|
}
|
|
55
57
|
declare function headersToObject(headers: HeadersPolyfill | Headers): HeaderRecord;
|
|
56
58
|
//#endregion
|
|
57
|
-
export { HeadersPolyfill, RequestPolyfill, ResponsePolyfill, headersToObject };
|
|
59
|
+
export { HeadersPolyfill, RequestPolyfill, ResponsePolyfill, getRequestBodyValue, headersToObject };
|
package/dist/http.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { f as isUrlInstance, i as decodeText, l as normalizeHeaderName, n as cloneArrayBuffer, o as encodeText, r as cloneArrayBufferView } from "./shared-B_5_ZEFl.mjs";
|
|
2
|
+
import { FormDataPolyfill } from "./web.mjs";
|
|
2
3
|
//#region src/http.ts
|
|
3
4
|
const SET_COOKIE_HEADER_NAME = "set-cookie";
|
|
4
5
|
function isIterableHeaders(input) {
|
|
@@ -79,6 +80,8 @@ const responseBodyUsedStore = /* @__PURE__ */ new WeakMap();
|
|
|
79
80
|
function normalizeBody(body) {
|
|
80
81
|
if (body == null || typeof body === "string" || body instanceof ArrayBuffer || ArrayBuffer.isView(body)) return body;
|
|
81
82
|
if (typeof Blob !== "undefined" && body instanceof Blob) return body;
|
|
83
|
+
if (typeof FormData !== "undefined" && body instanceof FormData) return body;
|
|
84
|
+
if (body instanceof FormDataPolyfill) return body;
|
|
82
85
|
return String(body);
|
|
83
86
|
}
|
|
84
87
|
async function readBodyAsArrayBuffer(body) {
|
|
@@ -213,4 +216,4 @@ function headersToObject(headers) {
|
|
|
213
216
|
return result;
|
|
214
217
|
}
|
|
215
218
|
//#endregion
|
|
216
|
-
export { HeadersPolyfill, RequestPolyfill, ResponsePolyfill, headersToObject };
|
|
219
|
+
export { HeadersPolyfill, RequestPolyfill, ResponsePolyfill, getRequestBodyValue, headersToObject };
|
package/dist/index.d.mts
CHANGED
|
@@ -3,8 +3,8 @@ import { AbortControllerPolyfill, AbortSignalPolyfill } from "./abort.mjs";
|
|
|
3
3
|
import { MiniProgramNetworkDefaults, RequestGlobalsMiniProgramOptions, WebSocketMiniProgramOptions, getMiniProgramNetworkDefaults, resetMiniProgramNetworkDefaults, setMiniProgramNetworkDefaults } from "./networkDefaults.mjs";
|
|
4
4
|
import { URLPolyfill, URLSearchParamsPolyfill } from "./url.mjs";
|
|
5
5
|
import { fetch } from "./fetch.mjs";
|
|
6
|
-
import { HeadersPolyfill, RequestPolyfill, ResponsePolyfill } from "./http.mjs";
|
|
7
6
|
import { BlobPolyfill, FilePolyfill, FormDataPolyfill } from "./web.mjs";
|
|
7
|
+
import { HeadersPolyfill, RequestPolyfill, ResponsePolyfill } from "./http.mjs";
|
|
8
8
|
import { WebSocketPolyfill } from "./websocket.mjs";
|
|
9
9
|
import { XMLHttpRequestPolyfill } from "./xhr.mjs";
|
|
10
10
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as decodeTextFallback, c as installRequestGlobalBinding, d as resolveRequestGlobalsHosts, g as getMiniProgramRuntimeGlobalKeys, s as encodeTextFallback, t as RequestGlobalsEventTarget, u as resolveRequestGlobalsHost } from "./shared-B_5_ZEFl.mjs";
|
|
2
2
|
import { URLPolyfill, URLSearchParamsPolyfill } from "./url.mjs";
|
|
3
3
|
import { AbortControllerPolyfill, AbortSignalPolyfill } from "./abort.mjs";
|
|
4
|
+
import { BlobPolyfill, FilePolyfill, FormDataPolyfill } from "./web.mjs";
|
|
4
5
|
import { HeadersPolyfill, RequestPolyfill, ResponsePolyfill } from "./http.mjs";
|
|
5
|
-
import { t as fetch } from "./fetch-
|
|
6
|
+
import { t as fetch } from "./fetch-DlXT0r06.mjs";
|
|
6
7
|
import { getMiniProgramNetworkDefaults, resetMiniProgramNetworkDefaults, setMiniProgramNetworkDefaults } from "./networkDefaults.mjs";
|
|
7
|
-
import { BlobPolyfill, FilePolyfill, FormDataPolyfill } from "./web.mjs";
|
|
8
8
|
import { WebSocketPolyfill } from "./websocket.mjs";
|
|
9
9
|
import { XMLHttpRequestPolyfill } from "./xhr.mjs";
|
|
10
10
|
import { REQUEST_GLOBAL_ACTUALS_KEY, REQUEST_GLOBAL_PLACEHOLDER_KEY } from "@weapp-core/constants";
|
package/dist/websocket.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h as resolveUrlConstructor$1, m as resolveTextEncoderConstructor, n as cloneArrayBuffer, r as cloneArrayBufferView, t as RequestGlobalsEventTarget } from "./shared-B_5_ZEFl.mjs";
|
|
2
2
|
import { URLPolyfill } from "./url.mjs";
|
|
3
|
-
import { resolveWebSocketMiniProgramOptions } from "./networkDefaults.mjs";
|
|
4
3
|
import { BlobPolyfill } from "./web.mjs";
|
|
4
|
+
import { resolveWebSocketMiniProgramOptions } from "./networkDefaults.mjs";
|
|
5
5
|
import { wpi } from "@wevu/api";
|
|
6
6
|
//#region src/websocket.ts
|
|
7
7
|
const WHITESPACE_RE = /\s/u;
|
package/dist/xhr.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as RequestGlobalsEventTarget, u as resolveRequestGlobalsHost } from "./shared-B_5_ZEFl.mjs";
|
|
2
2
|
import { AbortControllerPolyfill } from "./abort.mjs";
|
|
3
3
|
import { HeadersPolyfill, headersToObject } from "./http.mjs";
|
|
4
|
-
import { t as fetch } from "./fetch-
|
|
4
|
+
import { t as fetch } from "./fetch-DlXT0r06.mjs";
|
|
5
5
|
//#region src/xhr.ts
|
|
6
6
|
function createProgressEvent(type) {
|
|
7
7
|
return {
|
package/package.json
CHANGED