Skip to content

Commit

Permalink
chore: remove stale references of ref-transform
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 23, 2021
1 parent a273e88 commit fef191f
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions packages/compiler-sfc/__tests__/compileScript.spec.ts
Expand Up @@ -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'`)
Expand Down Expand Up @@ -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`)
Expand Down
Expand Up @@ -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
})
}
Expand Down
Expand Up @@ -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))
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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)
Expand All @@ -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');
Expand All @@ -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>
Expand Down Expand Up @@ -156,7 +156,7 @@ describe('sfc ref transform', () => {
bar
})
</script>`,
{ refTransform: true }
{ reactivityTransform: true }
)
).toThrow(`cannot reference locally declared variables`)

Expand All @@ -168,7 +168,7 @@ describe('sfc ref transform', () => {
bar
})
</script>`,
{ refTransform: true }
{ reactivityTransform: true }
)
).toThrow(`cannot reference locally declared variables`)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-sfc/src/compileScript.ts
Expand Up @@ -104,7 +104,7 @@ export interface SFCScriptCompileOptions {
*/
propsDestructureTransform?: boolean
/**
* @deprecated use `refTransform` instead.
* @deprecated use `reactivityTransform` instead.
*/
refSugar?: boolean
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/reactivity-transform/src/index.ts
@@ -1 +1 @@
export * from './refTransform'
export * from './reactivityTransform'
Expand Up @@ -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`
)
}
3 changes: 1 addition & 2 deletions packages/sfc-playground/src/App.vue
Expand Up @@ -19,8 +19,7 @@ const store = new ReplStore({
// enable experimental features
const sfcOptions = {
script: {
refTransform: true,
propsDestructureTransform: true
reactivityTransform: true
}
}
Expand Down

0 comments on commit fef191f

Please sign in to comment.