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.7 to 2.0.0-rc.8

6

CHANGELOG.md

@@ -0,1 +1,7 @@

# [2.0.0-rc.8](https://github.com/posva/pinia/compare/pinia@2.0.0-rc.7...pinia@2.0.0-rc.8) (2021-09-06)
### Bug Fixes
- correctly set the store properties in Vue 2 ([9e40309](https://github.com/posva/pinia/commit/9e40309e5bfc54f5f71178cf90d37ebcf8dd8dca)), closes [#657](https://github.com/posva/pinia/issues/657)
# [2.0.0-rc.7](https://github.com/posva/pinia/compare/pinia@2.0.0-rc.6...pinia@2.0.0-rc.7) (2021-09-03)

@@ -2,0 +8,0 @@

13

dist/pinia.cjs.prod.js
/*!
* pinia v2.0.0-rc.7
* pinia v2.0.0-rc.8
* (c) 2021 Eduardo San Martin Morote

@@ -448,3 +448,12 @@ * @license MIT

// add the state, getters, and action properties
assign(store, setupStore);
if (vueDemi.isVue2) {
Object.keys(setupStore).forEach((key) => {
vueDemi.set(store, key,
// @ts-expect-error: valid key indexing
setupStore[key]);
});
}
else {
assign(store, setupStore);
}
// use this instead of a computed with setter to be able to create it anywhere

@@ -451,0 +460,0 @@ // without linking the computed lifespan to wherever the store is first

4

dist/pinia.global.prod.js
/*!
* pinia v2.0.0-rc.7
* pinia v2.0.0-rc.8
* (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 o(t){return t&&"object"==typeof t&&"[object Object]"===Object.prototype.toString.call(t)&&"function"!=typeof t.toJSON}var r;t.MutationType=void 0,(r=t.MutationType||(t.MutationType={})).direct="direct",r.patchObject="patch object",r.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],r=t[i];t[i]=o(r)&&o(s)&&!e.isRef(s)&&!e.isReactive(s)?f(r,s):s}return t}const{assign:p}=Object;const d=()=>{};function l(n,s,o={},r,a){let l;const h=o.state,y={actions:{},...o},v={deep:!0};let $,g,b=e.markRaw([]),_=e.markRaw([]);const m=r.state.value[n];m||(e.isVue2?e.set(r.state.value,n,{}):r.state.value[n]={}),e.ref({});const j=d;function R(t,e){return function(){i(r);const s=Array.from(arguments);let o,a=d,c=d;function f(t){a=t}function p(t){c=t}u(_,{args:s,name:t,store:P,after:f,onError:p});try{o=e.apply(this&&this.$id===n?this:P,s)}catch(t){if(!1!==c(t))throw t}if(o instanceof Promise)return o.then((t=>{const e=a(t);return void 0===e?t:e})).catch((t=>{if(!1!==c(t))return Promise.reject(t)}));const l=a(o);return void 0===l?o:l}}const O={_p:r,$id:n,$onAction:c.bind(null,_),$patch:function(e){let i;$=!1,"function"==typeof e?(e(r.state.value[n]),i={type:t.MutationType.patchFunction,storeId:n,events:g}):(f(r.state.value[n],e),i={type:t.MutationType.patchObject,payload:e,storeId:n,events:g}),$=!0,u(b,i,r.state.value[n])},$reset:j,$subscribe(i,s={}){const o=c(b,i,s.detached),a=l.run((()=>e.watch((()=>r.state.value[n]),((e,s)=>{$&&i({storeId:n,type:t.MutationType.direct,events:g},e)}),p({},v,s))));return()=>{a(),o()}},$dispose:function(){l.stop(),b=[],_=[],r._s.delete(n)}},P=e.reactive(p({},O));r._s.set(n,P);const S=r._e.run((()=>(l=e.effectScope(),l.run((()=>s())))));for(const t in S){const i=S[t];if(e.isRef(i)&&(!(w=i)||!w.effect)||e.isReactive(i))h||(m&&(e.isRef(i)?i.value=m[t]:f(i,m[t])),e.isVue2?e.set(r.state.value[n],t,i):r.state.value[n][t]=i);else if("function"==typeof i){const n=R(t,i);e.isVue2?e.set(S,t,n):S[t]=n,y.actions[t]=i}}var w;return p(P,S),Object.defineProperty(P,"$state",{get:()=>r.state.value[n],set:t=>{r.state.value[n]=t}}),r._p.forEach((t=>{p(P,l.run((()=>t({store:P,app:r._a,pinia:r,options:y}))))})),m&&h&&(o.hydrate||f)(P,m),$=!0,P}let h="Store";function y(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=y;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,a&&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 o in n){const r=n[o];if("function"==typeof(s=r)&&"string"==typeof s.$id&&i._s.has(r.$id)){const n=r.$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");r(i,s)}}var s}}},t.createPinia=function(){const t=e.effectScope(!0),n=t.run((()=>e.ref({})));let o=[];const r=[],c=e.markRaw({install(t){e.isVue2||(c._a=t,t.provide(s,c),t.config.globalProperties.$pinia=c,a&&i(c),r.forEach((t=>o.push(t))))},use(t){return this._a||e.isVue2?o.push(t):r.push(t),this},_p:o,_a:null,_e:t,_s:new Map,state:n});return c},t.defineStore=function(t,o,r){let a,c;const u="function"==typeof o;function f(t,r){const f=e.getCurrentInstance();(t=t||f&&e.inject(s))&&i(t),(t=n)._s.has(a)||(u?l(a,o,c,t):function(t,n,s,o){const{state:r,actions:a,getters:c}=n,u=s.state.value[t];let f;f=l(t,(function(){u||(e.isVue2?e.set(s.state.value,t,r?r():{}):s.state.value[t]=r?r():{});const n=e.toRefs(s.state.value[t]);return p(n,a,Object.keys(c||{}).reduce(((t,n)=>(t[n]=e.markRaw(e.computed((()=>(i(s),f&&c[n].call(f,f))))),t)),{}))}),n,s),f.$reset=function(){const t=r?r():{};this.$patch((e=>{p(e,t)}))}}(a,c,t));return t._s.get(a)}return"string"==typeof t?(a=t,c=u?r:o):(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=v,t.mapState=y,t.mapStores=function(...t){return t.reduce(((t,e)=>(t[e.$id+h]=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){h=t},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 o(t){return t&&"object"==typeof t&&"[object Object]"===Object.prototype.toString.call(t)&&"function"!=typeof t.toJSON}var r;t.MutationType=void 0,(r=t.MutationType||(t.MutationType={})).direct="direct",r.patchObject="patch object",r.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],r=t[i];t[i]=o(r)&&o(s)&&!e.isRef(s)&&!e.isReactive(s)?f(r,s):s}return t}const{assign:p}=Object;const d=()=>{};function l(n,s,o={},r,a){let l;const h=o.state,y={actions:{},...o},v={deep:!0};let $,b,g=e.markRaw([]),_=e.markRaw([]);const j=r.state.value[n];j||(e.isVue2?e.set(r.state.value,n,{}):r.state.value[n]={}),e.ref({});const m=d;function R(t,e){return function(){i(r);const s=Array.from(arguments);let o,a=d,c=d;function f(t){a=t}function p(t){c=t}u(_,{args:s,name:t,store:P,after:f,onError:p});try{o=e.apply(this&&this.$id===n?this:P,s)}catch(t){if(!1!==c(t))throw t}if(o instanceof Promise)return o.then((t=>{const e=a(t);return void 0===e?t:e})).catch((t=>{if(!1!==c(t))return Promise.reject(t)}));const l=a(o);return void 0===l?o:l}}const O={_p:r,$id:n,$onAction:c.bind(null,_),$patch:function(e){let i;$=!1,"function"==typeof e?(e(r.state.value[n]),i={type:t.MutationType.patchFunction,storeId:n,events:b}):(f(r.state.value[n],e),i={type:t.MutationType.patchObject,payload:e,storeId:n,events:b}),$=!0,u(g,i,r.state.value[n])},$reset:m,$subscribe(i,s={}){const o=c(g,i,s.detached),a=l.run((()=>e.watch((()=>r.state.value[n]),((e,s)=>{$&&i({storeId:n,type:t.MutationType.direct,events:b},e)}),p({},v,s))));return()=>{a(),o()}},$dispose:function(){l.stop(),g=[],_=[],r._s.delete(n)}},P=e.reactive(p({},O));r._s.set(n,P);const S=r._e.run((()=>(l=e.effectScope(),l.run((()=>s())))));for(const t in S){const i=S[t];if(e.isRef(i)&&(!(w=i)||!w.effect)||e.isReactive(i))h||(j&&(e.isRef(i)?i.value=j[t]:f(i,j[t])),e.isVue2?e.set(r.state.value[n],t,i):r.state.value[n][t]=i);else if("function"==typeof i){const n=R(t,i);e.isVue2?e.set(S,t,n):S[t]=n,y.actions[t]=i}}var w;return e.isVue2?Object.keys(S).forEach((t=>{e.set(P,t,S[t])})):p(P,S),Object.defineProperty(P,"$state",{get:()=>r.state.value[n],set:t=>{r.state.value[n]=t}}),r._p.forEach((t=>{p(P,l.run((()=>t({store:P,app:r._a,pinia:r,options:y}))))})),j&&h&&(o.hydrate||f)(P,j),$=!0,P}let h="Store";function y(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=y;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,a&&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 o in n){const r=n[o];if("function"==typeof(s=r)&&"string"==typeof s.$id&&i._s.has(r.$id)){const n=r.$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");r(i,s)}}var s}}},t.createPinia=function(){const t=e.effectScope(!0),n=t.run((()=>e.ref({})));let o=[];const r=[],c=e.markRaw({install(t){e.isVue2||(c._a=t,t.provide(s,c),t.config.globalProperties.$pinia=c,a&&i(c),r.forEach((t=>o.push(t))))},use(t){return this._a||e.isVue2?o.push(t):r.push(t),this},_p:o,_a:null,_e:t,_s:new Map,state:n});return c},t.defineStore=function(t,o,r){let a,c;const u="function"==typeof o;function f(t,r){const f=e.getCurrentInstance();(t=t||f&&e.inject(s))&&i(t),(t=n)._s.has(a)||(u?l(a,o,c,t):function(t,n,s,o){const{state:r,actions:a,getters:c}=n,u=s.state.value[t];let f;f=l(t,(function(){u||(e.isVue2?e.set(s.state.value,t,r?r():{}):s.state.value[t]=r?r():{});const n=e.toRefs(s.state.value[t]);return p(n,a,Object.keys(c||{}).reduce(((t,n)=>(t[n]=e.markRaw(e.computed((()=>(i(s),f&&c[n].call(f,f))))),t)),{}))}),n,s),f.$reset=function(){const t=r?r():{};this.$patch((e=>{p(e,t)}))}}(a,c,t));return t._s.get(a)}return"string"==typeof t?(a=t,c=u?r:o):(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=v,t.mapState=y,t.mapStores=function(...t){return t.reduce(((t,e)=>(t[e.$id+h]=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){h=t},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.7",
"version": "2.0.0-rc.8",
"description": "Intuitive, type safe and flexible Store for Vue",

@@ -58,6 +58,6 @@ "main": "dist/pinia.cjs.js",

"@microsoft/api-extractor": "7.18.7",
"@vue/compiler-sfc": "^3.2.8",
"@vue/server-renderer": "^3.2.8",
"@vue/test-utils": "^2.0.0-rc.13",
"vue": "^3.2.8",
"@vue/compiler-sfc": "^3.2.9",
"@vue/server-renderer": "^3.2.9",
"@vue/test-utils": "^2.0.0-rc.14",
"vue": "^3.2.9",
"vue2": "npm:vue@2"

@@ -64,0 +64,0 @@ },

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 too big to display

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

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