diff --git a/browser/hyperfetch-browser.min.js b/browser/hyperfetch-browser.min.js index d749d32..7f45710 100644 --- a/browser/hyperfetch-browser.min.js +++ b/browser/hyperfetch-browser.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("hypf",[],t):"object"==typeof exports?exports.hypf=t():e.hypf=t()}(self,(()=>(()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>g});const o=2147483647,r=.3,n=1,i="function"==typeof globalThis.AbortController,s="function"==typeof globalThis.ReadableStream,l="function"==typeof globalThis.WritableStream,a="function"==typeof globalThis.WebSocket,c="function"==typeof globalThis.RTCPeerConnection,u=(globalThis.FormData,"undefined"!=typeof process&&"node"===process.release.name),f=()=>i?globalThis.abortController:null,p=(e,t)=>1e3*Math.pow(2,e)*t,d=e=>1e3*Math.random()*e;const b=(...e)=>{return t=void 0,f=[...e],g=function*(e="",t={},f,{baseUrl:y,hooks:g,DEBUG:h}=Object.create(null)){var m;const{method:T="GET",retries:j=0,backoff:O=p,jitter:v=!1,jitterFactor:R=n,backoffFactor:w=r,timeout:S=o,retryOnTimeout:E=!1,params:C,headers:P={},signal:x}=t,F=function(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n{globalThis.abortController.abort(),(null==g?void 0:g.postTimeout)&&g.postTimeout(e,t)}),S):void 0,d=C?((e,t)=>{if(!t)return e;const o=new URL(e);return Object.entries(t).forEach((([e,t])=>o.searchParams.append(e,String(t)))),o.toString()})(o,C):o;s&&!l&&u&&(F.duplex="half"),!s&&l&&u&&(F.duplex="half"),s&&l&&u&&(F.duplex="half"),c&&u&&(F.duplex="half"),a&&u&&(F.duplex="half");const b=t.body instanceof FormData?t.body:f?JSON.stringify(f):void 0,h=Object.assign(Object.assign({method:T,signal:i?globalThis.abortSignal:null,headers:r},F),{body:b});b instanceof FormData&&h.headers.delete("Content-Type");const j=fetch(d,h);clearTimeout(p);const O=yield j,v=O.headers.get("content-type"),R=v&&v.includes("application/json")?yield O.json():yield O.text();if(!O.ok)throw function(e,t){const o=`${e.status||0===e.status?e.status:""} ${e.statusText||""}`.trim(),r=new Error(o?`status code ${o}`:"an unknown error");return r.name="HTTPError",r.response=e,r.data=t,r}(O,R);return(null==g?void 0:g.postRequest)&&g.postRequest(e,t,f,[null,R]),[null,R]}catch(o){if((null==g?void 0:g.postRequest)&&o instanceof Error&&g.postRequest(e,t,f,[o,null]),o instanceof Error)if("AbortError"===o.name)console.error("Request aborted:",o);else{if(E&&"TimeoutError"===o.name&&j&&j>0){const o=v&&R?d(R):p(j,w||r);h&&console.warn(`Request timed out. Retrying in ${o}ms... (Remaining retries: ${j})`),(null==g?void 0:g.preRetry)&&g.preRetry(e,t,j,j),yield new Promise((e=>setTimeout(e,o)));const[n,i]=yield b(e,Object.assign(Object.assign({},t),{retries:j-1}),f);return(null==g?void 0:g.postRetry)&&g.postRetry(e,t,f,[n,i],j,j-1),[n,i]}if(t.retries&&t.retries>0){const o=t.jitter&&t.jitterFactor?d(t.jitterFactor):p(t.retries,t.backoffFactor?t.backoffFactor:r);h&&console.warn(`Request failed. Retrying in ${o}ms... (Remaining retries: ${t.retries})`),(null==g?void 0:g.preRetry)&&g.preRetry(e,t,t.retries,t.retries),yield new Promise((e=>setTimeout(e,o)));const[n,i]=yield b(e,Object.assign(Object.assign({},t),{retries:t.retries-1}),f);return(null==g?void 0:g.postRetry)&&g.postRetry(e,t,f,[n,i],t.retries,t.retries-1),[n,i]}}return o instanceof Error?[o,null]:[null,null]}},new((y=void 0)||(y=Promise))((function(e,o){function r(e){try{i(g.next(e))}catch(e){o(e)}}function n(e){try{i(g.throw(e))}catch(e){o(e)}}function i(t){var o;t.done?e(t.value):(o=t.value,o instanceof y?o:new y((function(e){e(o)}))).then(r,n)}i((g=g.apply(t,f||[])).next())}));var t,f,y,g},y=(e,t="GET",o={},r,n)=>b(e,Object.assign({method:t},o),r,n),g={init:function(e,t,o=!1){if("undefined"==typeof fetch)throw new Error("This library is intended for use in the browser environment only.");const r={baseUrl:e,hooks:t,DEBUG:o};return{get:(e,t,o)=>y(e,"GET",t,o,r),post:(e,t,o)=>y(e,"POST",t,o,r),put:(e,t,o)=>y(e,"PUT",t,o,r),delete:(e,t,o)=>y(e,"DELETE",t,o,r),patch:(e,t,o)=>y(e,"PATCH",t,o,r),options:(e,t,o)=>y(e,"OPTIONS",t,o,r),getAbortController:f}}};return t})())); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("hypf",[],t):"object"==typeof exports?exports.hypf=t():e.hypf=t()}(self,(()=>(()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>g});const o=2147483647,r=.3,n=1,i="function"==typeof globalThis.AbortController,s="function"==typeof globalThis.ReadableStream,l="function"==typeof globalThis.WritableStream,a="function"==typeof globalThis.WebSocket,c="function"==typeof globalThis.RTCPeerConnection,u=(globalThis.FormData,"undefined"!=typeof process&&"node"===process.release.name),f=()=>i?globalThis.abortController:null,d=(e,t)=>1e3*Math.pow(2,e)*t,p=e=>1e3*Math.random()*e;const b=(e="",t={},f,{baseUrl:y,hooks:g,DEBUG:h}=Object.create(null))=>{return m=void 0,T=void 0,v=function*(){var m;const{method:T="GET",retries:j=0,backoff:v=d,jitter:O=!1,jitterFactor:R=n,backoffFactor:w=r,timeout:S=o,retryOnTimeout:E=!1,params:C,headers:P={},signal:x}=t,F=function(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n{globalThis.abortController.abort(),(null==g?void 0:g.postTimeout)&&g.postTimeout(e,t)}),S):void 0,p=C?((e,t)=>{if(!t)return e;const o=new URL(e);return Object.entries(t).forEach((([e,t])=>o.searchParams.append(e,String(t)))),o.toString()})(o,C):o;s&&!l&&u&&(F.duplex="half"),!s&&l&&u&&(F.duplex="half"),s&&l&&u&&(F.duplex="half"),c&&u&&(F.duplex="half"),a&&u&&(F.duplex="half");const b=t.body instanceof FormData?t.body:f?JSON.stringify(f):void 0,h=Object.assign(Object.assign({method:T,signal:i?globalThis.abortSignal:null,headers:r},F),{body:b});b instanceof FormData&&h.headers.delete("Content-Type");const j=fetch(p,h);clearTimeout(d);const v=yield j,O=v.headers.get("content-type"),R=O&&O.includes("application/json")?yield v.json():yield v.text();if(!v.ok)throw function(e,t){const o=`${e.status||0===e.status?e.status:""} ${e.statusText||""}`.trim(),r=new Error(o?`status code ${o}`:"an unknown error");return r.name="HTTPError",r.response=e,r.data=t,r}(v,R);return(null==g?void 0:g.postRequest)&&g.postRequest(e,t,f,[null,R]),[null,R]}catch(o){if((null==g?void 0:g.postRequest)&&o instanceof Error&&g.postRequest(e,t,f,[o,null]),o instanceof Error)if("AbortError"===o.name)console.error("Request aborted:",o);else{if(E&&"TimeoutError"===o.name&&j&&j>0){const o=O&&R?p(R):v(j,w||r);h&&console.warn(`Request timed out. Retrying in ${o}ms... (Remaining retries: ${j})`),(null==g?void 0:g.preRetry)&&g.preRetry(e,t,j,j),yield new Promise((e=>setTimeout(e,o)));const[n,i]=yield b(e,Object.assign(Object.assign({},t),{retries:j-1}),f);return(null==g?void 0:g.postRetry)&&g.postRetry(e,t,f,[n,i],j,j-1),[n,i]}if(t.retries&&t.retries>0){const o=t.jitter&&t.jitterFactor?p(t.jitterFactor):v(t.retries,t.backoffFactor?t.backoffFactor:r);h&&console.warn(`Request failed. Retrying in ${o}ms... (Remaining retries: ${t.retries})`),(null==g?void 0:g.preRetry)&&g.preRetry(e,t,t.retries,t.retries),yield new Promise((e=>setTimeout(e,o)));const[n,i]=yield b(e,Object.assign(Object.assign({},t),{retries:t.retries-1}),f);return(null==g?void 0:g.postRetry)&&g.postRetry(e,t,f,[n,i],t.retries,t.retries-1),[n,i]}}return o instanceof Error?[o,null]:[null,null]}},new((j=void 0)||(j=Promise))((function(e,t){function o(e){try{n(v.next(e))}catch(e){t(e)}}function r(e){try{n(v.throw(e))}catch(e){t(e)}}function n(t){var n;t.done?e(t.value):(n=t.value,n instanceof j?n:new j((function(e){e(n)}))).then(o,r)}n((v=v.apply(m,T||[])).next())}));var m,T,j,v},y=(e,t="GET",o={},r,n)=>b(e,Object.assign({method:t},o),r,n),g={init:function(e,t,o=!1){if("undefined"==typeof fetch)throw new Error("This library is intended for use in the browser environment only.");const r={baseUrl:e,hooks:t,DEBUG:o};return{get:(e,t,o)=>y(e,"GET",t,o,r),post:(e,t,o)=>y(e,"POST",t,o,r),put:(e,t,o)=>y(e,"PUT",t,o,r),delete:(e,t,o)=>y(e,"DELETE",t,o,r),patch:(e,t,o)=>y(e,"PATCH",t,o,r),options:(e,t,o)=>y(e,"OPTIONS",t,o,r),getAbortController:f}}};return t})())); //# sourceMappingURL=hyperfetch-browser.min.js.map \ No newline at end of file diff --git a/browser/hyperfetch-browser.min.js.map b/browser/hyperfetch-browser.min.js.map index 05df70c..d17d993 100644 --- a/browser/hyperfetch-browser.min.js.map +++ b/browser/hyperfetch-browser.min.js.map @@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N,GAaF,OAVIE,aAAK,EAALA,EAAOwE,YACTxE,EAAMwE,UACJ5E,EACAC,EACAC,EACA,CAACwE,EAAUC,GACX1E,EAAQO,QACRP,EAAQO,QAAU,GAGf,CAACkE,EAAUC,EACpB,EAGF,OAAIX,aAAiBC,MACZ,CAACD,EAAO,MAGV,CAAC,KAAM,KAChB,CACF,E,YAnPmC,K,6QAmPlC,EGtQYa,EAAqB,CAChC7E,EACAO,EAAwB,MACxBN,EAAU,CAAC,EACXC,EACA4E,IAEO/E,EAAcC,EAAK,OAAF,QAAIO,UAAWN,GAAWC,EAAM4E,GC6B1D,GAAiBC,KAnCjB,SACE5E,EACAC,EACAC,GAAiB,GAGjB,GAAqB,oBAAVgD,MACT,MAAM,IAAIY,MACR,qEAIJ,MAAMa,EAAc,CAClB3E,UACAC,QACAC,SAGF,MAAO,CACL3C,IAAK,CAACsC,EAAKC,EAASC,IAClB2E,EAAmB7E,EAAK,MAAOC,EAASC,EAAM4E,GAChDE,KAAM,CAAChF,EAAKC,EAASC,IACnB2E,EAAmB7E,EAAK,OAAQC,EAASC,EAAM4E,GACjDG,IAAK,CAACjF,EAAKC,EAASC,IAClB2E,EAAmB7E,EAAK,MAAOC,EAASC,EAAM4E,GAChD3B,OAAQ,CAACnD,EAAKC,EAASC,IACrB2E,EAAmB7E,EAAK,SAAUC,EAASC,EAAM4E,GACnDI,MAAO,CAAClF,EAAKC,EAASC,IACpB2E,EAAmB7E,EAAK,QAASC,EAASC,EAAM4E,GAClD7E,QAAS,CAACD,EAAKC,EAASC,IACtB2E,EAAmB7E,EAAK,UAAWC,EAASC,EAAM4E,GACpDxF,mBAAkB,EAEtB,G","sources":["webpack://hypf/webpack/universalModuleDefinition","webpack://hypf/webpack/bootstrap","webpack://hypf/webpack/runtime/define property getters","webpack://hypf/webpack/runtime/hasOwnProperty shorthand","webpack://hypf/webpack/runtime/make namespace object","webpack://hypf/./src/utils/constant.ts","webpack://hypf/./src/utils/get-abort-controller.ts","webpack://hypf/./src/utils/default-retries.ts","webpack://hypf/./src/utils/create-request.ts","webpack://hypf/./src/utils/append-params.ts","webpack://hypf/./src/utils/create-http-error.ts","webpack://hypf/./src/utils/create-http-method.ts","webpack://hypf/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"hypf\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"hypf\"] = factory();\n\telse\n\t\troot[\"hypf\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// Default maximum recommended timeout in milliseconds (adjust as needed)\r\nexport const DEFAULT_MAX_TIMEOUT = 2147483647;\r\n\r\nexport const DEFAULT_BACKOFF_FACTOR = 0.3;\r\nexport const DEFAULT_JITTER_FACTOR = 1;\r\n\r\nexport const isAbortControllerSupported =\r\n typeof globalThis.AbortController === \"function\";\r\nexport const isReadableStreamSupported =\r\n typeof globalThis.ReadableStream === \"function\";\r\nexport const isWriteableStreamSupported =\r\n typeof globalThis.WritableStream === \"function\";\r\nexport const isWebsocketSupported = typeof globalThis.WebSocket === \"function\";\r\nexport const isWebRTCSupported =\r\n typeof globalThis.RTCPeerConnection === \"function\";\r\nexport const isFormDataSupported = typeof globalThis.FormData === \"function\";\r\nexport const isNode =\r\n typeof process !== \"undefined\" && process.release.name === \"node\";\r\n","import { isAbortControllerSupported } from \"./constant.js\";\r\n\r\n// Expose the AbortController instance through the library interface\r\nexport const getAbortController = () =>\r\n isAbortControllerSupported ? globalThis.abortController : null;\r\n","export const defaultBackoff = (retryCount: number, factor: number) =>\r\n Math.pow(2, retryCount) * 1000 * factor; // Exponential backoff, starting from 1 second\r\n\r\nexport const defaultJitter = (factor: number) => Math.random() * 1000 * factor; // Randomized delay up to 1 second\r\n","import type { InitOptions } from \"../types/init.js\";\r\nimport type { RequestFunction } from \"../types/request.js\";\r\n\r\nimport {\r\n DEFAULT_BACKOFF_FACTOR,\r\n DEFAULT_JITTER_FACTOR,\r\n DEFAULT_MAX_TIMEOUT,\r\n isAbortControllerSupported,\r\n isReadableStreamSupported,\r\n isWriteableStreamSupported,\r\n isWebRTCSupported,\r\n isWebsocketSupported,\r\n isNode,\r\n} from \"./constant.js\";\r\n\r\nimport { appendParams } from \"./append-params.js\";\r\nimport { createHTTPError } from \"./create-http-error.js\";\r\nimport { defaultBackoff, defaultJitter } from \"./default-retries.js\";\r\n\r\nexport const createRequest: RequestFunction = async (\r\n url = \"\",\r\n options = {},\r\n data,\r\n { baseUrl, hooks, DEBUG }: InitOptions = Object.create(null)\r\n): Promise<[Error | null, null]> => {\r\n const {\r\n method = \"GET\",\r\n retries = 0,\r\n backoff = defaultBackoff,\r\n jitter = false,\r\n jitterFactor = DEFAULT_JITTER_FACTOR,\r\n backoffFactor = DEFAULT_BACKOFF_FACTOR,\r\n timeout = DEFAULT_MAX_TIMEOUT,\r\n retryOnTimeout = false,\r\n params,\r\n headers = {},\r\n signal,\r\n ...otherOptions\r\n } = options;\r\n\r\n try {\r\n // Execute pre-request hook\r\n if (hooks?.preRequest) {\r\n hooks.preRequest(url, options);\r\n }\r\n\r\n const fullUrl = `${baseUrl}${url}`;\r\n\r\n const reqHeaders = new Headers(headers);\r\n\r\n // Automatically detect and add Content-Length based on payload length\r\n const textEncoder = new TextEncoder();\r\n if (!reqHeaders.get(\"Content-Length\") && data) {\r\n if (typeof data === \"string\") {\r\n reqHeaders.set(\r\n \"Content-Length\",\r\n String(textEncoder.encode(data).length)\r\n );\r\n } else if (\r\n reqHeaders.get(\"Content-Length\")?.includes(\"application/json\")\r\n ) {\r\n reqHeaders.set(\r\n \"Content-Length\",\r\n String(textEncoder.encode(JSON.stringify(data)).length)\r\n );\r\n }\r\n }\r\n\r\n // Set default Content-Type to application/json if not provided\r\n if (!reqHeaders.get(\"Content-Type\") && data && typeof data === \"object\") {\r\n if (!(((data as { body: FormData })?.body || data) instanceof FormData)) {\r\n reqHeaders.set(\"Content-Type\", \"application/json\");\r\n }\r\n }\r\n\r\n // Execute pre-timeout hook\r\n if (hooks?.preTimeout) {\r\n hooks.preTimeout(url, options);\r\n }\r\n\r\n if (isAbortControllerSupported) {\r\n // Expose the AbortController instance\r\n globalThis.abortController = new AbortController();\r\n\r\n // Use the external AbortController instance\r\n globalThis.abortSignal = signal\r\n ? signal\r\n : globalThis.abortController.signal;\r\n }\r\n\r\n const timeoutId =\r\n timeout && isAbortControllerSupported\r\n ? setTimeout(() => {\r\n globalThis.abortController.abort();\r\n\r\n // Execute post-timeout hook\r\n if (hooks?.postTimeout) {\r\n hooks.postTimeout(url, options);\r\n }\r\n }, timeout)\r\n : undefined;\r\n\r\n // Append params to the URL\r\n const urlWithParams = params ? appendParams(fullUrl, params) : fullUrl;\r\n\r\n if (isReadableStreamSupported && !isWriteableStreamSupported && isNode) {\r\n // @ts-expect-error\r\n otherOptions.duplex = \"half\";\r\n }\r\n if (!isReadableStreamSupported && isWriteableStreamSupported && isNode) {\r\n // @ts-expect-error\r\n otherOptions.duplex = \"half\";\r\n }\r\n if (isReadableStreamSupported && isWriteableStreamSupported && isNode) {\r\n // @ts-expect-error\r\n otherOptions.duplex = \"half\";\r\n }\r\n // WebRTC is supported, allowing for full duplex communication.\r\n if (isWebRTCSupported && isNode) {\r\n // @ts-expect-error\r\n otherOptions.duplex = \"half\";\r\n }\r\n // WebSockets are supported, and thus full duplex communication is possible.\r\n if (isWebsocketSupported && isNode) {\r\n // @ts-expect-error\r\n otherOptions.duplex = \"half\";\r\n }\r\n\r\n const requestBody =\r\n options.body instanceof FormData\r\n ? options.body\r\n : data\r\n ? JSON.stringify(data)\r\n : undefined;\r\n\r\n const requestOptions = {\r\n method,\r\n signal: isAbortControllerSupported ? globalThis.abortSignal : null,\r\n headers: reqHeaders,\r\n ...otherOptions,\r\n body: requestBody,\r\n };\r\n\r\n if (requestBody instanceof FormData) {\r\n requestOptions.headers.delete(\"Content-Type\");\r\n }\r\n\r\n const responsePromise = fetch(urlWithParams, requestOptions);\r\n\r\n clearTimeout(timeoutId);\r\n\r\n const response = await responsePromise;\r\n\r\n const contentType = response.headers.get(\"content-type\");\r\n\r\n const responseData =\r\n contentType && contentType.includes(\"application/json\")\r\n ? await response.json()\r\n : await response.text();\r\n\r\n if (!response.ok) {\r\n throw createHTTPError(response, responseData);\r\n }\r\n\r\n // Execute post-request hook\r\n if (hooks?.postRequest) {\r\n hooks.postRequest(url, options, data, [null, responseData]);\r\n }\r\n\r\n return [null, responseData];\r\n } catch (error) {\r\n // Execute post-request hook for errors\r\n if (hooks?.postRequest) {\r\n if (error instanceof Error) {\r\n hooks.postRequest(url, options, data, [error, null]);\r\n }\r\n }\r\n\r\n if (error instanceof Error) {\r\n if (error.name === \"AbortError\") {\r\n console.error(\"Request aborted:\", error);\r\n } else if (\r\n retryOnTimeout &&\r\n error.name === \"TimeoutError\" &&\r\n retries &&\r\n retries > 0\r\n ) {\r\n const delay =\r\n jitter && jitterFactor\r\n ? defaultJitter(jitterFactor)\r\n : defaultBackoff(\r\n retries,\r\n backoffFactor ? backoffFactor : DEFAULT_BACKOFF_FACTOR\r\n );\r\n if (DEBUG) {\r\n console.warn(\r\n `Request timed out. Retrying in ${delay}ms... (Remaining retries: ${retries})`\r\n );\r\n }\r\n // Execute pre-retry hook\r\n if (hooks?.preRetry) {\r\n hooks.preRetry(url, options, retries, retries);\r\n }\r\n await new Promise((resolve) => setTimeout(resolve, delay));\r\n const [retryErr, retryData] = await createRequest(\r\n url,\r\n { ...options, retries: retries - 1 },\r\n data\r\n );\r\n // Execute post-retry hook\r\n if (hooks?.postRetry) {\r\n hooks.postRetry(\r\n url,\r\n options,\r\n data,\r\n [retryErr, retryData],\r\n retries,\r\n retries - 1\r\n );\r\n }\r\n return [retryErr, retryData];\r\n } else if (options.retries && options.retries > 0) {\r\n const delay =\r\n options.jitter && options.jitterFactor\r\n ? defaultJitter(options.jitterFactor)\r\n : defaultBackoff(\r\n options.retries,\r\n options.backoffFactor\r\n ? options.backoffFactor\r\n : DEFAULT_BACKOFF_FACTOR\r\n );\r\n if (DEBUG) {\r\n console.warn(\r\n `Request failed. Retrying in ${delay}ms... (Remaining retries: ${options.retries})`\r\n );\r\n }\r\n // Execute pre-retry hook\r\n if (hooks?.preRetry) {\r\n hooks.preRetry(url, options, options.retries, options.retries);\r\n }\r\n await new Promise((resolve) => setTimeout(resolve, delay));\r\n const [retryErr, retryData] = await createRequest(\r\n url,\r\n { ...options, retries: options.retries - 1 },\r\n data\r\n );\r\n // Execute post-retry hook\r\n if (hooks?.postRetry) {\r\n hooks.postRetry(\r\n url,\r\n options,\r\n data,\r\n [retryErr, retryData],\r\n options.retries,\r\n options.retries - 1\r\n );\r\n }\r\n return [retryErr, retryData];\r\n }\r\n }\r\n\r\n if (error instanceof Error) {\r\n return [error, null];\r\n }\r\n\r\n return [null, null];\r\n }\r\n};\r\n","export const appendParams = (\r\n url: string,\r\n params?: Record\r\n): string => {\r\n if (!params) return url;\r\n\r\n const urlWithParams = new URL(url);\r\n Object.entries(params).forEach(([key, value]) =>\r\n urlWithParams.searchParams.append(key, String(value))\r\n );\r\n\r\n return urlWithParams.toString();\r\n};\r\n","export function createHTTPError(response: Response, responseData: Response) {\r\n const code = response.status || response.status === 0 ? response.status : \"\";\r\n const title = response.statusText || \"\";\r\n const status = `${code} ${title}`.trim();\r\n const reason = status ? `status code ${status}` : \"an unknown error\";\r\n const error = new Error(reason);\r\n\r\n error.name = \"HTTPError\";\r\n\r\n (error as any).response = response;\r\n (error as any).data = responseData;\r\n\r\n return error;\r\n}\r\n","import type { RequestMethod } from \"../types/request.js\";\r\nimport type { InitOptions } from \"../types/init.js\";\r\n\r\nimport { createRequest } from \"./create-request.js\";\r\n\r\nexport const httpMethodFunction = (\r\n url: string,\r\n method: RequestMethod = \"GET\",\r\n options = {},\r\n data: unknown,\r\n initOptions: InitOptions\r\n) => {\r\n return createRequest(url, { method, ...options }, data, initOptions);\r\n};\r\n","import { Hooks } from \"./types/hooks.js\";\r\nimport type { HttpRequestFunctions } from \"./types/request.js\";\r\n\r\nimport { getAbortController } from \"./utils/get-abort-controller.js\";\r\nimport { httpMethodFunction } from \"./utils/create-http-method.js\";\r\n\r\nfunction init(\r\n baseUrl?: string,\r\n hooks?: Hooks,\r\n DEBUG: boolean = false\r\n): HttpRequestFunctions {\r\n // Check if fetch is available\r\n if (typeof fetch === \"undefined\") {\r\n throw new Error(\r\n \"This library is intended for use in the browser environment only.\"\r\n );\r\n }\r\n\r\n const initOptions = {\r\n baseUrl,\r\n hooks,\r\n DEBUG,\r\n };\r\n\r\n return {\r\n get: (url, options, data) =>\r\n httpMethodFunction(url, \"GET\", options, data, initOptions),\r\n post: (url, options, data) =>\r\n httpMethodFunction(url, \"POST\", options, data, initOptions),\r\n put: (url, options, data) =>\r\n httpMethodFunction(url, \"PUT\", options, data, initOptions),\r\n delete: (url, options, data) =>\r\n httpMethodFunction(url, \"DELETE\", options, data, initOptions),\r\n patch: (url, options, data) =>\r\n httpMethodFunction(url, \"PATCH\", options, data, initOptions),\r\n options: (url, options, data) =>\r\n httpMethodFunction(url, \"OPTIONS\", options, data, initOptions),\r\n getAbortController,\r\n };\r\n}\r\n\r\nexport default { init };\r\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","DEFAULT_MAX_TIMEOUT","DEFAULT_BACKOFF_FACTOR","DEFAULT_JITTER_FACTOR","isAbortControllerSupported","globalThis","AbortController","isReadableStreamSupported","ReadableStream","isWriteableStreamSupported","WritableStream","isWebsocketSupported","WebSocket","isWebRTCSupported","RTCPeerConnection","isNode","FormData","process","release","name","getAbortController","abortController","defaultBackoff","retryCount","factor","Math","pow","defaultJitter","random","createRequest","url","options","data","baseUrl","hooks","DEBUG","create","method","retries","backoff","jitter","jitterFactor","backoffFactor","timeout","retryOnTimeout","params","headers","signal","otherOptions","preRequest","fullUrl","reqHeaders","Headers","textEncoder","TextEncoder","set","String","encode","length","includes","JSON","stringify","body","preTimeout","abortSignal","timeoutId","setTimeout","abort","postTimeout","undefined","urlWithParams","URL","entries","forEach","searchParams","append","toString","appendParams","duplex","requestBody","requestOptions","delete","responsePromise","fetch","clearTimeout","response","contentType","responseData","json","text","ok","status","statusText","trim","error","Error","createHTTPError","postRequest","console","delay","warn","preRetry","Promise","resolve","retryErr","retryData","postRetry","httpMethodFunction","initOptions","init","post","put","patch"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"hyperfetch-browser.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,OAAQ,GAAIH,GACO,iBAAZC,QACdA,QAAc,KAAID,IAElBD,EAAW,KAAIC,GAChB,CATD,CASGK,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAK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GF,MAAO,CACL3C,IAAK,CAACsC,EAAKC,EAASC,IAAS2E,EAAmB7E,EAAK,MAAOC,EAASC,EAAM4E,GAC3EE,KAAM,CAAChF,EAAKC,EAASC,IAAS2E,EAAmB7E,EAAK,OAAQC,EAASC,EAAM4E,GAC7EG,IAAK,CAACjF,EAAKC,EAASC,IAAS2E,EAAmB7E,EAAK,MAAOC,EAASC,EAAM4E,GAC3E3B,OAAQ,CAACnD,EAAKC,EAASC,IAAS2E,EAAmB7E,EAAK,SAAUC,EAASC,EAAM4E,GACjFI,MAAO,CAAClF,EAAKC,EAASC,IAAS2E,EAAmB7E,EAAK,QAASC,EAASC,EAAM4E,GAC/E7E,QAAS,CAACD,EAAKC,EAASC,IAAS2E,EAAmB7E,EAAK,UAAWC,EAASC,EAAM4E,GACnFxF,mBAAkB,EAEtB,G","sources":["webpack://hypf/webpack/universalModuleDefinition","webpack://hypf/webpack/bootstrap","webpack://hypf/webpack/runtime/define property getters","webpack://hypf/webpack/runtime/hasOwnProperty shorthand","webpack://hypf/webpack/runtime/make namespace object","webpack://hypf/./src/utils/constant.ts","webpack://hypf/./src/utils/get-abort-controller.ts","webpack://hypf/./src/utils/default-retries.ts","webpack://hypf/./src/utils/create-request.ts","webpack://hypf/./src/utils/append-params.ts","webpack://hypf/./src/utils/create-http-error.ts","webpack://hypf/./src/utils/create-http-method.ts","webpack://hypf/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"hypf\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"hypf\"] = factory();\n\telse\n\t\troot[\"hypf\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// Default maximum recommended timeout in milliseconds (adjust as needed)\nexport const DEFAULT_MAX_TIMEOUT = 2147483647\n\nexport const DEFAULT_BACKOFF_FACTOR = 0.3\nexport const DEFAULT_JITTER_FACTOR = 1\n\nexport const isAbortControllerSupported = typeof globalThis.AbortController === 'function'\nexport const isReadableStreamSupported = typeof globalThis.ReadableStream === 'function'\nexport const isWriteableStreamSupported = typeof globalThis.WritableStream === 'function'\nexport const isWebsocketSupported = typeof globalThis.WebSocket === 'function'\nexport const isWebRTCSupported = typeof globalThis.RTCPeerConnection === 'function'\nexport const isFormDataSupported = typeof globalThis.FormData === 'function'\nexport const isNode = typeof process !== 'undefined' && process.release.name === 'node'\n","import { isAbortControllerSupported } from './constant.js'\n\n// Expose the AbortController instance through the library interface\nexport const getAbortController = () =>\n isAbortControllerSupported ? globalThis.abortController : null\n","export const defaultBackoff = (retryCount: number, factor: number) =>\n Math.pow(2, retryCount) * 1000 * factor // Exponential backoff, starting from 1 second\n\nexport const defaultJitter = (factor: number) => Math.random() * 1000 * factor // Randomized delay up to 1 second\n","import type { InitOptions } from '../types/init.js'\nimport type { RequestFunction } from '../types/request.js'\n\nimport {\n DEFAULT_BACKOFF_FACTOR,\n DEFAULT_JITTER_FACTOR,\n DEFAULT_MAX_TIMEOUT,\n isAbortControllerSupported,\n isNode,\n isReadableStreamSupported,\n isWebRTCSupported,\n isWebsocketSupported,\n isWriteableStreamSupported,\n} from './constant.js'\n\nimport { appendParams } from './append-params.js'\nimport { createHTTPError } from './create-http-error.js'\nimport { defaultBackoff, defaultJitter } from './default-retries.js'\n\nexport const createRequest: RequestFunction = async (\n url = '',\n options = {},\n data,\n { baseUrl, hooks, DEBUG }: InitOptions = Object.create(null)\n): Promise<[Error | null, null]> => {\n const {\n method = 'GET',\n retries = 0,\n backoff = defaultBackoff,\n jitter = false,\n jitterFactor = DEFAULT_JITTER_FACTOR,\n backoffFactor = DEFAULT_BACKOFF_FACTOR,\n timeout = DEFAULT_MAX_TIMEOUT,\n retryOnTimeout = false,\n params,\n headers = {},\n signal,\n ...otherOptions\n } = options\n\n try {\n // Execute pre-request hook\n if (hooks?.preRequest) {\n hooks.preRequest(url, options)\n }\n\n const fullUrl = `${baseUrl}${url}`\n\n const reqHeaders = new Headers(headers)\n\n // Automatically detect and add Content-Length based on payload length\n const textEncoder = new TextEncoder()\n if (!reqHeaders.get('Content-Length') && data) {\n if (typeof data === 'string') {\n reqHeaders.set('Content-Length', String(textEncoder.encode(data).length))\n } else if (reqHeaders.get('Content-Length')?.includes('application/json')) {\n reqHeaders.set('Content-Length', String(textEncoder.encode(JSON.stringify(data)).length))\n }\n }\n\n // Set default Content-Type to application/json if not provided\n if (!reqHeaders.get('Content-Type') && data && typeof data === 'object') {\n if (!(((data as { body: FormData })?.body || data) instanceof FormData)) {\n reqHeaders.set('Content-Type', 'application/json')\n }\n }\n\n // Execute pre-timeout hook\n if (hooks?.preTimeout) {\n hooks.preTimeout(url, options)\n }\n\n if (isAbortControllerSupported) {\n // Expose the AbortController instance\n globalThis.abortController = new AbortController()\n\n // Use the external AbortController instance\n globalThis.abortSignal = signal ? signal : globalThis.abortController.signal\n }\n\n const timeoutId =\n timeout && isAbortControllerSupported\n ? setTimeout(() => {\n globalThis.abortController.abort()\n\n // Execute post-timeout hook\n if (hooks?.postTimeout) {\n hooks.postTimeout(url, options)\n }\n }, timeout)\n : undefined\n\n // Append params to the URL\n const urlWithParams = params ? appendParams(fullUrl, params) : fullUrl\n\n if (isReadableStreamSupported && !isWriteableStreamSupported && isNode) {\n // @ts-expect-error - Duplex types is not supported\n otherOptions.duplex = 'half'\n }\n if (!isReadableStreamSupported && isWriteableStreamSupported && isNode) {\n // @ts-expect-error - Duplex types is not supported\n otherOptions.duplex = 'half'\n }\n if (isReadableStreamSupported && isWriteableStreamSupported && isNode) {\n // @ts-expect-error - Duplex types is not supported\n otherOptions.duplex = 'half'\n }\n // WebRTC is supported, allowing for full duplex communication.\n if (isWebRTCSupported && isNode) {\n // @ts-expect-error - Duplex types is not supported\n otherOptions.duplex = 'half'\n }\n // WebSockets are supported, and thus full duplex communication is possible.\n if (isWebsocketSupported && isNode) {\n // @ts-expect-error - Duplex types is not supported\n otherOptions.duplex = 'half'\n }\n\n const requestBody =\n options.body instanceof FormData ? options.body : data ? JSON.stringify(data) : undefined\n\n const requestOptions = {\n method,\n signal: isAbortControllerSupported ? globalThis.abortSignal : null,\n headers: reqHeaders,\n ...otherOptions,\n body: requestBody,\n }\n\n if (requestBody instanceof FormData) {\n requestOptions.headers.delete('Content-Type')\n }\n\n const responsePromise = fetch(urlWithParams, requestOptions)\n\n clearTimeout(timeoutId)\n\n const response = await responsePromise\n\n const contentType = response.headers.get('content-type')\n\n const responseData =\n contentType && contentType.includes('application/json')\n ? await response.json()\n : await response.text()\n\n if (!response.ok) {\n throw createHTTPError(response, responseData)\n }\n\n // Execute post-request hook\n if (hooks?.postRequest) {\n hooks.postRequest(url, options, data, [null, responseData])\n }\n\n return [null, responseData]\n } catch (error) {\n // Execute post-request hook for errors\n if (hooks?.postRequest) {\n if (error instanceof Error) {\n hooks.postRequest(url, options, data, [error, null])\n }\n }\n\n if (error instanceof Error) {\n if (error.name === 'AbortError') {\n console.error('Request aborted:', error)\n } else if (retryOnTimeout && error.name === 'TimeoutError' && retries && retries > 0) {\n const delay =\n jitter && jitterFactor\n ? defaultJitter(jitterFactor)\n : backoff(retries, backoffFactor ? backoffFactor : DEFAULT_BACKOFF_FACTOR)\n if (DEBUG) {\n console.warn(\n `Request timed out. Retrying in ${delay}ms... (Remaining retries: ${retries})`\n )\n }\n // Execute pre-retry hook\n if (hooks?.preRetry) {\n hooks.preRetry(url, options, retries, retries)\n }\n await new Promise((resolve) => setTimeout(resolve, delay))\n const [retryErr, retryData] = await createRequest(\n url,\n { ...options, retries: retries - 1 },\n data\n )\n // Execute post-retry hook\n if (hooks?.postRetry) {\n hooks.postRetry(url, options, data, [retryErr, retryData], retries, retries - 1)\n }\n return [retryErr, retryData]\n } else if (options.retries && options.retries > 0) {\n const delay =\n options.jitter && options.jitterFactor\n ? defaultJitter(options.jitterFactor)\n : backoff(\n options.retries,\n options.backoffFactor ? options.backoffFactor : DEFAULT_BACKOFF_FACTOR\n )\n if (DEBUG) {\n console.warn(\n `Request failed. Retrying in ${delay}ms... (Remaining retries: ${options.retries})`\n )\n }\n // Execute pre-retry hook\n if (hooks?.preRetry) {\n hooks.preRetry(url, options, options.retries, options.retries)\n }\n await new Promise((resolve) => setTimeout(resolve, delay))\n const [retryErr, retryData] = await createRequest(\n url,\n { ...options, retries: options.retries - 1 },\n data\n )\n // Execute post-retry hook\n if (hooks?.postRetry) {\n hooks.postRetry(\n url,\n options,\n data,\n [retryErr, retryData],\n options.retries,\n options.retries - 1\n )\n }\n return [retryErr, retryData]\n }\n }\n\n if (error instanceof Error) {\n return [error, null]\n }\n\n return [null, null]\n }\n}\n","export const appendParams = (url: string, params?: Record): string => {\n if (!params) {\n return url\n }\n\n const urlWithParams = new URL(url)\n Object.entries(params).forEach(([key, value]) =>\n urlWithParams.searchParams.append(key, String(value))\n )\n\n return urlWithParams.toString()\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nexport function createHTTPError(response: Response, responseData: Response) {\n const code = response.status || response.status === 0 ? response.status : ''\n const title = response.statusText || ''\n const status = `${code} ${title}`.trim()\n const reason = status ? `status code ${status}` : 'an unknown error'\n const error = new Error(reason)\n\n error.name = 'HTTPError'\n ;(error as any).response = response\n ;(error as any).data = responseData\n\n return error\n}\n","import type { RequestMethod } from '../types/request.js'\nimport type { InitOptions } from '../types/init.js'\n\nimport { createRequest } from './create-request.js'\n\nexport const httpMethodFunction = (\n url: string,\n method: RequestMethod = 'GET',\n options = {},\n data: unknown,\n initOptions: InitOptions\n) => {\n return createRequest(url, { method, ...options }, data, initOptions)\n}\n","import type { Hooks } from './types/hooks.js'\nimport type { HttpRequestFunctions } from './types/request.js'\n\nimport { getAbortController } from './utils/get-abort-controller.js'\nimport { httpMethodFunction } from './utils/create-http-method.js'\n\nfunction init(baseUrl?: string, hooks?: Hooks, DEBUG: boolean = false): HttpRequestFunctions {\n // Check if fetch is available\n if (typeof fetch === 'undefined') {\n throw new Error('This library is intended for use in the browser environment only.')\n }\n\n const initOptions = {\n baseUrl,\n hooks,\n DEBUG,\n }\n\n return {\n get: (url, options, data) => httpMethodFunction(url, 'GET', options, data, initOptions),\n post: (url, options, data) => httpMethodFunction(url, 'POST', options, data, initOptions),\n put: (url, options, data) => httpMethodFunction(url, 'PUT', options, data, initOptions),\n delete: (url, options, data) => httpMethodFunction(url, 'DELETE', options, data, initOptions),\n patch: (url, options, data) => httpMethodFunction(url, 'PATCH', options, data, initOptions),\n options: (url, options, data) => httpMethodFunction(url, 'OPTIONS', options, data, initOptions),\n getAbortController,\n }\n}\n\nexport default { init }\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","DEFAULT_MAX_TIMEOUT","DEFAULT_BACKOFF_FACTOR","DEFAULT_JITTER_FACTOR","isAbortControllerSupported","globalThis","AbortController","isReadableStreamSupported","ReadableStream","isWriteableStreamSupported","WritableStream","isWebsocketSupported","WebSocket","isWebRTCSupported","RTCPeerConnection","isNode","FormData","process","release","name","getAbortController","abortController","defaultBackoff","retryCount","factor","Math","pow","defaultJitter","random","createRequest","url","options","data","baseUrl","hooks","DEBUG","create","method","retries","backoff","jitter","jitterFactor","backoffFactor","timeout","retryOnTimeout","params","headers","signal","otherOptions","preRequest","fullUrl","reqHeaders","Headers","textEncoder","TextEncoder","set","String","encode","length","includes","JSON","stringify","body","preTimeout","abortSignal","timeoutId","setTimeout","abort","postTimeout","undefined","urlWithParams","URL","entries","forEach","searchParams","append","toString","appendParams","duplex","requestBody","requestOptions","delete","responsePromise","fetch","clearTimeout","response","contentType","responseData","json","text","ok","status","statusText","trim","error","Error","createHTTPError","postRequest","console","delay","warn","preRetry","Promise","resolve","retryErr","retryData","postRetry","httpMethodFunction","initOptions","init","post","put","patch"],"sourceRoot":""} \ No newline at end of file diff --git a/build.ts b/build.ts index 8221b31..18445e8 100644 --- a/build.ts +++ b/build.ts @@ -5,92 +5,76 @@ Copyright (c) 2022 Taishi Naritomi */ -import { exec } from "child_process"; -import fs from "fs"; -import path from "path"; -import arg from "arg"; -import { build } from "esbuild"; -import type { Plugin, PluginBuild, BuildOptions } from "esbuild"; -import glob from "glob"; +import { exec } from 'child_process' +import fs from 'fs' +import path from 'path' +import arg from 'arg' +import { build } from 'esbuild' +import type { Plugin, PluginBuild, BuildOptions } from 'esbuild' +import { glob } from 'glob' const args = arg({ - "--watch": Boolean, -}); + '--watch': Boolean, +}) -const isWatch = args["--watch"] || false; +const isWatch = args['--watch'] || false -const entryPoints = glob.sync("./src/**/*.ts", { - ignore: [ - "./src/**/*.test.ts", - "./src/mod.ts", - "./src/middleware.ts", - "./src/deno/**/*.ts", - ], -}); +const entryPoints = glob.sync('./src/**/*.ts', { + ignore: ['./src/**/*.test.ts', './src/mod.ts', './src/deno/**/*.ts'], +}) /* This plugin is inspired by the following. https://github.com/evanw/esbuild/issues/622#issuecomment-769462611 */ -const addExtension = ( - extension: string = ".js", - fileExtension: string = ".ts" -): Plugin => ({ - name: "add-extension", +const addExtension = (extension: string = '.js', fileExtension: string = '.ts'): Plugin => ({ + name: 'add-extension', setup(build: PluginBuild) { build.onResolve({ filter: /.*/ }, (args) => { if (args.importer) { - const p = path.join(args.resolveDir, args.path); - let tsPath = `${p}${fileExtension}`; + const p = path.join(args.resolveDir, args.path) + let tsPath = `${p}${fileExtension}` - let importPath = ""; + let importPath = '' if (fs.existsSync(tsPath)) { - importPath = args.path + extension; + importPath = args.path + extension } else { - tsPath = path.join( - args.resolveDir, - args.path, - `index${fileExtension}` - ); + tsPath = path.join(args.resolveDir, args.path, `index${fileExtension}`) if (fs.existsSync(tsPath)) { - importPath = `${args.path}/index${extension}`; + importPath = `${args.path}/index${extension}` } } - return { path: importPath, external: true }; + return { path: importPath, external: true } } - }); + }) }, -}); +}) const commonOptions: BuildOptions = { watch: isWatch, entryPoints, - logLevel: "info", - platform: "node", -}; + logLevel: 'info', + platform: 'node', +} const cjsBuild = () => build({ ...commonOptions, - outbase: "./src", - outdir: "./dist/cjs", - format: "cjs", - }); + outbase: './src', + outdir: './dist/cjs', + format: 'cjs', + }) const esmBuild = () => build({ ...commonOptions, bundle: true, - outbase: "./src", - outdir: "./dist", - format: "esm", - plugins: [addExtension(".js")], - }); + outbase: './src', + outdir: './dist', + format: 'esm', + plugins: [addExtension('.js')], + }) -Promise.all([esmBuild(), cjsBuild()]); +Promise.all([esmBuild(), cjsBuild()]) -exec( - `tsc ${ - isWatch ? "-w" : "" - } --emitDeclarationOnly --declaration --project tsconfig.build.json` -); +exec(`tsc ${isWatch ? '-w' : ''} --emitDeclarationOnly --declaration --project tsconfig.build.json`) diff --git a/bun.lockb b/bun.lockb index aa8c755..8d1cffa 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index a103539..ef804ce 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,10 @@ "version": "0.1.0", "description": "Supertiny (4kB minified & 0 dependencies) and strong-typed HTTP client for Deno, Bun, Node.js, Cloudflare Workers and Browsers.", "main": "./dist/index.js", - "repository": "fzn0x/hypf", + "repository": { + "type": "git", + "url": "https://github.com/fzn0x/hypf.git" + }, "type": "module", "files": [ "dist" @@ -69,12 +72,17 @@ "data-retrieval" ], "license": "MIT", + "publishConfig": { + "registry": "https://registry.npmjs.org" + }, "devDependencies": { "@hono/eslint-config": "^0.0.6", "@types/node": "^20.11.26", "arg": "^5.0.2", "esbuild": "^0.15.12", + "esbuild-register": "^3.5.0", "eslint": "8.55.0", + "glob": "^10.4.1", "prettier": "^3.3.2", "rimraf": "^5.0.5", "ts-loader": "^9.5.1", diff --git a/yarn.lock b/yarn.lock index 684de5a..166a64d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1,6 +1,6 @@ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 -# bun ./bun.lockb --hash: 6234A78B511F5B19-ad96a3354cb89bdb-7C67F0662DC70DB6-2b96fa65a6996414 +# bun ./bun.lockb --hash: 7F993CDF47004981-e5cf8c7e206dc094-D45253AFE7E2C313-dd3310c26dc4927c "@discoveryjs/json-ext@^0.5.0": @@ -1302,7 +1302,7 @@ esbuild@^0.15.12: "@esbuild/linux-loong64" "0.15.18" esbuild-linux-mips64le "0.15.18" -esbuild@^0.21.3, esbuild@~0.21.4: +"esbuild@>=0.12 <1", esbuild@^0.21.3, esbuild@~0.21.4: version "0.21.5" resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz" integrity sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw== @@ -1411,6 +1411,13 @@ esbuild-openbsd-64@0.15.18: resolved "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.18.tgz" integrity sha512-yK5NCcH31Uae076AyQAXeJzt/vxIo9+omZRKj1pauhk3ITuADzuOx5N2fdHrAKPxN+zH3w96uFKlY7yIn490xQ== +esbuild-register@^3.5.0: + version "3.5.0" + resolved "https://registry.npmjs.org/esbuild-register/-/esbuild-register-3.5.0.tgz" + integrity sha512-+4G/XmakeBAsvJuDugJvtyF1x+XJT4FMocynNpxrvEBViirpfUn2PgNpCHedfWhF4WokNsO/OvMKrmJOIJsI5A== + dependencies: + debug "^4.3.4" + esbuild-sunos-64@0.15.18: version "0.15.18" resolved "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.18.tgz" @@ -1923,7 +1930,7 @@ glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^10.3.7: +glob@^10.3.7, glob@^10.4.1: version "10.4.1" resolved "https://registry.npmjs.org/glob/-/glob-10.4.1.tgz" integrity sha512-2jelhlq3E4ho74ZyVLN03oKdAZVUa6UDZzFLVH1H7dnoax+y9qyaq8zBkfDIggjniU19z0wU18y16jMB2eyVIw==