(node, state)
| 160 | } |
| 161 | |
| 162 | function transform(node, state) { |
| 163 | if (t.isNode(node)) return node; |
| 164 | if (typeof node === 'string') return stringValue(node); |
| 165 | if (typeof node === 'undefined') return t.identifier('undefined'); |
| 166 | |
| 167 | const { tag, props, children } = node; |
| 168 | const newTag = typeof tag === 'string' ? t.stringLiteral(tag) : tag; |
| 169 | const newProps = spreadNode(props, state); |
| 170 | const newChildren = t.arrayExpression(children.map(child => transform(child, state))); |
| 171 | return createVNode(newTag, newProps, newChildren); |
| 172 | } |
| 173 | |
| 174 | // The tagged template tag function name we're looking for. |
| 175 | // This is static because it's generally assigned via htm.bind(h), |
searching dependent graphs…