From: Eduardo San Martin Morote Date: Sat, 1 Feb 2025 22:25:58 +0000 (+0100) Subject: refactor: remove nuxt 2 code X-Git-Tag: @pinia/nuxt@0.10.0~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc9d968abc2bed975c53e9749a8299199afb02ea;p=thirdparty%2Fvuejs%2Fpinia.git refactor: remove nuxt 2 code --- diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index 89ce8790..4f0fc8be 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -46,14 +46,14 @@ "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.15.0" }, "peerDependencies": { "pinia": "workspace:^" }, "devDependencies": { "@nuxt/module-builder": "^0.8.4", - "@nuxt/schema": "^3.9.0", + "@nuxt/schema": "^3.15.0", "@nuxt/test-utils": "^3.15.4", "nuxt": "^3.15.4", "pinia": "workspace:^", diff --git a/packages/nuxt/src/module.ts b/packages/nuxt/src/module.ts index b425bda4..3ece342a 100644 --- a/packages/nuxt/src/module.ts +++ b/packages/nuxt/src/module.ts @@ -13,14 +13,6 @@ import type { NuxtModule } from '@nuxt/schema' import { fileURLToPath } from 'node:url' export interface ModuleOptions { - /** - * Pinia disables Vuex by default, set this option to `false` to avoid it and - * use Pinia alongside Vuex (Nuxt 2 only) - * - * @default `true` - */ - disableVuex?: boolean - /** * Automatically add stores dirs to the auto imports. This is the same as * directly adding the dirs to the `imports.dirs` option. If you want to @@ -36,29 +28,15 @@ const module: NuxtModule = defineNuxtModule({ name: 'pinia', configKey: 'pinia', compatibility: { - nuxt: '^2.0.0 || >=3.13.0', - bridge: true, + nuxt: '^3.15.0', }, }, - defaults: { - disableVuex: true, - }, + defaults: {}, setup(options, nuxt) { // configure transpilation const { resolve } = createResolver(import.meta.url) const runtimeDir = fileURLToPath(new URL('./runtime', import.meta.url)) - // Disable default Vuex store (Nuxt v2.10+ only) - if ( - nuxt.options.features && - // ts - options.disableVuex && - isNuxtMajorVersion(2, nuxt) - ) { - // @ts-expect-error: no `store` feature flag in nuxt v3 - nuxt.options.features.store = false - } - // Transpile runtime nuxt.options.build.transpile.push(resolve(runtimeDir)) @@ -76,12 +54,8 @@ const module: NuxtModule = defineNuxtModule({ // Add runtime plugin before the router plugin // https://github.com/nuxt/framework/issues/9130 nuxt.hook('modules:done', () => { - if (isNuxtMajorVersion(2, nuxt)) { - addPlugin(resolve(runtimeDir, 'plugin.vue2')) - } else { - addPlugin(resolve(runtimeDir, 'plugin.vue3')) - addPlugin(resolve(runtimeDir, 'payload-plugin')) - } + addPlugin(resolve(runtimeDir, 'plugin.vue3')) + addPlugin(resolve(runtimeDir, 'payload-plugin')) }) // Add auto imports