@wevu/web-apis 1.2.39 → 1.2.41

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import { RequestGlobalsEventTarget } from "./shared.mjs";
2
2
  //#region src/abort.d.ts
3
- declare class AbortSignalPolyfill extends RequestGlobalsEventTarget {
3
+ export declare class AbortSignalPolyfill extends RequestGlobalsEventTarget {
4
4
  aborted: boolean;
5
5
  reason: unknown;
6
6
  onabort: ((event: {
@@ -8,9 +8,8 @@ declare class AbortSignalPolyfill extends RequestGlobalsEventTarget {
8
8
  }) => void) | null;
9
9
  throwIfAborted(): void;
10
10
  }
11
- declare class AbortControllerPolyfill {
11
+ export declare class AbortControllerPolyfill {
12
12
  readonly signal: AbortSignalPolyfill;
13
13
  abort(reason?: unknown): void;
14
14
  }
15
- //#endregion
16
- export { AbortControllerPolyfill, AbortSignalPolyfill };
15
+ //#endregion
package/dist/abort.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as RequestGlobalsEventTarget } from "./shared-Boj9gvKq.mjs";
1
+ import { t as RequestGlobalsEventTarget } from "./shared-BsJRaiBh.mjs";
2
2
  //#region src/abort.ts
3
3
  function createAbortError(reason) {
4
4
  if (reason instanceof Error) return reason;
@@ -1,4 +1,4 @@
1
- import { d as normalizeHeaderName, h as isUrlSearchParamsInstance, l as isArrayBufferLike, m as isUrlInstance, n as cloneArrayBuffer, o as encodeText, r as cloneArrayBufferView, u as isBlobLike } from "./shared-Boj9gvKq.mjs";
1
+ import { d as normalizeHeaderName, h as isUrlSearchParamsInstance, l as isArrayBufferLike, m as isUrlInstance, n as cloneArrayBuffer, o as encodeText, r as cloneArrayBufferView, u as isBlobLike } from "./shared-BsJRaiBh.mjs";
2
2
  import { FormDataPolyfill } from "./web.mjs";
3
3
  import { HeadersPolyfill, RequestPolyfill, ResponsePolyfill, getRequestBodyValue } from "./http.mjs";
4
4
  import { resolveRequestMiniProgramOptions } from "./networkDefaults.mjs";
@@ -9,7 +9,7 @@ function createMultipartBoundary() {
9
9
  return `----weapp-vite-formdata-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
10
10
  }
11
11
  function escapeMultipartName(value) {
12
- return String(value).replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\r", "%0D").replaceAll("\n", "%0A");
12
+ return String(value).replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\r/g, "%0D").replace(/\n/g, "%0A");
13
13
  }
14
14
  function concatArrayBuffers(buffers) {
15
15
  const totalLength = buffers.reduce((sum, buffer) => sum + buffer.byteLength, 0);
package/dist/fetch.d.mts CHANGED
@@ -12,7 +12,7 @@ interface RequestLikeInput {
12
12
  text?: () => Promise<string>;
13
13
  };
14
14
  }
15
- interface RequestGlobalsFetchInit {
15
+ export interface RequestGlobalsFetchInit {
16
16
  method?: string;
17
17
  headers?: unknown;
18
18
  body?: unknown;
@@ -31,6 +31,6 @@ type RequestGlobalsFetchInput = string | URL | URLPolyfill | RequestLikeInput;
31
31
  /**
32
32
  * @description 使用 @wevu/api 的 request 能力实现 fetch 语义对齐。
33
33
  */
34
- declare function fetch(input: RequestGlobalsFetchInput, init?: RequestGlobalsFetchInit): Promise<Response>;
34
+ export declare function fetch(input: RequestGlobalsFetchInput, init?: RequestGlobalsFetchInit): Promise<Response>;
35
35
  //#endregion
36
- export { RequestGlobalsFetchInit, type RequestGlobalsMiniProgramOptions, fetch };
36
+ export type { RequestGlobalsMiniProgramOptions };
package/dist/fetch.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import "./http.mjs";
2
- import { t as fetch } from "./fetch-CeiB6wK4.mjs";
2
+ import { t as fetch } from "./fetch-BPqcYqI3.mjs";
3
3
  export { fetch };
package/dist/http.d.mts CHANGED
@@ -3,7 +3,7 @@ import { URLPolyfill } from "./url.mjs";
3
3
  import { FormDataPolyfill } from "./web.mjs";
4
4
  //#region src/http.d.ts
5
5
  type HeaderRecord = Record<string, string>;
6
- declare class HeadersPolyfill {
6
+ export declare class HeadersPolyfill {
7
7
  private readonly store;
8
8
  constructor(init?: unknown);
9
9
  append(key: string, value: string): void;
@@ -19,8 +19,8 @@ declare class HeadersPolyfill {
19
19
  [Symbol.iterator](): ArrayIterator<[string, string]>;
20
20
  }
21
21
  type RequestBodyLike = string | ArrayBuffer | ArrayBufferView | Blob | RequestGlobalsBlobLike | FormData | FormDataPolyfill | null | undefined;
22
- declare function getRequestBodyValue(request?: RequestPolyfill): RequestBodyLike;
23
- declare class RequestPolyfill {
22
+ export declare function getRequestBodyValue(request?: RequestPolyfill): RequestBodyLike;
23
+ export declare class RequestPolyfill {
24
24
  readonly url: string;
25
25
  readonly method: string;
26
26
  readonly headers: HeadersPolyfill;
@@ -33,7 +33,7 @@ declare class RequestPolyfill {
33
33
  text(): Promise<string>;
34
34
  clone(): RequestPolyfill;
35
35
  }
36
- declare class ResponsePolyfill {
36
+ export declare class ResponsePolyfill {
37
37
  readonly headers: HeadersPolyfill;
38
38
  readonly status: number;
39
39
  readonly statusText: string;
@@ -54,6 +54,5 @@ declare class ResponsePolyfill {
54
54
  text(): Promise<string>;
55
55
  clone(): ResponsePolyfill;
56
56
  }
57
- declare function headersToObject(headers: HeadersPolyfill | Headers): HeaderRecord;
58
- //#endregion
59
- export { HeadersPolyfill, RequestPolyfill, ResponsePolyfill, getRequestBodyValue, headersToObject };
57
+ export declare function headersToObject(headers: HeadersPolyfill | Headers): HeaderRecord;
58
+ //#endregion
package/dist/http.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { d as normalizeHeaderName, i as decodeText, l as isArrayBufferLike, m as isUrlInstance, n as cloneArrayBuffer, o as encodeText, r as cloneArrayBufferView, u as isBlobLike } from "./shared-Boj9gvKq.mjs";
1
+ import { d as normalizeHeaderName, i as decodeText, l as isArrayBufferLike, m as isUrlInstance, n as cloneArrayBuffer, o as encodeText, r as cloneArrayBufferView, u as isBlobLike } from "./shared-BsJRaiBh.mjs";
2
2
  import { FormDataPolyfill } from "./web.mjs";
3
3
  //#region src/http.ts
4
4
  const SET_COOKIE_HEADER_NAME = "set-cookie";
package/dist/index.d.mts CHANGED
@@ -8,13 +8,13 @@ import { HeadersPolyfill, RequestPolyfill, ResponsePolyfill } from "./http.mjs";
8
8
  import { WebSocketPolyfill } from "./websocket.mjs";
9
9
  import { XMLHttpRequestPolyfill } from "./xhr.mjs";
10
10
  //#region src/base64.d.ts
11
- declare function btoaPolyfill(input?: string): string;
12
- declare function atobPolyfill(input?: string): string;
11
+ export declare function btoaPolyfill(input?: string): string;
12
+ export declare function atobPolyfill(input?: string): string;
13
13
  //#endregion
14
14
  //#region src/crypto.d.ts
15
15
  type IntegerTypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array;
16
16
  declare function getRandomValuesPolyfill<T extends IntegerTypedArray>(typedArray: T): (T & Int8Array<ArrayBufferLike>) | (T & Uint8Array<ArrayBufferLike>) | (T & Uint8ClampedArray<ArrayBufferLike>) | (T & Int16Array<ArrayBufferLike>) | (T & Uint16Array<ArrayBufferLike>) | (T & Int32Array<ArrayBufferLike>) | (T & Uint32Array<ArrayBufferLike>) | (T & BigInt64Array<ArrayBufferLike>) | (T & BigUint64Array<ArrayBufferLike>);
17
- declare const cryptoPolyfill: {
17
+ export declare const cryptoPolyfill: {
18
18
  getRandomValues: typeof getRandomValuesPolyfill;
19
19
  };
20
20
  //#endregion
@@ -27,7 +27,7 @@ interface EventInitPolyfill {
27
27
  interface CustomEventInitPolyfill<T = any> extends EventInitPolyfill {
28
28
  detail?: T;
29
29
  }
30
- declare class EventPolyfill {
30
+ export declare class EventPolyfill {
31
31
  readonly bubbles: boolean;
32
32
  readonly cancelable: boolean;
33
33
  readonly composed: boolean;
@@ -44,7 +44,7 @@ declare class EventPolyfill {
44
44
  stopImmediatePropagation(): void;
45
45
  stopPropagation(): void;
46
46
  }
47
- declare class CustomEventPolyfill<T = any> extends EventPolyfill {
47
+ export declare class CustomEventPolyfill<T = any> extends EventPolyfill {
48
48
  readonly detail: T | null;
49
49
  constructor(type: string, init?: CustomEventInitPolyfill<T>);
50
50
  }
@@ -57,15 +57,15 @@ declare const performancePolyfill: {
57
57
  };
58
58
  //#endregion
59
59
  //#region src/task.d.ts
60
- declare function queueMicrotaskPolyfill(callback: () => void): void;
60
+ export declare function queueMicrotaskPolyfill(callback: () => void): void;
61
61
  //#endregion
62
62
  //#region src/textCodec.d.ts
63
63
  type TextDecoderInput = ArrayBuffer | ArrayBufferView | null | undefined;
64
- declare class TextEncoderPolyfill {
64
+ export declare class TextEncoderPolyfill {
65
65
  readonly encoding = "utf-8";
66
66
  encode(input?: string): Uint8Array<ArrayBuffer>;
67
67
  }
68
- declare class TextDecoderPolyfill {
68
+ export declare class TextDecoderPolyfill {
69
69
  readonly encoding = "utf-8";
70
70
  readonly fatal = false;
71
71
  readonly ignoreBOM = false;
@@ -73,24 +73,24 @@ declare class TextDecoderPolyfill {
73
73
  }
74
74
  //#endregion
75
75
  //#region src/index.d.ts
76
- type WeappInjectWebRuntimeGlobalsTarget = 'fetch' | 'Headers' | 'Request' | 'Response' | 'TextEncoder' | 'TextDecoder' | 'AbortController' | 'AbortSignal' | 'XMLHttpRequest' | 'WebSocket' | 'atob' | 'btoa' | 'queueMicrotask' | 'performance' | 'crypto' | 'Event' | 'CustomEvent';
77
- type WeappInjectRequestGlobalsTarget = WeappInjectWebRuntimeGlobalsTarget;
78
- interface InstallWebRuntimeGlobalsOptions {
76
+ export type WeappInjectWebRuntimeGlobalsTarget = 'fetch' | 'Headers' | 'Request' | 'Response' | 'TextEncoder' | 'TextDecoder' | 'AbortController' | 'AbortSignal' | 'XMLHttpRequest' | 'WebSocket' | 'atob' | 'btoa' | 'queueMicrotask' | 'performance' | 'crypto' | 'Event' | 'CustomEvent';
77
+ export type WeappInjectRequestGlobalsTarget = WeappInjectWebRuntimeGlobalsTarget;
78
+ export interface InstallWebRuntimeGlobalsOptions {
79
79
  targets?: WeappInjectWebRuntimeGlobalsTarget[];
80
80
  networkDefaults?: MiniProgramNetworkDefaults;
81
81
  }
82
- interface InstallRequestGlobalsOptions extends InstallWebRuntimeGlobalsOptions {}
82
+ export interface InstallRequestGlobalsOptions extends InstallWebRuntimeGlobalsOptions {}
83
83
  /**
84
84
  * @description 按需向小程序全局环境注入缺失的 Web Runtime 对象。
85
85
  */
86
- declare function installWebRuntimeGlobals(options?: InstallWebRuntimeGlobalsOptions): Record<string, any>;
86
+ export declare function installWebRuntimeGlobals(options?: InstallWebRuntimeGlobalsOptions): Record<string, any>;
87
87
  /**
88
88
  * @description 已废弃,请迁移到 `installWebRuntimeGlobals`。
89
89
  */
90
- declare function installRequestGlobals(options?: InstallRequestGlobalsOptions): Record<string, any>;
90
+ export declare function installRequestGlobals(options?: InstallRequestGlobalsOptions): Record<string, any>;
91
91
  /**
92
92
  * @description 仅安装 AbortController 与 AbortSignal 兼容层。
93
93
  */
94
- declare function installAbortGlobals(): Record<string, any>;
94
+ export declare function installAbortGlobals(): Record<string, any>;
95
95
  //#endregion
96
- export { AbortControllerPolyfill, AbortSignalPolyfill, BlobPolyfill, CustomEventPolyfill, EventPolyfill, FilePolyfill, FormDataPolyfill, HeadersPolyfill, InstallRequestGlobalsOptions, InstallWebRuntimeGlobalsOptions, type MiniProgramNetworkDefaults, RequestGlobalsEventTarget, type RequestGlobalsMiniProgramOptions, RequestPolyfill, ResponsePolyfill, TextDecoderPolyfill, TextEncoderPolyfill, URLPolyfill, URLSearchParamsPolyfill, WeappInjectRequestGlobalsTarget, WeappInjectWebRuntimeGlobalsTarget, type WebSocketMiniProgramOptions, WebSocketPolyfill, XMLHttpRequestPolyfill, atobPolyfill, btoaPolyfill, cryptoPolyfill, fetch, getMiniProgramNetworkDefaults, installAbortGlobals, installRequestGlobals, installWebRuntimeGlobals, performancePolyfill, queueMicrotaskPolyfill, resetMiniProgramNetworkDefaults, setMiniProgramNetworkDefaults };
96
+ export { AbortControllerPolyfill, AbortSignalPolyfill, BlobPolyfill, FilePolyfill, FormDataPolyfill, HeadersPolyfill, type MiniProgramNetworkDefaults, RequestGlobalsEventTarget, type RequestGlobalsMiniProgramOptions, RequestPolyfill, ResponsePolyfill, URLPolyfill, URLSearchParamsPolyfill, type WebSocketMiniProgramOptions, WebSocketPolyfill, XMLHttpRequestPolyfill, fetch, getMiniProgramNetworkDefaults, performancePolyfill, resetMiniProgramNetworkDefaults, setMiniProgramNetworkDefaults };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { a as decodeTextFallback, c as installRequestGlobalBinding, f as resolveRequestGlobalsHost, l as isArrayBufferLike, n as cloneArrayBuffer, p as resolveRequestGlobalsHosts, r as cloneArrayBufferView, s as encodeTextFallback, t as RequestGlobalsEventTarget, v as getMiniProgramRuntimeGlobalKeys } from "./shared-Boj9gvKq.mjs";
1
+ import { a as decodeTextFallback, c as installRequestGlobalBinding, f as resolveRequestGlobalsHost, l as isArrayBufferLike, n as cloneArrayBuffer, p as resolveRequestGlobalsHosts, r as cloneArrayBufferView, s as encodeTextFallback, t as RequestGlobalsEventTarget, v as getMiniProgramRuntimeGlobalKeys } from "./shared-BsJRaiBh.mjs";
2
2
  import { URLPolyfill, URLSearchParamsPolyfill } from "./url.mjs";
3
3
  import { AbortControllerPolyfill, AbortSignalPolyfill } from "./abort.mjs";
4
4
  import { BlobPolyfill, FilePolyfill, FormDataPolyfill } from "./web.mjs";
5
5
  import { HeadersPolyfill, RequestPolyfill, ResponsePolyfill } from "./http.mjs";
6
- import { t as fetch } from "./fetch-CeiB6wK4.mjs";
6
+ import { t as fetch } from "./fetch-BPqcYqI3.mjs";
7
7
  import { getMiniProgramNetworkDefaults, resetMiniProgramNetworkDefaults, setMiniProgramNetworkDefaults } from "./networkDefaults.mjs";
8
8
  import { WebSocketPolyfill } from "./websocket.mjs";
9
9
  import { XMLHttpRequestPolyfill } from "./xhr.mjs";
@@ -160,7 +160,7 @@ const performancePolyfill = {
160
160
  function queueMicrotaskPolyfill(callback) {
161
161
  if (typeof callback !== "function") throw new TypeError("Failed to execute 'queueMicrotask': callback must be a function");
162
162
  const nativeQueueMicrotask = globalThis.queueMicrotask;
163
- if (typeof nativeQueueMicrotask === "function" && nativeQueueMicrotask !== queueMicrotaskPolyfill) {
163
+ if (typeof nativeQueueMicrotask === "function" && nativeQueueMicrotask !== queueMicrotaskPolyfill && nativeQueueMicrotask[REQUEST_GLOBAL_PLACEHOLDER_KEY] !== true) {
164
164
  nativeQueueMicrotask(callback);
165
165
  return;
166
166
  }
@@ -4,18 +4,17 @@ declare const MINI_PROGRAM_REQUEST_OPTION_KEYS: readonly ["enableCache", "enable
4
4
  declare const MINI_PROGRAM_SOCKET_OPTION_KEYS: readonly ["forceCellularNetwork", "header", "perMessageDeflate", "timeout"];
5
5
  type RequestGlobalsMiniProgramOptionKey = typeof MINI_PROGRAM_REQUEST_OPTION_KEYS[number];
6
6
  type WebSocketMiniProgramOptionKey = typeof MINI_PROGRAM_SOCKET_OPTION_KEYS[number];
7
- type RequestGlobalsMiniProgramOptions = Pick<Partial<WeapiMiniProgramRequestOption>, RequestGlobalsMiniProgramOptionKey>;
8
- type WebSocketMiniProgramOptions = Pick<Partial<WeapiMiniProgramConnectSocketOption>, WebSocketMiniProgramOptionKey>;
9
- interface MiniProgramNetworkDefaults {
7
+ export type RequestGlobalsMiniProgramOptions = Pick<Partial<WeapiMiniProgramRequestOption>, RequestGlobalsMiniProgramOptionKey>;
8
+ export type WebSocketMiniProgramOptions = Pick<Partial<WeapiMiniProgramConnectSocketOption>, WebSocketMiniProgramOptionKey>;
9
+ export interface MiniProgramNetworkDefaults {
10
10
  request?: RequestGlobalsMiniProgramOptions;
11
11
  socket?: WebSocketMiniProgramOptions;
12
12
  }
13
- declare function normalizeRequestMiniProgramOptions(...sources: unknown[]): RequestGlobalsMiniProgramOptions;
14
- declare function normalizeWebSocketMiniProgramOptions(...sources: unknown[]): WebSocketMiniProgramOptions;
15
- declare function getMiniProgramNetworkDefaults(): MiniProgramNetworkDefaults;
16
- declare function setMiniProgramNetworkDefaults(defaults?: MiniProgramNetworkDefaults): MiniProgramNetworkDefaults;
17
- declare function resetMiniProgramNetworkDefaults(): MiniProgramNetworkDefaults;
18
- declare function resolveRequestMiniProgramOptions(...sources: unknown[]): RequestGlobalsMiniProgramOptions;
19
- declare function resolveWebSocketMiniProgramOptions(...sources: unknown[]): WebSocketMiniProgramOptions;
20
- //#endregion
21
- export { MiniProgramNetworkDefaults, RequestGlobalsMiniProgramOptions, WebSocketMiniProgramOptions, getMiniProgramNetworkDefaults, normalizeRequestMiniProgramOptions, normalizeWebSocketMiniProgramOptions, resetMiniProgramNetworkDefaults, resolveRequestMiniProgramOptions, resolveWebSocketMiniProgramOptions, setMiniProgramNetworkDefaults };
13
+ export declare function normalizeRequestMiniProgramOptions(...sources: unknown[]): RequestGlobalsMiniProgramOptions;
14
+ export declare function normalizeWebSocketMiniProgramOptions(...sources: unknown[]): WebSocketMiniProgramOptions;
15
+ export declare function getMiniProgramNetworkDefaults(): MiniProgramNetworkDefaults;
16
+ export declare function setMiniProgramNetworkDefaults(defaults?: MiniProgramNetworkDefaults): MiniProgramNetworkDefaults;
17
+ export declare function resetMiniProgramNetworkDefaults(): MiniProgramNetworkDefaults;
18
+ export declare function resolveRequestMiniProgramOptions(...sources: unknown[]): RequestGlobalsMiniProgramOptions;
19
+ export declare function resolveWebSocketMiniProgramOptions(...sources: unknown[]): WebSocketMiniProgramOptions;
20
+ //#endregion
@@ -1,5 +1,5 @@
1
1
  import { URLPolyfill, URLSearchParamsPolyfill } from "./url.mjs";
2
- //#region ../../@weapp-core/shared/dist/platforms-anvkpsCw.js
2
+ //#region ../../@weapp-core/shared/dist/platforms-CnaLvA5j.js
3
3
  const DEFAULT_PROJECT_CONFIG_ROOT_KEYS = ["miniprogramRoot", "srcMiniprogramRoot"];
4
4
  const DEFAULT_RUNTIME_CAPABILITIES = Object.freeze({
5
5
  globalPageStack: true,
@@ -333,7 +333,12 @@ function getOrderedRuntimeGlobalKeysByPriority(priorityKey) {
333
333
  }
334
334
  getOrderedRuntimeGlobalKeysByPriority("globalResolvePriority");
335
335
  getOrderedRuntimeGlobalKeysByPriority("routeGlobalResolvePriority");
336
- Object.freeze(Object.fromEntries(MINI_PROGRAM_PLATFORM_ALIAS_TO_ID.entries()));
336
+ /**
337
+ * @description 小程序平台别名映射表。
338
+ */
339
+ const MINI_PROGRAM_PLATFORM_ALIAS_RECORD = {};
340
+ for (const [alias, platform] of MINI_PROGRAM_PLATFORM_ALIAS_TO_ID) MINI_PROGRAM_PLATFORM_ALIAS_RECORD[alias] = platform;
341
+ Object.freeze(MINI_PROGRAM_PLATFORM_ALIAS_RECORD);
337
342
  /**
338
343
  * @description 获取平台描述。
339
344
  */
@@ -395,7 +400,8 @@ var RequestGlobalsEventTarget = class {
395
400
  target: event.target ?? this,
396
401
  currentTarget: event.currentTarget ?? this
397
402
  };
398
- for (const listener of this.listeners.get(event.type) ?? []) listener(payload);
403
+ for (const listener of this.listeners.get(event.type) ?? []) if (typeof listener === "function") listener(payload);
404
+ else listener.handleEvent(payload);
399
405
  const handlerKey = `on${event.type}`;
400
406
  const handler = this[handlerKey];
401
407
  if (typeof handler === "function") handler(payload);
package/dist/shared.d.mts CHANGED
@@ -1,37 +1,38 @@
1
1
  //#region src/shared.d.ts
2
- interface RequestGlobalsEventLike {
2
+ export interface RequestGlobalsEventLike {
3
3
  type: string;
4
4
  target?: unknown;
5
5
  currentTarget?: unknown;
6
6
  }
7
- interface RequestGlobalsEventTargetLike {
8
- addEventListener: (type: string, listener: (event: RequestGlobalsEventLike) => void) => void;
9
- removeEventListener: (type: string, listener: (event: RequestGlobalsEventLike) => void) => void;
7
+ export type RequestGlobalsEventListener = ((event: RequestGlobalsEventLike) => void) | {
8
+ handleEvent: (event: RequestGlobalsEventLike) => void;
9
+ };
10
+ export interface RequestGlobalsEventTargetLike {
11
+ addEventListener: (type: string, listener: RequestGlobalsEventListener) => void;
12
+ removeEventListener: (type: string, listener: RequestGlobalsEventListener) => void;
10
13
  dispatchEvent: (event: RequestGlobalsEventLike) => boolean;
11
14
  }
12
- type EventListener = (event: RequestGlobalsEventLike) => void;
13
- declare class RequestGlobalsEventTarget implements RequestGlobalsEventTargetLike {
15
+ export declare class RequestGlobalsEventTarget implements RequestGlobalsEventTargetLike {
14
16
  private readonly listeners;
15
- addEventListener(type: string, listener: EventListener): void;
16
- removeEventListener(type: string, listener: EventListener): void;
17
+ addEventListener(type: string, listener: RequestGlobalsEventListener): void;
18
+ removeEventListener(type: string, listener: RequestGlobalsEventListener): void;
17
19
  dispatchEvent(event: RequestGlobalsEventLike): boolean;
18
20
  }
19
- declare function resolveRequestGlobalsHost(): Record<string, any>;
20
- declare function resolveRequestGlobalsHosts(): Record<string, any>[];
21
- declare function installRequestGlobalBinding(name: string, value: unknown): void;
22
- declare function isArrayBufferLike(value: unknown): value is ArrayBuffer;
23
- interface RequestGlobalsBlobLike {
21
+ export declare function resolveRequestGlobalsHost(): Record<string, any>;
22
+ export declare function resolveRequestGlobalsHosts(): Record<string, any>[];
23
+ export declare function installRequestGlobalBinding(name: string, value: unknown): void;
24
+ export declare function isArrayBufferLike(value: unknown): value is ArrayBuffer;
25
+ export interface RequestGlobalsBlobLike {
24
26
  readonly size?: number;
25
27
  readonly type?: string;
26
28
  arrayBuffer: () => Promise<ArrayBuffer>;
27
29
  }
28
- declare function isBlobLike(value: unknown): value is RequestGlobalsBlobLike;
29
- declare function cloneArrayBuffer(buffer: ArrayBuffer): ArrayBuffer;
30
- declare function cloneArrayBufferView(view: ArrayBufferView): ArrayBuffer;
31
- declare function encodeTextFallback(value: string): ArrayBuffer;
32
- declare function encodeText(value: string): ArrayBuffer;
33
- declare function decodeTextFallback(value: ArrayBuffer): string;
34
- declare function decodeText(value: ArrayBuffer): string;
35
- declare function normalizeHeaderName(name: string): string;
36
- //#endregion
37
- export { RequestGlobalsBlobLike, RequestGlobalsEventLike, RequestGlobalsEventTarget, RequestGlobalsEventTargetLike, cloneArrayBuffer, cloneArrayBufferView, decodeText, decodeTextFallback, encodeText, encodeTextFallback, installRequestGlobalBinding, isArrayBufferLike, isBlobLike, normalizeHeaderName, resolveRequestGlobalsHost, resolveRequestGlobalsHosts };
30
+ export declare function isBlobLike(value: unknown): value is RequestGlobalsBlobLike;
31
+ export declare function cloneArrayBuffer(buffer: ArrayBuffer): ArrayBuffer;
32
+ export declare function cloneArrayBufferView(view: ArrayBufferView): ArrayBuffer;
33
+ export declare function encodeTextFallback(value: string): ArrayBuffer;
34
+ export declare function encodeText(value: string): ArrayBuffer;
35
+ export declare function decodeTextFallback(value: ArrayBuffer): string;
36
+ export declare function decodeText(value: ArrayBuffer): string;
37
+ export declare function normalizeHeaderName(name: string): string;
38
+ //#endregion
package/dist/shared.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as decodeTextFallback, c as installRequestGlobalBinding, d as normalizeHeaderName, f as resolveRequestGlobalsHost, i as decodeText, l as isArrayBufferLike, n as cloneArrayBuffer, o as encodeText, p as resolveRequestGlobalsHosts, r as cloneArrayBufferView, s as encodeTextFallback, t as RequestGlobalsEventTarget, u as isBlobLike } from "./shared-Boj9gvKq.mjs";
1
+ import { a as decodeTextFallback, c as installRequestGlobalBinding, d as normalizeHeaderName, f as resolveRequestGlobalsHost, i as decodeText, l as isArrayBufferLike, n as cloneArrayBuffer, o as encodeText, p as resolveRequestGlobalsHosts, r as cloneArrayBufferView, s as encodeTextFallback, t as RequestGlobalsEventTarget, u as isBlobLike } from "./shared-BsJRaiBh.mjs";
2
2
  export { RequestGlobalsEventTarget, cloneArrayBuffer, cloneArrayBufferView, decodeText, decodeTextFallback, encodeText, encodeTextFallback, installRequestGlobalBinding, isArrayBufferLike, isBlobLike, normalizeHeaderName, resolveRequestGlobalsHost, resolveRequestGlobalsHosts };
package/dist/url.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  //#region src/url.d.ts
2
2
  type URLSearchParamValue = string | readonly string[];
3
- declare class URLSearchParamsPolyfill {
3
+ export declare class URLSearchParamsPolyfill {
4
4
  private readonly onChange?;
5
5
  private readonly entriesStore;
6
6
  constructor(init?: string | URLSearchParamsPolyfill | Record<string, URLSearchParamValue> | Iterable<[string, string]>, onChange?: (() => void) | undefined);
@@ -19,7 +19,7 @@ declare class URLSearchParamsPolyfill {
19
19
  toString(): string;
20
20
  [Symbol.iterator](): ArrayIterator<[string, string]>;
21
21
  }
22
- declare class URLPolyfill {
22
+ export declare class URLPolyfill {
23
23
  private hashValue;
24
24
  private hrefValue;
25
25
  private searchValue;
@@ -46,5 +46,4 @@ declare class URLPolyfill {
46
46
  private updateHref;
47
47
  private syncSearchFromParams;
48
48
  }
49
- //#endregion
50
- export { URLPolyfill, URLSearchParamsPolyfill };
49
+ //#endregion
package/dist/web.d.mts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { RequestGlobalsBlobLike } from "./shared.mjs";
2
2
  //#region src/web.d.ts
3
- type BlobLikePart = RequestGlobalsBlobLike;
4
- type BlobPart = ArrayBuffer | ArrayBufferView | BlobLikePart | string;
5
- type FormDataEntryValue = FilePolyfill | BlobPolyfill | string;
3
+ export type BlobLikePart = RequestGlobalsBlobLike;
4
+ export type BlobPart = ArrayBuffer | ArrayBufferView | BlobLikePart | string;
5
+ export type FormDataEntryValue = FilePolyfill | BlobPolyfill | string;
6
6
  interface BlobPropertyBag {
7
7
  type?: string;
8
8
  }
9
9
  interface FilePropertyBag extends BlobPropertyBag {
10
10
  lastModified?: number;
11
11
  }
12
- declare class BlobPolyfill {
12
+ export declare class BlobPolyfill {
13
13
  readonly size: number;
14
14
  readonly type: string;
15
15
  private readonly parts;
@@ -17,13 +17,13 @@ declare class BlobPolyfill {
17
17
  arrayBuffer(): Promise<ArrayBuffer>;
18
18
  text(): Promise<string>;
19
19
  }
20
- declare class FilePolyfill extends BlobPolyfill {
20
+ export declare class FilePolyfill extends BlobPolyfill {
21
21
  readonly lastModified: number;
22
22
  readonly name: string;
23
23
  constructor(parts: BlobPart[] | undefined, name: string, options?: FilePropertyBag);
24
24
  get [Symbol.toStringTag](): string;
25
25
  }
26
- declare class FormDataPolyfill {
26
+ export declare class FormDataPolyfill {
27
27
  private readonly entriesList;
28
28
  append(name: string, value: string): void;
29
29
  append(name: string, value: BlobLikePart, filename?: string): void;
@@ -40,5 +40,4 @@ declare class FormDataPolyfill {
40
40
  [Symbol.iterator](): Generator<[string, FormDataEntryValue], void, unknown>;
41
41
  get [Symbol.toStringTag](): string;
42
42
  }
43
- //#endregion
44
- export { BlobLikePart, BlobPart, BlobPolyfill, FilePolyfill, FormDataEntryValue, FormDataPolyfill };
43
+ //#endregion
package/dist/web.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as decodeText, l as isArrayBufferLike, n as cloneArrayBuffer, o as encodeText, r as cloneArrayBufferView, u as isBlobLike } from "./shared-Boj9gvKq.mjs";
1
+ import { i as decodeText, l as isArrayBufferLike, n as cloneArrayBuffer, o as encodeText, r as cloneArrayBufferView, u as isBlobLike } from "./shared-BsJRaiBh.mjs";
2
2
  //#region src/web.ts
3
3
  function normalizeBlobPart(part) {
4
4
  if (typeof part === "string") return Promise.resolve(encodeText(part));
@@ -21,12 +21,12 @@ interface WebSocketMessageEventLike {
21
21
  origin: string;
22
22
  type: 'message';
23
23
  }
24
- interface WebSocketPolyfillInit {
24
+ export interface WebSocketPolyfillInit {
25
25
  protocols?: string | string[];
26
26
  miniProgram?: WebSocketMiniProgramOptions;
27
27
  miniprogram?: WebSocketMiniProgramOptions;
28
28
  }
29
- declare class WebSocketPolyfill extends RequestGlobalsEventTarget {
29
+ export declare class WebSocketPolyfill extends RequestGlobalsEventTarget {
30
30
  static readonly CONNECTING = 0;
31
31
  static readonly OPEN = 1;
32
32
  static readonly CLOSING = 2;
@@ -54,5 +54,4 @@ declare class WebSocketPolyfill extends RequestGlobalsEventTarget {
54
54
  private closeFromRuntime;
55
55
  private emitError;
56
56
  }
57
- //#endregion
58
- export { WebSocketPolyfill, WebSocketPolyfillInit };
57
+ //#endregion
@@ -1,4 +1,4 @@
1
- import { _ as resolveUrlConstructor$1, g as resolveTextEncoderConstructor, l as isArrayBufferLike, n as cloneArrayBuffer, r as cloneArrayBufferView, t as RequestGlobalsEventTarget, u as isBlobLike } from "./shared-Boj9gvKq.mjs";
1
+ import { _ as resolveUrlConstructor$1, g as resolveTextEncoderConstructor, l as isArrayBufferLike, n as cloneArrayBuffer, r as cloneArrayBufferView, t as RequestGlobalsEventTarget, u as isBlobLike } from "./shared-BsJRaiBh.mjs";
2
2
  import { URLPolyfill } from "./url.mjs";
3
3
  import { BlobPolyfill } from "./web.mjs";
4
4
  import { resolveWebSocketMiniProgramOptions } from "./networkDefaults.mjs";
package/dist/xhr.d.mts CHANGED
@@ -2,8 +2,8 @@ import { RequestGlobalsEventTarget } from "./shared.mjs";
2
2
  import { RequestGlobalsMiniProgramOptions } from "./networkDefaults.mjs";
3
3
  //#region src/xhr.d.ts
4
4
  type XhrBody = Document | XMLHttpRequestBodyInit | null | undefined;
5
- declare class XMLHttpRequestUploadPolyfill extends RequestGlobalsEventTarget {}
6
- declare class XMLHttpRequestPolyfill extends RequestGlobalsEventTarget {
5
+ export declare class XMLHttpRequestUploadPolyfill extends RequestGlobalsEventTarget {}
6
+ export declare class XMLHttpRequestPolyfill extends RequestGlobalsEventTarget {
7
7
  static readonly UNSENT = 0;
8
8
  static readonly OPENED = 1;
9
9
  static readonly HEADERS_RECEIVED = 2;
@@ -65,5 +65,4 @@ declare class XMLHttpRequestPolyfill extends RequestGlobalsEventTarget {
65
65
  private finish;
66
66
  private transitionTo;
67
67
  }
68
- //#endregion
69
- export { XMLHttpRequestPolyfill, XMLHttpRequestUploadPolyfill };
68
+ //#endregion
package/dist/xhr.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { f as resolveRequestGlobalsHost, t as RequestGlobalsEventTarget } from "./shared-Boj9gvKq.mjs";
1
+ import { f as resolveRequestGlobalsHost, t as RequestGlobalsEventTarget } from "./shared-BsJRaiBh.mjs";
2
2
  import { AbortControllerPolyfill } from "./abort.mjs";
3
3
  import { HeadersPolyfill, headersToObject } from "./http.mjs";
4
- import { t as fetch } from "./fetch-CeiB6wK4.mjs";
4
+ import { t as fetch } from "./fetch-BPqcYqI3.mjs";
5
5
  //#region src/xhr.ts
6
6
  function createProgressEvent(type) {
7
7
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wevu/web-apis",
3
3
  "type": "module",
4
- "version": "1.2.39",
4
+ "version": "1.2.41",
5
5
  "description": "Web API polyfills and global installers for mini-program runtimes",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -74,8 +74,8 @@
74
74
  "node": "^20.19.0 || >=22.12.0"
75
75
  },
76
76
  "dependencies": {
77
- "@weapp-core/constants": "0.2.1",
78
- "@wevu/api": "0.3.0"
77
+ "@weapp-core/constants": "0.2.2",
78
+ "@wevu/api": "0.3.1"
79
79
  },
80
80
  "publishConfig": {
81
81
  "access": "public",