wip(ssr): further restructure

This commit is contained in:
Evan You 2020-01-27 18:06:37 -05:00
parent 27fbfbdb8b
commit f4d190cc9c
5 changed files with 22 additions and 28 deletions

View File

@ -1,4 +1,4 @@
describe('ssr: render raw vnodes', () => {
describe('ssr: render props', () => {
test('class', () => {})
test('styles', () => {

View File

@ -1,16 +1,11 @@
import { toDisplayString } from 'vue'
import { escape } from './escape'
export { renderToString, renderComponent } from './renderToString'
export {
renderVNode,
renderClass,
renderStyle,
renderProps
} from './renderVnode'
export { escape } from './escape'
export { escape }
export function interpolate(value: unknown) {
return escape(toDisplayString(value))
}
export { renderToString, renderComponent, renderSlot } from './renderToString'
export { renderClass, renderStyle, renderProps } from './renderProps'

View File

@ -0,0 +1,5 @@
export function renderProps() {}
export function renderClass() {}
export function renderStyle() {}

View File

@ -9,11 +9,10 @@ import {
renderComponentRoot
} from 'vue'
import { isString, isPromise, isArray, isFunction } from '@vue/shared'
import { renderVNode } from './renderVnode'
export type SSRBuffer = SSRBufferItem[]
export type SSRBufferItem = string | ResolvedSSRBuffer | Promise<SSRBuffer>
export type ResolvedSSRBuffer = (string | ResolvedSSRBuffer)[]
type SSRBuffer = SSRBufferItem[]
type SSRBufferItem = string | ResolvedSSRBuffer | Promise<SSRBuffer>
type ResolvedSSRBuffer = (string | ResolvedSSRBuffer)[]
function createBuffer() {
let appendable = false
@ -107,3 +106,11 @@ function innerRenderComponent(
Promise.all(buffer as any)
: (buffer as ResolvedSSRBuffer)
}
export function renderVNode(push: (item: SSRBufferItem) => void, vnode: VNode) {
// TODO
}
export function renderSlot() {
// TODO
}

View File

@ -1,13 +0,0 @@
import { VNode } from 'vue'
import { SSRBufferItem } from './renderToString'
export function renderVNode(
push: (item: SSRBufferItem) => void,
vnode: VNode
) {}
export function renderProps() {}
export function renderClass() {}
export function renderStyle() {}