2
2
import spawn from 'cross-spawn'
3
3
import { existsSync , readFileSync , unlinkSync , writeFileSync } from 'fs'
4
4
import { writeFile } from 'fs-extra'
5
- import { fetch as undiciFetch } from 'undici'
5
+ import { fetch as undiciFetch } from 'next/dist/compiled/ undici'
6
6
import nodeFetch from 'node-fetch'
7
7
import path from 'path'
8
8
import qs from 'querystring'
@@ -111,7 +111,7 @@ async function processChunkedResponse(response) {
111
111
* @param {string | number } appPort
112
112
* @param {string } pathname
113
113
* @param {Record<string, any> | string | undefined } [query]
114
- * @param {import("undici").RequestInit } [opts]
114
+ * @param {import("next/dist/compiled/ undici").RequestInit } [opts]
115
115
* @returns {Promise<string> }
116
116
*/
117
117
export function renderViaHTTP ( appPort , pathname , query , opts ) {
@@ -121,11 +121,11 @@ export function renderViaHTTP(appPort, pathname, query, opts) {
121
121
/**
122
122
* @param {string | number } appPort
123
123
* @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} > }
127
127
*/
128
- export async function fetchViaHTTP ( appPort , pathname , query = undefined , opts = undefined , useUndici = false ) {
128
+ export function fetchViaHTTP ( appPort , pathname , query , opts , useUndici = false ) {
129
129
const url = `${ pathname } ${ typeof query === 'string' ? query : query ? `?${ qs . stringify ( query ) } ` : '' } `
130
130
const fetch = useUndici ? undiciFetch : nodeFetch
131
131
const fullUrl = getFullUrl ( appPort , url )
0 commit comments