MCPcopy
hub / github.com/vuejs/core / createBuffer

Function createBuffer

packages/server-renderer/src/render.ts:67–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65// synchronously)
66// - An async buffer (a Promise that resolves to a resolved buffer)
67export function createBuffer() {
68 let appendable = false
69 const buffer: SSRBuffer = []
70 return {
71 getBuffer(): SSRBuffer {
72 // Return static buffer and await on items during unroll stage
73 return buffer
74 },
75 push(item: SSRBufferItem): void {
76 const isStringItem = isString(item)
77 if (appendable && isStringItem) {
78 buffer[buffer.length - 1] += item as string
79 return
80 }
81 buffer.push(item)
82 appendable = isStringItem
83 if (isPromise(item) || (isArray(item) && item.hasAsync)) {
84 // promise, or child buffer with async, mark as async.
85 // this allows skipping unnecessary await ticks during unroll stage
86 buffer.hasAsync = true
87 }
88 },
89 }
90}
91
92export function renderComponentVNode(
93 vnode: VNode,

Callers 8

ssrRenderTeleportFunction · 0.90
createSyncBufferFunction · 0.90
addItemsFunction · 0.90
createMixedBufferFunction · 0.90
setupFunction · 0.90
renderComponentSubTreeFunction · 0.85

Calls

no outgoing calls

Tested by 4

createSyncBufferFunction · 0.72
addItemsFunction · 0.72
createMixedBufferFunction · 0.72
setupFunction · 0.72