diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScriptRefSugar.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScriptRefSugar.spec.ts.snap index df09c5af..f4970919 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScriptRefSugar.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScriptRefSugar.spec.ts.snap @@ -74,16 +74,16 @@ return { a, get } `; exports[``) expect(content).toMatch(`let [{ a: { b: __b }}] = (useFoo())`) expect(content).toMatch(`let { c: [__d, __e] } = (useBar())`) - expect(content).not.toMatch(`\nconst a = _ref(__a);`) - expect(content).not.toMatch(`\nconst c = _ref(__c);`) - expect(content).toMatch(`\nconst b = _ref(__b);`) - expect(content).toMatch(`\nconst d = _ref(__d);`) - expect(content).toMatch(`\nconst e = _ref(__e);`) + expect(content).not.toMatch(`\nconst a = _shallowRef(__a);`) + expect(content).not.toMatch(`\nconst c = _shallowRef(__c);`) + expect(content).toMatch(`\nconst b = _shallowRef(__b);`) + expect(content).toMatch(`\nconst d = _shallowRef(__d);`) + expect(content).toMatch(`\nconst e = _shallowRef(__e);`) expect(content).toMatch(`return { b, d, e }`) expect(bindings).toStrictEqual({ b: BindingTypes.SETUP_REF, diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index 8fb6b7ff..c6709475 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -643,7 +643,7 @@ export function compileScript( // append binding declarations after the parent statement s.appendLeft( statement.end! + startOffset, - `\nconst ${nameId.name} = ${helper('ref')}(__${nameId.name});` + `\nconst ${nameId.name} = ${helper('shallowRef')}(__${nameId.name});` ) } } @@ -677,7 +677,7 @@ export function compileScript( // append binding declarations after the parent statement s.appendLeft( statement.end! + startOffset, - `\nconst ${nameId.name} = ${helper('ref')}(__${nameId.name});` + `\nconst ${nameId.name} = ${helper('shallowRef')}(__${nameId.name});` ) } } diff --git a/packages/runtime-core/src/helpers/refMacros.ts b/packages/runtime-core/src/helpers/refSugar.ts similarity index 100% rename from packages/runtime-core/src/helpers/refMacros.ts rename to packages/runtime-core/src/helpers/refSugar.ts diff --git a/packages/runtime-core/src/index.ts b/packages/runtime-core/src/index.ts index 5fbcc892..a784bd73 100644 --- a/packages/runtime-core/src/index.ts +++ b/packages/runtime-core/src/index.ts @@ -352,6 +352,6 @@ export const compatUtils = ( __COMPAT__ ? _compatUtils : null ) as typeof _compatUtils -// Ref macros ------------------------------------------------------------------ +// Ref sugar macros ------------------------------------------------------------ // for dts generation only -export { $ref, $computed, $raw, $fromRefs } from './helpers/refMacros' +export { $ref, $computed, $raw, $fromRefs } from './helpers/refSugar' diff --git a/test-dts/refMacros.test-d.ts b/test-dts/regSugar.test-d.ts similarity index 100% rename from test-dts/refMacros.test-d.ts rename to test-dts/regSugar.test-d.ts