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)
</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`)

View 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
})
}

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
// 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`)
})

View File

@ -104,7 +104,7 @@ export interface SFCScriptCompileOptions {
*/
propsDestructureTransform?: boolean
/**
* @deprecated use `refTransform` instead.
* @deprecated use `reactivityTransform` instead.
*/
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) {
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
const sfcOptions = {
script: {
refTransform: true,
propsDestructureTransform: true
reactivityTransform: true
}
}