From 85b2f5b26ed7b72d23ccf140dd0e682754c3d548 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 21 Nov 2023 21:07:50 +0800 Subject: [PATCH] feat!: drop reactivity transform support BREAKING CHANGE: Reactivity Transform is no longer supported as part of this plugin, in coordination with Vue 3.4. Use VueMacros if you wish to continue using this feature. --- packages/plugin-vue/src/index.ts | 21 ------------------- playground/vue/Main.vue | 2 -- playground/vue/ReactivityTransform.vue | 12 ----------- playground/vue/__tests__/vue.spec.ts | 8 ------- .../SetupImportTemplate.vue | 5 +++-- 5 files changed, 3 insertions(+), 45 deletions(-) delete mode 100644 playground/vue/ReactivityTransform.vue diff --git a/packages/plugin-vue/src/index.ts b/packages/plugin-vue/src/index.ts index b9f15b86..35afedbf 100644 --- a/packages/plugin-vue/src/index.ts +++ b/packages/plugin-vue/src/index.ts @@ -9,7 +9,6 @@ import type { SFCTemplateCompileOptions, } from 'vue/compiler-sfc' import type * as _compiler from 'vue/compiler-sfc' -import type { ExistingRawSourceMap } from 'rollup' /* eslint-enable import/no-duplicates */ import { computed, shallowRef } from 'vue' import { version } from '../package.json' @@ -124,13 +123,6 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { ? () => options.value.customElement as boolean : createFilter(options.value.customElement), ) - const refTransformFilter = computed(() => - options.value.reactivityTransform === false - ? () => false - : options.value.reactivityTransform === true - ? createFilter(/\.(j|t)sx?$/, /node_modules/) - : createFilter(options.value.reactivityTransform), - ) return { name: 'vite:vue', @@ -255,19 +247,6 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { } if (!filter.value(filename) && !query.vue) { - if ( - !query.vue && - refTransformFilter.value(filename) && - options.value.compiler.shouldTransformRef(code) - ) { - const result = options.value.compiler.transformRef(code, { - filename, - sourceMap: true, - }) - return result as Omit & { - map: ExistingRawSourceMap | null - } - } return } diff --git a/playground/vue/Main.vue b/playground/vue/Main.vue index fec9c40e..e7bc898a 100644 --- a/playground/vue/Main.vue +++ b/playground/vue/Main.vue @@ -24,7 +24,6 @@ - @@ -50,7 +49,6 @@ import Slotted from './Slotted.vue' import ScanDep from './ScanDep.vue' import TsImport from './TsImport.vue' import AsyncComponent from './AsyncComponent.vue' -import ReactivityTransform from './ReactivityTransform.vue' import SetupImportTemplate from './setup-import-template/SetupImportTemplate.vue' import WorkerTest from './worker.vue' import { ref } from 'vue' diff --git a/playground/vue/ReactivityTransform.vue b/playground/vue/ReactivityTransform.vue deleted file mode 100644 index 0dc2b093..00000000 --- a/playground/vue/ReactivityTransform.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/playground/vue/__tests__/vue.spec.ts b/playground/vue/__tests__/vue.spec.ts index 2428e627..cfbed95d 100644 --- a/playground/vue/__tests__/vue.spec.ts +++ b/playground/vue/__tests__/vue.spec.ts @@ -268,14 +268,6 @@ describe('async component', () => { }) }) -describe('ref transform', () => { - test('should work', async () => { - expect(await page.textContent('.ref-transform')).toMatch('0') - await page.click('.ref-transform') - expect(await page.textContent('.ref-transform')).toMatch('1') - }) -}) - describe('custom element', () => { test('should work', async () => { await page.click('.custom-element') diff --git a/playground/vue/setup-import-template/SetupImportTemplate.vue b/playground/vue/setup-import-template/SetupImportTemplate.vue index d7fb119e..cb91d27a 100644 --- a/playground/vue/setup-import-template/SetupImportTemplate.vue +++ b/playground/vue/setup-import-template/SetupImportTemplate.vue @@ -1,5 +1,6 @@