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

Function processChildren

packages/compiler-ssr/src/ssrCodegenTransform.ts:154–240  ·  view source on GitHub ↗
(
  parent: Container,
  context: SSRTransformContext,
  asFragment = false,
  disableNestedFragments = false,
  disableComment = false,
)

Source from the content-addressed store, hash-verified

152}
153
154export function processChildren(
155 parent: Container,
156 context: SSRTransformContext,
157 asFragment = false,
158 disableNestedFragments = false,
159 disableComment = false,
160): void {
161 if (asFragment) {
162 context.pushStringPart(`<!--[-->`)
163 }
164 const { children } = parent
165 for (let i = 0; i < children.length; i++) {
166 const child = children[i]
167 switch (child.type) {
168 case NodeTypes.ELEMENT:
169 switch (child.tagType) {
170 case ElementTypes.ELEMENT:
171 ssrProcessElement(child, context)
172 break
173 case ElementTypes.COMPONENT:
174 ssrProcessComponent(child, context, parent)
175 break
176 case ElementTypes.SLOT:
177 ssrProcessSlotOutlet(child, context)
178 break
179 case ElementTypes.TEMPLATE:
180 // TODO
181 break
182 default:
183 context.onError(
184 createSSRCompilerError(
185 SSRErrorCodes.X_SSR_INVALID_AST_NODE,
186 (child as any).loc,
187 ),
188 )
189 // make sure we exhaust all possible types
190 const exhaustiveCheck: never = child
191 return exhaustiveCheck
192 }
193 break
194 case NodeTypes.TEXT:
195 context.pushStringPart(escapeHtml(child.content))
196 break
197 case NodeTypes.COMMENT:
198 // no need to escape comment here because the AST can only
199 // contain valid comments.
200 if (!disableComment) {
201 context.pushStringPart(`<!--${child.content}-->`)
202 }
203 break
204 case NodeTypes.INTERPOLATION:
205 context.pushStringPart(
206 createCallExpression(context.helper(SSR_INTERPOLATE), [
207 child.content,
208 ]),
209 )
210 break
211 case NodeTypes.IF:

Callers 6

ssrProcessComponentFunction · 0.90
ssrProcessElementFunction · 0.90
ssrProcessTransitionFunction · 0.90
ssrCodegenTransformFunction · 0.85

Calls 10

ssrProcessElementFunction · 0.90
ssrProcessComponentFunction · 0.90
ssrProcessSlotOutletFunction · 0.90
createSSRCompilerErrorFunction · 0.90
escapeHtmlFunction · 0.90
ssrProcessIfFunction · 0.90
ssrProcessForFunction · 0.90
createCallExpressionFunction · 0.85
pushStringPartMethod · 0.80
helperMethod · 0.65

Tested by

no test coverage detected