Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions packages/oxc/src/modules/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import type { PluginWithDevTools } from '@vitejs/devtools-kit'
import { addVitePlugin, defineNuxtModule } from '@nuxt/kit'
import { DevToolsServer } from '../../../core/src/node/plugins/server'
import { rpcFunctions } from '../node/rpc'

// `@nuxt/kit` types `addVitePlugin` against whatever `vite` install pnpm
// resolves for its own peer chain, which can differ from the one our
// plugins are built against even on the same `vite` version — cast past
// the resulting structural mismatch.
function addDevToolsVitePlugin<T extends { name: string }>(plugin: T): void {
addVitePlugin(plugin as unknown as Parameters<typeof addVitePlugin>[0])
}

export default defineNuxtModule({
meta: {
name: 'devtools-rpc',
configKey: 'devtoolsRpc',
},
setup() {
addVitePlugin({
const rpcPlugin: PluginWithDevTools = {
name: 'vite:devtools:oxc',
devtools: {
setup(ctx) {
Expand All @@ -17,8 +26,9 @@ export default defineNuxtModule({
}
},
},
})
}
addDevToolsVitePlugin(rpcPlugin)

addVitePlugin(DevToolsServer())
addDevToolsVitePlugin(DevToolsServer())
},
})
16 changes: 13 additions & 3 deletions packages/rolldown/src/modules/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import type { PluginWithDevTools } from '@vitejs/devtools-kit'
import { addVitePlugin, defineNuxtModule } from '@nuxt/kit'
import { DevToolsServer } from '../../../core/src/node/plugins/server'
import { rpcFunctions } from '../node/rpc'

// `@nuxt/kit` types `addVitePlugin` against whatever `vite` install pnpm
// resolves for its own peer chain, which can differ from the one our
// plugins are built against even on the same `vite` version — cast past
// the resulting structural mismatch.
function addDevToolsVitePlugin<T extends { name: string }>(plugin: T): void {
addVitePlugin(plugin as unknown as Parameters<typeof addVitePlugin>[0])
}

export default defineNuxtModule({
meta: {
name: 'devtools-rpc',
configKey: 'devtoolsRpc',
},
setup() {
addVitePlugin({
const rpcPlugin: PluginWithDevTools = {
name: 'vite:devtools:rolldown',
devtools: {
setup(ctx) {
Expand All @@ -17,8 +26,9 @@ export default defineNuxtModule({
}
},
},
})
}
addDevToolsVitePlugin(rpcPlugin)

addVitePlugin(DevToolsServer())
addDevToolsVitePlugin(DevToolsServer())
},
})
12 changes: 10 additions & 2 deletions packages/vite/src/modules/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ import { addVitePlugin, defineNuxtModule } from '@nuxt/kit'
import { DevToolsServer } from '../../../core/src/node/plugins/server'
import { DevToolsViteInspect } from '../node/inspect/plugin'

// `@nuxt/kit` types `addVitePlugin` against whatever `vite` install pnpm
// resolves for its own peer chain, which can differ from the one our
// plugins are built against even on the same `vite` version — cast past
// the resulting structural mismatch.
function addDevToolsVitePlugin<T extends { name: string }>(plugin: T): void {
addVitePlugin(plugin as unknown as Parameters<typeof addVitePlugin>[0])
}

export default defineNuxtModule({
meta: {
name: 'devtools-rpc',
configKey: 'devtoolsRpc',
},
setup() {
addVitePlugin(DevToolsViteInspect())
addVitePlugin(DevToolsServer())
addDevToolsVitePlugin(DevToolsViteInspect())
addDevToolsVitePlugin(DevToolsServer())
},
})
Loading