vue-use-async 1.1.14 → 1.1.18

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.d.ts CHANGED
@@ -32,13 +32,13 @@ export declare type XhrConfig = Partial<{
32
32
  responseType?: 'arraybuffer' | 'blob';
33
33
  }>;
34
34
  export declare type $GetConfigArgs = (Omit<XhrConfig, 'url'> & Partial<{
35
- cacheDuration?: CacheDuration;
35
+ cacheDuration: CacheDuration;
36
36
  url: string | ((params: Obj) => string) | ComputedRef<string>;
37
- params?: Obj | ComputedRef<Obj>;
38
- enabled?: undefined | null | (() => boolean) | boolean | ComputedRef<boolean> | Ref<boolean>;
37
+ params: Obj | ComputedRef<Obj>;
38
+ enabled: undefined | null | (() => boolean) | boolean | ComputedRef<boolean> | Ref<boolean>;
39
39
  }>);
40
40
  export declare type $GetConfig = string | $GetConfigArgs;
41
- export declare type GetConfig = $GetConfig | Ref<$GetConfig> | ComputedRef<$GetConfig>;
41
+ export declare type GetConfig = $GetConfig | Ref<$GetConfig>;
42
42
  export declare type GetReturn<T> = {
43
43
  isPending: ComputedRef<undefined | boolean>;
44
44
  data: Ref<T>;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("vue"));else if("function"==typeof define&&define.amd)define(["vue"],t);else{var n="object"==typeof exports?t(require("vue")):t(e.vue);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,(function(e){return(()=>{"use strict";var t={103:t=>{t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{r.r(o),r.d(o,{Deferred:()=>a,Xhr:()=>m,cache:()=>t,cacheSize:()=>n,clearCache:()=>i,useAsync:()=>f,useMutation:()=>d,useResult:()=>h,useSpinner:()=>S,useXhr:()=>R});var e=new Map;function t(t){var n,r,o=t||{},i=o.id,u=o.xhr,a="string"!=typeof t.duration&&t.duration||200;if("max"===t.duration&&(a=36e5),!e.get(i)&&u?(n=u(),e.set(i,n),n.then((function(t){return"[Log] add cache: ".concat(i),clearTimeout(r),r=setTimeout((function(){e.delete(i),"[Log] delete cache: ".concat(i),clearTimeout(r)}),a),t}),(function(){return e.delete(i),void"[Log] delete cache: ".concat(i)}))):i&&(n=e.get(i)),n)return n;throw Error("Call to undefined cache")}function n(){return e.size}function i(t){t?e.delete(t):e.forEach((function(e,t,n){n.delete(t)}))}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,"resolve",void 0),u(this,"reject",void 0),u(this,"promise",void 0),this.resolve=function(){throw Error("Can t resolve")},this.reject=function(){throw Error("Can t reject")},this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))},s=r(103);function c(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,s.ref)(!0),r=(0,s.ref)(),o=(0,s.ref)(),i=(0,s.ref)(null),u=[],l=[],f=[],d=(0,s.ref)(new a),h=(0,s.computed)((function(){return"function"==typeof t?t():(0,s.unref)(t)})),v=(0,s.computed)((function(){return"function"==typeof n?n():(0,s.unref)(n)})),p=function(t){l.forEach((function(e){return e(h.value)})),d.value=new a,r.value=!0,i.value=null;var n=e,s=e,v=Array.isArray(t)?s.apply(void 0,c(t)):n(t);v.then((function(e){o.value=e,d.value.resolve(e),f.forEach((function(t){return t(e,h.value)}))}),(function(e){i.value=e||null,u.forEach((function(e){return e(i.value,h.value)})),d.value.reject(e),i.value=e})),v.finally((function(){r.value=!1}))};return(0,s.watch)((function(){return v.value}),(function(e){!r.value&&e&&p(h.value)}),{immediate:!1}),(0,s.watch)((function(){return h.value}),(function(e,t){!r.value&&(v.value&&JSON.stringify(e)!==JSON.stringify(t)||void 0===e&&void 0===t)&&p(e)}),{immediate:v.value,deep:!0}),{isPending:r,data:o,error:i,reload:function(){return p(h.value)},onError:function(e){return u.push(e)},onStart:function(e){return l.push(e)},onEnd:function(e){return f.push(e)},promise:(0,s.computed)((function(){return d.value.promise}))}}function d(e){var t=(0,s.ref)(),n=(0,s.ref)(),r=(0,s.ref)(),o=[],i=[],u=(0,s.ref)(new a);return{mutate:function(s){for(var c=arguments.length,l=new Array(c>1?c-1:0),f=1;f<c;f++)l[f-1]=arguments[f];u.value=new a,t.value=!0,r.value=null;var d=e,h=d.apply(void 0,[s].concat(l));return h.then((function(e){n.value=e,u.value.resolve(e),i.forEach((function(e){return e(n.value,l.length?[s].concat(l):s)}))}),(function(e){r.value=e||null,o.forEach((function(e){return e(r.value)})),u.value.reject(e),r.value=e})),h.finally((function(){t.value=!1})),h},onError:function(e){return o.push(e)},onEnd:function(e){return i.push(e)},isPending:t,error:r,data:n,promise:(0,s.computed)((function(){return u.value.promise}))}}function h(e,t,n){var r=(0,s.ref)(t);return n||(n=function(e){return e}),t&&(r.value=n(t)),(0,s.watchEffect)((function(){if(e){var t,o=(0,s.unref)(e);o&&(r.value=null===(t=n)||void 0===t?void 0:t(o))}})),r}function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var m=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),y(this,"onError",(function(){})),y(this,"onStart",(function(){})),y(this,"onAbort",(function(){})),y(this,"onProgress",(function(){})),y(this,"onEnd",(function(){})),y(this,"token",null),y(this,"url",""),y(this,"params",{}),y(this,"sendAs","json"),y(this,"timeout",1e4),y(this,"port",80),y(this,"responseType","text"),y(this,"isPending",!1),y(this,"_eventsReady",void 0),y(this,"_oXHR",void 0),y(this,"_onEnd",void 0),y(this,"_deferred",void 0),y(this,"_isXhrResolved",void 0),y(this,"_isXhrRejected",void 0),y(this,"_eventReady",void 0),this._eventsReady=!1,this._constructor(t||{},n)}var t,n,r;return t=e,r=[{key:"parseResult",value:function(e){var t=e.response;try{var n=e.getResponseHeader("Content-Type");n&&n.toLowerCase().indexOf("json")>-1&&(t=JSON.parse(e.response))}catch(n){t=e.response}return t}},{key:"onBeforeSend",value:function(t){e.onBeforeSendList.push(t)}},{key:"new",value:function(t){return new e(t)}},{key:"stringifyUrl",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e._injectParamsInUrl(t,n);t=r.url,n=r.params;var o=t.indexOf("?")>-1?"&":"?",i="";return Object.keys(n).filter((function(e){return void 0!==n[e]})).forEach((function(e){i+="".concat(o+e,"=").concat(encodeURIComponent(JSON.stringify(n[e]))),o="&"})),(t=t.replace(/\/:[^/]*/gi,""))+i}},{key:"getFormData",value:function(e){var t,n=new FormData;return Object.keys(e).forEach((function(r){if(e[r]instanceof FileList)for(var o=0;o<e[r].length;o+=1)n.append(r,e[r][o]);else e[r]instanceof File?n.append(r,e[r]):("object"!==v(t=e[r])&&!Array.isArray(t)||null===t||(t=JSON.stringify(t)),n.append(r,t))})),n}},{key:"_injectParamsInUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object.getOwnPropertyNames(t).filter((function(e){return!e.match(/__[a-zA-Z0-9_]+__/gi)})).reduce((function(e,n){return e[n]=t[n],e}),{});return((e=e.replace(/#/,"%23")).match(/:[a-z0-9]+/gi)||[]).forEach((function(t){t=t.substr(1,t.length),void 0!==n[t]&&(e=e.replace(":".concat(t),null===n[t]||""===n[t]?"null":n[t]),delete n[t])})),{url:e,params:n}}}],(n=[{key:"_onError",value:function(e){this.onError(e),this._deferred.reject(e)}},{key:"_getUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.onBeforeSendList.reduce((function(e,t){return t(e||{})}),t);return e.stringifyUrl(this.url,n)}},{key:"removeEvents",value:function(){var e=this,t=function(){e._oXHR.removeEventListener("load",e._onEnd,!1),e._oXHR.removeEventListener("error",e.onError,!1),e._oXHR.removeEventListener("loadstart",e.onStart,!1),e._oXHR.removeEventListener("abort",e.onAbort,!1),e._oXHR.upload.removeEventListener("progress",e.onProgress,!1),e._oXHR.removeEventListener("progress",e.onProgress,!1),e._oXHR.removeEventListener("timeout",e.onError,!1)};this._deferred.promise.then(t,t)}},{key:"post",value:function(e){return this._constructor(e),this._oXHR.open("POST",this._getUrl(),!0),this._send(),this._deferred.promise}},{key:"put",value:function(e){return this._constructor(e),this._oXHR.open("PUT",this._getUrl(),!0),this._send(),this._deferred.promise}},{key:"get",value:function(e){this._constructor(e||{}),this._oXHR.open("GET",this._getUrl("multipart"===this.sendAs?{}:this.params),!0),this._send();var t=this._deferred.promise;return t.abortXhr=this.abort.bind(this),t}},{key:"delete",value:function(e){return this._constructor(e),this._oXHR.open("DELETE",this._getUrl(this.params),!0),this._send(),this._deferred.promise}},{key:"abort",value:function(){return this._isXhrResolved&&!this._isXhrRejected||(this._oXHR.abort(null,this),this._isXhrRejected=!0,this._deferred.reject({error:"Xhr aborted: ".concat(this.url),code:"HTTP-ABORTED"})),this._deferred.promise}},{key:"resolve",value:function(e){return this._deferred.resolve(e),this._deferred.promise}},{key:"reject",value:function(e){return this._deferred.reject(e),this._deferred.promise}},{key:"_setEvents",value:function(e){this._eventsReady||(this._eventReady=!0,e.addEventListener("load",this._onEnd,!1),e.addEventListener("error",this.onError,!1),e.addEventListener("loadstart",this.onStart,!1),e.addEventListener("abort",this.onAbort,!1),e.upload.addEventListener("progress",this.onProgress,!1),e.addEventListener("progress",this.onProgress,!1),e.addEventListener("timeout",this.onError,!1))}},{key:"_send",value:function(){var t;this.isPending=!0,"multipart"===this.sendAs?t=e.getFormData(this.params):"json"===this.sendAs&&(this._oXHR.setRequestHeader("content-type","application/json; charset=utf-8"),t=JSON.stringify(this.params)),this.token&&this._oXHR.setRequestHeader("Authorization","Bearer ".concat(this.token)),this._oXHR.send(t,this)}},{key:"_constructor",value:function(t,n){var r=this;t&&"object"===v(t)?(this.sendAs=t.sendAs||this.sendAs,this.url=t.url||this.url,this.port=t.port||this.port,this.params=t.params||this.params,this.timeout=t.timeout||this.timeout,this.responseType=t.responseType||this.responseType,this.onProgress=(t.onProgress||this.onProgress).bind(this),this.onStart=(t.onStart||this.onStart).bind(this),this.onAbort=(t.onAbort||this.onAbort).bind(this),this.onEnd=(t.onEnd||this.onEnd).bind(this),this.onError=(t.onError||this.onError).bind(this),this.token=t.token||this.token):t&&"string"==typeof t&&(this.url=t,this.params=n||this.params),80!==this.port&&(this.url="".concat(window.location.protocol,"//").concat(window.location.hostname,":").concat(this.port).concat(this.url)),this._deferred=new a,this._deferred.promise.finally((function(){r.isPending=!1})),this._oXHR=new XMLHttpRequest,this._oXHR.timeout=this.timeout,this._oXHR.responseType=this.responseType,this._isXhrResolved=!1,this._isXhrRejected=!1;var o=e._injectParamsInUrl(this.url,this.params);this.url=o.url,this.params=o.params,this._onEnd=function(t){var n=e.parseResult(r._oXHR);return r._oXHR.status>=400?(r._isXhrRejected=!0,r._onError(n),r._deferred.reject(n)):(r.onEnd(n,t),r._isXhrResolved=!0,r.removeEvents(),r.resolve(n))},this._setEvents(this._oXHR)}}])&&p(t.prototype,n),r&&p(t,r),e}();function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){E(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}y(m,"onBeforeSendList",[]);var j=function(){},w=function(e){return(0,s.isRef)(e)?e.value:e};function R(e){var n=e||{onError:function(){},onStart:function(){},onEnd:function(){},context:null,legacy:!1,token:null},r=n.onError,o=n.onStart,u=n.onEnd,a=n.context,c=n.legacy,l=n.token,d=void 0===l?null:l,h=function(e){var t=w(d);return t?((0,s.isRef)(e)?e.value.token=t:e.token=t,e):e},v=(0,s.ref)([]);return c||(0,s.onBeforeUnmount)((function(){v.value.forEach((function(e){e.isPending&&e.abort()}))})),{get:function(e,n,c){var l=new m,f=(r||j).bind(a),h=(o||j).bind(a),p=(u||j).bind(a),y=[f],_=[h],E=[p],R=(0,s.ref)(null);v.value.push(l);var S,O,P=(0,s.ref)(),X=(0,s.ref)(),k="",A=0,H=(0,s.computed)((function(){var t,r={},o=(0,s.unref)(e);"string"==typeof o?t=o:(t=o.url,n||(n=o.params||{}),A=o.cacheDuration,void 0!==o.enabled&&(r.enabled=o.enabled),void 0===r.enabled&&(r.enabled=c),r.params=n,r.cacheDuration=A),d&&(r.token=w(d));var i=(0,s.unref)(r.params||n||{});return"function"==typeof i&&(i=i()),r.params=g(g({},i),(0,s.isRef)(n)?n.value||{}:n),k="function"==typeof t?t(r.params):(0,s.unref)(t),r.url=k,r})),L=void 0!==H.value.enabled?H.value.enabled:c;S=void 0===L?(0,s.ref)(!0):(0,s.isRef)(L)?L:"function"==typeof L?(0,s.ref)(L()):(0,s.ref)(!0===L);var T=(0,s.ref)(),x=function(){P.value&&l.abort();var e="object"===b(H.value.params)?H.value.params:{};_.forEach((function(t){return t(e,l)})),P.value=!0,R.value=null,O&&i(O),O=decodeURIComponent(m.stringifyUrl(String(k),e)),T.value=t({id:O,xhr:l.get.bind(l,H.value),duration:A}),T.value.then((function(e){X.value=e}),(function(e){y.forEach((function(t){return t(e,l)})),R.value=e})),T.value.finally((function(){var t;(t=v.value.indexOf(l))>-1&&v.value.splice(t,1),P.value=!1,E.forEach((function(t){return t(X.value,e,l)}))}))};return(0,s.watch)((function(){return H.value}),(function(){S.value&&x()}),{immediate:S.value}),(0,s.watch)((function(){return S.value}),(function(e){!P.value&&e&&x()}),{immediate:!1}),{isPending:(0,s.computed)((function(){return P.value})),data:X,onError:function(e){return y.push(e)},onStart:function(e){return _.push(e)},onEnd:function(e){return E.push(e)},error:R,abort:function(){var e;return null===(e=T.value)||void 0===e?void 0:e.abortXhr()},promise:(0,s.computed)((function(){return T.value||new Promise((function(){}))})),reload:x,xhr:l}},post:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new m;return g(g({},f((function(){return n.post(e||{})}),h(t))),{},{xhr:n})},put:function(e,t){var n=new m;return g(g({},f((function(){return n.put(e||{})}),h(t||{}))),{},{xhr:n})},delete:function(e,t){var n=new m;return g(g({},f((function(){return n.delete(e||{})}),h(t||{}))),{},{xhr:n})}}}function S(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400,r=(0,s.ref)(!1);return(0,s.watch)((function(){return e.value}),(function(){r.value&&!e.value?(t&&clearTimeout(t),t=setTimeout((function(){r.value=!0===e.value}),n)):r.value=!0===e.value}),{immediate:!0}),(0,s.computed)((function(){return r.value}))}})(),o})()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("vue"));else if("function"==typeof define&&define.amd)define(["vue"],t);else{var n="object"==typeof exports?t(require("vue")):t(e.vue);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,(function(e){return(()=>{"use strict";var t={748:t=>{t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{r.r(o),r.d(o,{Deferred:()=>a,Xhr:()=>m,cache:()=>t,cacheSize:()=>n,clearCache:()=>i,useAsync:()=>f,useMutation:()=>v,useResult:()=>d,useSpinner:()=>S,useXhr:()=>w});var e=new Map;function t(t){var n,r,o=t||{},i=o.id,u=o.xhr,a="string"!=typeof t.duration&&t.duration||200;if("max"===t.duration&&(a=36e5),!e.get(i)&&u?(n=u(),e.set(i,n),n.then((function(t){return"[Log] add cache: ".concat(i),clearTimeout(r),r=window.setTimeout((function(){e.delete(i),"[Log] delete cache: ".concat(i),clearTimeout(r)}),a),t}),(function(){return e.delete(i),void"[Log] delete cache: ".concat(i)}))):i&&(n=e.get(i)),n)return n;throw Error("Call to undefined cache")}function n(){return e.size}function i(t){t?e.delete(t):e.forEach((function(e,t,n){n.delete(t)}))}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,"resolve",void 0),u(this,"reject",void 0),u(this,"promise",void 0),this.resolve=function(){throw Error("Can t resolve")},this.reject=function(){throw Error("Can t reject")},this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))},s=r(748);function c(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,s.ref)(!0),r=(0,s.ref)(),o=(0,s.ref)(),i=(0,s.ref)(null),u=[],a=[],l=[],f=(0,s.ref)(null),v=(0,s.computed)((function(){return"function"==typeof t?t():(0,s.unref)(t)})),d=(0,s.ref)(),h=(0,s.computed)((function(){return"function"==typeof n?n():(0,s.unref)(n)})),p=function(t){a.forEach((function(e){return e(v.value)})),r.value=!0,i.value=null;var n=e,s=e;return f.value=Array.isArray(t)?s.apply(void 0,c(t)):n(t),f.value.catch((function(e){i.value=e||null,u.forEach((function(e){return e(i.value,v.value)})),i.value=e})),f.value.then((function(e){o.value=e,l.forEach((function(t){return t(e,v.value)}))})),f.value.finally((function(){r.value=!1})),f.value};return(0,s.watch)((function(){return h.value}),(function(e){!r.value&&e&&p(v.value)}),{immediate:!1}),(0,s.watch)((function(){return v.value}),(function(e){var t=JSON.stringify(e);!r.value&&(void 0===e&&void 0===d.value||h.value&&t!==JSON.stringify(d.value))&&p(e),d.value=void 0===t?void 0:JSON.parse(t)}),{immediate:h.value,deep:!0}),{isPending:r,data:o,error:i,reload:function(){return p(v.value)},onError:function(e){return u.push(e)},onStart:function(e){return a.push(e)},onEnd:function(e){return l.push(e)},promise:(0,s.computed)((function(){return f.value}))}}function v(e){var t=(0,s.ref)(),n=(0,s.ref)(),r=(0,s.ref)(),o=[],i=[],u=(0,s.ref)(null);return{mutate:function(a){for(var s=arguments.length,c=new Array(s>1?s-1:0),l=1;l<s;l++)c[l-1]=arguments[l];t.value=!0,r.value=null;var f=e;return u.value=f.apply(void 0,[a].concat(c)),u.value.then((function(e){n.value=e,i.forEach((function(e){return e(n.value,c.length?[a].concat(c):a)}))}),(function(e){r.value=e||null,o.forEach((function(e){return e(r.value,c.length?[a].concat(c):a)})),r.value=e})),u.value.finally((function(){t.value=!1})),u.value},onError:function(e){return o.push(e)},onEnd:function(e){return i.push(e)},isPending:t,error:r,data:n,promise:(0,s.computed)((function(){return u.value}))}}function d(e,t,n){var r=(0,s.ref)(t);return n||(n=function(e){return e}),t&&(r.value=n(t)),(0,s.watchEffect)((function(){if(e){var t,o=(0,s.unref)(e);o&&(r.value=null===(t=n)||void 0===t?void 0:t(o))}})),r}function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var m=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),y(this,"onError",(function(){})),y(this,"onStart",(function(){})),y(this,"onAbort",(function(){})),y(this,"onProgress",(function(){})),y(this,"onEnd",(function(){})),y(this,"token",null),y(this,"url",""),y(this,"params",{}),y(this,"sendAs","json"),y(this,"timeout",1e4),y(this,"port",80),y(this,"responseType","text"),y(this,"isPending",!1),y(this,"_eventsReady",void 0),y(this,"_oXHR",void 0),y(this,"_onEnd",void 0),y(this,"_deferred",void 0),y(this,"_isXhrResolved",void 0),y(this,"_isXhrRejected",void 0),y(this,"_eventReady",void 0),this._eventsReady=!1,this._constructor(t||{},n)}var t,n,r;return t=e,n=[{key:"_onError",value:function(e){this.onError(e),this._deferred.reject(e)}},{key:"_getUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.onBeforeSendList.reduce((function(e,t){return t(e||{})}),t);return e.stringifyUrl(this.url,n)}},{key:"removeEvents",value:function(){var e=this,t=function(){e._oXHR.removeEventListener("load",e._onEnd,!1),e._oXHR.removeEventListener("error",e.onError,!1),e._oXHR.removeEventListener("loadstart",e.onStart,!1),e._oXHR.removeEventListener("abort",e.onAbort,!1),e._oXHR.upload.removeEventListener("progress",e.onProgress,!1),e._oXHR.removeEventListener("progress",e.onProgress,!1),e._oXHR.removeEventListener("timeout",e.onError,!1)};this._deferred.promise.then(t,t)}},{key:"post",value:function(e){return this._constructor(e),this._oXHR.open("POST",this._getUrl(),!0),this._send(),this._deferred.promise}},{key:"put",value:function(e){return this._constructor(e),this._oXHR.open("PUT",this._getUrl(),!0),this._send(),this._deferred.promise}},{key:"get",value:function(e){this._constructor(e||{}),this._oXHR.open("GET",this._getUrl("multipart"===this.sendAs?{}:this.params),!0),this._send();var t=this._deferred.promise;return t.abortXhr=this.abort.bind(this),t}},{key:"delete",value:function(e){return this._constructor(e),this._oXHR.open("DELETE",this._getUrl(this.params),!0),this._send(),this._deferred.promise}},{key:"abort",value:function(){return this._isXhrResolved&&!this._isXhrRejected||(this._oXHR.abort(null,this),this._isXhrRejected=!0,this._deferred.reject({error:"Xhr aborted: ".concat(this.url),code:"HTTP-ABORTED"})),this._deferred.promise}},{key:"resolve",value:function(e){return this._deferred.resolve(e),this._deferred.promise}},{key:"reject",value:function(e){return this._deferred.reject(e),this._deferred.promise}},{key:"_setEvents",value:function(e){this._eventsReady||(this._eventReady=!0,e.addEventListener("load",this._onEnd,!1),e.addEventListener("error",this.onError,!1),e.addEventListener("loadstart",this.onStart,!1),e.addEventListener("abort",this.onAbort,!1),e.upload.addEventListener("progress",this.onProgress,!1),e.addEventListener("progress",this.onProgress,!1),e.addEventListener("timeout",this.onError,!1))}},{key:"_send",value:function(){var t;this.isPending=!0,"multipart"===this.sendAs?t=e.getFormData(this.params):"json"===this.sendAs&&(this._oXHR.setRequestHeader("content-type","application/json; charset=utf-8"),t=JSON.stringify(this.params)),this.token&&this._oXHR.setRequestHeader("Authorization","Bearer ".concat(this.token)),this._oXHR.send(t,this)}},{key:"_constructor",value:function(t,n){var r=this;t&&"object"===h(t)?(this.sendAs=t.sendAs||this.sendAs,this.url=t.url||this.url,this.port=t.port||this.port,this.params=t.params||this.params,this.timeout=t.timeout||this.timeout,this.responseType=t.responseType||this.responseType,this.onProgress=(t.onProgress||this.onProgress).bind(this),this.onStart=(t.onStart||this.onStart).bind(this),this.onAbort=(t.onAbort||this.onAbort).bind(this),this.onEnd=(t.onEnd||this.onEnd).bind(this),this.onError=(t.onError||this.onError).bind(this),this.token=t.token||this.token):t&&"string"==typeof t&&(this.url=t,this.params=n||this.params),80!==this.port&&(this.url="".concat(window.location.protocol,"//").concat(window.location.hostname,":").concat(this.port).concat(this.url)),this._deferred=new a,this._deferred.promise.finally((function(){r.isPending=!1})),this._oXHR=new XMLHttpRequest,this._oXHR.timeout=this.timeout,this._oXHR.responseType=this.responseType,this._isXhrResolved=!1,this._isXhrRejected=!1;var o=e._injectParamsInUrl(this.url,this.params);this.url=o.url,this.params=o.params,this._onEnd=function(t){var n=e.parseResult(r._oXHR);return r._oXHR.status>=400?(r._isXhrRejected=!0,r._onError(n),r._deferred.reject(n)):(r.onEnd(n,t),r._isXhrResolved=!0,r.removeEvents(),r.resolve(n))},this._setEvents(this._oXHR)}}],r=[{key:"parseResult",value:function(e){var t=e.response;try{var n=e.getResponseHeader("Content-Type");n&&n.toLowerCase().indexOf("json")>-1&&(t=JSON.parse(e.response))}catch(n){t=e.response}return t}},{key:"onBeforeSend",value:function(t){e.onBeforeSendList.push(t)}},{key:"new",value:function(t){return new e(t)}},{key:"stringifyUrl",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e._injectParamsInUrl(t,n);t=r.url,n=r.params;var o=t.indexOf("?")>-1?"&":"?",i="";return Object.keys(n).filter((function(e){return void 0!==n[e]})).forEach((function(e){i+="".concat(o+e,"=").concat(encodeURIComponent(JSON.stringify(n[e]))),o="&"})),(t=t.replace(/\/:[^/]*/gi,""))+i}},{key:"getFormData",value:function(e){var t,n=new FormData;return Object.keys(e).forEach((function(r){if(e[r]instanceof FileList)for(var o=0;o<e[r].length;o+=1)n.append(r,e[r][o]);else e[r]instanceof File?n.append(r,e[r]):("object"!==h(t=e[r])&&!Array.isArray(t)||null===t||(t=JSON.stringify(t)),n.append(r,t))})),n}},{key:"_injectParamsInUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object.getOwnPropertyNames(t).filter((function(e){return!e.match(/__[a-zA-Z0-9_]+__/gi)})).reduce((function(e,n){return e[n]=t[n],e}),{});return((e=e.replace(/#/,"%23")).match(/:[a-z0-9]+/gi)||[]).forEach((function(t){t=t.substr(1,t.length),void 0!==n[t]&&(e=e.replace(":".concat(t),null===n[t]||""===n[t]?"null":n[t]),delete n[t])})),{url:e,params:n}}}],n&&p(t.prototype,n),r&&p(t,r),e}();function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function g(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?g(Object(n),!0).forEach((function(t){E(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}y(m,"onBeforeSendList",[]);var j=function(){},R=function(e){return(0,s.isRef)(e)?e.value:e};function w(e){var n=e||{onError:function(){},onStart:function(){},onEnd:function(){},context:null,legacy:!1,token:null},r=n.onError,o=n.onStart,u=n.onEnd,a=n.context,c=n.legacy,l=n.token,v=void 0===l?null:l,d=function(e){var t=R(v);return t?((0,s.isRef)(e)?e.value.token=t:e.token=t,e):e},h=(0,s.ref)([]);return c||(0,s.onBeforeUnmount)((function(){h.value.forEach((function(e){e.isPending&&e.abort()}))})),{get:function(e,n,c){var l=new m,f=(r||j).bind(a),d=(o||j).bind(a),p=(u||j).bind(a),y=[f],g=[d],E=[p],w=(0,s.ref)(null);h.value.push(l);var S,O,P=(0,s.ref)(),X=(0,s.ref)(),k="",A=0,H=(0,s.computed)((function(){var t,r={},o=(0,s.unref)(e);"string"==typeof o?t=o:(t=o.url,n||(n=o.params||{}),A=o.cacheDuration,void 0!==o.enabled&&(r.enabled=o.enabled),void 0===r.enabled&&(r.enabled=c),r.params=n,r.cacheDuration=A),v&&(r.token=R(v));var i=(0,s.unref)(r.params||n||{});return"function"==typeof i&&(i=i()),r.params=_(_({},i),(0,s.isRef)(n)?n.value||{}:n),k="function"==typeof t?t(r.params):(0,s.unref)(t),r.url=k,r})),L=void 0!==H.value.enabled?H.value.enabled:c;S=void 0===L?(0,s.ref)(!0):(0,s.isRef)(L)?L:"function"==typeof L?(0,s.ref)(L()):(0,s.ref)(!0===L);var T=(0,s.ref)(),x=function(){P.value&&l.abort();var e="object"===b(H.value.params)?H.value.params:{};g.forEach((function(t){return t(e,l)})),P.value=!0,w.value=null,O&&i(O),O=decodeURIComponent(m.stringifyUrl(String(k),e)),T.value=t({id:O,xhr:l.get.bind(l,H.value),duration:A}),T.value.then((function(e){X.value=e}),(function(e){y.forEach((function(t){return t(e,l)})),w.value=e})),T.value.finally((function(){var t;(t=h.value.indexOf(l))>-1&&h.value.splice(t,1),P.value=!1,E.forEach((function(t){return t(X.value,e,l)}))}))};return(0,s.watch)((function(){return H.value}),(function(){S.value&&x()}),{immediate:S.value}),(0,s.watch)((function(){return S.value}),(function(e){!P.value&&e&&x()}),{immediate:!1}),{isPending:(0,s.computed)((function(){return P.value})),data:X,onError:function(e){return y.push(e)},onStart:function(e){return g.push(e)},onEnd:function(e){return E.push(e)},error:w,abort:function(){var e;return null===(e=T.value)||void 0===e?void 0:e.abortXhr()},promise:(0,s.computed)((function(){return T.value||new Promise((function(){}))})),reload:x,xhr:l}},post:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new m;return _(_({},f((function(){return n.post(e||{})}),d(t))),{},{xhr:n})},put:function(e,t){var n=new m;return _(_({},f((function(){return n.put(e||{})}),d(t||{}))),{},{xhr:n})},delete:function(e,t){var n=new m;return _(_({},f((function(){return n.delete(e||{})}),d(t||{}))),{},{xhr:n})}}}function S(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400,r=(0,s.ref)(!1);return(0,s.watch)((function(){return e.value}),(function(){r.value&&!e.value?(t&&clearTimeout(t),t=setTimeout((function(){r.value=!0===e.value}),n)):r.value=!0===e.value}),{immediate:!0}),(0,s.computed)((function(){return r.value}))}})(),o})()}));
@@ -8,13 +8,13 @@ declare type Params<Z, A extends unknown[]> = (() => (Z | [...A])) | ComputedRef
8
8
  ];
9
9
  declare type TypeAllowed = undefined | null | string | number | Obj;
10
10
  export default function useAsync<T, Z extends TypeAllowed, A extends TypeAllowed[]>(func: ((...args: A) => Promise<T>) | ((args: Z) => Promise<T>), params?: Params<Z, A>, enabled?: Ref<boolean> | (() => boolean)): {
11
- onError: (cb: OnErrorCb) => any;
12
- onStart: (cb: OnStartCb) => any;
13
- onEnd: (cb: OnEndCb<UnwrappedPromiseType<typeof func>>) => any;
14
11
  isPending: Ref<undefined | boolean>;
15
- error: Ref<null | Error>;
16
12
  data: Ref<undefined | null | UnwrappedPromiseType<typeof func>>;
13
+ error: Ref<null | Error>;
17
14
  reload: () => any;
18
- promise: ComputedRef<ReturnType<typeof func>>;
15
+ onError: (cb: OnErrorCb) => any;
16
+ onStart: (cb: OnStartCb) => any;
17
+ onEnd: (cb: OnEndCb<UnwrappedPromiseType<typeof func>>) => any;
18
+ promise: ComputedRef<null | ReturnType<typeof func>>;
19
19
  };
20
20
  export {};
@@ -1,15 +1,15 @@
1
1
  import { ComputedRef, Ref } from 'vue';
2
2
  import type { Obj, UnwrappedPromiseType } from './index';
3
3
  declare type TypeAllowed = undefined | boolean | null | string | number | Obj;
4
- declare type OnErrorCb = (e: null | Error) => unknown;
4
+ declare type OnErrorCb<Z, A extends TypeAllowed[]> = (e: null | Error, params: A extends [] ? Z : [Z, ...A]) => unknown;
5
5
  declare type OnEndCb<T, Z, A extends TypeAllowed[]> = (res: T, params: A extends [] ? Z : [Z, ...A]) => unknown;
6
6
  export default function useMutation<T, Z, A extends TypeAllowed[]>(func: (arg: Z, ...args: A) => Promise<T>): {
7
7
  mutate: (param: Z, ...restParams: A) => Promise<UnwrappedPromiseType<typeof func>>;
8
- onError: (cb: OnErrorCb) => unknown;
8
+ onError: (cb: OnErrorCb<Z, A>) => unknown;
9
9
  onEnd: (cb: OnEndCb<UnwrappedPromiseType<typeof func>, Z, A>) => unknown;
10
10
  isPending: Ref<boolean>;
11
11
  error: Ref<null | Error>;
12
12
  data: Ref<UnwrappedPromiseType<typeof func>>;
13
- promise: ComputedRef<Promise<T>>;
13
+ promise: ComputedRef<null | Promise<T>>;
14
14
  };
15
15
  export {};
@@ -1,5 +1,5 @@
1
1
  import { Ref } from 'vue';
2
2
  declare type NonNullable<T> = Exclude<T, null | undefined>;
3
3
  declare type Res<T, Z extends T> = NonNullable<Z extends never[] ? T : Z>;
4
- export default function <T, Z extends T>(res: Ref<T>, defaultRes: NonNullable<Z>, map?: (r: Res<T, Z>) => Res<T, Z>): Ref<Res<T, Z>>;
4
+ export default function <T, Z extends T, U = Res<T, Z>>(res: Ref<T>, defaultRes: NonNullable<Z>, map?: (r: Res<T, Z>) => NonNullable<U>): Ref<U>;
5
5
  export {};
package/dist/useXhr.d.ts CHANGED
@@ -33,14 +33,14 @@ export default function (args?: UseXhr): {
33
33
  responseType?: "arraybuffer" | "blob" | undefined;
34
34
  }> | undefined, params?: Obj | Ref<Obj>) => {
35
35
  xhr: Xhr<T_1>;
36
- onError: (cb: (e: Error | null, params: any) => any) => any;
37
- onStart: (cb: (params: any) => any) => any;
38
- onEnd: (cb: (res: T_1, params: any) => any) => any;
39
36
  isPending: Ref<boolean | undefined>;
40
- error: Ref<Error | null>;
41
37
  data: Ref<T_1 | null | undefined>;
38
+ error: Ref<Error | null>;
42
39
  reload: () => any;
43
- promise: ComputedRef<Promise<T_1>>;
40
+ onError: (cb: (e: Error | null, params: any) => any) => any;
41
+ onStart: (cb: (params: any) => any) => any;
42
+ onEnd: (cb: (res: T_1, params: any) => any) => any;
43
+ promise: ComputedRef<Promise<T_1> | null>;
44
44
  };
45
45
  put: <T_2 = any>(xhrConfig?: Partial<{
46
46
  url?: string | undefined;
@@ -57,14 +57,14 @@ export default function (args?: UseXhr): {
57
57
  responseType?: "arraybuffer" | "blob" | undefined;
58
58
  }> | undefined, params?: Obj | Ref<Obj> | undefined) => {
59
59
  xhr: Xhr<T_2>;
60
- onError: (cb: (e: Error | null, params: any) => any) => any;
61
- onStart: (cb: (params: any) => any) => any;
62
- onEnd: (cb: (res: T_2, params: any) => any) => any;
63
60
  isPending: Ref<boolean | undefined>;
64
- error: Ref<Error | null>;
65
61
  data: Ref<T_2 | null | undefined>;
62
+ error: Ref<Error | null>;
66
63
  reload: () => any;
67
- promise: ComputedRef<Promise<T_2>>;
64
+ onError: (cb: (e: Error | null, params: any) => any) => any;
65
+ onStart: (cb: (params: any) => any) => any;
66
+ onEnd: (cb: (res: T_2, params: any) => any) => any;
67
+ promise: ComputedRef<Promise<T_2> | null>;
68
68
  };
69
69
  delete: <T_3 = any>(xhrConfig?: Partial<{
70
70
  url?: string | undefined;
@@ -81,14 +81,14 @@ export default function (args?: UseXhr): {
81
81
  responseType?: "arraybuffer" | "blob" | undefined;
82
82
  }> | undefined, params?: Obj | Ref<Obj> | undefined) => {
83
83
  xhr: Xhr<T_3>;
84
- onError: (cb: (e: Error | null, params: any) => any) => any;
85
- onStart: (cb: (params: any) => any) => any;
86
- onEnd: (cb: (res: any, params: any) => any) => any;
87
84
  isPending: Ref<boolean | undefined>;
88
- error: Ref<Error | null>;
89
85
  data: Ref<any>;
86
+ error: Ref<Error | null>;
90
87
  reload: () => any;
91
- promise: ComputedRef<Promise<any>>;
88
+ onError: (cb: (e: Error | null, params: any) => any) => any;
89
+ onStart: (cb: (params: any) => any) => any;
90
+ onEnd: (cb: (res: any, params: any) => any) => any;
91
+ promise: ComputedRef<Promise<any> | null>;
92
92
  };
93
93
  };
94
94
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-use-async",
3
- "version": "1.1.14",
3
+ "version": "1.1.18",
4
4
  "description": "Xhr and async helpers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,30 +29,30 @@
29
29
  "vue": "^3.0.11"
30
30
  },
31
31
  "devDependencies": {
32
- "@babel/plugin-proposal-class-properties": "^7.14.5",
33
- "@babel/preset-env": "^7.14.7",
34
- "@babel/preset-typescript": "^7.14.5",
35
- "@types/jest": "^26.0.24",
36
- "@typescript-eslint/eslint-plugin": "^4.28.4",
37
- "@typescript-eslint/parser": "^4.28.4",
32
+ "@babel/plugin-proposal-class-properties": "^7.16.0",
33
+ "@babel/preset-env": "^7.16.4",
34
+ "@babel/preset-typescript": "^7.16.0",
35
+ "@types/jest": "^27.0.3",
36
+ "@typescript-eslint/eslint-plugin": "^5.4.0",
37
+ "@typescript-eslint/parser": "^5.4.0",
38
38
  "babel-eslint": "^10.1.0",
39
- "babel-jest": "^27.0.6",
40
- "babel-loader": "^8.2.2",
39
+ "babel-jest": "^27.3.1",
40
+ "babel-loader": "^8.2.3",
41
41
  "babel-plugin-module-resolver": "^4.1.0",
42
- "eslint": "^7.31.0",
43
- "eslint-config-airbnb-base": "^14.2.1",
44
- "eslint-import-resolver-typescript": "^2.4.0",
45
- "eslint-plugin-import": "^2.23.4",
46
- "husky": "^7.0.1",
47
- "jest": "^26.6.3",
48
- "lint-staged": "^11.0.1",
49
- "typescript": "^4.3.5",
50
- "vue": "^3.0.11",
51
- "webpack": "^5.45.1",
52
- "webpack-cli": "^4.7.2"
42
+ "eslint": "^8.3.0",
43
+ "eslint-config-airbnb-base": "^15.0.0",
44
+ "eslint-import-resolver-typescript": "^2.5.0",
45
+ "eslint-plugin-import": "^2.25.3",
46
+ "husky": "^7.0.4",
47
+ "jest": "^27.3.1",
48
+ "lint-staged": "^12.1.2",
49
+ "typescript": "^4.5.2",
50
+ "vue": "^3.2.11",
51
+ "webpack": "^5.64.2",
52
+ "webpack-cli": "^4.9.1"
53
53
  },
54
54
  "peerDependencies": {
55
- "vue": "^3.0.11"
55
+ "vue": "^3.2.11"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=14"