expect(code).not.toMatch(`_ctx.t`)
})
+test('prefixing edge case for reused AST ssr mode', () => {
+ const src = `
+ <script setup lang="ts">
+ import { Foo } from './foo'
+ </script>
+ <template>
+ <Bar>
+ <template #option="{ foo }"></template>
+ </Bar>
+ </template>
+ `
+ const { descriptor } = parse(src)
+ // compileScript triggers importUsageCheck
+ compileScript(descriptor, { id: 'xxx' })
+ expect(() =>
+ compileTemplate({
+ id: 'xxx',
+ filename: 'test.vue',
+ ast: descriptor.template!.ast,
+ source: descriptor.template!.content,
+ ssr: true,
+ }),
+ ).not.toThrowError()
+})
+
interface Pos {
line: number
column: number
ssrProcessTransitionGroup,
ssrTransformTransitionGroup,
} from './ssrTransformTransitionGroup'
-import { extend, isArray, isObject, isSymbol } from '@vue/shared'
+import { extend, isArray, isObject, isPlainObject, isSymbol } from '@vue/shared'
import { buildSSRProps } from './ssrTransformElement'
import {
ssrProcessTransition,
const vnodeBranches: ReturnStatement[] = []
const clonedNode = clone(node)
+ console.log(clonedNode)
+
return function ssrPostTransformComponent() {
// Using the cloned node, build the normal VNode-based branches (for
// fallback in case the child is render-fn based). Store them in an array
function clone(v: any): any {
if (isArray(v)) {
return v.map(clone)
- } else if (isObject(v)) {
+ } else if (isPlainObject(v)) {
const res: any = {}
for (const key in v) {
- res[key] = clone(v[key])
+ res[key] = clone(v[key as keyof typeof v])
}
return res
} else {