Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pinia

Package Overview
Dependencies
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pinia - npm Package Compare versions

Comparing version 2.0.0-rc.15 to 2.0.0

10

CHANGELOG.md

@@ -0,1 +1,11 @@

# [2.0.0](https://github.com/posva/pinia/compare/pinia@2.0.0-rc.15...pinia@2.0.0) (2021-10-27)
🎉 🎉 🎉
### Bug Fixes
- **devtools:** root store access [#732](https://github.com/posva/pinia/issues/732) ([90d2c35](https://github.com/posva/pinia/commit/90d2c35d94ccb6e3991b99b181bfe3b360cfa289))
- **plugins:** ensure plugins are used only once ([#745](https://github.com/posva/pinia/issues/745)) ([150fdfc](https://github.com/posva/pinia/commit/150fdfc8abe2577046af947b2e4fbbde2efb057e))
- **ssr:** make skipHydrate compatible with @vue/composition-api ([71448b0](https://github.com/posva/pinia/commit/71448b008fc4517ab0036b98121a0346df75880e))
# [2.0.0-rc.15](https://github.com/posva/pinia/compare/pinia@2.0.0-rc.14...pinia@2.0.0-rc.15) (2021-10-25)

@@ -2,0 +12,0 @@

4

dist/pinia.iife.prod.js
/*!
* pinia v2.0.0-rc.15
* pinia v2.0.0
* (c) 2021 Eduardo San Martin Morote
* @license MIT
*/
var Pinia=function(t,e){"use strict";let n;const i=t=>n=t,s=Symbol();function r(t){return t&&"object"==typeof t&&"[object Object]"===Object.prototype.toString.call(t)&&"function"!=typeof t.toJSON}var o;t.MutationType=void 0,(o=t.MutationType||(t.MutationType={})).direct="direct",o.patchObject="patch object",o.patchFunction="patch function";const c="undefined"!=typeof window;function a(t,n,i){t.push(n);const s=()=>{const e=t.indexOf(n);e>-1&&t.splice(e,1)};return!i&&e.getCurrentInstance()&&e.onUnmounted(s),s}function u(t,...e){t.forEach((t=>{t(...e)}))}function f(t,n){for(const i in n){const s=n[i],o=t[i];t[i]=r(o)&&r(s)&&!e.isRef(s)&&!e.isReactive(s)?f(o,s):s}return t}const p=Symbol();const{assign:d}=Object;const h=()=>{};function l(n,s,o={},c,l){let y;const v=o.state,$={actions:{},...o},_={deep:!0};let b,g,j=e.markRaw([]),m=e.markRaw([]);const O=c.state.value[n];function R(e){let i;b=!1,"function"==typeof e?(e(c.state.value[n]),i={type:t.MutationType.patchFunction,storeId:n,events:g}):(f(c.state.value[n],e),i={type:t.MutationType.patchObject,payload:e,storeId:n,events:g}),b=!0,u(j,i,c.state.value[n])}v||O||(e.isVue2?e.set(c.state.value,n,{}):c.state.value[n]={}),e.ref({});const P=h;function S(t,e){return function(){i(c);const s=Array.from(arguments);let r,o=h,a=h;function f(t){o=t}function p(t){a=t}u(m,{args:s,name:t,store:V,after:f,onError:p});try{r=e.apply(this&&this.$id===n?this:V,s)}catch(t){if(!1!==a(t))throw t}if(r instanceof Promise)return r.then((t=>{const e=o(t);return void 0===e?t:e})).catch((t=>{if(!1!==a(t))return Promise.reject(t)}));const d=o(r);return void 0===d?r:d}}const w={_p:c,$id:n,$onAction:a.bind(null,m),$patch:R,$reset:P,$subscribe(i,s={}){const r=a(j,i,s.detached),o=y.run((()=>e.watch((()=>c.state.value[n]),((e,s)=>{b&&i({storeId:n,type:t.MutationType.direct,events:g},e)}),d({},_,s))));return()=>{o(),r()}},$dispose:function(){y.stop(),j=[],m=[],c._s.delete(n)}};e.isVue2&&(w._r=!1);const V=e.reactive(d({},w));c._s.set(n,V);const k=c._e.run((()=>(y=e.effectScope(),y.run((()=>s())))));for(const t in k){const i=k[t];if(e.isRef(i)&&(!e.isRef(M=i)||!M.effect)||e.isReactive(i))v||(!O||r(A=i)&&A.hasOwnProperty(p)||(e.isRef(i)?i.value=O[t]:f(i,O[t])),e.isVue2?e.set(c.state.value[n],t,i):c.state.value[n][t]=i);else if("function"==typeof i){const n=S(t,i);e.isVue2?e.set(k,t,n):k[t]=n,$.actions[t]=i}}var A,M;return e.isVue2?Object.keys(k).forEach((t=>{e.set(V,t,k[t])})):d(V,k),Object.defineProperty(V,"$state",{get:()=>c.state.value[n],set:t=>{R((e=>{d(e,t)}))}}),e.isVue2&&(V._r=!0),c._p.forEach((t=>{d(V,y.run((()=>t({store:V,app:c._a,pinia:c,options:$}))))})),O&&v&&o.hydrate&&o.hydrate(V.$state,O),b=!0,V}let y="Store";function v(t,e){return Array.isArray(e)?e.reduce(((e,n)=>(e[n]=function(){return t(this.$pinia)[n]},e)),{}):Object.keys(e).reduce(((n,i)=>(n[i]=function(){const n=t(this.$pinia),s=e[i];return"function"==typeof s?s.call(this,n):n[s]},n)),{})}const $=v;const _=function(t){t.mixin({beforeCreate(){const t=this.$options;if(t.pinia){const e=t.pinia;if(!this._provided){const t={};Object.defineProperty(this,"_provided",{get:()=>t,set:e=>Object.assign(t,e)})}this._provided[s]=e,this.$pinia||(this.$pinia=e),e._a=this,c&&i(e)}else!this.$pinia&&t.parent&&t.parent.$pinia&&(this.$pinia=t.parent.$pinia)},destroyed(){delete this._pStores}})};return t.PiniaPlugin=_,t.PiniaVuePlugin=_,t.acceptHMRUpdate=function(t,e){return n=>{const i=e.data.pinia||t._pinia;if(i){e.data.pinia=i;for(const r in n){const o=n[r];if("function"==typeof(s=o)&&"string"==typeof s.$id&&i._s.has(o.$id)){const n=o.$id;if(n!==t.$id)return console.warn(`The id of the store changed from "${t.$id}" to "${n}". Reloading.`),e.invalidate();const s=i._s.get(n);if(!s)return void console.log("skipping hmr because store doesn't exist yet");o(i,s)}}var s}}},t.createPinia=function(){const t=e.effectScope(!0),n=t.run((()=>e.ref({})));let r=[];const o=[],c=e.markRaw({install(t){i(c),e.isVue2||(c._a=t,t.provide(s,c),t.config.globalProperties.$pinia=c,o.forEach((t=>r.push(t))))},use(t){return this._a||e.isVue2?r.push(t):o.push(t),this},_p:r,_a:null,_e:t,_s:new Map,state:n});return c},t.defineStore=function(t,r,o){let c,a;const u="function"==typeof r;function f(t,o){const f=e.getCurrentInstance();(t=t||f&&e.inject(s))&&i(t),(t=n)._s.has(c)||(u?l(c,r,a,t):function(t,n,s,r){const{state:o,actions:c,getters:a}=n,u=s.state.value[t];let f;f=l(t,(function(){u||(e.isVue2?e.set(s.state.value,t,o?o():{}):s.state.value[t]=o?o():{});const n=e.toRefs(s.state.value[t]);return d(n,c,Object.keys(a||{}).reduce(((n,r)=>(n[r]=e.markRaw(e.computed((()=>{i(s);const n=s._s.get(t);if(!e.isVue2||n._r)return a[r].call(n,n)}))),n)),{}))}),n,s),f.$reset=function(){const t=o?o():{};this.$patch((e=>{d(e,t)}))}}(c,a,t));return t._s.get(c)}return"string"==typeof t?(c=t,a=u?o:r):(a=t,c=t.id),f.$id=c,f},t.getActivePinia=()=>e.getCurrentInstance()&&e.inject(s)||n,t.mapActions=function(t,e){return Array.isArray(e)?e.reduce(((e,n)=>(e[n]=function(...e){return t(this.$pinia)[n](...e)},e)),{}):Object.keys(e).reduce(((n,i)=>(n[i]=function(...n){return t(this.$pinia)[e[i]](...n)},n)),{})},t.mapGetters=$,t.mapState=v,t.mapStores=function(...t){return t.reduce(((t,e)=>(t[e.$id+y]=function(){return e(this.$pinia)},t)),{})},t.mapWritableState=function(t,e){return Array.isArray(e)?e.reduce(((e,n)=>(e[n]={get(){return t(this.$pinia)[n]},set(e){return t(this.$pinia)[n]=e}},e)),{}):Object.keys(e).reduce(((n,i)=>(n[i]={get(){return t(this.$pinia)[e[i]]},set(n){return t(this.$pinia)[e[i]]=n}},n)),{})},t.setActivePinia=i,t.setMapStoreSuffix=function(t){y=t},t.skipHydrate=function(t){return Object.defineProperty(t,p,{})},t.storeToRefs=function(t){t=e.toRaw(t);const n={};for(const i in t){const s=t[i];(e.isRef(s)||e.isReactive(s))&&(n[i]=e.toRef(t,i))}return n},Object.defineProperty(t,"__esModule",{value:!0}),t}({},VueDemi);
var Pinia=function(t,e){"use strict";let n;const i=t=>n=t,s=Symbol();function r(t){return t&&"object"==typeof t&&"[object Object]"===Object.prototype.toString.call(t)&&"function"!=typeof t.toJSON}var o;t.MutationType=void 0,(o=t.MutationType||(t.MutationType={})).direct="direct",o.patchObject="patch object",o.patchFunction="patch function";const a="undefined"!=typeof window;function c(t,n,i){t.push(n);const s=()=>{const e=t.indexOf(n);e>-1&&t.splice(e,1)};return!i&&e.getCurrentInstance()&&e.onUnmounted(s),s}function u(t,...e){t.forEach((t=>{t(...e)}))}function f(t,n){for(const i in n){const s=n[i],o=t[i];t[i]=r(o)&&r(s)&&!e.isRef(s)&&!e.isReactive(s)?f(o,s):s}return t}const p=Symbol(),d=new WeakMap;const{assign:h}=Object;const l=()=>{};function y(n,s,o={},a,y){let v;const $=o.state,_={actions:{},...o},b={deep:!0};let g,j,m=e.markRaw([]),O=e.markRaw([]);const R=a.state.value[n];function P(e){let i;g=!1,"function"==typeof e?(e(a.state.value[n]),i={type:t.MutationType.patchFunction,storeId:n,events:j}):(f(a.state.value[n],e),i={type:t.MutationType.patchObject,payload:e,storeId:n,events:j}),g=!0,u(m,i,a.state.value[n])}$||R||(e.isVue2?e.set(a.state.value,n,{}):a.state.value[n]={}),e.ref({});const S=l;function V(t,e){return function(){i(a);const s=Array.from(arguments);let r,o=l,c=l;function f(t){o=t}function p(t){c=t}u(O,{args:s,name:t,store:k,after:f,onError:p});try{r=e.apply(this&&this.$id===n?this:k,s)}catch(t){if(!1!==c(t))throw t}if(r instanceof Promise)return r.then((t=>{const e=o(t);return void 0===e?t:e})).catch((t=>{if(!1!==c(t))return Promise.reject(t)}));const d=o(r);return void 0===d?r:d}}const w={_p:a,$id:n,$onAction:c.bind(null,O),$patch:P,$reset:S,$subscribe(i,s={}){const r=c(m,i,s.detached),o=v.run((()=>e.watch((()=>a.state.value[n]),((e,s)=>{g&&i({storeId:n,type:t.MutationType.direct,events:j},e)}),h({},b,s))));return()=>{o(),r()}},$dispose:function(){v.stop(),m=[],O=[],a._s.delete(n)}};e.isVue2&&(w._r=!1);const k=e.reactive(h({},w));a._s.set(n,k);const A=a._e.run((()=>(v=e.effectScope(),v.run((()=>s())))));for(const t in A){const i=A[t];if(e.isRef(i)&&(!e.isRef(T=i)||!T.effect)||e.isReactive(i))$||(R&&(M=i,e.isVue2?d.has(M):!r(M)||!M.hasOwnProperty(p))&&(e.isRef(i)?i.value=R[t]:f(i,R[t])),e.isVue2?e.set(a.state.value[n],t,i):a.state.value[n][t]=i);else if("function"==typeof i){const n=V(t,i);e.isVue2?e.set(A,t,n):A[t]=n,_.actions[t]=i}}var M,T;return e.isVue2?Object.keys(A).forEach((t=>{e.set(k,t,A[t])})):h(k,A),Object.defineProperty(k,"$state",{get:()=>a.state.value[n],set:t=>{P((e=>{h(e,t)}))}}),e.isVue2&&(k._r=!0),a._p.forEach((t=>{h(k,v.run((()=>t({store:k,app:a._a,pinia:a,options:_}))))})),R&&$&&o.hydrate&&o.hydrate(k.$state,R),g=!0,k}let v="Store";function $(t,e){return Array.isArray(e)?e.reduce(((e,n)=>(e[n]=function(){return t(this.$pinia)[n]},e)),{}):Object.keys(e).reduce(((n,i)=>(n[i]=function(){const n=t(this.$pinia),s=e[i];return"function"==typeof s?s.call(this,n):n[s]},n)),{})}const _=$;const b=function(t){t.mixin({beforeCreate(){const t=this.$options;if(t.pinia){const e=t.pinia;if(!this._provided){const t={};Object.defineProperty(this,"_provided",{get:()=>t,set:e=>Object.assign(t,e)})}this._provided[s]=e,this.$pinia||(this.$pinia=e),e._a=this,a&&i(e)}else!this.$pinia&&t.parent&&t.parent.$pinia&&(this.$pinia=t.parent.$pinia)},destroyed(){delete this._pStores}})};return t.PiniaPlugin=b,t.PiniaVuePlugin=b,t.acceptHMRUpdate=function(t,e){return n=>{const i=e.data.pinia||t._pinia;if(i){e.data.pinia=i;for(const r in n){const o=n[r];if("function"==typeof(s=o)&&"string"==typeof s.$id&&i._s.has(o.$id)){const n=o.$id;if(n!==t.$id)return console.warn(`The id of the store changed from "${t.$id}" to "${n}". Reloading.`),e.invalidate();const s=i._s.get(n);if(!s)return void console.log("skipping hmr because store doesn't exist yet");o(i,s)}}var s}}},t.createPinia=function(){const t=e.effectScope(!0),n=t.run((()=>e.ref({})));let r=[],o=[];const a=e.markRaw({install(t){i(a),e.isVue2||(a._a=t,t.provide(s,a),t.config.globalProperties.$pinia=a,o.forEach((t=>r.push(t))),o=[])},use(t){return this._a||e.isVue2?r.push(t):o.push(t),this},_p:r,_a:null,_e:t,_s:new Map,state:n});return a},t.defineStore=function(t,r,o){let a,c;const u="function"==typeof r;function f(t,o){const f=e.getCurrentInstance();(t=t||f&&e.inject(s))&&i(t),(t=n)._s.has(a)||(u?y(a,r,c,t):function(t,n,s,r){const{state:o,actions:a,getters:c}=n,u=s.state.value[t];let f;f=y(t,(function(){u||(e.isVue2?e.set(s.state.value,t,o?o():{}):s.state.value[t]=o?o():{});const n=e.toRefs(s.state.value[t]);return h(n,a,Object.keys(c||{}).reduce(((n,r)=>(n[r]=e.markRaw(e.computed((()=>{i(s);const n=s._s.get(t);if(!e.isVue2||n._r)return c[r].call(n,n)}))),n)),{}))}),n,s),f.$reset=function(){const t=o?o():{};this.$patch((e=>{h(e,t)}))}}(a,c,t));return t._s.get(a)}return"string"==typeof t?(a=t,c=u?o:r):(c=t,a=t.id),f.$id=a,f},t.getActivePinia=()=>e.getCurrentInstance()&&e.inject(s)||n,t.mapActions=function(t,e){return Array.isArray(e)?e.reduce(((e,n)=>(e[n]=function(...e){return t(this.$pinia)[n](...e)},e)),{}):Object.keys(e).reduce(((n,i)=>(n[i]=function(...n){return t(this.$pinia)[e[i]](...n)},n)),{})},t.mapGetters=_,t.mapState=$,t.mapStores=function(...t){return t.reduce(((t,e)=>(t[e.$id+v]=function(){return e(this.$pinia)},t)),{})},t.mapWritableState=function(t,e){return Array.isArray(e)?e.reduce(((e,n)=>(e[n]={get(){return t(this.$pinia)[n]},set(e){return t(this.$pinia)[n]=e}},e)),{}):Object.keys(e).reduce(((n,i)=>(n[i]={get(){return t(this.$pinia)[e[i]]},set(n){return t(this.$pinia)[e[i]]=n}},n)),{})},t.setActivePinia=i,t.setMapStoreSuffix=function(t){v=t},t.skipHydrate=function(t){return e.isVue2?d.set(t,1)&&t:Object.defineProperty(t,p,{})},t.storeToRefs=function(t){t=e.toRaw(t);const n={};for(const i in t){const s=t[i];(e.isRef(s)||e.isReactive(s))&&(n[i]=e.toRef(t,i))}return n},Object.defineProperty(t,"__esModule",{value:!0}),t}({},VueDemi);
{
"name": "pinia",
"version": "2.0.0-rc.15",
"version": "2.0.0",
"description": "Intuitive, type safe and flexible Store for Vue",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc