From acd577ac6beedc3a4c13ef70a8efb839323bb20d Mon Sep 17 00:00:00 2001 From: Corbin Crutchley Date: Fri, 9 Oct 2026 16:41:18 -0700 Subject: [PATCH] chore: remove Vue 2 support --- .changeset/grumpy-hairs-shop.md | 7 +++ .github/renovate.json | 4 +- docs/installation.md | 2 +- knip.json | 3 - packages/vue-store/package.json | 22 ++----- packages/vue-store/src/_useStore.ts | 2 +- packages/vue-store/src/useAtom.ts | 2 +- packages/vue-store/src/useSelector.ts | 4 +- packages/vue-store/src/useStore.ts | 2 +- packages/vue-store/tests/index.test.tsx | 2 +- packages/vue-store/tests/test.test-d.ts | 2 +- pnpm-lock.yaml | 78 +------------------------ pnpm-workspace.yaml | 10 ---- 13 files changed, 21 insertions(+), 119 deletions(-) create mode 100644 .changeset/grumpy-hairs-shop.md diff --git a/.changeset/grumpy-hairs-shop.md b/.changeset/grumpy-hairs-shop.md new file mode 100644 index 00000000..4b417a31 --- /dev/null +++ b/.changeset/grumpy-hairs-shop.md @@ -0,0 +1,7 @@ +--- +'@tanstack/vue-store': major +--- + +Drop Vue 2 support from `@tanstack/vue-store`. The adapter now requires Vue 3 (`vue: ^3.0.0`) and imports Vue APIs and types directly, removing its `vue-demi` dependency and optional `@vue/composition-api` peer dependency. + +Vue 2 applications must upgrade to Vue 3 or keep using a previous version of `@tanstack/vue-store`. The adapter's public hooks and their behavior are unchanged for Vue 3 applications. diff --git a/.github/renovate.json b/.github/renovate.json index eecf09c7..cf5493ac 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -28,8 +28,6 @@ "typescript50", "typescript51", "typescript52", - "typescript53", - "vue2", - "vue2.7" + "typescript53" ] } diff --git a/docs/installation.md b/docs/installation.md index 6db7a2c4..035f9654 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -27,7 +27,7 @@ TanStack Store is compatible with Preact 10+. npm install @tanstack/vue-store ``` -TanStack Store is compatible with Vue 2 and 3. +TanStack Store is compatible with Vue 3. ## Angular diff --git a/knip.json b/knip.json index 1be79759..84210695 100644 --- a/knip.json +++ b/knip.json @@ -3,9 +3,6 @@ "workspaces": { "packages/store": { "entry": ["src/signal.ts"] - }, - "packages/vue-store": { - "ignoreDependencies": ["vue2", "vue2.7"] } }, "ignoreWorkspaces": ["examples/**"] diff --git a/packages/vue-store/package.json b/packages/vue-store/package.json index b6517925..929c7d9e 100644 --- a/packages/vue-store/package.json +++ b/packages/vue-store/package.json @@ -27,11 +27,7 @@ "test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js", "test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js", "test:types:ts59": "tsc", - "test:lib": "pnpm run test:lib:3", - "test:lib:2": "vue-demi-switch 2 vue2 && vitest", - "test:lib:2.7": "vue-demi-switch 2.7 vue2.7 && vitest", - "test:lib:3": "vue-demi-switch 3 && vitest", - "test:lib:fixme": "pnpm run test:lib:2 && pnpm run test:lib:2.7 && pnpm run test:lib:3", + "test:lib": "vitest", "test:lib:dev": "pnpm run test:lib --watch", "test:build": "publint --strict", "build": "tsdown --tsconfig tsconfig.build.json" @@ -53,24 +49,14 @@ "src" ], "dependencies": { - "@tanstack/store": "workspace:*", - "vue-demi": "^0.14.10" + "@tanstack/store": "workspace:*" }, "devDependencies": { "@testing-library/vue": "^8.1.0", "@vitejs/plugin-vue": "^6.0.5", - "@vue/composition-api": "^1.7.2", - "vue": "^3.5.43", - "vue2": "npm:vue@2.6", - "vue2.7": "npm:vue@2.7" + "vue": "^3.5.43" }, "peerDependencies": { - "@vue/composition-api": "^1.2.1", - "vue": "^2.5.0 || ^3.0.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } + "vue": "^3.0.0" } } diff --git a/packages/vue-store/src/_useStore.ts b/packages/vue-store/src/_useStore.ts index f7401fb8..8e990f7c 100644 --- a/packages/vue-store/src/_useStore.ts +++ b/packages/vue-store/src/_useStore.ts @@ -1,5 +1,5 @@ import { useSelector } from './useSelector' -import type { Ref } from 'vue-demi' +import type { Ref } from 'vue' import type { Store, StoreActionMap } from '@tanstack/store' import type { UseSelectorOptions } from './useSelector' diff --git a/packages/vue-store/src/useAtom.ts b/packages/vue-store/src/useAtom.ts index 44680038..f5271d64 100644 --- a/packages/vue-store/src/useAtom.ts +++ b/packages/vue-store/src/useAtom.ts @@ -1,5 +1,5 @@ import { useSelector } from './useSelector' -import type { Ref } from 'vue-demi' +import type { Ref } from 'vue' import type { Atom } from '@tanstack/store' import type { UseSelectorOptions } from './useSelector' diff --git a/packages/vue-store/src/useSelector.ts b/packages/vue-store/src/useSelector.ts index 1a3cea66..1ed054e4 100644 --- a/packages/vue-store/src/useSelector.ts +++ b/packages/vue-store/src/useSelector.ts @@ -1,5 +1,5 @@ -import { onScopeDispose, readonly, shallowRef, toRaw } from 'vue-demi' -import type { Ref } from 'vue-demi' +import { onScopeDispose, readonly, shallowRef, toRaw } from 'vue' +import type { Ref } from 'vue' export interface UseSelectorOptions { compare?: (a: TSelected, b: TSelected) => boolean diff --git a/packages/vue-store/src/useStore.ts b/packages/vue-store/src/useStore.ts index 7b6d1346..7a273d8b 100644 --- a/packages/vue-store/src/useStore.ts +++ b/packages/vue-store/src/useStore.ts @@ -1,5 +1,5 @@ import { useSelector } from './useSelector' -import type { Ref } from 'vue-demi' +import type { Ref } from 'vue' /** * Deprecated alias for {@link useSelector}. diff --git a/packages/vue-store/tests/index.test.tsx b/packages/vue-store/tests/index.test.tsx index f9a2d0ce..a2a7c678 100644 --- a/packages/vue-store/tests/index.test.tsx +++ b/packages/vue-store/tests/index.test.tsx @@ -1,5 +1,5 @@ import { describe, expect, it, test, vi } from 'vitest' -import { defineComponent, h } from 'vue-demi' +import { defineComponent, h } from 'vue' import { render, waitFor } from '@testing-library/vue' import { createAtom, createStore } from '@tanstack/store' import { userEvent } from '@testing-library/user-event' diff --git a/packages/vue-store/tests/test.test-d.ts b/packages/vue-store/tests/test.test-d.ts index 77410538..6a1c9151 100644 --- a/packages/vue-store/tests/test.test-d.ts +++ b/packages/vue-store/tests/test.test-d.ts @@ -1,7 +1,7 @@ import { expectTypeOf, test } from 'vitest' import { createAtom, createStore } from '@tanstack/store' import { _useStore, useAtom, useSelector, useStore } from '../src' -import type { Ref } from 'vue-demi' +import type { Ref } from 'vue' import type { Store } from '@tanstack/store' test('useSelector works with derived state', () => { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 43ad3839..edc8a422 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -162,7 +162,7 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false -packageExtensionsChecksum: sha256-QSjdHvOExHHSyNiVe6itFpAjt52AQVWz92MEbXECXgk= +packageExtensionsChecksum: sha256-iWMlPJFHrj45xVLCE2lxHogmkbbHqhVgFYbuj0g0l1k= importers: @@ -1399,9 +1399,6 @@ importers: '@tanstack/store': specifier: workspace:* version: link:../store - vue-demi: - specifier: ^0.14.10 - version: 0.14.10(@vue/composition-api@1.7.2(vue@3.5.43(typescript@6.0.3)))(vue@3.5.43(typescript@6.0.3)) devDependencies: '@testing-library/vue': specifier: ^8.1.0 @@ -1409,18 +1406,9 @@ importers: '@vitejs/plugin-vue': specifier: ^6.0.5 version: 6.0.5(vite@8.3.0(@types/node@26.6.4)(esbuild@0.28.2)(jiti@2.7.0)(less@4.4.2)(sass-embedded@1.104.1)(sass@1.104.1)(terser@5.46.0)(yaml@2.9.0))(vue@3.5.43(typescript@6.0.3)) - '@vue/composition-api': - specifier: ^1.7.2 - version: 1.7.2(vue@3.5.43(typescript@6.0.3)) vue: specifier: ^3.5.43 version: 3.5.43(typescript@6.0.3) - vue2: - specifier: npm:vue@2.6 - version: vue@2.6.14 - vue2.7: - specifier: npm:vue@2.7 - version: vue@2.7.16 packages: @@ -4295,7 +4283,6 @@ packages: '@types/unist@3.0.3': resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} - '@typescript-eslint/eslint-plugin@8.58.1': resolution: {integrity: sha512-eSkwoemjo76bdXl2MYqtxg51HNwUSkWfODUOQ3PaTLZGh9uIWWFZIjyjaJnex7wXDu+TRx+ATsnSxdN9YWfRTQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -4544,9 +4531,6 @@ packages: '@vue/compiler-dom@3.5.43': resolution: {integrity: sha512-PEZoAk3NQmsn/ejMzSOCyTYqwGqczrWm70PuhBKjjv1+TCoQAaO/zOqNwjV+honlNstT5ILxtc+8r8UUfj+iEQ==} - '@vue/compiler-sfc@2.7.16': - resolution: {integrity: sha512-KWhJ9k5nXuNtygPU7+t1rX6baZeqOYLEforUPjgNDBnLicfHCoi48H87Q8XyLZOrNNsmhuwKqtpDQWjEFe6Ekg==} - '@vue/compiler-sfc@3.5.32': resolution: {integrity: sha512-8UYUYo71cP/0YHMO814TRZlPuUUw3oifHuMR7Wp9SNoRSrxRQnhMLNlCeaODNn6kNTJsjFoQ/kqIj4qGvya4Xg==} @@ -4559,11 +4543,6 @@ packages: '@vue/compiler-ssr@3.5.43': resolution: {integrity: sha512-GF62orf7KiJX9RqrHNGrYBudsQGD0OhJ5nDs90O8UiDuS40+YMYomiXu6w6EuvtXuRDc3MSNis3EaaSKAVSWpg==} - '@vue/composition-api@1.7.2': - resolution: {integrity: sha512-M8jm9J/laYrYT02665HkZ5l2fWTK4dcVg3BsDHm/pfz+MjDYwX+9FUaZyGwEyXEDonQYRCo0H7aLgdklcIELjw==} - peerDependencies: - vue: '>= 2.5 < 2.7' - '@vue/language-core@3.2.6': resolution: {integrity: sha512-xYYYX3/aVup576tP/23sEUpgiEnujrENaoNRbaozC1/MA9I6EGFQRJb4xrt/MmUCAGlxTKL2RmT8JLTPqagCkg==} @@ -6633,11 +6612,6 @@ packages: prettier: ^3.0.0 svelte: ^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0 - prettier@2.8.8: - resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} - engines: {node: '>=10.13.0'} - hasBin: true - prettier@3.8.2: resolution: {integrity: sha512-8c3mgTe0ASwWAJK+78dpviD+A8EqhndQPUBpNUIPt6+xWlIigCwfN01lWr9MAede4uqXGTEKeQWTvzb3vjia0Q==} engines: {node: '>=14'} @@ -7469,7 +7443,6 @@ packages: uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} @@ -7641,17 +7614,6 @@ packages: vue-component-type-helpers@2.2.12: resolution: {integrity: sha512-YbGqHZ5/eW4SnkPNR44mKVc6ZKQoRs/Rux1sxC6rdwXb4qpbOSYfDr9DsTHolOTGmIKgM9j141mZbBeg05R1pw==} - vue-demi@0.14.10: - resolution: {integrity: sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==} - engines: {node: '>=12'} - hasBin: true - peerDependencies: - '@vue/composition-api': ^1.0.0-rc.1 - vue: ^3.0.0-0 || ^2.6.0 - peerDependenciesMeta: - '@vue/composition-api': - optional: true - vue-eslint-parser@10.4.0: resolution: {integrity: sha512-Vxi9pJdbN3ZnVGLODVtZ7y4Y2kzAAE2Cm0CZ3ZDRvydVYxZ6VrnBhLikBsRS+dpwj4Jv4UCv21PTEwF5rQ9WXg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -7664,14 +7626,6 @@ packages: peerDependencies: typescript: '>=5.0.0' - vue@2.6.14: - resolution: {integrity: sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ==} - deprecated: Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details. - - vue@2.7.16: - resolution: {integrity: sha512-4gCtFXaAA3zYZdTp5s4Hl2sozuySsgz4jy1EnpBHNfpMa9dK1ZCG7viqBPCwXtmgc8nHqUsAu3G4gtmXkkY3Sw==} - deprecated: Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details. - vue@3.5.32: resolution: {integrity: sha512-vM4z4Q9tTafVfMAK7IVzmxg34rSzTFMyIe0UUEijUCkn9+23lj0WRfA83dg7eQZIUlgOSGrkViIaCfqSAUXsMw==} peerDependencies: @@ -10293,7 +10247,6 @@ snapshots: '@types/unist@3.0.3': {} - '@typescript-eslint/eslint-plugin@8.58.1(@typescript-eslint/parser@8.58.1(eslint@10.10.0(jiti@2.7.0)(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3))(eslint@10.10.0(jiti@2.7.0)(supports-color@7.2.0))(supports-color@7.2.0)(typescript@6.0.3)': dependencies: '@eslint-community/regexpp': 4.12.2 @@ -10654,14 +10607,6 @@ snapshots: '@vue/compiler-core': 3.5.43 '@vue/shared': 3.5.43 - '@vue/compiler-sfc@2.7.16': - dependencies: - '@babel/parser': 7.29.8 - postcss: 8.5.28 - source-map: 0.6.1 - optionalDependencies: - prettier: 2.8.8 - '@vue/compiler-sfc@3.5.32': dependencies: '@babel/parser': 7.29.8 @@ -10696,10 +10641,6 @@ snapshots: '@vue/compiler-dom': 3.5.43 '@vue/shared': 3.5.43 - '@vue/composition-api@1.7.2(vue@3.5.43(typescript@6.0.3))': - dependencies: - vue: 3.5.43(typescript@6.0.3) - '@vue/language-core@3.2.6': dependencies: '@volar/language-core': 2.4.28 @@ -13363,9 +13304,6 @@ snapshots: prettier: 3.8.2 svelte: 5.55.7(@typescript-eslint/types@8.58.1) - prettier@2.8.8: - optional: true - prettier@3.8.2: {} pretty-format@27.5.1: @@ -14288,7 +14226,6 @@ snapshots: dependencies: punycode: 2.3.1 - util-deprecate@1.0.2: {} validate-npm-package-name@8.0.0: {} @@ -14474,12 +14411,6 @@ snapshots: vue-component-type-helpers@2.2.12: {} - vue-demi@0.14.10(@vue/composition-api@1.7.2(vue@3.5.43(typescript@6.0.3)))(vue@3.5.43(typescript@6.0.3)): - dependencies: - vue: 3.5.43(typescript@6.0.3) - optionalDependencies: - '@vue/composition-api': 1.7.2(vue@3.5.43(typescript@6.0.3)) - vue-eslint-parser@10.4.0(eslint@10.10.0(jiti@2.7.0)(supports-color@7.2.0))(supports-color@7.2.0): dependencies: debug: 4.4.3(supports-color@7.2.0) @@ -14498,13 +14429,6 @@ snapshots: '@vue/language-core': 3.2.6 typescript: 6.0.3 - vue@2.6.14: {} - - vue@2.7.16: - dependencies: - '@vue/compiler-sfc': 2.7.16 - csstype: 3.2.3 - vue@3.5.32(typescript@6.0.3): dependencies: '@vue/compiler-dom': 3.5.32 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 8c502004..48f28675 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -10,14 +10,7 @@ trustPolicyExclude: - 'semver@5.7.2' # Socket: popular legacy line, 673M weekly downloads; alerts page returned no alert entries - 'semver@6.3.1' # Socket: popular latest-6 line, 673M weekly downloads; alerts page returned no alert entries -peerDependencyRules: - allowedVersions: - '@vue/composition-api>vue': '>= 2.5' - packageExtensions: - '@vue/composition-api': - peerDependencies: - vue: '>= 2.5' '@vue/test-utils@2.4.6': peerDependencies: # Use the consumer's Vue runtime for rendering and reactivity. @@ -44,9 +37,6 @@ allowBuilds: '@parcel/watcher': false # optional dep of @angular/build lmdb: false # optional dep of @angular/build msgpackr-extract: false # optional dep of @angular/build - - # @tanstack/vue-store - vue-demi: true # only required for vue 2 support minimumReleaseAgeExclude: # Renovate security update: nx@22.7.7 || 22.7.10 - nx@22.7.7 || 22.7.10