chore: remove stale references of ref-transform

This commit is contained in:
Evan You 2021-12-23 16:56:36 +08:00
parent a273e8844c
commit fef191fb07
8 changed files with 16 additions and 17 deletions

View File

@ -310,7 +310,7 @@ defineExpose({ foo: 123 })
let foo = $ref(1) let foo = $ref(1)
</script> </script>
`, `,
{ refTransform: true } { reactivityTransform: true }
) )
assertCode(content) assertCode(content)
expect(content).toMatch(`import { ref } from 'vue'`) expect(content).toMatch(`import { ref } from 'vue'`)
@ -1108,7 +1108,7 @@ const emit = defineEmits(['a', 'b'])
describe('async/await detection', () => { describe('async/await detection', () => {
function assertAwaitDetection(code: string, shouldAsync = true) { function assertAwaitDetection(code: string, shouldAsync = true) {
const { content } = compile(`<script setup>${code}</script>`, { const { content } = compile(`<script setup>${code}</script>`, {
refTransform: true reactivityTransform: true
}) })
if (shouldAsync) { if (shouldAsync) {
expect(content).toMatch(`let __temp, __restore`) expect(content).toMatch(`let __temp, __restore`)

View File

@ -6,7 +6,7 @@ describe('sfc props transform', () => {
function compile(src: string, options?: Partial<SFCScriptCompileOptions>) { function compile(src: string, options?: Partial<SFCScriptCompileOptions>) {
return compileSFCScript(src, { return compileSFCScript(src, {
inlineTemplate: true, inlineTemplate: true,
propsDestructureTransform: true, reactivityTransform: true,
...options ...options
}) })
} }

View 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 // this file only tests integration with SFC - main test case for the ref
// transform can be found in <root>/packages/reactivity-transform/__tests__ // transform can be found in <root>/packages/reactivity-transform/__tests__
describe('sfc ref transform', () => { describe('sfc ref transform', () => {
function compileWithRefTransform(src: string) { function compileWithReactivityTransform(src: string) {
return compile(src, { refTransform: true }) return compile(src, { reactivityTransform: true })
} }
test('$ unwrapping', () => { test('$ unwrapping', () => {
const { content, bindings } = compileWithRefTransform(`<script setup> const { content, bindings } = compileWithReactivityTransform(`<script setup>
import { ref, shallowRef } from 'vue' import { ref, shallowRef } from 'vue'
let foo = $(ref()) let foo = $(ref())
let a = $(ref(1)) let a = $(ref(1))
@ -46,7 +46,7 @@ describe('sfc ref transform', () => {
}) })
test('$ref & $shallowRef declarations', () => { test('$ref & $shallowRef declarations', () => {
const { content, bindings } = compileWithRefTransform(`<script setup> const { content, bindings } = compileWithReactivityTransform(`<script setup>
let foo = $ref() let foo = $ref()
let a = $ref(1) let a = $ref(1)
let b = $shallowRef({ let b = $shallowRef({
@ -82,7 +82,7 @@ describe('sfc ref transform', () => {
}) })
test('usage in normal <script>', () => { test('usage in normal <script>', () => {
const { content } = compileWithRefTransform(`<script> const { content } = compileWithReactivityTransform(`<script>
export default { export default {
setup() { setup() {
let count = $ref(0) let count = $ref(0)
@ -100,7 +100,7 @@ describe('sfc ref transform', () => {
}) })
test('usage /w typescript', () => { test('usage /w typescript', () => {
const { content } = compileWithRefTransform(` const { content } = compileWithReactivityTransform(`
<script setup lang="ts"> <script setup lang="ts">
let msg = $ref<string | number>('foo'); let msg = $ref<string | number>('foo');
let bar = $ref <string | number>('bar'); let bar = $ref <string | number>('bar');
@ -113,7 +113,7 @@ describe('sfc ref transform', () => {
}) })
test('usage with normal <script> + <script setup>', () => { test('usage with normal <script> + <script setup>', () => {
const { content, bindings } = compileWithRefTransform(`<script> const { content, bindings } = compileWithReactivityTransform(`<script>
let a = $ref(0) let a = $ref(0)
let c = $ref(0) let c = $ref(0)
</script> </script>
@ -156,7 +156,7 @@ describe('sfc ref transform', () => {
bar bar
}) })
</script>`, </script>`,
{ refTransform: true } { reactivityTransform: true }
) )
).toThrow(`cannot reference locally declared variables`) ).toThrow(`cannot reference locally declared variables`)
@ -168,7 +168,7 @@ describe('sfc ref transform', () => {
bar bar
}) })
</script>`, </script>`,
{ refTransform: true } { reactivityTransform: true }
) )
).toThrow(`cannot reference locally declared variables`) ).toThrow(`cannot reference locally declared variables`)
}) })

View File

@ -104,7 +104,7 @@ export interface SFCScriptCompileOptions {
*/ */
propsDestructureTransform?: boolean propsDestructureTransform?: boolean
/** /**
* @deprecated use `refTransform` instead. * @deprecated use `reactivityTransform` instead.
*/ */
refSugar?: boolean refSugar?: boolean
/** /**

View File

@ -1 +1 @@
export * from './refTransform' export * from './reactivityTransform'

View File

@ -660,6 +660,6 @@ function warnOnce(msg: string) {
function warn(msg: string) { function warn(msg: string) {
console.warn( 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`
) )
} }

View File

@ -19,8 +19,7 @@ const store = new ReplStore({
// enable experimental features // enable experimental features
const sfcOptions = { const sfcOptions = {
script: { script: {
refTransform: true, reactivityTransform: true
propsDestructureTransform: true
} }
} }