wip: whitespace behavior compat

This commit is contained in:
Evan You
2021-04-26 12:21:36 -04:00
parent 091e6d67bf
commit 5913e01d6b
5 changed files with 76 additions and 53 deletions

View File

@@ -24,6 +24,7 @@ export const enum DeprecationTypes {
CONFIG_KEY_CODES = 'CONFIG_KEY_CODES',
CONFIG_PRODUCTION_TIP = 'CONFIG_PRODUCTION_TIP',
CONFIG_IGNORED_ELEMENTS = 'CONFIG_IGNORED_ELEMENTS',
CONFIG_WHITESPACE = 'CONFIG_WHITESPACE',
INSTANCE_SET = 'INSTANCE_SET',
INSTANCE_DELETE = 'INSTANCE_DELETE',
@@ -162,6 +163,15 @@ const deprecationData: Record<DeprecationTypes, DeprecationData> = {
link: `https://v3.vuejs.org/guide/migration/global-api.html#config-ignoredelements-is-now-config-iscustomelement`
},
[DeprecationTypes.CONFIG_WHITESPACE]: {
// this warning is only relevant in the full build when using runtime
// compilation, so it's put in the runtime compatConfig list.
message:
`Vue 3 compiler's whitespace option will default to "condense" instead of ` +
`"preserve". To suppress this warning, provide an explicit value for ` +
`\`config.compilerOptions.whitespace\`.`
},
[DeprecationTypes.INSTANCE_SET]: {
message:
`vm.$set() has been removed as it is no longer needed in Vue 3. ` +

View File

@@ -141,13 +141,15 @@ export function createCompatVue(
// copy over global config mutations
isCopyingConfig = true
for (const key in singletonApp.config) {
if (key === 'isNativeTag') continue
if (
key !== 'isNativeTag' &&
!(key === 'isCustomElement' && isRuntimeOnly())
isRuntimeOnly() &&
(key === 'isCustomElement' || key === 'compilerOptions')
) {
// @ts-ignore
app.config[key] = singletonApp.config[key]
continue
}
// @ts-ignore
app.config[key] = singletonApp.config[key]
}
isCopyingConfig = false