Skip to content

Commit 3d2ebf4

Browse files
antfubotantfu
andauthored
fix(deps): upgrade Vite DevTools to 0.5.1, fix e2e client-context global (#1069)
Co-authored-by: Anthony Fu <github@antfu.me>
1 parent d2c6d90 commit 3d2ebf4

6 files changed

Lines changed: 218 additions & 230 deletions

File tree

‎pnpm-lock.yaml‎

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

‎pnpm-workspace.yaml‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ allowBuilds:
4141
vue-demi: true
4242

4343
refs:
44-
devframe: &devframe ^0.9.2
44+
devframe: &devframe ^0.9.4
4545
# Nuxt 5 nightly. Its own `@nuxt/vite-builder-nightly` already requires
4646
# `vite@^8.1.5`, so this and the `vite` ref below move together.
4747
#
@@ -64,7 +64,7 @@ refs:
6464
shiki: &shiki ^4.4.3
6565
unocss: &unocss ^66.7.5
6666
vite: &vite ^8.2.1
67-
vite-devtools: &vite-devtools ^0.5.0
67+
vite-devtools: &vite-devtools ^0.5.1
6868
vue: &vue ^3.5.41
6969
vueuse: &vueuse ^14.4.0
7070
overrides:
@@ -84,25 +84,13 @@ overrides:
8484
chokidar: ^5.0.0
8585
devframe: *devframe
8686
esbuild: ^0.28.2
87-
# `unplugin-vue-markdown@32.0.0` depends on its own `markdown-exit
88-
# ^1.0.0-beta.9`, a different prerelease tuple than the `^1.1.0-beta.2`
89-
# `packages/devtools` depends on directly — semver won't let one satisfy
90-
# the other, so without this override pnpm resolves and ships two copies
91-
# of the engine. Force both onto the version this workspace uses directly.
9287
markdown-exit: ^1.1.0-beta.2
9388
rollup: ^4.62.4
9489
semver: ^7.8.5
9590
typescript: ^6.0.3
9691
unimport: ^6.4.0
9792
vite: *vite
9893
vue: *vue
99-
# `@nuxt/module-builder@1.0.3` bundles `mkdist@2.4.1`, whose own
100-
# `vue-sfc-transformer` dependency is pinned to `^0.1.17` — but
101-
# `resolutionMode: highest` otherwise hoists mkdist's copy up to
102-
# `@nuxt/module-builder`'s own newer `^0.2.3` want, and mkdist's `.vue`
103-
# transform silently breaks under that mismatch (it wrote compiled output
104-
# into `packages/devtools/src/runtime/**` instead of `dist/`, clobbering
105-
# `auth/index.html` in the process). Pin to what mkdist itself needs.
10694
vue-sfc-transformer: ^0.2.5
10795
vue-tsc: ^3.3.10
10896
catalogs:

‎tests/e2e/fixtures/devtools.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ async function ensureDockReady(page: Page): Promise<void> {
2828
{ timeout: 30_000 },
2929
)
3030
await page.waitForFunction(
31-
() => Boolean((globalThis as any).__VITE_DEVTOOLS_CLIENT_CONTEXT__?.rpc),
31+
() => Boolean((globalThis as any).__DEVFRAME_HUB_CLIENT_CONTEXT__?.rpc),
3232
null,
3333
{ timeout: 30_000 },
3434
)
3535
await page.evaluate(() => {
36-
const ctx = (globalThis as any).__VITE_DEVTOOLS_CLIENT_CONTEXT__
36+
const ctx = (globalThis as any).__DEVFRAME_HUB_CLIENT_CONTEXT__
3737
if (ctx?.rpc && !ctx.rpc.isTrusted)
3838
ctx.rpc.events?.emit?.('rpc:is-trusted:updated', true)
3939
})
4040
await page.waitForFunction(
41-
() => Boolean((globalThis as any).__VITE_DEVTOOLS_CLIENT_CONTEXT__?.docks?.entries?.length),
41+
() => Boolean((globalThis as any).__DEVFRAME_HUB_CLIENT_CONTEXT__?.docks?.entries?.length),
4242
null,
4343
{ timeout: 30_000 },
4444
)

‎tests/e2e/specs/code-server.spec.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ test('reports a missing editor binary without starting a process', async ({ page
1313
await openDevTools()
1414

1515
await page.waitForFunction((id) => {
16-
const ctx = (globalThis as any).__VITE_DEVTOOLS_CLIENT_CONTEXT__
16+
const ctx = (globalThis as any).__DEVFRAME_HUB_CLIENT_CONTEXT__
1717
return ctx?.docks?.entries?.some((entry: any) => entry.id === id)
1818
}, CODE_SERVER_DOCK_ID, { timeout: 30_000 })
1919

2020
// Open the Code Server member the way a user would.
2121
await page.evaluate(async (id) => {
22-
const ctx = (globalThis as any).__VITE_DEVTOOLS_CLIENT_CONTEXT__
22+
const ctx = (globalThis as any).__DEVFRAME_HUB_CLIENT_CONTEXT__
2323
await ctx.docks.switchEntry(id)
2424
}, CODE_SERVER_DOCK_ID)
2525

@@ -30,7 +30,7 @@ test('reports a missing editor binary without starting a process', async ({ page
3030

3131
// Opening the member performs detection only — it must not launch a process.
3232
const status = await page.evaluate(async (rpcName) => {
33-
const ctx = (globalThis as any).__VITE_DEVTOOLS_CLIENT_CONTEXT__
33+
const ctx = (globalThis as any).__DEVFRAME_HUB_CLIENT_CONTEXT__
3434
return ctx.rpc.call(rpcName)
3535
}, CODE_SERVER_STATUS_RPC)
3636
expect((status as any).server.status).toBe('stopped')
@@ -45,20 +45,20 @@ test('launches an installed Code Server with authenticated iframe handoff', asyn
4545
await page.goto('/')
4646
await openDevTools()
4747
await page.waitForFunction((id) => {
48-
const ctx = (globalThis as any).__VITE_DEVTOOLS_CLIENT_CONTEXT__
48+
const ctx = (globalThis as any).__DEVFRAME_HUB_CLIENT_CONTEXT__
4949
return ctx?.docks?.entries?.some((entry: any) => entry.id === id)
5050
}, CODE_SERVER_DOCK_ID, { timeout: 30_000 })
5151

5252
await page.evaluate(async (id) => {
53-
const ctx = (globalThis as any).__VITE_DEVTOOLS_CLIENT_CONTEXT__
53+
const ctx = (globalThis as any).__DEVFRAME_HUB_CLIENT_CONTEXT__
5454
await ctx.docks.switchEntry(id)
5555
}, CODE_SERVER_DOCK_ID)
5656
const launcher = page.frameLocator(`iframe[src*="${CODE_SERVER_DOCK_ID}"]`)
5757
await launcher.getByRole('button', { name: 'Launch editor' }).click()
5858

5959
await expect.poll(async () => {
6060
return page.evaluate(async (rpcName) => {
61-
const ctx = (globalThis as any).__VITE_DEVTOOLS_CLIENT_CONTEXT__
61+
const ctx = (globalThis as any).__DEVFRAME_HUB_CLIENT_CONTEXT__
6262
return ctx.rpc.call(rpcName)
6363
}, CODE_SERVER_STATUS_RPC)
6464
}, { timeout: 60_000 }).toMatchObject({
@@ -67,7 +67,7 @@ test('launches an installed Code Server with authenticated iframe handoff', asyn
6767
})
6868

6969
const runningStatus = await page.evaluate(async (rpcName) => {
70-
const ctx = (globalThis as any).__VITE_DEVTOOLS_CLIENT_CONTEXT__
70+
const ctx = (globalThis as any).__DEVFRAME_HUB_CLIENT_CONTEXT__
7171
return ctx.rpc.call(rpcName)
7272
}, CODE_SERVER_STATUS_RPC) as any
7373
const serverPort = String(runningStatus.server.port)

‎tests/e2e/specs/data-inspector.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const EXAMPLE_SOURCE_ID = 'devframes:plugin:data-inspector:example'
88

99
async function inspectorSources(page: any): Promise<string[]> {
1010
return page.evaluate(async () => {
11-
const ctx = (globalThis as any).__VITE_DEVTOOLS_CLIENT_CONTEXT__
11+
const ctx = (globalThis as any).__DEVFRAME_HUB_CLIENT_CONTEXT__
1212
const sources = await ctx.rpc.call('devframes:plugin:data-inspector:sources')
1313
return (sources as { id: string }[]).map(s => s.id)
1414
})
@@ -29,7 +29,7 @@ test('exposes the live Nuxt application as a data source and hides the demo sour
2929

3030
// Querying the live source returns data (the integration is wired end to end).
3131
const results = await page.evaluate(async (sourceId) => {
32-
const ctx = (globalThis as any).__VITE_DEVTOOLS_CLIENT_CONTEXT__
32+
const ctx = (globalThis as any).__DEVFRAME_HUB_CLIENT_CONTEXT__
3333
const nuxt = await ctx.rpc.call('devframes:plugin:data-inspector:query', sourceId, 'nuxt')
3434
const vite = await ctx.rpc.call('devframes:plugin:data-inspector:query', sourceId, 'vite')
3535
return { nuxt, vite }

‎tests/e2e/specs/devtools.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test('registers a single Nuxt entry (no duplicate from the SSR Vite context)', a
2323
// group. There is no user-visible proxy for "how many groups registered", so
2424
// this is the one place we read the dock registry — kept to a single count.
2525
const nuxtGroups = await page.evaluate(() => {
26-
const ctx = (globalThis as any).__VITE_DEVTOOLS_CLIENT_CONTEXT__
26+
const ctx = (globalThis as any).__DEVFRAME_HUB_CLIENT_CONTEXT__
2727
return ctx.docks.entries.filter((entry: any) => entry.id === 'nuxt').length
2828
})
2929
expect(nuxtGroups).toBe(1)

0 commit comments

Comments
 (0)