@andrewcaires/fetch 1.2.0 → 2.0.0
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/index.cjs.js +3 -3
- package/dist/index.d.ts +72 -56
- package/dist/index.esm.js +3 -3
- package/dist/index.min.js +3 -3
- package/package.json +13 -9
package/dist/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @andrewcaires/fetch
|
|
3
|
-
* Plugin for fetch api
|
|
2
|
+
* @andrewcaires/fetch v2.0.0
|
|
3
|
+
* Plugin for fetch api
|
|
4
4
|
* (c) 2026 Andrew Caires
|
|
5
5
|
* @license: MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var
|
|
7
|
+
"use strict";var e=require("@andrewcaires/utils.js");const t={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",511:"Network Authentication Required"};class r extends e.EventEmitter{constructor(t){super(),this.baseOptions=e.merge({headers:{},timeout:1e4},null!=t?t:{})}async get(e,t){return this.request(this._buildParams(e,"GET",t))}static async get(e,t){return(new r).get(e,t)}async post(e,t){return this.request(this._buildParams(e,"POST",t))}static async post(e,t){return(new r).post(e,t)}async put(e,t){return this.request(this._buildParams(e,"PUT",t))}static async put(e,t){return(new r).put(e,t)}async patch(e,t){return this.request(this._buildParams(e,"PATCH",t))}static async patch(e,t){return(new r).patch(e,t)}async delete(e,t){return this.request(this._buildParams(e,"DELETE",t))}static async delete(e,t){return(new r).delete(e,t)}async head(e,t){return this.request(this._buildParams(e,"HEAD",t))}static async head(e,t){return(new r).head(e,t)}async options(e,t){return this.request(this._buildParams(e,"OPTIONS",t))}static async options(e,t){return(new r).options(e,t)}async request(e){const t={...this.baseOptions,...e,headers:{...this.baseOptions.headers,...e.headers}},r=this._buildRequest(t),s={data:{}};try{this.emit("before",r),s.raw=await fetch(r.url,r),s.data=await this._parseResponseData(s.raw),s.raw.ok||(s.error=this._resolveStatusText(s.raw)),this.emit("complete",s)}catch(e){this.emit("error",e),s.error=e.message}return s}static request(e){return(new r).request(e)}_buildUrl(t,r,s){const a=new URL(null!=r?r:"",t);return s?(e.forEachKey(s,((t,r)=>{e.isArray(t)?t.forEach((t=>e.isDef(t)&&a.searchParams.append(r,String(t)))):e.isDef(t)&&a.searchParams.set(r,String(t))})),a.toString()):a.toString()}_buildParams(e,t,r){return{...null!=r?r:{},path:e,method:t}}_buildRequest(e){var t;const r=this._buildUrl(e.url,e.path,e.query),s=e.method.toUpperCase(),{body:a,isJson:n}=this._serializeBody(e.body),i={...null!==(t=e.headers)&&void 0!==t?t:{}};n&&void 0!==a&&!i["Content-Type"]&&(i["Content-Type"]="application/json");const{signal:o,cleanup:u}=this._createAbortSignal(e.timeout);return{url:r,method:s,body:a,headers:i,credentials:e.credentials,signal:o,cleanup:u}}_createAbortSignal(e){if(!e)return{signal:void 0,cleanup:void 0};const t=new AbortController,r=setTimeout((()=>t.abort()),e);return{signal:t.signal,cleanup:()=>clearTimeout(r)}}_getHeader(e,t){var r;return null!==(r=e.headers.get(t))&&void 0!==r?r:""}async _parseResponseData(e){if(204===e.status)return null;const t=this._getHeader(e,"Content-Type").toLowerCase();return!t||t.includes("text/plain")||t.includes("text/html")?e.text():t.includes("application/json")?e.json():e.blob()}_serializeBody(t){if(null==t)return{isJson:!1,body:void 0};const r=!(t instanceof Blob||t instanceof FormData||t instanceof URLSearchParams||e.isString(t));return{isJson:r,body:r?JSON.stringify(t):t}}_resolveStatusText(e){return e.statusText||t[e.status]||"ERROR"}}exports.Fetch=r,exports.FetchStatusText=t;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,47 +1,35 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @andrewcaires/fetch
|
|
3
|
-
* Plugin for fetch api
|
|
2
|
+
* @andrewcaires/fetch v2.0.0
|
|
3
|
+
* Plugin for fetch api
|
|
4
4
|
* (c) 2026 Andrew Caires
|
|
5
5
|
* @license: MIT
|
|
6
6
|
*/
|
|
7
|
-
import { TypeObjectString,
|
|
7
|
+
import { TypeObjectString, TypeObject, TypeScalar, TypeObjectOptional, EventEmitter } from '@andrewcaires/utils.js';
|
|
8
|
+
|
|
9
|
+
interface FetchAbort {
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
cleanup?: () => void;
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
interface FetchBody {
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
body?: any;
|
|
16
|
+
isJson: boolean;
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
type FetchCredentials = "include" | "omit" | "same-origin";
|
|
15
20
|
|
|
16
21
|
type FetchHeaders = TypeObjectString;
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
url?: string;
|
|
20
|
-
headers?: FetchHeaders;
|
|
21
|
-
timeout?: number;
|
|
22
|
-
credentials?: FetchCredentials;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
type FetchQuery = TypeNullable<TypeObjectString>;
|
|
26
|
-
|
|
27
|
-
interface FetchParams {
|
|
28
|
-
url?: string;
|
|
29
|
-
path: string;
|
|
30
|
-
query?: FetchQuery;
|
|
31
|
-
method: string;
|
|
32
|
-
body?: any;
|
|
33
|
-
headers?: FetchHeaders;
|
|
34
|
-
timeout?: number;
|
|
35
|
-
credentials?: FetchCredentials;
|
|
36
|
-
}
|
|
23
|
+
type FetchMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
|
|
37
24
|
|
|
38
25
|
interface FetchRequest {
|
|
39
26
|
url: string;
|
|
40
|
-
method:
|
|
27
|
+
method: FetchMethod;
|
|
41
28
|
body: any;
|
|
42
|
-
signal: AbortSignal;
|
|
43
29
|
headers: FetchHeaders;
|
|
44
30
|
credentials?: FetchCredentials;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
cleanup?: () => void;
|
|
45
33
|
}
|
|
46
34
|
|
|
47
35
|
interface FetchResponse<T = any> {
|
|
@@ -50,39 +38,67 @@ interface FetchResponse<T = any> {
|
|
|
50
38
|
raw?: Response;
|
|
51
39
|
}
|
|
52
40
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
41
|
+
interface FetchEvents {
|
|
42
|
+
before: FetchRequest;
|
|
43
|
+
retry: FetchRequest;
|
|
44
|
+
interception: FetchResponse;
|
|
45
|
+
complete: FetchResponse;
|
|
46
|
+
error: any;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface FetchOptionsBase {
|
|
50
|
+
url?: string;
|
|
51
|
+
headers?: FetchHeaders;
|
|
52
|
+
timeout?: number;
|
|
53
|
+
credentials?: FetchCredentials;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface FetchOptions extends FetchOptionsBase {
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type FetchQuery = TypeObject<TypeScalar | Array<TypeScalar>>;
|
|
60
|
+
|
|
61
|
+
interface FetchOptionsRequest extends TypeObjectOptional<FetchOptions> {
|
|
62
|
+
path: string;
|
|
63
|
+
query?: FetchQuery;
|
|
64
|
+
method: FetchMethod;
|
|
65
|
+
body?: any;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
type FetchOptionsBody = Omit<FetchOptionsRequest, "method" | "path">;
|
|
69
|
+
|
|
70
|
+
type FetchOptionsGet = Omit<FetchOptionsBody, "body">;
|
|
71
|
+
|
|
72
|
+
declare class Fetch<E extends FetchEvents = FetchEvents> extends EventEmitter<E> {
|
|
73
|
+
private baseOptions;
|
|
58
74
|
constructor(options?: FetchOptions);
|
|
59
|
-
|
|
60
|
-
static
|
|
61
|
-
|
|
62
|
-
static
|
|
63
|
-
|
|
64
|
-
static
|
|
65
|
-
|
|
66
|
-
static
|
|
67
|
-
|
|
68
|
-
static
|
|
69
|
-
|
|
70
|
-
static
|
|
71
|
-
|
|
72
|
-
static
|
|
73
|
-
request<T = any>(
|
|
74
|
-
static request<T = any>(
|
|
75
|
-
private
|
|
76
|
-
private
|
|
77
|
-
private
|
|
78
|
-
private
|
|
79
|
-
private
|
|
80
|
-
private
|
|
81
|
-
private
|
|
82
|
-
private
|
|
75
|
+
get<T = any>(path: string, options?: FetchOptionsGet): Promise<FetchResponse<T>>;
|
|
76
|
+
static get<T = any>(path: string, options?: FetchOptionsGet): Promise<FetchResponse<T>>;
|
|
77
|
+
post<T = any>(path: string, options?: FetchOptionsBody): Promise<FetchResponse<T>>;
|
|
78
|
+
static post<T = any>(path: string, options?: FetchOptionsBody): Promise<FetchResponse<T>>;
|
|
79
|
+
put<T = any>(path: string, options?: FetchOptionsBody): Promise<FetchResponse<T>>;
|
|
80
|
+
static put<T = any>(path: string, options?: FetchOptionsBody): Promise<FetchResponse<T>>;
|
|
81
|
+
patch<T = any>(path: string, options?: FetchOptionsBody): Promise<FetchResponse<T>>;
|
|
82
|
+
static patch<T = any>(path: string, options?: FetchOptionsBody): Promise<FetchResponse<T>>;
|
|
83
|
+
delete<T = any>(path: string, options?: FetchOptionsGet): Promise<FetchResponse<T>>;
|
|
84
|
+
static delete<T = any>(path: string, options?: FetchOptionsGet): Promise<FetchResponse<T>>;
|
|
85
|
+
head<T = any>(path: string, options?: FetchOptionsGet): Promise<FetchResponse<T>>;
|
|
86
|
+
static head<T = any>(path: string, options?: FetchOptionsGet): Promise<FetchResponse<T>>;
|
|
87
|
+
options<T = any>(path: string, options?: FetchOptionsGet): Promise<FetchResponse<T>>;
|
|
88
|
+
static options<T = any>(path: string, options?: FetchOptionsGet): Promise<FetchResponse<T>>;
|
|
89
|
+
request<T = any>(options: FetchOptionsRequest): Promise<FetchResponse<T>>;
|
|
90
|
+
static request<T = any>(options: FetchOptionsRequest): Promise<FetchResponse<T>>;
|
|
91
|
+
private _buildUrl;
|
|
92
|
+
private _buildParams;
|
|
93
|
+
private _buildRequest;
|
|
94
|
+
private _createAbortSignal;
|
|
95
|
+
private _getHeader;
|
|
96
|
+
private _parseResponseData;
|
|
97
|
+
private _serializeBody;
|
|
98
|
+
private _resolveStatusText;
|
|
83
99
|
}
|
|
84
100
|
|
|
85
101
|
declare const FetchStatusText: TypeObjectString;
|
|
86
102
|
|
|
87
103
|
export { Fetch, FetchStatusText };
|
|
88
|
-
export type { FetchBody, FetchCredentials, FetchHeaders, FetchOptions,
|
|
104
|
+
export type { FetchAbort, FetchBody, FetchCredentials, FetchEvents, FetchHeaders, FetchMethod, FetchOptions, FetchOptionsBase, FetchOptionsBody, FetchOptionsGet, FetchOptionsRequest, FetchQuery, FetchRequest, FetchResponse };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @andrewcaires/fetch
|
|
3
|
-
* Plugin for fetch api
|
|
2
|
+
* @andrewcaires/fetch v2.0.0
|
|
3
|
+
* Plugin for fetch api
|
|
4
4
|
* (c) 2026 Andrew Caires
|
|
5
5
|
* @license: MIT
|
|
6
6
|
*/
|
|
7
|
-
import{EventEmitter as
|
|
7
|
+
import{EventEmitter as e,merge as t,forEachKey as r,isArray as a,isDef as s,isString as n}from"@andrewcaires/utils.js";const i={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",511:"Network Authentication Required"};class o extends e{constructor(e){super(),this.baseOptions=t({headers:{},timeout:1e4},null!=e?e:{})}async get(e,t){return this.request(this._buildParams(e,"GET",t))}static async get(e,t){return(new o).get(e,t)}async post(e,t){return this.request(this._buildParams(e,"POST",t))}static async post(e,t){return(new o).post(e,t)}async put(e,t){return this.request(this._buildParams(e,"PUT",t))}static async put(e,t){return(new o).put(e,t)}async patch(e,t){return this.request(this._buildParams(e,"PATCH",t))}static async patch(e,t){return(new o).patch(e,t)}async delete(e,t){return this.request(this._buildParams(e,"DELETE",t))}static async delete(e,t){return(new o).delete(e,t)}async head(e,t){return this.request(this._buildParams(e,"HEAD",t))}static async head(e,t){return(new o).head(e,t)}async options(e,t){return this.request(this._buildParams(e,"OPTIONS",t))}static async options(e,t){return(new o).options(e,t)}async request(e){const t={...this.baseOptions,...e,headers:{...this.baseOptions.headers,...e.headers}},r=this._buildRequest(t),a={data:{}};try{this.emit("before",r),a.raw=await fetch(r.url,r),a.data=await this._parseResponseData(a.raw),a.raw.ok||(a.error=this._resolveStatusText(a.raw)),this.emit("complete",a)}catch(e){this.emit("error",e),a.error=e.message}return a}static request(e){return(new o).request(e)}_buildUrl(e,t,n){const i=new URL(null!=t?t:"",e);return n?(r(n,((e,t)=>{a(e)?e.forEach((e=>s(e)&&i.searchParams.append(t,String(e)))):s(e)&&i.searchParams.set(t,String(e))})),i.toString()):i.toString()}_buildParams(e,t,r){return{...null!=r?r:{},path:e,method:t}}_buildRequest(e){var t;const r=this._buildUrl(e.url,e.path,e.query),a=e.method.toUpperCase(),{body:s,isJson:n}=this._serializeBody(e.body),i={...null!==(t=e.headers)&&void 0!==t?t:{}};n&&void 0!==s&&!i["Content-Type"]&&(i["Content-Type"]="application/json");const{signal:o,cleanup:u}=this._createAbortSignal(e.timeout);return{url:r,method:a,body:s,headers:i,credentials:e.credentials,signal:o,cleanup:u}}_createAbortSignal(e){if(!e)return{signal:void 0,cleanup:void 0};const t=new AbortController,r=setTimeout((()=>t.abort()),e);return{signal:t.signal,cleanup:()=>clearTimeout(r)}}_getHeader(e,t){var r;return null!==(r=e.headers.get(t))&&void 0!==r?r:""}async _parseResponseData(e){if(204===e.status)return null;const t=this._getHeader(e,"Content-Type").toLowerCase();return!t||t.includes("text/plain")||t.includes("text/html")?e.text():t.includes("application/json")?e.json():e.blob()}_serializeBody(e){if(null==e)return{isJson:!1,body:void 0};const t=!(e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||n(e));return{isJson:t,body:t?JSON.stringify(e):e}}_resolveStatusText(e){return e.statusText||i[e.status]||"ERROR"}}export{o as Fetch,i as FetchStatusText};
|
package/dist/index.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @andrewcaires/fetch
|
|
3
|
-
* Plugin for fetch api
|
|
2
|
+
* @andrewcaires/fetch v2.0.0
|
|
3
|
+
* Plugin for fetch api
|
|
4
4
|
* (c) 2026 Andrew Caires
|
|
5
5
|
* @license: MIT
|
|
6
6
|
*/
|
|
7
|
-
var Fetch=function(t
|
|
7
|
+
var Fetch=function(e,t){"use strict";const r={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",511:"Network Authentication Required"};class s extends t.EventEmitter{constructor(e){super(),this.baseOptions=t.merge({headers:{},timeout:1e4},null!=e?e:{})}async get(e,t){return this.request(this._buildParams(e,"GET",t))}static async get(e,t){return(new s).get(e,t)}async post(e,t){return this.request(this._buildParams(e,"POST",t))}static async post(e,t){return(new s).post(e,t)}async put(e,t){return this.request(this._buildParams(e,"PUT",t))}static async put(e,t){return(new s).put(e,t)}async patch(e,t){return this.request(this._buildParams(e,"PATCH",t))}static async patch(e,t){return(new s).patch(e,t)}async delete(e,t){return this.request(this._buildParams(e,"DELETE",t))}static async delete(e,t){return(new s).delete(e,t)}async head(e,t){return this.request(this._buildParams(e,"HEAD",t))}static async head(e,t){return(new s).head(e,t)}async options(e,t){return this.request(this._buildParams(e,"OPTIONS",t))}static async options(e,t){return(new s).options(e,t)}async request(e){const t={...this.baseOptions,...e,headers:{...this.baseOptions.headers,...e.headers}},r=this._buildRequest(t),s={data:{}};try{this.emit("before",r),s.raw=await fetch(r.url,r),s.data=await this._parseResponseData(s.raw),s.raw.ok||(s.error=this._resolveStatusText(s.raw)),this.emit("complete",s)}catch(e){this.emit("error",e),s.error=e.message}return s}static request(e){return(new s).request(e)}_buildUrl(e,r,s){const a=new URL(null!=r?r:"",e);return s?(t.forEachKey(s,((e,r)=>{t.isArray(e)?e.forEach((e=>t.isDef(e)&&a.searchParams.append(r,String(e)))):t.isDef(e)&&a.searchParams.set(r,String(e))})),a.toString()):a.toString()}_buildParams(e,t,r){return{...null!=r?r:{},path:e,method:t}}_buildRequest(e){var t;const r=this._buildUrl(e.url,e.path,e.query),s=e.method.toUpperCase(),{body:a,isJson:n}=this._serializeBody(e.body),i={...null!==(t=e.headers)&&void 0!==t?t:{}};n&&void 0!==a&&!i["Content-Type"]&&(i["Content-Type"]="application/json");const{signal:o,cleanup:u}=this._createAbortSignal(e.timeout);return{url:r,method:s,body:a,headers:i,credentials:e.credentials,signal:o,cleanup:u}}_createAbortSignal(e){if(!e)return{signal:void 0,cleanup:void 0};const t=new AbortController,r=setTimeout((()=>t.abort()),e);return{signal:t.signal,cleanup:()=>clearTimeout(r)}}_getHeader(e,t){var r;return null!==(r=e.headers.get(t))&&void 0!==r?r:""}async _parseResponseData(e){if(204===e.status)return null;const t=this._getHeader(e,"Content-Type").toLowerCase();return!t||t.includes("text/plain")||t.includes("text/html")?e.text():t.includes("application/json")?e.json():e.blob()}_serializeBody(e){if(null==e)return{isJson:!1,body:void 0};const r=!(e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||t.isString(e));return{isJson:r,body:r?JSON.stringify(e):e}}_resolveStatusText(e){return e.statusText||r[e.status]||"ERROR"}}return e.Fetch=s,e.FetchStatusText=r,e}({},UtilsJS);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrewcaires/fetch",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Plugin for fetch api",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs.js",
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"
|
|
24
|
+
"dev": "tsx watch ./src/index.ts",
|
|
25
|
+
"build": "npm run lint && rollup --bundleConfigAsCjs -c rollup.config.js",
|
|
26
|
+
"lint": "eslint \"src/**/*.{ts,tsx,js,jsx}\" --max-warnings=0"
|
|
25
27
|
},
|
|
26
28
|
"repository": {
|
|
27
29
|
"type": "git",
|
|
@@ -37,16 +39,18 @@
|
|
|
37
39
|
},
|
|
38
40
|
"homepage": "https://github.com/andrewcaires/npm#readme",
|
|
39
41
|
"dependencies": {
|
|
40
|
-
"@andrewcaires/utils.js": "^0.4.
|
|
42
|
+
"@andrewcaires/utils.js": "^0.4.32"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
|
-
"@
|
|
44
|
-
"@rollup/plugin-
|
|
45
|
+
"@eslint/js": "^10.0.1",
|
|
46
|
+
"@rollup/plugin-commonjs": "^29.0.2",
|
|
47
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
45
48
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
46
|
-
"eslint": "^
|
|
47
|
-
"rollup": "^4.
|
|
48
|
-
"rollup-plugin-dts": "^6.
|
|
49
|
+
"eslint": "^10.0.3",
|
|
50
|
+
"rollup": "^4.59.0",
|
|
51
|
+
"rollup-plugin-dts": "^6.4.0",
|
|
49
52
|
"tslib": "^2.8.1",
|
|
50
|
-
"
|
|
53
|
+
"tsx": "^4.21.0",
|
|
54
|
+
"typescript-eslint": "^8.57.0"
|
|
51
55
|
}
|
|
52
56
|
}
|