exports[`dynamic arguments 1`] = `
"import { defineComponent as _defineComponent } from 'vue'
-import { FooBar, foo, bar, unused, baz } from './x'
+import { FooBar, foo, bar, unused, baz, msg } from './x'
export default /*#__PURE__*/_defineComponent({
setup(__props, { expose: __expose }) {
__expose();
-return { get FooBar() { return FooBar }, get foo() { return foo }, get bar() { return bar }, get baz() { return baz } }
+return { get FooBar() { return FooBar }, get foo() { return foo }, get bar() { return bar }, get baz() { return baz }, get msg() { return msg } }
}
})"
test('dynamic arguments', () => {
const { content } = compile(`
<script setup lang="ts">
- import { FooBar, foo, bar, unused, baz } from './x'
+ import { FooBar, foo, bar, unused, baz, msg } from './x'
</script>
<template>
<FooBar #[foo.slotName] />
<div :[bar.attrName]="15"></div>
<div unused="unused"></div>
<div #[\`item:\${baz.key}\`]="{ value }"></div>
+ <FooBar :msg />
</template>
`)
expect(content).toMatch(
`return { get FooBar() { return FooBar }, get foo() { return foo }, ` +
- `get bar() { return bar }, get baz() { return baz } }`,
+ `get bar() { return bar }, get baz() { return baz }, get msg() { return msg } }`,
)
assertCode(content)
})
extractIdentifiers(ids, prop.forParseResult!.source)
} else if (prop.exp) {
extractIdentifiers(ids, prop.exp)
+ } else if (prop.name === 'bind' && !prop.exp) {
+ // v-bind shorthand name as identifier
+ ids.add((prop.arg as SimpleExpressionNode).content)
}
}
if (