File tree 2 files changed +22
-10
lines changed
2 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -101,12 +101,20 @@ export const camelize = _camelize as (s: string) => string
101
101
// For integration with runtime compiler
102
102
export { registerRuntimeCompiler } from './component'
103
103
104
- // For server-renderer
105
- // TODO move these into a conditional object to avoid exporting them in client
106
- // builds
107
- export { createComponentInstance , setupComponent } from './component'
108
- export { renderComponentRoot } from './componentRenderUtils'
109
- export { normalizeVNode } from './vnode'
104
+ // SSR -------------------------------------------------------------------------
105
+ import { createComponentInstance , setupComponent } from './component'
106
+ import { renderComponentRoot } from './componentRenderUtils'
107
+ import { normalizeVNode } from './vnode'
108
+
109
+ // SSR utils are only exposed in SSR builds.
110
+ const _ssrUtils = {
111
+ createComponentInstance,
112
+ setupComponent,
113
+ renderComponentRoot,
114
+ normalizeVNode
115
+ }
116
+
117
+ export const ssrUtils = ( __SSR__ ? _ssrUtils : null ) as typeof _ssrUtils
110
118
111
119
// Types -----------------------------------------------------------------------
112
120
Original file line number Diff line number Diff line change @@ -4,16 +4,13 @@ import {
4
4
ComponentInternalInstance ,
5
5
VNode ,
6
6
VNodeChildren ,
7
- createComponentInstance ,
8
- setupComponent ,
9
7
createVNode ,
10
- renderComponentRoot ,
11
8
Text ,
12
9
Comment ,
13
10
Fragment ,
14
11
Portal ,
15
12
ShapeFlags ,
16
- normalizeVNode
13
+ ssrUtils
17
14
} from 'vue'
18
15
import {
19
16
isString ,
@@ -25,6 +22,13 @@ import {
25
22
import { renderProps } from './renderProps'
26
23
import { escape } from './escape'
27
24
25
+ const {
26
+ createComponentInstance,
27
+ setupComponent,
28
+ renderComponentRoot,
29
+ normalizeVNode
30
+ } = ssrUtils
31
+
28
32
// Each component has a buffer array.
29
33
// A buffer array can contain one of the following:
30
34
// - plain string
You can’t perform that action at this time.
0 commit comments