(node, context)
| 46 | // Note the exit callback is executed before buildSlots() on the same node, |
| 47 | // so only nested slots see positive numbers. |
| 48 | export const trackSlotScopes: NodeTransform = (node, context) => { |
| 49 | if ( |
| 50 | node.type === NodeTypes.ELEMENT && |
| 51 | (node.tagType === ElementTypes.COMPONENT || |
| 52 | node.tagType === ElementTypes.TEMPLATE) |
| 53 | ) { |
| 54 | // We are only checking non-empty v-slot here |
| 55 | // since we only care about slots that introduce scope variables. |
| 56 | const vSlot = findDir(node, 'slot') |
| 57 | if (vSlot) { |
| 58 | const slotProps = vSlot.exp |
| 59 | if (!__BROWSER__ && context.prefixIdentifiers) { |
| 60 | slotProps && context.addIdentifiers(slotProps) |
| 61 | } |
| 62 | context.scopes.vSlot++ |
| 63 | return () => { |
| 64 | if (!__BROWSER__ && context.prefixIdentifiers) { |
| 65 | slotProps && context.removeIdentifiers(slotProps) |
| 66 | } |
| 67 | context.scopes.vSlot-- |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | // A NodeTransform that tracks scope identifiers for scoped slots with v-for. |
| 74 | // This transform is only applied in non-browser builds with { prefixIdentifiers: true } |
nothing calls this directly
no test coverage detected