Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
]
},
"resolutions": {
"@nuxt/kit": "^3.9.0",
"@nuxt/schema": "^3.9.0"
},
"pnpm": {
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . -l @pinia/nuxt -r 1"
},
"dependencies": {
"@nuxt/kit": "^3.9.0"
"@nuxt/kit": "^3.19.1"
},
"peerDependencies": {
"pinia": "workspace:^"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default defineNuxtConfig({})
5 changes: 5 additions & 0 deletions packages/nuxt/playground/layers/layer-domain/stores/basic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const useBasicStore = defineStore('layer-basic', () => {
const count = ref(0)

return { count }
})
5 changes: 3 additions & 2 deletions packages/nuxt/playground/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

const counter = useCounter()

useTestStore()
useSomeStoreStore()
useTestStore() // ~/domain/one/stores/testStore.ts
useSomeStoreStore() // ~/stores/nested/some-stores.ts
useBasicStore() // ~~/layers/layer-domain/stores/basic.ts

// await useAsyncData('counter', () => counter.asyncIncrement().then(() => true))

Expand Down
7 changes: 7 additions & 0 deletions packages/nuxt/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
addImports,
createResolver,
addImportsDir,
getLayerDirectories,
} from '@nuxt/kit'
import type { NuxtModule } from '@nuxt/schema'
import { fileURLToPath } from 'node:url'
Expand Down Expand Up @@ -73,8 +74,14 @@ const module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({
}

if (options.storesDirs) {
const layers = getLayerDirectories(nuxt)

for (const storeDir of options.storesDirs) {
addImportsDir(resolve(nuxt.options.rootDir, storeDir))

for (const layer of layers) {
addImportsDir(resolve(layer.app, storeDir))
}
}
}
},
Expand Down
Loading
Loading