From 4af5d1b0754035058436f9e4e5c12aedef199177 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 31 Mar 2023 08:53:15 +0800 Subject: [PATCH] feat(sfc): revert withDefaults() deprecation In some cases, the user still needs access to the full props object, in such cases withDefaults() is still needed. --- CHANGELOG.md | 2 +- packages/compiler-sfc/src/compileScript.ts | 7 +------ packages/runtime-core/src/apiSetupHelpers.ts | 2 -- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5b70cbf6a2..ad42a00eccb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,7 @@ * **compiler-core:** support parsing `const` modifier in type parameters ([#7912](https://github.com/vuejs/core/issues/7912)) ([b7bd50f](https://github.com/vuejs/core/commit/b7bd50f5059e8755c0204f01a8c55b1724688e7e)) * **compiler-sfc:** add defineOptions macro ([#5738](https://github.com/vuejs/core/issues/5738)) ([bcf5841](https://github.com/vuejs/core/commit/bcf5841ddecc64d0bdbd56ce1463eb8ebf01bb9d)) -* **compiler-sfc:** enable reactive props destructure by default and deprecate withDefaults() ([#7986](https://github.com/vuejs/core/issues/7986)) ([ba9c2ae](https://github.com/vuejs/core/commit/ba9c2ae247fcc3960b238a04cb635158daa82004)) +* **compiler-sfc:** enable reactive props destructure by default ([#7986](https://github.com/vuejs/core/issues/7986)) ([ba9c2ae](https://github.com/vuejs/core/commit/ba9c2ae247fcc3960b238a04cb635158daa82004)) * **compiler-sfc:** improve runtime props inference for enum ([eded947](https://github.com/vuejs/core/commit/eded94712e37856f258dc8c85f98a26fa41ae05f)) * **compiler-sfc:** support generating variable instead of default export in compileScript ([71635be](https://github.com/vuejs/core/commit/71635be68d25887f91d624bb7f78281a851bc0cb)) * **compiler-sfc:** support module string names syntax ([#7428](https://github.com/vuejs/core/issues/7428)) ([0002567](https://github.com/vuejs/core/commit/000256772816d54976e462330a7be342c49c7304)) diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index ef287a0a8fb..cb9e4860126 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -162,7 +162,7 @@ export function compileScript( ): SFCScriptBlock { let { script, scriptSetup, source, filename } = sfc // feature flags - // TODO remove support for deprecated options when out of experimental + // TODO remove in 3.4 const enableReactivityTransform = !!options.reactivityTransform const isProd = !!options.isProd const genSourceMap = options.sourceMap !== false @@ -524,11 +524,6 @@ export function compileScript( if (!isCallOf(node, WITH_DEFAULTS)) { return false } - warnOnce( - `withDefaults() has been deprecated. ` + - `Props destructure is now reactive by default - ` + - `use destructure with default values instead.` - ) if (processDefineProps(node.arguments[0], declId)) { if (propsRuntimeDecl) { error( diff --git a/packages/runtime-core/src/apiSetupHelpers.ts b/packages/runtime-core/src/apiSetupHelpers.ts index 91f4e39e32e..31307aa7e75 100644 --- a/packages/runtime-core/src/apiSetupHelpers.ts +++ b/packages/runtime-core/src/apiSetupHelpers.ts @@ -232,8 +232,6 @@ type PropsWithDefaults = Base & { * * This is only usable inside `