Skip to content

Commit 8c24ee4

Browse files
authored
feat: expose createServerModuleRunnerTransport (#18730)
1 parent 3766004 commit 8c24ee4

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

packages/vite/index.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const disallowedVariables = [
4646
// can be exposed, but doesn't make sense as it's Environment API related
4747
'createServerHotChannel',
4848
'createServerModuleRunner',
49+
'createServerModuleRunnerTransport',
4950
'isRunnableDevEnvironment',
5051
]
5152
disallowedVariables.forEach((name) => {

packages/vite/rollup.dts.config.ts

+6
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ function patchTypes(): Plugin {
9595
renderChunk(code, chunk) {
9696
if (
9797
chunk.fileName.startsWith('module-runner') ||
98+
// index and moduleRunner have a common chunk "moduleRunnerTransport"
99+
chunk.fileName.startsWith('moduleRunnerTransport') ||
98100
chunk.fileName.startsWith('types.d-')
99101
) {
100102
validateRunnerChunk.call(this, chunk)
@@ -117,6 +119,8 @@ function validateRunnerChunk(this: PluginContext, chunk: RenderedChunk) {
117119
if (
118120
!id.startsWith('./') &&
119121
!id.startsWith('../') &&
122+
// index and moduleRunner have a common chunk "moduleRunnerTransport"
123+
!id.startsWith('moduleRunnerTransport.d') &&
120124
!id.startsWith('types.d')
121125
) {
122126
this.warn(
@@ -139,6 +143,8 @@ function validateChunkImports(this: PluginContext, chunk: RenderedChunk) {
139143
!id.startsWith('node:') &&
140144
!id.startsWith('types.d') &&
141145
!id.startsWith('vite/') &&
146+
// index and moduleRunner have a common chunk "moduleRunnerTransport"
147+
!id.startsWith('moduleRunnerTransport.d') &&
142148
!deps.includes(id) &&
143149
!deps.some((name) => id.startsWith(name + '/'))
144150
) {

packages/vite/src/node/index.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ export { runnerImport } from './ssr/runnerImport'
3535
export { BuildEnvironment } from './build'
3636

3737
export { fetchModule, type FetchModuleOptions } from './ssr/fetchModule'
38-
export { createServerModuleRunner } from './ssr/runtime/serverModuleRunner'
38+
export {
39+
createServerModuleRunner,
40+
createServerModuleRunnerTransport,
41+
} from './ssr/runtime/serverModuleRunner'
3942
export { createServerHotChannel } from './server/hmr'
4043
export { ssrTransform as moduleRunnerTransform } from './ssr/ssrTransform'
4144
export type { ModuleRunnerTransformOptions } from './ssr/ssrTransform'
@@ -170,6 +173,9 @@ export type {
170173
HotChannel,
171174
ServerHotChannel,
172175
HotChannelClient,
176+
NormalizedHotChannel,
177+
NormalizedHotChannelClient,
178+
NormalizedServerHotChannel,
173179
} from './server/hmr'
174180

175181
export type { FetchFunction, FetchResult } from 'vite/module-runner'

0 commit comments

Comments
 (0)