import { RequestGlobalsEventTarget } from "./shared.mjs"; import { AbortControllerPolyfill, AbortSignalPolyfill } from "./abort.mjs"; import { MiniProgramNetworkDefaults, RequestGlobalsMiniProgramOptions, WebSocketMiniProgramOptions, getMiniProgramNetworkDefaults, resetMiniProgramNetworkDefaults, setMiniProgramNetworkDefaults } from "./networkDefaults.mjs"; import { URLPolyfill, URLSearchParamsPolyfill } from "./url.mjs"; import { fetch } from "./fetch.mjs"; import { BlobPolyfill, FilePolyfill, FormDataPolyfill } from "./web.mjs"; import { HeadersPolyfill, RequestPolyfill, ResponsePolyfill } from "./http.mjs"; import { WebSocketPolyfill } from "./websocket.mjs"; import { XMLHttpRequestPolyfill } from "./xhr.mjs"; //#region src/base64.d.ts declare function btoaPolyfill(input?: string): string; declare function atobPolyfill(input?: string): string; //#endregion //#region src/crypto.d.ts type IntegerTypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array; declare function getRandomValuesPolyfill(typedArray: T): (T & Int8Array) | (T & Uint8Array) | (T & Uint8ClampedArray) | (T & Int16Array) | (T & Uint16Array) | (T & Int32Array) | (T & Uint32Array) | (T & BigInt64Array) | (T & BigUint64Array); declare const cryptoPolyfill: { getRandomValues: typeof getRandomValuesPolyfill; }; //#endregion //#region src/events.d.ts interface EventInitPolyfill { bubbles?: boolean; cancelable?: boolean; composed?: boolean; } interface CustomEventInitPolyfill extends EventInitPolyfill { detail?: T; } declare class EventPolyfill { readonly bubbles: boolean; readonly cancelable: boolean; readonly composed: boolean; readonly isTrusted = false; readonly timeStamp: number; readonly type: string; currentTarget: unknown; target: unknown; defaultPrevented: boolean; cancelBubble: boolean; constructor(type: string, init?: EventInitPolyfill); composedPath(): {}[]; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; } declare class CustomEventPolyfill extends EventPolyfill { readonly detail: T | null; constructor(type: string, init?: CustomEventInitPolyfill); } //#endregion //#region src/performance.d.ts declare const performancePolyfill: { __weappVitePerformancePolyfill: boolean; now(): number; timeOrigin: number; }; //#endregion //#region src/task.d.ts declare function queueMicrotaskPolyfill(callback: () => void): void; //#endregion //#region src/textCodec.d.ts type TextDecoderInput = ArrayBuffer | ArrayBufferView | null | undefined; declare class TextEncoderPolyfill { readonly encoding = "utf-8"; encode(input?: string): Uint8Array; } declare class TextDecoderPolyfill { readonly encoding = "utf-8"; readonly fatal = false; readonly ignoreBOM = false; decode(input?: TextDecoderInput): string; } //#endregion //#region src/index.d.ts type WeappInjectWebRuntimeGlobalsTarget = 'fetch' | 'Headers' | 'Request' | 'Response' | 'TextEncoder' | 'TextDecoder' | 'AbortController' | 'AbortSignal' | 'XMLHttpRequest' | 'WebSocket' | 'atob' | 'btoa' | 'queueMicrotask' | 'performance' | 'crypto' | 'Event' | 'CustomEvent'; type WeappInjectRequestGlobalsTarget = WeappInjectWebRuntimeGlobalsTarget; interface InstallWebRuntimeGlobalsOptions { targets?: WeappInjectWebRuntimeGlobalsTarget[]; networkDefaults?: MiniProgramNetworkDefaults; } interface InstallRequestGlobalsOptions extends InstallWebRuntimeGlobalsOptions {} /** * @description 按需向小程序全局环境注入缺失的 Web Runtime 对象。 */ declare function installWebRuntimeGlobals(options?: InstallWebRuntimeGlobalsOptions): Record; /** * @description 已废弃,请迁移到 `installWebRuntimeGlobals`。 */ declare function installRequestGlobals(options?: InstallRequestGlobalsOptions): Record; /** * @description 仅安装 AbortController 与 AbortSignal 兼容层。 */ declare function installAbortGlobals(): Record; //#endregion 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 };