]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: remove stale references of ref-transform
authorEvan You <yyx990803@gmail.com>
Thu, 23 Dec 2021 08:56:36 +0000 (16:56 +0800)
committerEvan You <yyx990803@gmail.com>
Thu, 23 Dec 2021 08:56:36 +0000 (16:56 +0800)
packages/compiler-sfc/__tests__/compileScript.spec.ts
packages/compiler-sfc/__tests__/compileScriptPropsTransform.spec.ts
packages/compiler-sfc/__tests__/compileScriptRefTransform.spec.ts
packages/compiler-sfc/src/compileScript.ts
packages/reactivity-transform/__tests__/reactivityTransform.spec.ts [moved from packages/reactivity-transform/__tests__/refTransform.spec.ts with 100% similarity]
packages/reactivity-transform/src/index.ts
packages/reactivity-transform/src/reactivityTransform.ts [moved from packages/reactivity-transform/src/refTransform.ts with 99% similarity]
packages/sfc-playground/src/App.vue

index 93373b2b4dca309ff8182c86d57ce877f49e6674..4d40d88de72f99db4529fd6d99971702b2e34c9e 100644 (file)
@@ -310,7 +310,7 @@ defineExpose({ foo: 123 })
       let foo = $ref(1)
       </script>
       `,
-        { refTransform: true }
+        { reactivityTransform: true }
       )
       assertCode(content)
       expect(content).toMatch(`import { ref } from 'vue'`)
@@ -1108,7 +1108,7 @@ const emit = defineEmits(['a', 'b'])
   describe('async/await detection', () => {
     function assertAwaitDetection(code: string, shouldAsync = true) {
       const { content } = compile(`<script setup>${code}</script>`, {
-        refTransform: true
+        reactivityTransform: true
       })
       if (shouldAsync) {
         expect(content).toMatch(`let __temp, __restore`)
index 08a97316dcfe452285bc5a089ea74e75f20d4d94..140dbec2e6be20ad1468b54d298ec28c7944e17f 100644 (file)
@@ -6,7 +6,7 @@ describe('sfc props transform', () => {
   function compile(src: string, options?: Partial<SFCScriptCompileOptions>) {
     return compileSFCScript(src, {
       inlineTemplate: true,
-      propsDestructureTransform: true,
+      reactivityTransform: true,
       ...options
     })
   }
index f6897b8038d8795a249c054d55dbf0f5bcb9c0f8..15e633c6e0a70af000ab4573cd4086b2b5157b48 100644 (file)
@@ -4,12 +4,12 @@ import { compileSFCScript as compile, assertCode } from './utils'
 // this file only tests integration with SFC - main test case for the ref
 // transform can be found in <root>/packages/reactivity-transform/__tests__
 describe('sfc ref transform', () => {
-  function compileWithRefTransform(src: string) {
-    return compile(src, { refTransform: true })
+  function compileWithReactivityTransform(src: string) {
+    return compile(src, { reactivityTransform: true })
   }
 
   test('$ unwrapping', () => {
-    const { content, bindings } = compileWithRefTransform(`<script setup>
+    const { content, bindings } = compileWithReactivityTransform(`<script setup>
     import { ref, shallowRef } from 'vue'
     let foo = $(ref())
     let a = $(ref(1))
@@ -46,7 +46,7 @@ describe('sfc ref transform', () => {
   })
 
   test('$ref & $shallowRef declarations', () => {
-    const { content, bindings } = compileWithRefTransform(`<script setup>
+    const { content, bindings } = compileWithReactivityTransform(`<script setup>
     let foo = $ref()
     let a = $ref(1)
     let b = $shallowRef({
@@ -82,7 +82,7 @@ describe('sfc ref transform', () => {
   })
 
   test('usage in normal <script>', () => {
-    const { content } = compileWithRefTransform(`<script>
+    const { content } = compileWithReactivityTransform(`<script>
     export default {
       setup() {
         let count = $ref(0)
@@ -100,7 +100,7 @@ describe('sfc ref transform', () => {
   })
 
   test('usage /w typescript', () => {
-    const { content } = compileWithRefTransform(`
+    const { content } = compileWithReactivityTransform(`
       <script setup lang="ts">
         let msg = $ref<string | number>('foo');
         let bar = $ref <string | number>('bar');
@@ -113,7 +113,7 @@ describe('sfc ref transform', () => {
   })
 
   test('usage with normal <script> + <script setup>', () => {
-    const { content, bindings } = compileWithRefTransform(`<script>
+    const { content, bindings } = compileWithReactivityTransform(`<script>
     let a = $ref(0)
     let c = $ref(0)
     </script>
@@ -156,7 +156,7 @@ describe('sfc ref transform', () => {
           bar
         })
       </script>`,
-          { refTransform: true }
+          { reactivityTransform: true }
         )
       ).toThrow(`cannot reference locally declared variables`)
 
@@ -168,7 +168,7 @@ describe('sfc ref transform', () => {
           bar
         })
       </script>`,
-          { refTransform: true }
+          { reactivityTransform: true }
         )
       ).toThrow(`cannot reference locally declared variables`)
     })
index 75203d42b53bcabd85fa3e7b67fbed722602329a..79ac5207ed708e9eb5c19637b539799dd83ea208 100644 (file)
@@ -104,7 +104,7 @@ export interface SFCScriptCompileOptions {
    */
   propsDestructureTransform?: boolean
   /**
-   * @deprecated use `refTransform` instead.
+   * @deprecated use `reactivityTransform` instead.
    */
   refSugar?: boolean
   /**
index 2009e6800fd8d4cebe9a5a98662fd23716cdd54d..0a4d85f00fcbe0381f52aaef4e773279dae24096 100644 (file)
@@ -1 +1 @@
-export * from './refTransform'
+export * from './reactivityTransform'
similarity index 99%
rename from packages/reactivity-transform/src/refTransform.ts
rename to packages/reactivity-transform/src/reactivityTransform.ts
index 6a94f3b58a5f1ffd2c69a6691d5e38ac6fae4000..f7a822ff508e9d2f42088e5ffb0cb247c7bb1606 100644 (file)
@@ -660,6 +660,6 @@ function warnOnce(msg: string) {
 
 function warn(msg: string) {
   console.warn(
-    `\x1b[1m\x1b[33m[@vue/ref-transform]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`
+    `\x1b[1m\x1b[33m[@vue/reactivity-transform]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`
   )
 }
index 299bd0aced333e78f6479cb974071cbe90f39c62..df91bb5af74bc5e25f7fbc7467c1d643890a58ec 100644 (file)
@@ -19,8 +19,7 @@ const store = new ReplStore({
 // enable experimental features
 const sfcOptions = {
   script: {
-    refTransform: true,
-    propsDestructureTransform: true
+    reactivityTransform: true
   }
 }