Skip to content

Commit

Permalink
fix: backport legacy api for better compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Nov 30, 2024
1 parent 0db371c commit 3aa9231
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/node/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export function createServerRpc(
.serverMetrics || {}
},
async onModuleUpdated() {},

async list() {
const query = ctx.queryEnv({ vite: 'vite1', env: 'client' })
return query.getModulesList()
},
}

return rpc
Expand Down
5 changes: 5 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ export interface RpcFunctions {
getServerMetrics: (query: QueryEnv) => Promise<ServerMetrics>
resolveId: (query: QueryEnv, id: string) => Promise<string>
onModuleUpdated: () => Promise<void>

/**
* @deprecated Query for the default Vite instance with the default env. Deprecated. Use `getModulesList` instead.
*/
list: () => Promise<ModulesList>
}

export interface QueryEnv {
Expand Down

0 comments on commit 3aa9231

Please sign in to comment.