| 184 | } |
| 185 | |
| 186 | function getPropsToString (bindings: Record<string, string>): string { |
| 187 | const vfor = bindings['v-for']?.split(' in ').map((v: string) => v.trim()) as [string, string] | undefined |
| 188 | if (Object.keys(bindings).length === 0) { return 'undefined' } |
| 189 | const contentParts: string[] = [] |
| 190 | for (const [name, value] of Object.entries(bindings)) { |
| 191 | if (name && (name !== '_bind' && name !== 'v-for')) { |
| 192 | contentParts.push(isBinding(name) ? `[\`${name.slice(1)}\`]: ${value}` : `[\`${name}\`]: \`${value}\``) |
| 193 | } |
| 194 | } |
| 195 | const content = contentParts.join(',') |
| 196 | const data = bindings._bind ? `__mergeProps(${bindings._bind}, { ${content} })` : `{ ${content} }` |
| 197 | if (!vfor) { |
| 198 | return `[${data}]` |
| 199 | } else { |
| 200 | return `__vforToArray(${vfor[1]}).map(${vfor[0]} => (${data}))` |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | type ChunkPluginOptions = { |
| 205 | dev: boolean |