wip(ssr): move ssr only utils to conditional export
This commit is contained in:
parent
e6e2c58234
commit
a7b0954f14
@ -101,12 +101,20 @@ export const camelize = _camelize as (s: string) => string
|
|||||||
// For integration with runtime compiler
|
// For integration with runtime compiler
|
||||||
export { registerRuntimeCompiler } from './component'
|
export { registerRuntimeCompiler } from './component'
|
||||||
|
|
||||||
// For server-renderer
|
// SSR -------------------------------------------------------------------------
|
||||||
// TODO move these into a conditional object to avoid exporting them in client
|
import { createComponentInstance, setupComponent } from './component'
|
||||||
// builds
|
import { renderComponentRoot } from './componentRenderUtils'
|
||||||
export { createComponentInstance, setupComponent } from './component'
|
import { normalizeVNode } from './vnode'
|
||||||
export { renderComponentRoot } from './componentRenderUtils'
|
|
||||||
export { normalizeVNode } from './vnode'
|
// SSR utils are only exposed in SSR builds.
|
||||||
|
const _ssrUtils = {
|
||||||
|
createComponentInstance,
|
||||||
|
setupComponent,
|
||||||
|
renderComponentRoot,
|
||||||
|
normalizeVNode
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ssrUtils = (__SSR__ ? _ssrUtils : null) as typeof _ssrUtils
|
||||||
|
|
||||||
// Types -----------------------------------------------------------------------
|
// Types -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -4,16 +4,13 @@ import {
|
|||||||
ComponentInternalInstance,
|
ComponentInternalInstance,
|
||||||
VNode,
|
VNode,
|
||||||
VNodeChildren,
|
VNodeChildren,
|
||||||
createComponentInstance,
|
|
||||||
setupComponent,
|
|
||||||
createVNode,
|
createVNode,
|
||||||
renderComponentRoot,
|
|
||||||
Text,
|
Text,
|
||||||
Comment,
|
Comment,
|
||||||
Fragment,
|
Fragment,
|
||||||
Portal,
|
Portal,
|
||||||
ShapeFlags,
|
ShapeFlags,
|
||||||
normalizeVNode
|
ssrUtils
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import {
|
import {
|
||||||
isString,
|
isString,
|
||||||
@ -25,6 +22,13 @@ import {
|
|||||||
import { renderProps } from './renderProps'
|
import { renderProps } from './renderProps'
|
||||||
import { escape } from './escape'
|
import { escape } from './escape'
|
||||||
|
|
||||||
|
const {
|
||||||
|
createComponentInstance,
|
||||||
|
setupComponent,
|
||||||
|
renderComponentRoot,
|
||||||
|
normalizeVNode
|
||||||
|
} = ssrUtils
|
||||||
|
|
||||||
// Each component has a buffer array.
|
// Each component has a buffer array.
|
||||||
// A buffer array can contain one of the following:
|
// A buffer array can contain one of the following:
|
||||||
// - plain string
|
// - plain string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user