diff --git a/packages/vite/src/node/index.ts b/packages/vite/src/node/index.ts index d8358109611461..92b6a0acd6e7db 100644 --- a/packages/vite/src/node/index.ts +++ b/packages/vite/src/node/index.ts @@ -28,6 +28,7 @@ export { fetchModule, type FetchModuleOptions } from './ssr/fetchModule' export { createServerModuleRunner } from './ssr/runtime/serverModuleRunner' export { ServerHMRConnector } from './ssr/runtime/serverHmrConnector' export { ssrTransform as moduleRunnerTransform } from './ssr/ssrTransform' +export type { ModuleRunnerTransformOptions } from './ssr/ssrTransform' export * from './publicUtils' diff --git a/packages/vite/src/node/ssr/ssrTransform.ts b/packages/vite/src/node/ssr/ssrTransform.ts index ab49bdbcd18c85..0ba9dd09ed00b7 100644 --- a/packages/vite/src/node/ssr/ssrTransform.ts +++ b/packages/vite/src/node/ssr/ssrTransform.ts @@ -26,7 +26,7 @@ type Node = _Node & { end: number } -interface TransformOptions { +export interface ModuleRunnerTransformOptions { json?: { stringify?: boolean } @@ -47,7 +47,7 @@ export async function ssrTransform( inMap: SourceMap | { mappings: '' } | null, url: string, originalCode: string, - options?: TransformOptions, + options?: ModuleRunnerTransformOptions, // TODO: Should we export two functions instead of using options here? ): Promise { if (options?.json?.stringify && isJSONRequest(url)) { return ssrTransformJSON(code, inMap)