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

6

CHANGELOG.md

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

# [2.0.0-rc.3](https://github.com/posva/pinia/compare/v2.0.0-rc.2...v2.0.0-rc.3) (2021-08-05)
### Bug Fixes
- set initial state in prod ([f8e3c83](https://github.com/posva/pinia/commit/f8e3c83a4c7be7bf537a5d6ffca97408263bc9a0)), closes [#598](https://github.com/posva/pinia/issues/598)
# [2.0.0-rc.2](https://github.com/posva/pinia/compare/v2.0.0-rc.1...v2.0.0-rc.2) (2021-08-04)

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

6

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

@@ -240,3 +240,3 @@ * @license MIT

}
store = createSetupStore(id, setup, options, pinia, hot);
store = createSetupStore(id, setup, options, pinia);
store.$reset = function $reset() {

@@ -267,3 +267,3 @@ const newState = state ? state() : {};

const initialState = pinia.state.value[$id];
if (!initialState && false && !hot) {
if (!initialState && (!false )) {
if (vueDemi.isVue2) {

@@ -270,0 +270,0 @@ vueDemi.set(pinia.state.value, $id, {});

/*!
* pinia v2.0.0-rc.2
* pinia v2.0.0-rc.3
* (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 a="undefined"!=typeof window;function c(){const t=e.effectScope(!0),n=t.run((()=>e.ref({})));let r=[];const o=[],c=e.markRaw({install(t){e.isVue2||(c._a=t,t.provide(s,c),t.config.globalProperties.$pinia=c,a&&i(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}function u(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 p(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{assign:d}=Object;const h=()=>{};function l(n,s,r={},o,a){let c;const l=r.state,y={actions:{},...r},$={deep:!0,flush:"sync"};let v,b,g=e.markRaw([]),_=e.markRaw([]);const j=o.state.value[n];e.ref({});const m=o._e.run((()=>(c=e.effectScope(),c.run((()=>(e.watch((()=>o.state.value[n]),((e,i)=>{v&&p(g,{storeId:n,type:t.MutationType.direct,events:b},e)}),$),s()))))));const O=h;function S(t,e){return function(){i(o);const s=Array.from(arguments);let r,a=h,c=h;function u(t){a=t}function f(t){c=t}p(_,{args:s,name:t,store:P,after:u,onError:f});try{r=e.apply(this&&this.$id===n?this:P,s)}catch(t){if(!1!==c(t))throw t}if(r instanceof Promise)return r.then((t=>{const e=a(t);return void 0===e?t:e})).catch((t=>{if(!1!==c(t))return Promise.reject(t)}));const d=a(r);return void 0===d?r:d}}for(const t in m){const i=m[t];if(e.isRef(i)&&(!(w=i)||!w.effect)||e.isReactive(i))l||(e.isVue2?e.set(o.state.value[n],t,i):o.state.value[n][t]=i);else if("function"==typeof i){const n=S(t,i);e.isVue2?e.set(m,t,n):m[t]=n,y.actions[t]=i}}var w;const A={_p:o,$id:n,$onAction:u.bind(null,_),$patch:function(e){let i;v=!1,"function"==typeof e?(e(o.state.value[n]),i={type:t.MutationType.patchFunction,storeId:n,events:b}):(f(o.state.value[n],e),i={type:t.MutationType.patchObject,payload:e,storeId:n,events:b}),v=!0,p(g,i,o.state.value[n])},$reset:O,$subscribe:u.bind(null,g)},P=e.reactive(d({},A,m));return Object.defineProperty(P,"$state",{get:()=>o.state.value[n],set:t=>{o.state.value[n]=t}}),o._p.forEach((t=>{d(P,c.run((()=>t({store:P,app:o._a,pinia:o,options:y}))))})),j&&(r.hydrate||f)(P,j),v=!0,P}let y="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 v=$;return t.PiniaPlugin=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}})},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=c,t.createTestingPinia=function({plugins:t=[],stubActions:n=!0,stubPatch:s=!1,fakeApp:r=!1,createSpy:o}={}){const a=c();if(t.forEach((t=>a.use(t))),!(o=o||void 0!==typeof jest&&jest.fn))throw new Error("You must configure the `createSpy` option.");const u=new Map;if(a.use((({store:t,options:e})=>{u.has(t.$id)||u.set(t.$id,{});const i=u.get(t.$id);Object.keys(e.actions||{}).forEach((e=>{i[e]=i[e]||(n?o():o(t[e])),t[e]=i[e]})),t.$patch=s?o():o(t.$patch)})),r){e.createApp({}).use(a)}return a._testing=!0,i(a),Object.assign({resetSpyCache(){u.clear()},get app(){return this._a}},a)},t.defineStore=function(t,r,o){let a,c;const u="function"==typeof r;function p(t,o){const p=e.getCurrentInstance();(t=t||p&&e.inject(s))&&i(t),(t=n)._s.has(a)||t._s.set(a,u?l(a,r,c,t):function(t,n,s,r){const{state:o,actions:a,getters:c}=n,u=s.state.value[t];let p;return p=l(t,(function(){u||(e.isVue2?e.set(s.state.value,t,o?o():{}):s.state.value[t]=o?o():{});const n=u||e.toRefs(s.state.value[t]);return d(n,a,Object.keys(c||{}).reduce(((t,n)=>(t[n]=e.markRaw(e.computed((()=>(i(s),p&&c[n].call(p,p))))),t)),{}))}),n,s),p.$reset=function(){const t=o?o():{};this.$patch((e=>{d(e,t)}))},p}(a,c,t));return t._s.get(a)}return"string"==typeof t?(a=t,c=u?o:r):(c=t,a=t.id),p.$id=a,p},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=$,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},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(){const t=e.effectScope(!0),n=t.run((()=>e.ref({})));let r=[];const o=[],c=e.markRaw({install(t){e.isVue2||(c._a=t,t.provide(s,c),t.config.globalProperties.$pinia=c,a&&i(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}function u(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 p(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{assign:d}=Object;const h=()=>{};function l(n,s,r={},o,a){let c;const l=r.state,y={actions:{},...r},$={deep:!0,flush:"sync"};let v,b,g=e.markRaw([]),_=e.markRaw([]);const j=o.state.value[n];j||(e.isVue2?e.set(o.state.value,n,{}):o.state.value[n]={}),e.ref({});const m=o._e.run((()=>(c=e.effectScope(),c.run((()=>(e.watch((()=>o.state.value[n]),((e,i)=>{v&&p(g,{storeId:n,type:t.MutationType.direct,events:b},e)}),$),s()))))));const O=h;function S(t,e){return function(){i(o);const s=Array.from(arguments);let r,a=h,c=h;function u(t){a=t}function f(t){c=t}p(_,{args:s,name:t,store:P,after:u,onError:f});try{r=e.apply(this&&this.$id===n?this:P,s)}catch(t){if(!1!==c(t))throw t}if(r instanceof Promise)return r.then((t=>{const e=a(t);return void 0===e?t:e})).catch((t=>{if(!1!==c(t))return Promise.reject(t)}));const d=a(r);return void 0===d?r:d}}for(const t in m){const i=m[t];if(e.isRef(i)&&(!(w=i)||!w.effect)||e.isReactive(i))l||(e.isVue2?e.set(o.state.value[n],t,i):o.state.value[n][t]=i);else if("function"==typeof i){const n=S(t,i);e.isVue2?e.set(m,t,n):m[t]=n,y.actions[t]=i}}var w;const A={_p:o,$id:n,$onAction:u.bind(null,_),$patch:function(e){let i;v=!1,"function"==typeof e?(e(o.state.value[n]),i={type:t.MutationType.patchFunction,storeId:n,events:b}):(f(o.state.value[n],e),i={type:t.MutationType.patchObject,payload:e,storeId:n,events:b}),v=!0,p(g,i,o.state.value[n])},$reset:O,$subscribe:u.bind(null,g)},P=e.reactive(d({},A,m));return Object.defineProperty(P,"$state",{get:()=>o.state.value[n],set:t=>{o.state.value[n]=t}}),o._p.forEach((t=>{d(P,c.run((()=>t({store:P,app:o._a,pinia:o,options:y}))))})),j&&(r.hydrate||f)(P,j),v=!0,P}let y="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 v=$;return t.PiniaPlugin=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}})},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=c,t.createTestingPinia=function({plugins:t=[],stubActions:n=!0,stubPatch:s=!1,fakeApp:r=!1,createSpy:o}={}){const a=c();if(t.forEach((t=>a.use(t))),!(o=o||void 0!==typeof jest&&jest.fn))throw new Error("You must configure the `createSpy` option.");const u=new Map;if(a.use((({store:t,options:e})=>{u.has(t.$id)||u.set(t.$id,{});const i=u.get(t.$id);Object.keys(e.actions||{}).forEach((e=>{i[e]=i[e]||(n?o():o(t[e])),t[e]=i[e]})),t.$patch=s?o():o(t.$patch)})),r){e.createApp({}).use(a)}return a._testing=!0,i(a),Object.assign({resetSpyCache(){u.clear()},get app(){return this._a}},a)},t.defineStore=function(t,r,o){let a,c;const u="function"==typeof r;function p(t,o){const p=e.getCurrentInstance();(t=t||p&&e.inject(s))&&i(t),(t=n)._s.has(a)||t._s.set(a,u?l(a,r,c,t):function(t,n,s,r){const{state:o,actions:a,getters:c}=n,u=s.state.value[t];let p;return p=l(t,(function(){u||(e.isVue2?e.set(s.state.value,t,o?o():{}):s.state.value[t]=o?o():{});const n=u||e.toRefs(s.state.value[t]);return d(n,a,Object.keys(c||{}).reduce(((t,n)=>(t[n]=e.markRaw(e.computed((()=>(i(s),p&&c[n].call(p,p))))),t)),{}))}),n,s),p.$reset=function(){const t=o?o():{};this.$patch((e=>{d(e,t)}))},p}(a,c,t));return t._s.get(a)}return"string"==typeof t?(a=t,c=u?o:r):(c=t,a=t.id),p.$id=a,p},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=$,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},Object.defineProperty(t,"__esModule",{value:!0}),t}({},VueDemi);
{
"name": "pinia",
"version": "2.0.0-rc.2",
"version": "2.0.0-rc.3",
"description": "Intuitive, type safe and flexible Store for Vue",

@@ -5,0 +5,0 @@ "main": "dist/pinia.cjs.js",

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