@wevu/web-apis 1.4.1 → 1.4.2
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/README.md +1 -1
- package/dist/{eventsource-BIlpv2mS.mjs → eventsource-cHN0nNB1.mjs} +1 -1
- package/dist/eventsource.mjs +1 -1
- package/dist/{fetch-jNITH6mC.mjs → fetch-Cw1K3y4n.mjs} +3 -3
- package/dist/fetch.mjs +1 -1
- package/dist/{http-DCCqK1QL.mjs → http-BJOhNGfL.mjs} +5 -6
- package/dist/http.mjs +1 -1
- package/dist/index.mjs +5 -5
- package/dist/{streams-6m8eQfZM.mjs → streams-CcHd-MmG.mjs} +0 -1
- package/dist/streams.mjs +1 -1
- package/dist/{web-DDzJNeV3.mjs → web-LPwQrCMM.mjs} +1 -1
- package/dist/web.mjs +1 -1
- package/dist/websocket.mjs +1 -1
- package/dist/xhr.mjs +2 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -190,7 +190,7 @@ null body 读取为空且保持未消费;空字符串和零长度二进制属
|
|
|
190
190
|
`fetch()` 在收到真实 HTTP 状态码和响应头时返回,后续字节通过 `Response.body` 交付。
|
|
191
191
|
`wevu/fetch` 复用同一实现。普通缓冲请求也提供可读 body,但不表示网络增量交付。
|
|
192
192
|
|
|
193
|
-
`@wevu/web-apis/streams` 导出作为一组选择的 `ReadableStream`、`WritableStream`、`TransformStream`,保留可用的原生实现,否则使用 `web-streams-polyfill@4.
|
|
193
|
+
`@wevu/web-apis/streams` 导出作为一组选择的 `ReadableStream`、`WritableStream`、`TransformStream`,保留可用的原生实现,否则使用 `web-streams-polyfill@4.5.0` ponyfill。该入口也导出三个 `*Polyfill` 构造器和 `TextDecoderStreamPolyfill`。
|
|
194
194
|
`@wevu/web-apis/eventsource` 导出 `EventSourcePolyfill`、其别名 `EventSource` 与 `MessageEventPolyfill`,也可以由构建器注入全局 `EventSource`。
|
|
195
195
|
EventSource 自动启用分块请求,支持 GET、命名事件、`Last-Event-ID`、`retry` 与自动重连。
|
|
196
196
|
POST、自定义鉴权头使用 Fetch;Fetch 不自动重试请求。
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbortControllerPolyfill } from "./abort.mjs";
|
|
2
|
-
import { t as fetch } from "./fetch-
|
|
2
|
+
import { t as fetch } from "./fetch-Cw1K3y4n.mjs";
|
|
3
3
|
import { t as TextDecoderPolyfill } from "./textCodec-muWByCAW.mjs";
|
|
4
4
|
import { t as URLPolyfill } from "./url-DjMmeEth.mjs";
|
|
5
5
|
// src/events.ts
|
package/dist/eventsource.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "./abort.mjs";
|
|
2
|
-
export { t as EventSource, t as EventSourcePolyfill, n as MessageEventPolyfill } from "./eventsource-
|
|
2
|
+
export { t as EventSource, t as EventSourcePolyfill, n as MessageEventPolyfill } from "./eventsource-cHN0nNB1.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { d as normalizeHeaderName, h as isUrlSearchParamsInstance, l as isArrayBufferLike, m as isUrlInstance, n as cloneArrayBuffer, r as cloneArrayBufferView, u as isBlobLike } from "./shared-CARmZrDA.mjs";
|
|
2
|
-
import { a as isReadableBodyStream, c as createMultipartBoundary, i as consumeBodyValue, l as encodeMultipartFormData, n as RequestPolyfill, o as isStreamingRequestBody, s as readBodyStream, t as ResponsePolyfill } from "./http-
|
|
2
|
+
import { a as isReadableBodyStream, c as createMultipartBoundary, i as consumeBodyValue, l as encodeMultipartFormData, n as RequestPolyfill, o as isStreamingRequestBody, s as readBodyStream, t as ResponsePolyfill } from "./http-BJOhNGfL.mjs";
|
|
3
3
|
import { resolveRequestMiniProgramOptions } from "./networkDefaults.mjs";
|
|
4
|
-
import { t as FormDataPolyfill } from "./web-
|
|
5
|
-
import { t as ReadableStream } from "./streams-
|
|
4
|
+
import { t as FormDataPolyfill } from "./web-LPwQrCMM.mjs";
|
|
5
|
+
import { t as ReadableStream } from "./streams-CcHd-MmG.mjs";
|
|
6
6
|
import { wpi } from "@wevu/api";
|
|
7
7
|
// src/fetch/abort.ts
|
|
8
8
|
/** 准备请求体期间也遵循同一中止信号,避免无限输入阻塞请求取消。 */
|
package/dist/fetch.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as fetch } from "./fetch-
|
|
1
|
+
export { t as fetch } from "./fetch-Cw1K3y4n.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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-CARmZrDA.mjs";
|
|
2
|
-
import { l as nativeStreams, n as ReadableStreamPolyfill, t as ReadableStream } from "./streams-
|
|
2
|
+
import { l as nativeStreams, n as ReadableStreamPolyfill, t as ReadableStream } from "./streams-CcHd-MmG.mjs";
|
|
3
3
|
import { t as TextDecoderPolyfill } from "./textCodec-muWByCAW.mjs";
|
|
4
|
-
import { r as BlobPolyfill, t as FormDataPolyfill } from "./web-
|
|
4
|
+
import { r as BlobPolyfill, t as FormDataPolyfill } from "./web-LPwQrCMM.mjs";
|
|
5
5
|
// src/http/headers.ts
|
|
6
6
|
const SET_COOKIE_HEADER_NAME = "set-cookie";
|
|
7
7
|
function isIterableHeaders(input) {
|
|
@@ -152,13 +152,13 @@ function isPonyfillStream(value) {
|
|
|
152
152
|
return value instanceof ReadableStreamPolyfill;
|
|
153
153
|
}
|
|
154
154
|
/**
|
|
155
|
-
* web-streams-polyfill 固定为 4.
|
|
155
|
+
* web-streams-polyfill 固定为 4.5.1;其公共 API 未提供 disturbed 查询,因此将版本相关读取限制在此处。
|
|
156
156
|
* 品牌与字段形状必须同时匹配;升级依赖时由包版本测试和消费状态回归共同阻止静默漂移。
|
|
157
157
|
*/
|
|
158
158
|
function isPonyfillStreamDisturbed(stream) {
|
|
159
159
|
if (!isPonyfillStream(stream)) throw new TypeError("Expected a web-streams-polyfill ReadableStream");
|
|
160
160
|
const disturbed = Reflect.get(stream, "_disturbed");
|
|
161
|
-
if (typeof disturbed !== "boolean") throw new TypeError("Unsupported web-streams-polyfill state layout; expected version 4.
|
|
161
|
+
if (typeof disturbed !== "boolean") throw new TypeError("Unsupported web-streams-polyfill state layout; expected version 4.5.1");
|
|
162
162
|
return disturbed;
|
|
163
163
|
}
|
|
164
164
|
// src/streams/bodyTracking.ts
|
|
@@ -276,11 +276,10 @@ function isReadableBodyStream(value) {
|
|
|
276
276
|
function isFormData(value) {
|
|
277
277
|
return value instanceof FormDataPolyfill || typeof FormData === "function" && value instanceof FormData;
|
|
278
278
|
}
|
|
279
|
+
/** 转换初始化时归类为缓冲的非空值,并兼容外部 BlobLike 别名在拉取前换形为流。 */
|
|
279
280
|
async function bodyBytes(value, multipartBoundary) {
|
|
280
|
-
if (value == null) return /* @__PURE__ */ new ArrayBuffer(0);
|
|
281
281
|
if (typeof value === "string") return encodeText(value);
|
|
282
282
|
if (isArrayBufferLike(value)) return cloneArrayBuffer(value);
|
|
283
|
-
if (ArrayBuffer.isView(value)) return cloneArrayBufferView(value);
|
|
284
283
|
if (isBlobLike(value)) return cloneArrayBuffer(await value.arrayBuffer());
|
|
285
284
|
if (isReadableBodyStream(value)) return readBodyStream(value);
|
|
286
285
|
return (await encodeMultipartFormData(value, multipartBoundary)).body;
|
package/dist/http.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { u as HeadersPolyfill, n as RequestPolyfill, t as ResponsePolyfill, r as getRequestBodyValue, d as headersToObject } from "./http-
|
|
1
|
+
export { u as HeadersPolyfill, n as RequestPolyfill, t as ResponsePolyfill, r as getRequestBodyValue, d as headersToObject } from "./http-BJOhNGfL.mjs";
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AbortControllerPolyfill, AbortSignalPolyfill } from "./abort.mjs";
|
|
2
2
|
import { c as installRequestGlobalBinding, f as resolveRequestGlobalsHost, p as resolveRequestGlobalsHosts, t as RequestGlobalsEventTarget, v as getMiniProgramRuntimeGlobalKeys } from "./shared-CARmZrDA.mjs";
|
|
3
|
-
import { i as EventPolyfill, r as CustomEventPolyfill, t as EventSourcePolyfill } from "./eventsource-
|
|
4
|
-
import { t as fetch } from "./fetch-
|
|
5
|
-
import { n as RequestPolyfill, t as ResponsePolyfill, u as HeadersPolyfill } from "./http-
|
|
3
|
+
import { i as EventPolyfill, r as CustomEventPolyfill, t as EventSourcePolyfill } from "./eventsource-cHN0nNB1.mjs";
|
|
4
|
+
import { t as fetch } from "./fetch-Cw1K3y4n.mjs";
|
|
5
|
+
import { n as RequestPolyfill, t as ResponsePolyfill, u as HeadersPolyfill } from "./http-BJOhNGfL.mjs";
|
|
6
6
|
import { getMiniProgramNetworkDefaults, resetMiniProgramNetworkDefaults, setMiniProgramNetworkDefaults } from "./networkDefaults.mjs";
|
|
7
|
-
import { a as TransformStreamPolyfill, i as TransformStream, n as ReadableStreamPolyfill, o as WritableStream, r as TextDecoderStreamPolyfill, s as WritableStreamPolyfill, t as ReadableStream } from "./streams-
|
|
7
|
+
import { a as TransformStreamPolyfill, i as TransformStream, n as ReadableStreamPolyfill, o as WritableStream, r as TextDecoderStreamPolyfill, s as WritableStreamPolyfill, t as ReadableStream } from "./streams-CcHd-MmG.mjs";
|
|
8
8
|
import { n as TextEncoderPolyfill, r as hasUsableTextDecoderConstructor, t as TextDecoderPolyfill } from "./textCodec-muWByCAW.mjs";
|
|
9
9
|
import { n as URLSearchParamsPolyfill, t as URLPolyfill } from "./url-DjMmeEth.mjs";
|
|
10
|
-
import { n as FilePolyfill, r as BlobPolyfill, t as FormDataPolyfill } from "./web-
|
|
10
|
+
import { n as FilePolyfill, r as BlobPolyfill, t as FormDataPolyfill } from "./web-LPwQrCMM.mjs";
|
|
11
11
|
import { WebSocketPolyfill } from "./websocket.mjs";
|
|
12
12
|
import { XMLHttpRequestPolyfill } from "./xhr.mjs";
|
|
13
13
|
import { REQUEST_GLOBAL_ACTUALS_KEY, REQUEST_GLOBAL_INSTALLER_MARKER, REQUEST_GLOBAL_PLACEHOLDER_KEY, WEB_RUNTIME_GLOBAL_TARGETS, resolveWebRuntimeGlobalTargetDependencies } from "@weapp-core/constants";
|
|
@@ -8,7 +8,6 @@ function isUsableConstructor(value) {
|
|
|
8
8
|
/** 安全捕获同一组宿主构造器;缺失全局或惰性属性抛错时整组回退,不重复触发宿主 getter。 */
|
|
9
9
|
function resolveNativeStreams() {
|
|
10
10
|
try {
|
|
11
|
-
if (typeof globalThis === "undefined") return;
|
|
12
11
|
const { ReadableStream, WritableStream, TransformStream } = globalThis;
|
|
13
12
|
if (![
|
|
14
13
|
ReadableStream,
|
package/dist/streams.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ReadableStream, n as ReadableStreamPolyfill, r as TextDecoderStreamPolyfill, i as TransformStream, a as TransformStreamPolyfill, o as WritableStream, s as WritableStreamPolyfill, c as usesNativeStreams } from "./streams-
|
|
1
|
+
export { t as ReadableStream, n as ReadableStreamPolyfill, r as TextDecoderStreamPolyfill, i as TransformStream, a as TransformStreamPolyfill, o as WritableStream, s as WritableStreamPolyfill, c as usesNativeStreams } from "./streams-CcHd-MmG.mjs";
|
|
@@ -14,7 +14,7 @@ function segmentSize(segment) {
|
|
|
14
14
|
return Math.max(0, (segment.end ?? segment.start) - segment.start);
|
|
15
15
|
}
|
|
16
16
|
function normalizePart(part) {
|
|
17
|
-
if (typeof part === "object" && part !== null && segments.has(part)) return segments.get(part)
|
|
17
|
+
if (typeof part === "object" && part !== null && segments.has(part)) return segments.get(part);
|
|
18
18
|
if (isBlobLike(part)) return [{
|
|
19
19
|
source: part,
|
|
20
20
|
start: 0,
|
package/dist/web.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { r as BlobPolyfill, n as FilePolyfill, t as FormDataPolyfill } from "./web-
|
|
1
|
+
export { r as BlobPolyfill, n as FilePolyfill, t as FormDataPolyfill } from "./web-LPwQrCMM.mjs";
|
package/dist/websocket.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
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-CARmZrDA.mjs";
|
|
2
2
|
import { resolveWebSocketMiniProgramOptions } from "./networkDefaults.mjs";
|
|
3
3
|
import { t as URLPolyfill } from "./url-DjMmeEth.mjs";
|
|
4
|
-
import { r as BlobPolyfill } from "./web-
|
|
4
|
+
import { r as BlobPolyfill } from "./web-LPwQrCMM.mjs";
|
|
5
5
|
import { wpi } from "@wevu/api";
|
|
6
6
|
// src/websocket.ts
|
|
7
7
|
const WHITESPACE_RE = /\s/u;
|
package/dist/xhr.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbortControllerPolyfill } from "./abort.mjs";
|
|
2
|
-
import { t as fetch } from "./fetch-
|
|
3
|
-
import { d as headersToObject, u as HeadersPolyfill } from "./http-
|
|
2
|
+
import { t as fetch } from "./fetch-Cw1K3y4n.mjs";
|
|
3
|
+
import { d as headersToObject, u as HeadersPolyfill } from "./http-BJOhNGfL.mjs";
|
|
4
4
|
import { f as resolveRequestGlobalsHost, t as RequestGlobalsEventTarget } from "./shared-CARmZrDA.mjs";
|
|
5
5
|
// src/xhr.ts
|
|
6
6
|
function createProgressEvent(type) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wevu/web-apis",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.2",
|
|
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",
|
|
@@ -87,10 +87,10 @@
|
|
|
87
87
|
"node": "^22.23.4 || ^24.22.1 || >=26.12.1"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@weapp-core/api": "0.4.
|
|
91
|
-
"@weapp-core/constants": "0.5.
|
|
92
|
-
"@wevu/api": "0.4.
|
|
93
|
-
"web-streams-polyfill": "4.
|
|
90
|
+
"@weapp-core/api": "0.4.2",
|
|
91
|
+
"@weapp-core/constants": "0.5.2",
|
|
92
|
+
"@wevu/api": "0.4.2",
|
|
93
|
+
"web-streams-polyfill": "4.5.1"
|
|
94
94
|
},
|
|
95
95
|
"publishConfig": {
|
|
96
96
|
"access": "public",
|