@wevu/web-apis 1.2.25 → 1.2.26
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/abort.d.mts +0 -1
- package/dist/fetch.d.mts +0 -1
- package/dist/http.d.mts +0 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +9 -1
- package/dist/networkDefaults.d.mts +0 -1
- package/dist/url.mjs +1 -1
- package/dist/web.d.mts +0 -1
- package/dist/websocket.d.mts +0 -1
- package/dist/xhr.d.mts +0 -1
- package/package.json +1 -1
package/dist/abort.d.mts
CHANGED
package/dist/fetch.d.mts
CHANGED
package/dist/http.d.mts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -7,7 +7,6 @@ import { BlobPolyfill, FilePolyfill, FormDataPolyfill } from "./web.mjs";
|
|
|
7
7
|
import { HeadersPolyfill, RequestPolyfill, ResponsePolyfill } from "./http.mjs";
|
|
8
8
|
import { WebSocketPolyfill } from "./websocket.mjs";
|
|
9
9
|
import { XMLHttpRequestPolyfill } from "./xhr.mjs";
|
|
10
|
-
|
|
11
10
|
//#region src/base64.d.ts
|
|
12
11
|
declare function btoaPolyfill(input?: string): string;
|
|
13
12
|
declare function atobPolyfill(input?: string): string;
|
package/dist/index.mjs
CHANGED
|
@@ -223,6 +223,14 @@ function hasUsableConstructor(value, args = []) {
|
|
|
223
223
|
return false;
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
+
function hasWebCompatibleUrlConstructor(value) {
|
|
227
|
+
if (!hasUsableConstructor(value, ["https://request-globals.invalid"])) return false;
|
|
228
|
+
try {
|
|
229
|
+
return new value("123", "fake://abc").href === "fake://abc/123";
|
|
230
|
+
} catch {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
226
234
|
function assignHostGlobal(host, key, value) {
|
|
227
235
|
try {
|
|
228
236
|
host[key] = value;
|
|
@@ -381,7 +389,7 @@ function installSingleTarget(host, target) {
|
|
|
381
389
|
if (target === "XMLHttpRequest" && (typeof host.XMLHttpRequest !== "function" || isPlaceholderRequestGlobal(host.XMLHttpRequest))) assignHostGlobal(host, "XMLHttpRequest", XMLHttpRequestPolyfill);
|
|
382
390
|
}
|
|
383
391
|
function installUrlGlobals(host) {
|
|
384
|
-
if (!
|
|
392
|
+
if (!hasWebCompatibleUrlConstructor(host.URL) || !patchUrlConstructor(host)) assignHostGlobal(host, "URL", URLPolyfill);
|
|
385
393
|
if (!hasUsableConstructor(host.URLSearchParams, ["client=graphql-request"]) || !patchUrlSearchParamsConstructor(host)) assignHostGlobal(host, "URLSearchParams", URLSearchParamsPolyfill);
|
|
386
394
|
if (!hasUsableConstructor(host.Blob)) assignHostGlobal(host, "Blob", BlobPolyfill);
|
|
387
395
|
if (!hasUsableConstructor(host.File, [[], "request-globals.bin"])) assignHostGlobal(host, "File", FilePolyfill);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { WeapiMiniProgramConnectSocketOption, WeapiMiniProgramRequestOption } from "@wevu/api";
|
|
2
|
-
|
|
3
2
|
//#region src/networkDefaults.d.ts
|
|
4
3
|
declare const MINI_PROGRAM_REQUEST_OPTION_KEYS: readonly ["enableCache", "enableChunked", "enableHttp2", "enableHttpDNS", "enableProfile", "enableQuic", "forceCellularNetwork", "httpDNSServiceId", "httpDNSTimeout", "redirect", "timeout", "useHighPerformanceMode"];
|
|
5
4
|
declare const MINI_PROGRAM_SOCKET_OPTION_KEYS: readonly ["forceCellularNetwork", "header", "perMessageDeflate", "timeout"];
|
package/dist/url.mjs
CHANGED
|
@@ -64,7 +64,7 @@ function resolveRelativeUrl(input, base) {
|
|
|
64
64
|
}
|
|
65
65
|
basePathSegments.push(segment);
|
|
66
66
|
}
|
|
67
|
-
return `${parsedBase.origin}
|
|
67
|
+
return `${parsedBase.origin}${basePathSegments.join("/")}`;
|
|
68
68
|
}
|
|
69
69
|
var URLSearchParamsPolyfill = class {
|
|
70
70
|
onChange;
|
package/dist/web.d.mts
CHANGED
package/dist/websocket.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RequestGlobalsBlobLike, RequestGlobalsEventTarget } from "./shared.mjs";
|
|
2
2
|
import { WebSocketMiniProgramOptions } from "./networkDefaults.mjs";
|
|
3
3
|
import { BlobPolyfill } from "./web.mjs";
|
|
4
|
-
|
|
5
4
|
//#region src/websocket.d.ts
|
|
6
5
|
type WebSocketBinaryType = 'blob' | 'arraybuffer';
|
|
7
6
|
type WebSocketSendData = string | ArrayBuffer | ArrayBufferView | Blob | RequestGlobalsBlobLike;
|
package/dist/xhr.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RequestGlobalsEventTarget } from "./shared.mjs";
|
|
2
2
|
import { RequestGlobalsMiniProgramOptions } from "./networkDefaults.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/xhr.d.ts
|
|
5
4
|
type XhrBody = Document | XMLHttpRequestBodyInit | null | undefined;
|
|
6
5
|
declare class XMLHttpRequestUploadPolyfill extends RequestGlobalsEventTarget {}
|
package/package.json
CHANGED