( props: PropsExpression | undefined, directives: DirectiveNode[], context: TransformContext, )
| 372 | } |
| 373 | |
| 374 | export function buildSSRProps( |
| 375 | props: PropsExpression | undefined, |
| 376 | directives: DirectiveNode[], |
| 377 | context: TransformContext, |
| 378 | ): JSChildNode { |
| 379 | let mergePropsArgs: JSChildNode[] = [] |
| 380 | if (props) { |
| 381 | if (props.type === NodeTypes.JS_CALL_EXPRESSION) { |
| 382 | // already a mergeProps call |
| 383 | mergePropsArgs = props.arguments as JSChildNode[] |
| 384 | } else { |
| 385 | mergePropsArgs.push(props) |
| 386 | } |
| 387 | } |
| 388 | if (directives.length) { |
| 389 | for (const dir of directives) { |
| 390 | mergePropsArgs.push( |
| 391 | createCallExpression(context.helper(SSR_GET_DIRECTIVE_PROPS), [ |
| 392 | `_ctx`, |
| 393 | ...buildDirectiveArgs(dir, context).elements, |
| 394 | ] as JSChildNode[]), |
| 395 | ) |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | return mergePropsArgs.length > 1 |
| 400 | ? createCallExpression(context.helper(MERGE_PROPS), mergePropsArgs) |
| 401 | : mergePropsArgs[0] |
| 402 | } |
| 403 | |
| 404 | function isTrueFalseValue(prop: DirectiveNode | AttributeNode) { |
| 405 | if (prop.type === NodeTypes.DIRECTIVE) { |
no test coverage detected