import { SourceLocation } from '../ast' import { CompilerError } from '../errors' import { ParserContext } from '../parse' import { TransformContext } from '../transform' export type CompilerCompatConfig = Partial< Record > & { MODE?: 2 | 3 } export interface CompilerCompatOptions { compatConfig?: CompilerCompatConfig } export const enum CompilerDeprecationTypes { COMPILER_IS_ON_ELEMENT = 'COMPILER_IS_ON_ELEMENT', COMPILER_V_BIND_SYNC = 'COMPILER_V_BIND_SYNC', COMPILER_V_BIND_PROP = 'COMPILER_V_BIND_PROP', COMPILER_V_BIND_OBJECT_ORDER = 'COMPILER_V_BIND_OBJECT_ORDER', COMPILER_V_ON_NATIVE = 'COMPILER_V_ON_NATIVE', COMPILER_V_IF_V_FOR_PRECEDENCE = 'COMPILER_V_IF_V_FOR_PRECEDENCE', COMPILER_NATIVE_TEMPLATE = 'COMPILER_NATIVE_TEMPLATE', COMPILER_INLINE_TEMPLATE = 'COMPILER_INLINE_TEMPLATE', COMPILER_FILTER = 'COMPILER_FILTER' } type DeprecationData = { message: string | ((...args: any[]) => string) link?: string } const deprecationData: Record = { [CompilerDeprecationTypes.COMPILER_IS_ON_ELEMENT]: { message: `Platform-native elements with "is" prop will no longer be ` + `treated as components in Vue 3 unless the "is" value is explicitly ` + `prefixed with "vue:".`, link: `https://v3.vuejs.org/guide/migration/custom-elements-interop.html` }, [CompilerDeprecationTypes.COMPILER_V_BIND_SYNC]: { message: key => `.sync modifier for v-bind has been removed. Use v-model with ` + `argument instead. \`v-bind:${key}.sync\` should be changed to ` + `\`v-model:${key}\`.`, link: `https://v3.vuejs.org/guide/migration/v-model.html` }, [CompilerDeprecationTypes.COMPILER_V_BIND_PROP]: { message: `.prop modifier for v-bind has been removed and no longer necessary. ` + `Vue 3 will automatically set a binding as DOM property when appropriate.` }, [CompilerDeprecationTypes.COMPILER_V_BIND_OBJECT_ORDER]: { message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript ` + `object spread: it will now overwrite an existing non-mergeable attribute ` + `that appears before v-bind in the case of conflict. ` + `To retain 2.x behavior, move v-bind to make it the first attribute. ` + `You can also suppress this warning if the usage is intended.`, link: `https://v3.vuejs.org/guide/migration/v-bind.html` }, [CompilerDeprecationTypes.COMPILER_V_ON_NATIVE]: { message: `.native modifier for v-on has been removed as is no longer necessary.`, link: `https://v3.vuejs.org/guide/migration/v-on-native-modifier-removed.html` }, [CompilerDeprecationTypes.COMPILER_V_IF_V_FOR_PRECEDENCE]: { message: `v-if / v-for precedence when used on the same element has changed ` + `in Vue 3: v-if now takes higher precedence and will no longer have ` + `access to v-for scope variables. It is best to avoid the ambiguity ` + `with