From: Eduardo San Martin Morote Date: Wed, 3 Nov 2021 15:14:16 +0000 (+0100) Subject: refactor: use PiniaPlugin X-Git-Tag: @pinia/nuxt@0.1.1~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5a2a38d0077d4603e390f8e8e3ceafd0835a4cf3;p=thirdparty%2Fvuejs%2Fpinia.git refactor: use PiniaPlugin --- diff --git a/packages/docs/cookbook/migration-v1-v2.md b/packages/docs/cookbook/migration-v1-v2.md index 23a6239b..36aca78a 100644 --- a/packages/docs/cookbook/migration-v1-v2.md +++ b/packages/docs/cookbook/migration-v1-v2.md @@ -63,7 +63,7 @@ If you were writing plugins, using TypeScript, and extending the type `DefineSto ## `PiniaStorePLugin` was renamed -The type `PiniaStorePlugin` was renamed to `PiniaPlugin` +The type `PiniaStorePlugin` was renamed to `PiniaPlugin`. ```diff -import { PiniaStorePlugin } from 'pinia' diff --git a/packages/pinia/src/createPinia.ts b/packages/pinia/src/createPinia.ts index 4b362c6f..acd97612 100644 --- a/packages/pinia/src/createPinia.ts +++ b/packages/pinia/src/createPinia.ts @@ -1,9 +1,4 @@ -import { - Pinia, - PiniaStorePlugin, - setActivePinia, - piniaSymbol, -} from './rootStore' +import { Pinia, PiniaPlugin, setActivePinia, piniaSymbol } from './rootStore' import { ref, App, markRaw, effectScope, isVue2 } from 'vue-demi' import { registerPiniaDevtools, devtoolsPlugin } from './devtools' import { IS_CLIENT } from './env' @@ -20,7 +15,7 @@ export function createPinia(): Pinia { let _p: Pinia['_p'] = [] // plugins added before calling app.use(pinia) - let toBeInstalled: PiniaStorePlugin[] = [] + let toBeInstalled: PiniaPlugin[] = [] const pinia: Pinia = markRaw({ install(app: App) { diff --git a/packages/pinia/src/rootStore.ts b/packages/pinia/src/rootStore.ts index e2be8960..833566dd 100644 --- a/packages/pinia/src/rootStore.ts +++ b/packages/pinia/src/rootStore.ts @@ -4,7 +4,6 @@ import { getCurrentInstance, inject, InjectionKey, - Plugin, Ref, } from 'vue-demi' import { @@ -56,14 +55,14 @@ export interface Pinia { * * @param plugin - store plugin to add */ - use(plugin: PiniaStorePlugin): Pinia + use(plugin: PiniaPlugin): Pinia /** * Installed store plugins * * @internal */ - _p: Array + _p: PiniaPlugin[] /** * App linked to this Pinia instance diff --git a/packages/testing/src/testing.ts b/packages/testing/src/testing.ts index 7a292bc5..8bd35fe1 100644 --- a/packages/testing/src/testing.ts +++ b/packages/testing/src/testing.ts @@ -1,12 +1,12 @@ import { App, createApp } from 'vue-demi' -import { Pinia, PiniaStorePlugin, setActivePinia, createPinia } from 'pinia' +import { Pinia, PiniaPlugin, setActivePinia, createPinia } from 'pinia' export interface TestingOptions { /** * Plugins to be installed before the testing plugin. Add any plugins used in * your application that will be used while testing. */ - plugins?: PiniaStorePlugin[] + plugins?: PiniaPlugin[] /** * When set to false, actions are only spied, they still get executed. When