]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
refactor: remove nuxt 2 code
authorEduardo San Martin Morote <posva13@gmail.com>
Sat, 1 Feb 2025 22:25:58 +0000 (23:25 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Sat, 1 Feb 2025 22:25:58 +0000 (23:25 +0100)
packages/nuxt/package.json
packages/nuxt/src/module.ts

index 89ce8790b6ad158dbed44760a5219b4f1fc1c3d7..4f0fc8bed7ef8a42c3d4ff8aea5a06721dbcd292 100644 (file)
     "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:^",
index b425bda4e4cf2b7ff903ac1f5673b20c3de1cdaa..3ece342a93ddec4fa3b08272f8d45b6f3db3975f 100644 (file)
@@ -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<ModuleOptions> = defineNuxtModule<ModuleOptions>({
     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<ModuleOptions> = defineNuxtModule<ModuleOptions>({
     // 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