(node, context)
| 10 | } from '@vue/compiler-dom' |
| 11 | |
| 12 | export const ssrInjectCssVars: NodeTransform = (node, context) => { |
| 13 | if (!context.ssrCssVars) { |
| 14 | return |
| 15 | } |
| 16 | |
| 17 | // _cssVars is initialized once per render function |
| 18 | // the code is injected in ssrCodegenTransform when creating the |
| 19 | // ssr transform context |
| 20 | if (node.type === NodeTypes.ROOT) { |
| 21 | context.identifiers._cssVars = 1 |
| 22 | } |
| 23 | |
| 24 | const parent = context.parent |
| 25 | if (!parent || parent.type !== NodeTypes.ROOT) { |
| 26 | return |
| 27 | } |
| 28 | |
| 29 | if (node.type === NodeTypes.IF_BRANCH) { |
| 30 | for (const child of node.children) { |
| 31 | injectCssVars(child) |
| 32 | } |
| 33 | } else { |
| 34 | injectCssVars(node) |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | function injectCssVars(node: RootNode | TemplateChildNode) { |
| 39 | if ( |
nothing calls this directly
no test coverage detected