]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: experimental warnings for reactive props destructure and defineModel
authorEvan You <yyx990803@gmail.com>
Tue, 2 May 2023 08:23:02 +0000 (16:23 +0800)
committerEvan You <yyx990803@gmail.com>
Tue, 2 May 2023 08:23:02 +0000 (16:23 +0800)
packages/compiler-sfc/src/script/defineModel.ts
packages/compiler-sfc/src/script/definePropsDestructure.ts

index 0584196707aa986afff18f4449f89f0aa1e505db..2e7800aba48359d47133878cb7f1b1aa6f26acfe 100644 (file)
@@ -9,6 +9,7 @@ import {
   unwrapTSNode
 } from './utils'
 import { BindingTypes } from '@vue/compiler-dom'
+import { warnOnce } from '../warn'
 
 export const DEFINE_MODEL = 'defineModel'
 
@@ -26,6 +27,14 @@ export function processDefineModel(
   if (!ctx.options.defineModel || !isCallOf(node, DEFINE_MODEL)) {
     return false
   }
+
+  warnOnce(
+    `This project is using defineModel(), which is an experimental ` +
+      ` feature. It may receive breaking changes or be removed in the future, so ` +
+      `use at your own risk.\n` +
+      `To stay updated, follow the RFC at https://github.com/vuejs/rfcs/discussions/503.`
+  )
+
   ctx.hasDefineModelCall = true
 
   const type =
index 9f693f8519d122444b5ca3162b73505bb4c36ced..f735b324eb6bc4aa78b7658d53a093b907aafa5d 100644 (file)
@@ -21,6 +21,7 @@ import { genPropsAccessExp } from '@vue/shared'
 import { isCallOf, resolveObjectKey, unwrapTSNode } from './utils'
 import { ScriptCompileContext } from './context'
 import { DEFINE_PROPS } from './defineProps'
+import { warnOnce } from '../warn'
 
 export function processPropsDestructure(
   ctx: ScriptCompileContext,
@@ -30,6 +31,13 @@ export function processPropsDestructure(
     return
   }
 
+  warnOnce(
+    `This project is using reactive props destructure, which is an experimental ` +
+      ` feature. It may receive breaking changes or be removed in the future, so ` +
+      `use at your own risk.\n` +
+      `To stay updated, follow the RFC at https://github.com/vuejs/rfcs/discussions/502.`
+  )
+
   ctx.propsDestructureDecl = declId
 
   const registerBinding = (