From ab2fde3a8b3cc6392569bd856654e9e645ba46fb Mon Sep 17 00:00:00 2001 From: Pouya Date: Wed, 27 Sep 2023 00:10:32 +0330 Subject: [PATCH] feat: Add storeToRefs to the auto imports in @pinia/nuxt #1876 --- packages/docs/.vitepress/config/index.ts | 6 +++--- .../nuxt/playground/domain/one/stores/testStore.ts | 10 ++++++++++ packages/nuxt/src/module.ts | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/docs/.vitepress/config/index.ts b/packages/docs/.vitepress/config/index.ts index 36916271a8..b4b2dfa689 100644 --- a/packages/docs/.vitepress/config/index.ts +++ b/packages/docs/.vitepress/config/index.ts @@ -20,9 +20,9 @@ export default defineConfig({ link: 'https://pinia.vuejs.kr/', }, pt: { - label: 'Português', - lang: 'pt-PT', - link: 'https://pinia-docs-pt.netlify.app/', + label: 'Português', + lang: 'pt-PT', + link: 'https://pinia-docs-pt.netlify.app/', }, uk: { label: 'Українська', diff --git a/packages/nuxt/playground/domain/one/stores/testStore.ts b/packages/nuxt/playground/domain/one/stores/testStore.ts index b4affbe1f8..3fffd1d393 100644 --- a/packages/nuxt/playground/domain/one/stores/testStore.ts +++ b/packages/nuxt/playground/domain/one/stores/testStore.ts @@ -1,4 +1,14 @@ +// import { storeToRefs } from "pinia" + export const useTestStore = defineStore('test', () => { console.log('I was defined within a store directory') + + // Should work without any error or importing + const { count, getCount } = storeToRefs(useCounter()) + console.log( + 'storeToRefs works without importing (Nuxt) !', + count.value === getCount.value + ) + return {} }) diff --git a/packages/nuxt/src/module.ts b/packages/nuxt/src/module.ts index e02f61177c..9fed9d39a6 100644 --- a/packages/nuxt/src/module.ts +++ b/packages/nuxt/src/module.ts @@ -90,6 +90,7 @@ const module: NuxtModule = defineNuxtModule({ { from: composables, name: 'defineStore' }, { from: composables, name: 'acceptHMRUpdate' }, { from: composables, name: 'usePinia' }, + { from: composables, name: 'storeToRefs' }, ]) if (options.storesDirs) {