piral-fetch 0.15.0-alpha.3555 → 0.15.0-alpha.3640
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/package.json +7 -5
- package/piral-fetch.min.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-fetch",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.3640",
|
|
4
4
|
"description": "Plugin for standardizing fetch in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"files": [
|
|
25
25
|
"esm",
|
|
26
26
|
"lib",
|
|
27
|
-
"src"
|
|
27
|
+
"src",
|
|
28
|
+
"piral-fetch.min.js"
|
|
28
29
|
],
|
|
29
30
|
"repository": {
|
|
30
31
|
"type": "git",
|
|
@@ -34,7 +35,8 @@
|
|
|
34
35
|
"url": "https://github.com/smapiot/piral/issues"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
37
|
-
"build": "yarn build:commonjs && yarn build:esnext",
|
|
38
|
+
"build": "yarn build:bundle && yarn build:commonjs && yarn build:esnext",
|
|
39
|
+
"build:bundle": "esbuild src/index.ts --outfile=piral-fetch.min.js --bundle --external:piral-core --minify --global-name=piralFetch",
|
|
38
40
|
"build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs",
|
|
39
41
|
"build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
|
|
40
42
|
"typedoc": "typedoc --json ../../../docs/types/piral-fetch.json src --exclude \"src/**/*.test.*\"",
|
|
@@ -45,10 +47,10 @@
|
|
|
45
47
|
"@types/express": "^4.11.1",
|
|
46
48
|
"cors": "^2.8.5",
|
|
47
49
|
"express": "^4.17.1",
|
|
48
|
-
"piral-core": "0.15.0-alpha.
|
|
50
|
+
"piral-core": "0.15.0-alpha.3640"
|
|
49
51
|
},
|
|
50
52
|
"peerDependencies": {
|
|
51
53
|
"piral-core": "0.14.x"
|
|
52
54
|
},
|
|
53
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "29ee91f865f9ee42229e58a7804cba6ab5e9145b"
|
|
54
56
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var piralFetch=(()=>{var u=Object.defineProperty,C=Object.defineProperties;var O=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var b=(e,t,o)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,c=(e,t)=>{for(var o in t||(t={}))R.call(t,o)&&b(e,o,t[o]);if(P)for(var o of P(t))H.call(t,o)&&b(e,o,t[o]);return e},m=(e,t)=>C(e,O(t)),I=e=>u(e,"__esModule",{value:!0});var B=(e,t)=>{I(e);for(var o in t)u(e,o,{get:t[o],enumerable:!0})};var w={};B(w,{createFetchApi:()=>q,httpFetch:()=>l});var J="accept",x="content-type",U="application/json";function l(e,t,o={}){let r=e.default||{},h=r.headers||{},p=e.base||location.origin,{method:s="get",body:n,headers:f={},cache:i=r.cache,mode:j=r.mode,result:y="auto"}=o,g=Array.isArray(n)||typeof n=="number"||typeof n=="object"&&!(n instanceof FormData)&&!(n instanceof Blob),A=new URL(t,p),d=m(c({},r),{method:s,body:g?JSON.stringify(n):n,headers:c(c({},h),f),cache:i,mode:j});return g&&(d.headers[x]="application/json",d.headers[J]=U),fetch(A.href,d).then(a=>{let F=a.headers.get(x);return(y==="json"||y==="auto"&&!!F&&F.indexOf("json")!==-1?a.json():a.text()).then(T=>({body:T,code:a.status,text:a.statusText}))})}function q(e={}){return t=>({fetch(o,r={}){let h=r.headers||{},p=[];return t.emit("before-fetch",{headers:h,method:r.method||"GET",target:o,setHeaders(s){s&&p.push(s)}}),Promise.all(p).then(s=>{let n=s.reduce((f,i)=>typeof i=="object"&&i?c(c({},f),i):f,h);return m(c({},r),{headers:n})}).then(s=>l(e,o,s))}})}return w;})();
|