Skip to content

Commit efb54e7

Browse files
committed
feat(sfc): deprecate reactivity transform
1 parent ea5bf12 commit efb54e7

File tree

3 files changed

+13
-48
lines changed

3 files changed

+13
-48
lines changed

packages/compiler-sfc/src/compileScript.ts

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -91,26 +91,11 @@ export interface SFCScriptCompileOptions {
9191
/**
9292
* (Experimental) Enable syntax transform for using refs without `.value` and
9393
* using destructured props with reactivity
94+
* @deprecated the Reactivity Transform proposal has been dropped. This
95+
* feature will be removed from Vue core in 3.4. If you intend to continue
96+
* using it, disable this and switch to the [Vue Macros implementation](https://vue-macros.sxzz.moe/features/reactivity-transform.html).
9497
*/
9598
reactivityTransform?: boolean
96-
/**
97-
* (Experimental) Enable syntax transform for using refs without `.value`
98-
* https://github.com/vuejs/rfcs/discussions/369
99-
* @deprecated now part of `reactivityTransform`
100-
* @default false
101-
*/
102-
refTransform?: boolean
103-
/**
104-
* (Experimental) Enable syntax transform for destructuring from defineProps()
105-
* https://github.com/vuejs/rfcs/discussions/394
106-
* @deprecated now part of `reactivityTransform`
107-
* @default false
108-
*/
109-
propsDestructureTransform?: boolean
110-
/**
111-
* @deprecated use `reactivityTransform` instead.
112-
*/
113-
refSugar?: boolean
11499
/**
115100
* Compile the template and inline the resulting render function
116101
* directly inside setup().
@@ -154,12 +139,8 @@ export function compileScript(
154139
let { script, scriptSetup, source, filename } = sfc
155140
// feature flags
156141
// TODO remove support for deprecated options when out of experimental
157-
const enableReactivityTransform =
158-
!!options.reactivityTransform ||
159-
!!options.refSugar ||
160-
!!options.refTransform
161-
const enablePropsTransform =
162-
!!options.reactivityTransform || !!options.propsDestructureTransform
142+
const enableReactivityTransform = !!options.reactivityTransform
143+
const enablePropsTransform = !!options.reactivityTransform
163144
const isProd = !!options.isProd
164145
const genSourceMap = options.sourceMap !== false
165146
let refBindings: string[] | undefined

packages/reactivity-transform/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# @vue/reactivity-transform
22

3-
> ⚠️ 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!
3+
> ⚠️ This is experimental and the proposal has been dropped.
4+
> The feature is now marked as deprecated and will be removed from Vue core
5+
> in 3.4.
46
>
5-
> Follow https://github.com/vuejs/rfcs/discussions/369 for details and updates.
7+
> See reason for deprecation [here](https://github.com/vuejs/rfcs/discussions/369#discussioncomment-5059028).
68
79
## Basic Rules
810

packages/reactivity-transform/src/reactivityTransform.ts

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ export function transformAST(
129129
rootRefs: string[]
130130
importedHelpers: string[]
131131
} {
132-
// TODO remove when out of experimental
133132
warnExperimental()
134133

135134
const userImports: Record<string, ImportBinding> = Object.create(null)
@@ -729,22 +728,6 @@ export function transformAST(
729728
}
730729
}
731730
}
732-
733-
// TODO remove when out of experimental
734-
if (callee === '$raw') {
735-
error(
736-
`$raw() has been replaced by $$(). ` +
737-
`See ${RFC_LINK} for latest updates.`,
738-
node
739-
)
740-
}
741-
if (callee === '$fromRef') {
742-
error(
743-
`$fromRef() has been replaced by $(). ` +
744-
`See ${RFC_LINK} for latest updates.`,
745-
node
746-
)
747-
}
748731
}
749732
},
750733
leave(node: Node, parent?: Node) {
@@ -771,7 +754,6 @@ export function transformAST(
771754
}
772755
}
773756

774-
const RFC_LINK = `https://github.com/vuejs/rfcs/discussions/369`
775757
const hasWarned: Record<string, boolean> = {}
776758

777759
function warnExperimental() {
@@ -780,10 +762,10 @@ function warnExperimental() {
780762
return
781763
}
782764
warnOnce(
783-
`Reactivity transform is an experimental feature.\n` +
784-
`Experimental features may change behavior between patch versions.\n` +
785-
`It is recommended to pin your vue dependencies to exact versions to avoid breakage.\n` +
786-
`You can follow the proposal's status at ${RFC_LINK}.`
765+
`Reactivity Transform was an experimental feature and has now been deprecated. ` +
766+
`It will be removed from Vue core in 3.4. If you intend to continue using it, ` +
767+
`switch to https://vue-macros.sxzz.moe/features/reactivity-transform.html.\n` +
768+
`See reason for deprecation here: https://github.com/vuejs/rfcs/discussions/369#discussioncomment-5059028`
787769
)
788770
}
789771

0 commit comments

Comments
 (0)