Comparing version 2.0.0-alpha.3 to 2.0.0-alpha.4
@@ -0,1 +1,7 @@ | ||
# [2.0.0-alpha.4](https://github.com/posva/pinia/compare/v2.0.0-alpha.3...v2.0.0-alpha.4) (2020-09-29) | ||
### Bug Fixes | ||
- detach stores creation from currentInstance ([dc31736](https://github.com/posva/pinia/commit/dc317360ebebc208ca31d819953c573f6a7ac3cc)) | ||
# [2.0.0-alpha.3](https://github.com/posva/pinia/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2020-09-28) | ||
@@ -2,0 +8,0 @@ |
/*! | ||
* pinia v2.0.0-alpha.3 | ||
* pinia v2.0.0-alpha.4 | ||
* (c) 2020 Eduardo San Martin Morote | ||
@@ -340,2 +340,10 @@ * @license MIT | ||
const IS_CLIENT = typeof window !== 'undefined'; | ||
function withScope(factory) { | ||
{ | ||
// no need to wrap with an app on SSR | ||
return factory(); | ||
} | ||
} | ||
function innerPatch(target, patchToApply) { | ||
@@ -472,6 +480,6 @@ // TODO: get all keys like symbols as well | ||
if (!store) { | ||
stores.set(id, | ||
// @ts-ignore | ||
(store = buildStore(id, state, getters, actions, getInitialState(id)))); | ||
if (IS_CLIENT && true /*|| __FEATURE_PROD_DEVTOOLS__*/) { | ||
stores.set(id, (store = withScope(() => buildStore(id, state, getters, actions, getInitialState(id))))); | ||
if (IS_CLIENT && | ||
false && | ||
true /*|| __FEATURE_PROD_DEVTOOLS__*/) { | ||
const app = getClientApp(); | ||
@@ -478,0 +486,0 @@ if (app) { |
/*! | ||
* pinia v2.0.0-alpha.3 | ||
* pinia v2.0.0-alpha.4 | ||
* (c) 2020 Eduardo San Martin Morote | ||
@@ -339,2 +339,10 @@ * @license MIT | ||
const IS_CLIENT = typeof window !== 'undefined'; | ||
function withScope(factory) { | ||
{ | ||
// no need to wrap with an app on SSR | ||
return factory(); | ||
} | ||
} | ||
function innerPatch(target, patchToApply) { | ||
@@ -471,6 +479,6 @@ // TODO: get all keys like symbols as well | ||
if (!store) { | ||
stores.set(id, | ||
// @ts-ignore | ||
(store = buildStore(id, state, getters, actions, getInitialState(id)))); | ||
if (IS_CLIENT && false /*|| __FEATURE_PROD_DEVTOOLS__*/) { | ||
stores.set(id, (store = withScope(() => buildStore(id, state, getters, actions, getInitialState(id))))); | ||
if (IS_CLIENT && | ||
false && | ||
false /*|| __FEATURE_PROD_DEVTOOLS__*/) { | ||
const app = getClientApp(); | ||
@@ -477,0 +485,0 @@ if (app) { |
/*! | ||
* pinia v2.0.0-alpha.3 | ||
* pinia v2.0.0-alpha.4 | ||
* (c) 2020 Eduardo San Martin Morote | ||
* @license MIT | ||
*/ | ||
import { getCurrentInstance, inject, ref, watch, computed, reactive } from 'vue'; | ||
import { createApp, getCurrentInstance, inject, ref, watch, computed, reactive } from 'vue'; | ||
@@ -336,2 +336,21 @@ /** | ||
const IS_CLIENT = typeof window !== 'undefined'; | ||
function withScope(factory) { | ||
if ( IS_CLIENT) { | ||
let store; | ||
createApp({ | ||
setup() { | ||
store = factory(); | ||
return () => null; | ||
}, | ||
}).mount(document.createElement('div')); | ||
// TODO: collect apps to be unmounted when the main app is unmounted | ||
return store; | ||
} | ||
else { | ||
// no need to wrap with an app on SSR | ||
return factory(); | ||
} | ||
} | ||
function innerPatch(target, patchToApply) { | ||
@@ -468,6 +487,6 @@ // TODO: get all keys like symbols as well | ||
if (!store) { | ||
stores.set(id, | ||
// @ts-ignore | ||
(store = buildStore(id, state, getters, actions, getInitialState(id)))); | ||
if (IS_CLIENT && true /*|| __FEATURE_PROD_DEVTOOLS__*/) { | ||
stores.set(id, (store = withScope(() => buildStore(id, state, getters, actions, getInitialState(id))))); | ||
if (IS_CLIENT && | ||
true && | ||
true /*|| __FEATURE_PROD_DEVTOOLS__*/) { | ||
const app = getClientApp(); | ||
@@ -474,0 +493,0 @@ if (app) { |
/*! | ||
* pinia v2.0.0-alpha.3 | ||
* pinia v2.0.0-alpha.4 | ||
* (c) 2020 Eduardo San Martin Morote | ||
* @license MIT | ||
*/ | ||
import { getCurrentInstance, inject, ref, watch, computed, reactive } from 'vue'; | ||
import { createApp, getCurrentInstance, inject, ref, watch, computed, reactive } from 'vue'; | ||
@@ -337,2 +337,21 @@ /** | ||
const IS_CLIENT = typeof window !== 'undefined'; | ||
function withScope(factory) { | ||
if ( IS_CLIENT) { | ||
let store; | ||
createApp({ | ||
setup() { | ||
store = factory(); | ||
return () => null; | ||
}, | ||
}).mount(document.createElement('div')); | ||
// TODO: collect apps to be unmounted when the main app is unmounted | ||
return store; | ||
} | ||
else { | ||
// no need to wrap with an app on SSR | ||
return factory(); | ||
} | ||
} | ||
function innerPatch(target, patchToApply) { | ||
@@ -469,6 +488,6 @@ // TODO: get all keys like symbols as well | ||
if (!store) { | ||
stores.set(id, | ||
// @ts-ignore | ||
(store = buildStore(id, state, getters, actions, getInitialState(id)))); | ||
if (IS_CLIENT && (process.env.NODE_ENV !== 'production') /*|| __FEATURE_PROD_DEVTOOLS__*/) { | ||
stores.set(id, (store = withScope(() => buildStore(id, state, getters, actions, getInitialState(id))))); | ||
if (IS_CLIENT && | ||
true && | ||
(process.env.NODE_ENV !== 'production') /*|| __FEATURE_PROD_DEVTOOLS__*/) { | ||
const app = getClientApp(); | ||
@@ -475,0 +494,0 @@ if (app) { |
/*! | ||
* pinia v2.0.0-alpha.3 | ||
* pinia v2.0.0-alpha.4 | ||
* (c) 2020 Eduardo San Martin Morote | ||
@@ -337,2 +337,21 @@ * @license MIT | ||
const IS_CLIENT = typeof window !== 'undefined'; | ||
function withScope(factory) { | ||
if ( IS_CLIENT) { | ||
let store; | ||
vue.createApp({ | ||
setup() { | ||
store = factory(); | ||
return () => null; | ||
}, | ||
}).mount(document.createElement('div')); | ||
// TODO: collect apps to be unmounted when the main app is unmounted | ||
return store; | ||
} | ||
else { | ||
// no need to wrap with an app on SSR | ||
return factory(); | ||
} | ||
} | ||
function innerPatch(target, patchToApply) { | ||
@@ -469,6 +488,6 @@ // TODO: get all keys like symbols as well | ||
if (!store) { | ||
stores.set(id, | ||
// @ts-ignore | ||
(store = buildStore(id, state, getters, actions, getInitialState(id)))); | ||
if (IS_CLIENT && true /*|| __FEATURE_PROD_DEVTOOLS__*/) { | ||
stores.set(id, (store = withScope(() => buildStore(id, state, getters, actions, getInitialState(id))))); | ||
if (IS_CLIENT && | ||
true && | ||
true /*|| __FEATURE_PROD_DEVTOOLS__*/) { | ||
const app = getClientApp(); | ||
@@ -475,0 +494,0 @@ if (app) { |
/*! | ||
* pinia v2.0.0-alpha.3 | ||
* pinia v2.0.0-alpha.4 | ||
* (c) 2020 Eduardo San Martin Morote | ||
* @license MIT | ||
*/ | ||
var Pinia=function(e,t){"use strict";let n={};const o=e=>e&&(n=e),r=()=>n,i=new WeakMap,u=new WeakMap;let c;const a=Symbol();new Set;function s(e){return e&&"object"==typeof e&&"[object Object]"===Object.prototype.toString.call(e)&&"function"!=typeof e.toJSON}var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function l(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},n.exports),n.exports}var p=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.hook=t.target=t.isBrowser=void 0,t.isBrowser="undefined"!=typeof navigator,t.target=t.isBrowser?window:void 0!==f?f:{},t.hook=t.target.__VUE_DEVTOOLS_GLOBAL_HOOK__})),_=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ApiHookEvents=void 0,function(e){e.SETUP_DEVTOOLS_PLUGIN="devtools-plugin:setup"}(t.ApiHookEvents||(t.ApiHookEvents={}))})),d=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),O=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),E=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),v=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),P=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Hooks=void 0,function(e){e.TRANSFORM_CALL="transformCall",e.GET_APP_RECORD_NAME="getAppRecordName",e.GET_APP_ROOT_INSTANCE="getAppRootInstance",e.REGISTER_APPLICATION="registerApplication",e.WALK_COMPONENT_TREE="walkComponentTree",e.WALK_COMPONENT_PARENTS="walkComponentParents",e.INSPECT_COMPONENT="inspectComponent",e.GET_COMPONENT_BOUNDS="getComponentBounds",e.GET_COMPONENT_NAME="getComponentName",e.GET_ELEMENT_COMPONENT="getElementComponent",e.GET_INSPECTOR_TREE="getInspectorTree",e.GET_INSPECTOR_STATE="getInspectorState"}(t.Hooks||(t.Hooks={}))})),T=l((function(e,t){var n=f&&f.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),o=f&&f.__exportStar||function(e,t){for(var o in e)"default"===o||t.hasOwnProperty(o)||n(t,e,o)};Object.defineProperty(t,"__esModule",{value:!0}),o(d,t),o(O,t),o(E,t),o(v,t),o(P,t)}));l((function(e,t){var n=f&&f.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),o=f&&f.__exportStar||function(e,t){for(var o in e)"default"===o||t.hasOwnProperty(o)||n(t,e,o)};Object.defineProperty(t,"__esModule",{value:!0}),t.setupDevtoolsPlugin=void 0,o(T,t),t.setupDevtoolsPlugin=function(e,t){if(p.hook)p.hook.emit(_.ApiHookEvents.SETUP_DEVTOOLS_PLUGIN,e,t);else{(p.target.__VUE_DEVTOOLS_PLUGINS__=p.target.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:e,setupFn:t})}}}));function g(e,t){for(const n in t){const o=t[n],r=e[n];e[n]=s(r)&&s(o)?g(r,o):o}return e}function N(e){const n={};for(const o in e.value)n[o]=t.computed({get:()=>e.value[o],set:t=>e.value[o]=t});return n}function y(e,n=(()=>({})),i={},u={},c){const a=t.ref(c||n()),s=r();let f=!0,l=[];t.watch(()=>a.value,t=>{f&&l.forEach(n=>{n({storeName:e,type:"๐งฉ in place",payload:{}},t)})},{deep:!0,flush:"sync"});const p={id:e,_r:s,state:t.computed({get:()=>a.value,set:e=>{f=!1,a.value=e,f=!0}}),patch:function(t){f=!1,g(a.value,t),f=!0,l.forEach(n=>{n({storeName:e,type:"โคต๏ธ patch",payload:t},a.value)})},subscribe:function(e){return l.push(e),()=>{const t=l.indexOf(e);t>-1&&l.splice(t,1)}},reset:function(){l=[],a.value=n()}},_={};for(const e in i)_[e]=t.computed(()=>(o(s),i[e].call(O,O)));const d={};for(const e in u)d[e]=function(){return o(s),u[e].apply(O,arguments)};const O=t.reactive({...p,...N(a),..._,...d});return O}function S(e){const{id:n,state:c,getters:s,actions:f}=e;return function(e){(e=e||t.getCurrentInstance()&&t.inject(a))&&o(e);const l=r();let p=i.get(l);p||i.set(l,p=new Map);let _=p.get(n);return _||p.set(n,_=y(n,c,s,f,function(e){const t=u.get(r());return t&&t()[e]}(n))),_}}return e.createPinia=function(){const e={install(t){t.provide(a,e),(e=>{c=e})(t)},store:t=>t(e)};return e},e.createStore=e=>(console.warn('[๐]: "createStore" has been deprecated and will be removed on the sable release, use "defineStore" instead.'),S(e)),e.defineStore=S,e.getRootState=function(e){const t=i.get(e);if(!t)return{};const n={};return t.forEach(e=>{n[e.id]=e.state}),n},e.setActiveReq=o,e.setStateProvider=function(e){u.set(r(),e)},e}({},Vue); | ||
var Pinia=function(e,t){"use strict";let n={};const o=e=>e&&(n=e),r=()=>n,i=new WeakMap,u=new WeakMap;let c;const a=Symbol();new Set;function s(e){return e&&"object"==typeof e&&"[object Object]"===Object.prototype.toString.call(e)&&"function"!=typeof e.toJSON}var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function l(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},n.exports),n.exports}var p=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.hook=t.target=t.isBrowser=void 0,t.isBrowser="undefined"!=typeof navigator,t.target=t.isBrowser?window:void 0!==f?f:{},t.hook=t.target.__VUE_DEVTOOLS_GLOBAL_HOOK__})),d=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ApiHookEvents=void 0,function(e){e.SETUP_DEVTOOLS_PLUGIN="devtools-plugin:setup"}(t.ApiHookEvents||(t.ApiHookEvents={}))})),_=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),O=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),E=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),v=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),P=l((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Hooks=void 0,function(e){e.TRANSFORM_CALL="transformCall",e.GET_APP_RECORD_NAME="getAppRecordName",e.GET_APP_ROOT_INSTANCE="getAppRootInstance",e.REGISTER_APPLICATION="registerApplication",e.WALK_COMPONENT_TREE="walkComponentTree",e.WALK_COMPONENT_PARENTS="walkComponentParents",e.INSPECT_COMPONENT="inspectComponent",e.GET_COMPONENT_BOUNDS="getComponentBounds",e.GET_COMPONENT_NAME="getComponentName",e.GET_ELEMENT_COMPONENT="getElementComponent",e.GET_INSPECTOR_TREE="getInspectorTree",e.GET_INSPECTOR_STATE="getInspectorState"}(t.Hooks||(t.Hooks={}))})),T=l((function(e,t){var n=f&&f.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),o=f&&f.__exportStar||function(e,t){for(var o in e)"default"===o||t.hasOwnProperty(o)||n(t,e,o)};Object.defineProperty(t,"__esModule",{value:!0}),o(_,t),o(O,t),o(E,t),o(v,t),o(P,t)}));l((function(e,t){var n=f&&f.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),o=f&&f.__exportStar||function(e,t){for(var o in e)"default"===o||t.hasOwnProperty(o)||n(t,e,o)};Object.defineProperty(t,"__esModule",{value:!0}),t.setupDevtoolsPlugin=void 0,o(T,t),t.setupDevtoolsPlugin=function(e,t){if(p.hook)p.hook.emit(d.ApiHookEvents.SETUP_DEVTOOLS_PLUGIN,e,t);else{(p.target.__VUE_DEVTOOLS_PLUGINS__=p.target.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:e,setupFn:t})}}}));const g="undefined"!=typeof window;function N(e,t){for(const n in t){const o=t[n],r=e[n];e[n]=s(r)&&s(o)?N(r,o):o}return e}function y(e){const n={};for(const o in e.value)n[o]=t.computed({get:()=>e.value[o],set:t=>e.value[o]=t});return n}function S(e,n=(()=>({})),i={},u={},c){const a=t.ref(c||n()),s=r();let f=!0,l=[];t.watch(()=>a.value,t=>{f&&l.forEach(n=>{n({storeName:e,type:"๐งฉ in place",payload:{}},t)})},{deep:!0,flush:"sync"});const p={id:e,_r:s,state:t.computed({get:()=>a.value,set:e=>{f=!1,a.value=e,f=!0}}),patch:function(t){f=!1,N(a.value,t),f=!0,l.forEach(n=>{n({storeName:e,type:"โคต๏ธ patch",payload:t},a.value)})},subscribe:function(e){return l.push(e),()=>{const t=l.indexOf(e);t>-1&&l.splice(t,1)}},reset:function(){l=[],a.value=n()}},d={};for(const e in i)d[e]=t.computed(()=>(o(s),i[e].call(O,O)));const _={};for(const e in u)_[e]=function(){return o(s),u[e].apply(O,arguments)};const O=t.reactive({...p,...y(a),...d,..._});return O}function b(e){const{id:n,state:c,getters:s,actions:f}=e;return function(e){(e=e||t.getCurrentInstance()&&t.inject(a))&&o(e);const l=r();let p=i.get(l);p||i.set(l,p=new Map);let d=p.get(n);return d||p.set(n,d=function(e){if(g){let n;return t.createApp({setup:()=>(n=e(),()=>null)}).mount(document.createElement("div")),n}return e()}(()=>S(n,c,s,f,function(e){const t=u.get(r());return t&&t()[e]}(n)))),d}}return e.createPinia=function(){const e={install(t){t.provide(a,e),(e=>{c=e})(t)},store:t=>t(e)};return e},e.createStore=e=>(console.warn('[๐]: "createStore" has been deprecated and will be removed on the sable release, use "defineStore" instead.'),b(e)),e.defineStore=b,e.getRootState=function(e){const t=i.get(e);if(!t)return{};const n={};return t.forEach(e=>{n[e.id]=e.state}),n},e.setActiveReq=o,e.setStateProvider=function(e){u.set(r(),e)},e}({},Vue); |
{ | ||
"name": "pinia", | ||
"version": "2.0.0-alpha.3", | ||
"version": "2.0.0-alpha.4", | ||
"description": "Some awesome description", | ||
@@ -62,2 +62,3 @@ "main": "dist/pinia.cjs.js", | ||
"@vue/server-renderer": "^3.0.0", | ||
"@vue/test-utils": "^2.0.0-beta.5", | ||
"brotli": "^1.3.2", | ||
@@ -64,0 +65,0 @@ "codecov": "^3.6.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113982
2515
26