Skip to content

Commit 17b841b

Browse files
committed
feat: upgrade devtools-api to v7
1 parent 6a26c92 commit 17b841b

File tree

4 files changed

+15
-24
lines changed

4 files changed

+15
-24
lines changed

packages/playground/vite.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { fileURLToPath, URL } from 'node:url'
22
import { defineConfig } from 'vite'
33
import Vue from '@vitejs/plugin-vue'
4+
import VueDevtools from 'vite-plugin-vue-devtools'
45

56
// https://vite.dev/config/
67
export default defineConfig({
7-
plugins: [Vue()],
8+
plugins: [Vue(), VueDevtools()],
89
resolve: {
910
alias: {
1011
'@': fileURLToPath(new URL('./src', import.meta.url)),

packages/router/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
"dependencies": {
151151
"@babel/generator": "^7.28.6",
152152
"@vue-macros/common": "^3.1.1",
153-
"@vue/devtools-api": "^6.6.4",
153+
"@vue/devtools-api": "^7.3.0",
154154
"ast-walker-scope": "^0.8.3",
155155
"chokidar": "^5.0.0",
156156
"json5": "^2.2.3",

packages/router/src/devtools.ts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import {
2-
App,
1+
import { setupDevtoolsPlugin } from '@vue/devtools-api'
2+
import type {
33
CustomInspectorNode,
44
InspectorNodeTag,
55
CustomInspectorState,
6-
HookPayloads,
7-
setupDevtoolsPlugin,
86
TimelineEvent,
9-
} from '@vue/devtools-api'
10-
import { watch } from 'vue'
7+
} from '@vue/devtools-kit'
8+
import { type App, watch } from 'vue'
119
import { decode } from './encoding'
1210
import { isSameRouteRecord } from './location'
1311
import { RouterMatcher } from './matcher'
@@ -18,7 +16,6 @@ import { UseLinkDevtoolsContext } from './RouterLink'
1816
import { RouterViewDevtoolsContext } from './RouterView'
1917
import { assign, isArray } from './utils'
2018
import { RouteLocationNormalized } from './typed-routes'
21-
import { warn } from './warning'
2219

2320
/**
2421
* Copies a route location and removes any problematic properties that cannot be shown in devtools (e.g. Vue instances).
@@ -80,14 +77,8 @@ export function addDevtools(app: App, router: Router, matcher: RouterMatcher) {
8077
app,
8178
},
8279
api => {
83-
if (typeof api.now !== 'function') {
84-
warn(
85-
'[Vue Router]: You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.'
86-
)
87-
}
88-
8980
// display state added by the router
90-
api.on.inspectComponent((payload, ctx) => {
81+
api.on.inspectComponent(payload => {
9182
if (payload.instanceData) {
9283
payload.instanceData.state.push({
9384
type: 'Routing',
@@ -299,7 +290,11 @@ export function addDevtools(app: App, router: Router, matcher: RouterMatcher) {
299290
payload.rootNodes = routes.map(formatRouteRecordForInspector)
300291
}
301292

302-
let activeRoutesPayload: HookPayloads['getInspectorTree'] | undefined
293+
type GetInspectorTreePayload = Parameters<
294+
Parameters<typeof api.on.getInspectorTree>[0]
295+
>[0]
296+
297+
let activeRoutesPayload: GetInspectorTreePayload | undefined
303298
api.on.getInspectorTree(payload => {
304299
activeRoutesPayload = payload
305300
if (payload.app === app && payload.inspectorId === routerInspectorId) {

pnpm-lock.yaml

Lines changed: 2 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)