Skip to content
Merged
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
3 changes: 3 additions & 0 deletions src/_internal/find-process-import.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import findProcessFn, { type FindFunction } from "find-process"

export const findProcess = ((findProcessFn as any).default || findProcessFn) as FindFunction
15 changes: 2 additions & 13 deletions src/_internal/nextjs-runtime-manager.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
import * as findProcessModule from "find-process"
import { findProcess } from "./find-process-import.js"
import { pidToPorts } from "pid-port"

// Type for find-process function
type FindProcessFunction = (
by: string,
value: string | number,
strict?: boolean
) => Promise<Array<{ pid: number; name: string; cmd?: string }>>

// Handle CommonJS default export in ES modules
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const findProcess = ((findProcessModule as any).default || findProcessModule) as FindProcessFunction

interface NextJsServerInfo {
port: number
pid: number
Expand Down Expand Up @@ -80,7 +69,7 @@ async function findNextJsServers(): Promise<NextJsServerInfo[]> {

return servers
} catch (error) {
console.error("[Next.js Runtime Manager] Error finding Next.js servers:", error)
console.error("[next-devtools-mcp] Error finding Next.js servers:", error)
return []
}
}
Expand Down