]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
feat(sfc): deprecate reactivity transform
authorEvan You <yyx990803@gmail.com>
Mon, 27 Mar 2023 12:56:07 +0000 (20:56 +0800)
committerEvan You <yyx990803@gmail.com>
Mon, 27 Mar 2023 13:01:36 +0000 (21:01 +0800)
packages/compiler-sfc/src/compileScript.ts
packages/reactivity-transform/README.md
packages/reactivity-transform/src/reactivityTransform.ts

index b7e4c0ea77885db699ddb40a22c4bc6cf1fdb917..310a9e374ec0ef21572a9d1dca03a8919f3bc9c3 100644 (file)
@@ -91,26 +91,11 @@ export interface SFCScriptCompileOptions {
   /**
    * (Experimental) Enable syntax transform for using refs without `.value` and
    * using destructured props with reactivity
+   * @deprecated the Reactivity Transform proposal has been dropped. This
+   * feature will be removed from Vue core in 3.4. If you intend to continue
+   * using it, disable this and switch to the [Vue Macros implementation](https://vue-macros.sxzz.moe/features/reactivity-transform.html).
    */
   reactivityTransform?: boolean
-  /**
-   * (Experimental) Enable syntax transform for using refs without `.value`
-   * https://github.com/vuejs/rfcs/discussions/369
-   * @deprecated now part of `reactivityTransform`
-   * @default false
-   */
-  refTransform?: boolean
-  /**
-   * (Experimental) Enable syntax transform for destructuring from defineProps()
-   * https://github.com/vuejs/rfcs/discussions/394
-   * @deprecated now part of `reactivityTransform`
-   * @default false
-   */
-  propsDestructureTransform?: boolean
-  /**
-   * @deprecated use `reactivityTransform` instead.
-   */
-  refSugar?: boolean
   /**
    * Compile the template and inline the resulting render function
    * directly inside setup().
@@ -154,12 +139,8 @@ export function compileScript(
   let { script, scriptSetup, source, filename } = sfc
   // feature flags
   // TODO remove support for deprecated options when out of experimental
-  const enableReactivityTransform =
-    !!options.reactivityTransform ||
-    !!options.refSugar ||
-    !!options.refTransform
-  const enablePropsTransform =
-    !!options.reactivityTransform || !!options.propsDestructureTransform
+  const enableReactivityTransform = !!options.reactivityTransform
+  const enablePropsTransform = !!options.reactivityTransform
   const isProd = !!options.isProd
   const genSourceMap = options.sourceMap !== false
   let refBindings: string[] | undefined
index 92277a8b288d44066b646640f9ba2fcd09673017..931702b3b0d93e2dcb629dd994f336f38fbd8ddb 100644 (file)
@@ -1,8 +1,10 @@
 # @vue/reactivity-transform
 
-> ⚠️ This is experimental and currently only provided for testing and feedback. It may break during patches or even be removed. Use at your own risk!
+> ⚠️ This is experimental and the proposal has been dropped.
+> The feature is now marked as deprecated and will be removed from Vue core
+> in 3.4.
 >
-> Follow https://github.com/vuejs/rfcs/discussions/369 for details and updates.
+> See reason for deprecation [here](https://github.com/vuejs/rfcs/discussions/369#discussioncomment-5059028).
 
 ## Basic Rules
 
index 4223df527fc1f1905215a57a570cf6ef695ed093..16cf88e5ac8595586f4ee07febaf43d818cff23c 100644 (file)
@@ -129,7 +129,6 @@ export function transformAST(
   rootRefs: string[]
   importedHelpers: string[]
 } {
-  // TODO remove when out of experimental
   warnExperimental()
 
   const userImports: Record<string, ImportBinding> = Object.create(null)
@@ -729,22 +728,6 @@ export function transformAST(
             }
           }
         }
-
-        // TODO remove when out of experimental
-        if (callee === '$raw') {
-          error(
-            `$raw() has been replaced by $$(). ` +
-              `See ${RFC_LINK} for latest updates.`,
-            node
-          )
-        }
-        if (callee === '$fromRef') {
-          error(
-            `$fromRef() has been replaced by $(). ` +
-              `See ${RFC_LINK} for latest updates.`,
-            node
-          )
-        }
       }
     },
     leave(node: Node, parent?: Node) {
@@ -771,7 +754,6 @@ export function transformAST(
   }
 }
 
-const RFC_LINK = `https://github.com/vuejs/rfcs/discussions/369`
 const hasWarned: Record<string, boolean> = {}
 
 function warnExperimental() {
@@ -780,10 +762,10 @@ function warnExperimental() {
     return
   }
   warnOnce(
-    `Reactivity transform is an experimental feature.\n` +
-      `Experimental features may change behavior between patch versions.\n` +
-      `It is recommended to pin your vue dependencies to exact versions to avoid breakage.\n` +
-      `You can follow the proposal's status at ${RFC_LINK}.`
+    `Reactivity Transform was an experimental feature and has now been deprecated. ` +
+      `It will be removed from Vue core in 3.4. If you intend to continue using it, ` +
+      `switch to https://vue-macros.sxzz.moe/features/reactivity-transform.html.\n` +
+      `See reason for deprecation here: https://github.com/vuejs/rfcs/discussions/369#discussioncomment-5059028`
   )
 }