Skip to content

Commit 85b2f5b

Browse files
committed
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.
1 parent 2ac1045 commit 85b2f5b

File tree

5 files changed

+3
-45
lines changed

5 files changed

+3
-45
lines changed

Diff for: packages/plugin-vue/src/index.ts

-21
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import type {
99
SFCTemplateCompileOptions,
1010
} from 'vue/compiler-sfc'
1111
import type * as _compiler from 'vue/compiler-sfc'
12-
import type { ExistingRawSourceMap } from 'rollup'
1312
/* eslint-enable import/no-duplicates */
1413
import { computed, shallowRef } from 'vue'
1514
import { version } from '../package.json'
@@ -124,13 +123,6 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin {
124123
? () => options.value.customElement as boolean
125124
: createFilter(options.value.customElement),
126125
)
127-
const refTransformFilter = computed(() =>
128-
options.value.reactivityTransform === false
129-
? () => false
130-
: options.value.reactivityTransform === true
131-
? createFilter(/\.(j|t)sx?$/, /node_modules/)
132-
: createFilter(options.value.reactivityTransform),
133-
)
134126

135127
return {
136128
name: 'vite:vue',
@@ -255,19 +247,6 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin {
255247
}
256248

257249
if (!filter.value(filename) && !query.vue) {
258-
if (
259-
!query.vue &&
260-
refTransformFilter.value(filename) &&
261-
options.value.compiler.shouldTransformRef(code)
262-
) {
263-
const result = options.value.compiler.transformRef(code, {
264-
filename,
265-
sourceMap: true,
266-
})
267-
return result as Omit<typeof result, 'map'> & {
268-
map: ExistingRawSourceMap | null
269-
}
270-
}
271250
return
272251
}
273252

Diff for: playground/vue/Main.vue

-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
<Suspense>
2525
<AsyncComponent />
2626
</Suspense>
27-
<ReactivityTransform :foo="time" />
2827
<SetupImportTemplate />
2928
<WorkerTest />
3029
<Url />
@@ -50,7 +49,6 @@ import Slotted from './Slotted.vue'
5049
import ScanDep from './ScanDep.vue'
5150
import TsImport from './TsImport.vue'
5251
import AsyncComponent from './AsyncComponent.vue'
53-
import ReactivityTransform from './ReactivityTransform.vue'
5452
import SetupImportTemplate from './setup-import-template/SetupImportTemplate.vue'
5553
import WorkerTest from './worker.vue'
5654
import { ref } from 'vue'

Diff for: playground/vue/ReactivityTransform.vue

-12
This file was deleted.

Diff for: playground/vue/__tests__/vue.spec.ts

-8
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,6 @@ describe('async component', () => {
268268
})
269269
})
270270

271-
describe('ref transform', () => {
272-
test('should work', async () => {
273-
expect(await page.textContent('.ref-transform')).toMatch('0')
274-
await page.click('.ref-transform')
275-
expect(await page.textContent('.ref-transform')).toMatch('1')
276-
})
277-
})
278-
279271
describe('custom element', () => {
280272
test('should work', async () => {
281273
await page.click('.custom-element')
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template src="./template.html"></template>
22
<script setup>
3-
let count = $ref(0)
4-
const inc = () => count++
3+
import { ref } from 'vue'
4+
const count = ref(0)
5+
const inc = () => count.value++
56
</script>

0 commit comments

Comments
 (0)