@cloudpss/fetch 0.6.0-alpha.8 → 0.6.0-beta.1
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/impl.d.ts +2 -1
- package/dist/impl.d.ts.map +1 -1
- package/dist/impl.js +8 -2
- package/dist/impl.js.map +1 -1
- package/package.json +1 -1
- package/src/impl.ts +11 -2
package/dist/impl.d.ts
CHANGED
|
@@ -19,7 +19,8 @@ export declare const fetch: typeof globalThis.fetch, Headers: {
|
|
|
19
19
|
}, FormData: {
|
|
20
20
|
new (form?: HTMLFormElement, submitter?: HTMLElement | null): FormData;
|
|
21
21
|
prototype: FormData;
|
|
22
|
-
}
|
|
22
|
+
};
|
|
23
|
+
export declare let WebSocket: {
|
|
23
24
|
new (url: string | URL, protocols?: string | string[]): WebSocket;
|
|
24
25
|
prototype: WebSocket;
|
|
25
26
|
readonly CONNECTING: 0;
|
package/dist/impl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl.d.ts","sourceRoot":"","sources":["../src/impl.ts"],"names":[],"mappings":"AAIA,eAAO,MAAQ,KAAK,2BAAE,OAAO;;;GAAE,QAAQ;;;;;;GAAE,OAAO;;;GAAE,IAAI;;;GAAE,IAAI;;;GAAE,QAAQ;;;
|
|
1
|
+
{"version":3,"file":"impl.d.ts","sourceRoot":"","sources":["../src/impl.ts"],"names":[],"mappings":"AAIA,eAAO,MAAQ,KAAK,2BAAE,OAAO;;;GAAE,QAAQ;;;;;;GAAE,OAAO;;;GAAE,IAAI;;;GAAE,IAAI;;;GAAE,QAAQ;;;CAAe,CAAC;AAKtF,eAAO,IAAM,SAAS;;;;;;;CAAe,CAAC"}
|
package/dist/impl.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
if (typeof globalThis == 'undefined') {
|
|
2
2
|
throw new TypeError(`globalThis is not defined, you should load polyfill of globalThis.`);
|
|
3
3
|
}
|
|
4
|
-
export const { fetch, Headers, Response, Request, File, Blob, FormData
|
|
4
|
+
export const { fetch, Headers, Response, Request, File, Blob, FormData } = globalThis;
|
|
5
5
|
if (typeof fetch != 'function') {
|
|
6
6
|
throw new TypeError(`fetch is not defined on the global object, you should load polyfill of fetch.`);
|
|
7
7
|
}
|
|
8
|
+
export let { WebSocket } = globalThis;
|
|
8
9
|
if (typeof WebSocket != 'function') {
|
|
9
|
-
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
11
|
+
WebSocket = class {
|
|
12
|
+
constructor() {
|
|
13
|
+
throw new TypeError(`WebSocket is not implemented in this environment, you should load polyfill of WebSocket.`);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
10
16
|
}
|
|
11
17
|
//# sourceMappingURL=impl.js.map
|
package/dist/impl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl.js","sourceRoot":"","sources":["../src/impl.ts"],"names":[],"mappings":"AAAA,IAAI,OAAO,UAAU,IAAI,WAAW,EAAE,CAAC;IACnC,MAAM,IAAI,SAAS,CAAC,oEAAoE,CAAC,CAAC;AAC9F,CAAC;AAED,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"impl.js","sourceRoot":"","sources":["../src/impl.ts"],"names":[],"mappings":"AAAA,IAAI,OAAO,UAAU,IAAI,WAAW,EAAE,CAAC;IACnC,MAAM,IAAI,SAAS,CAAC,oEAAoE,CAAC,CAAC;AAC9F,CAAC;AAED,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC;AACtF,IAAI,OAAO,KAAK,IAAI,UAAU,EAAE,CAAC;IAC7B,MAAM,IAAI,SAAS,CAAC,+EAA+E,CAAC,CAAC;AACzG,CAAC;AAED,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC;AACtC,IAAI,OAAO,SAAS,IAAI,UAAU,EAAE,CAAC;IACjC,kEAAkE;IAClE,SAAS,GAAG;QACR;YACI,MAAM,IAAI,SAAS,CACf,0FAA0F,CAC7F,CAAC;QACN,CAAC;KAC2B,CAAC;AACrC,CAAC"}
|
package/package.json
CHANGED
package/src/impl.ts
CHANGED
|
@@ -2,10 +2,19 @@ if (typeof globalThis == 'undefined') {
|
|
|
2
2
|
throw new TypeError(`globalThis is not defined, you should load polyfill of globalThis.`);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
export const { fetch, Headers, Response, Request, File, Blob, FormData
|
|
5
|
+
export const { fetch, Headers, Response, Request, File, Blob, FormData } = globalThis;
|
|
6
6
|
if (typeof fetch != 'function') {
|
|
7
7
|
throw new TypeError(`fetch is not defined on the global object, you should load polyfill of fetch.`);
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
export let { WebSocket } = globalThis;
|
|
9
11
|
if (typeof WebSocket != 'function') {
|
|
10
|
-
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
13
|
+
WebSocket = class {
|
|
14
|
+
constructor() {
|
|
15
|
+
throw new TypeError(
|
|
16
|
+
`WebSocket is not implemented in this environment, you should load polyfill of WebSocket.`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
} as unknown as typeof WebSocket;
|
|
11
20
|
}
|