isSymbol,
isOn,
isObject,
- isReservedProp
+ isReservedProp,
+ capitalize,
+ camelize,
+ EMPTY_OBJ
} from '@vue/shared'
import { createCompilerError, ErrorCodes } from '../errors'
import {
}
// 3. user component (from setup bindings)
- if (context.bindingMetadata[tag] === 'setup') {
- return `$setup[${JSON.stringify(tag)}]`
+ let tagFromSetup = tag
+ const bindings = context.bindingMetadata
+ if (
+ bindings !== EMPTY_OBJ &&
+ (bindings[tagFromSetup] === 'setup' ||
+ bindings[(tagFromSetup = camelize(tag))] === 'setup' ||
+ bindings[(tagFromSetup = capitalize(camelize(tag)))] === 'setup')
+ ) {
+ return `$setup[${JSON.stringify(tagFromSetup)}]`
}
// 4. user component (resolve)
function warnOnce(msg: string) {
if (!hasWarned[msg]) {
hasWarned[msg] = true
- console.log(`\n\x1b[33m[@vue/compiler-sfc] %s\x1b[0m\n`, msg)
+ console.log(`\x1b[33m[@vue/compiler-sfc] %s\x1b[0m\n`, msg)
}
}
if (__DEV__ && !__TEST__ && scriptSetup) {
warnOnce(
`<script setup> is still an experimental proposal.\n` +
- `Follow https://github.com/vuejs/rfcs/pull/227 for its status.`
+ `Follow its status at https://github.com/vuejs/rfcs/pull/227.`
)
}
) {
if (enableRefSugar) {
warnOnce(
- `ref: sugar is still an experimental proposal and is not\n` +
+ `ref: sugar is still an experimental proposal and is not ` +
`guaranteed to be a part of <script setup>.\n` +
- `Follow its status at https://github.com/vuejs/rfcs/pull/228`
+ `Follow its status at https://github.com/vuejs/rfcs/pull/228.`
)
s.overwrite(
node.label.start! + startOffset,