22import spawn from 'cross-spawn'
33import { existsSync , readFileSync , unlinkSync , writeFileSync } from 'fs'
44import { writeFile } from 'fs-extra'
5- import { fetch as undiciFetch } from 'undici'
5+ import { fetch as undiciFetch } from 'next/dist/compiled/ undici'
66import nodeFetch from 'node-fetch'
77import path from 'path'
88import qs from 'querystring'
@@ -111,7 +111,7 @@ async function processChunkedResponse(response) {
111111 * @param {string | number } appPort
112112 * @param {string } pathname
113113 * @param {Record<string, any> | string | undefined } [query]
114- * @param {import("undici").RequestInit } [opts]
114+ * @param {import("next/dist/compiled/ undici").RequestInit } [opts]
115115 * @returns {Promise<string> }
116116 */
117117export function renderViaHTTP ( appPort , pathname , query , opts ) {
@@ -121,11 +121,11 @@ export function renderViaHTTP(appPort, pathname, query, opts) {
121121/**
122122 * @param {string | number } appPort
123123 * @param {string } pathname
124- * @param {Record<string, any> | string | undefined } query
125- * @param {RequestInit } opts
126- * @returns {Promise<Response> }
124+ * @param {Record<string, any> | string | null | undefined } [ query]
125+ * @param {import('node-fetch'). RequestInit } [ opts]
126+ * @returns {Promise<Response & {buffer: any} & {headers: Headers} > }
127127 */
128- export async function fetchViaHTTP ( appPort , pathname , query = undefined , opts = undefined , useUndici = false ) {
128+ export function fetchViaHTTP ( appPort , pathname , query , opts , useUndici = false ) {
129129 const url = `${ pathname } ${ typeof query === 'string' ? query : query ? `?${ qs . stringify ( query ) } ` : '' } `
130130 const fetch = useUndici ? undiciFetch : nodeFetch
131131 const fullUrl = getFullUrl ( appPort , url )
0 commit comments