From 21a585a98709156ead8c7b50b65f5fc7c2509af9 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Wed, 12 Feb 2025 12:04:12 +0100 Subject: [PATCH] chore: deleted unused file --- packages/pinia/src/index.ts | 2 - packages/pinia/src/vue2-plugin.ts | 71 ------------------------------- vitest.config.ts | 1 - 3 files changed, 74 deletions(-) delete mode 100644 packages/pinia/src/vue2-plugin.ts diff --git a/packages/pinia/src/index.ts b/packages/pinia/src/index.ts index 87f845cf..c398e016 100644 --- a/packages/pinia/src/index.ts +++ b/packages/pinia/src/index.ts @@ -76,6 +76,4 @@ export type { export { acceptHMRUpdate } from './hmr' -export { PiniaVuePlugin } from './vue2-plugin' - export * from './globalExtensions' diff --git a/packages/pinia/src/vue2-plugin.ts b/packages/pinia/src/vue2-plugin.ts deleted file mode 100644 index 2ca3d052..00000000 --- a/packages/pinia/src/vue2-plugin.ts +++ /dev/null @@ -1,71 +0,0 @@ -import type { Plugin } from 'vue' -import { registerPiniaDevtools } from './devtools' -import { IS_CLIENT } from './env' -import { Pinia, piniaSymbol, setActivePinia } from './rootStore' - -/** - * Vue 2 Plugin that must be installed for pinia to work. Note **you don't need - * this plugin if you are using Nuxt.js**. Use the `buildModule` instead: - * https://pinia.vuejs.org/ssr/nuxt.html. - * - * @example - * ```js - * import Vue from 'vue' - * import { PiniaVuePlugin, createPinia } from 'pinia' - * - * Vue.use(PiniaVuePlugin) - * const pinia = createPinia() - * - * new Vue({ - * el: '#app', - * // ... - * pinia, - * }) - * ``` - * - * @param _Vue - `Vue` imported from 'vue'. - */ -export const PiniaVuePlugin: Plugin = function (_Vue) { - // Equivalent of - // app.config.globalProperties.$pinia = pinia - _Vue.mixin({ - beforeCreate() { - const options = this.$options - if (options.pinia) { - const pinia = options.pinia as Pinia - // HACK: taken from provide(): https://github.com/vuejs/composition-api/blob/main/src/apis/inject.ts#L31 - /* istanbul ignore else */ - if (!(this as any)._provided) { - const provideCache = {} - Object.defineProperty(this, '_provided', { - get: () => provideCache, - set: (v) => Object.assign(provideCache, v), - }) - } - ;(this as any)._provided[piniaSymbol as any] = pinia - - // propagate the pinia instance in an SSR friendly way - // avoid adding it to nuxt twice - /* istanbul ignore else */ - if (!this.$pinia) { - this.$pinia = pinia - } - - pinia._a = this as any - if (IS_CLIENT) { - // this allows calling useStore() outside of a component setup after - // installing pinia's plugin - setActivePinia(pinia) - } - if (__USE_DEVTOOLS__ && IS_CLIENT) { - registerPiniaDevtools(pinia._a, pinia) - } - } else if (!this.$pinia && options.parent && options.parent.$pinia) { - this.$pinia = options.parent.$pinia - } - }, - destroyed() { - delete this._pStores - }, - }) -} diff --git a/vitest.config.ts b/vitest.config.ts index 592825c5..187a4d14 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -54,7 +54,6 @@ export default defineConfig({ '**/src/index.ts', '**/*.test-d.ts', 'packages/pinia/src/devtools', - 'packages/pinia/src/vue2-plugin.ts', 'packages/pinia/src/hmr.ts', ], }, -- 2.47.3