Skip to content

Commit e91415b

Browse files
committed
refactor: support reactivity transform during compilation
1 parent 8a6660d commit e91415b

File tree

11 files changed

+1478
-563
lines changed

11 files changed

+1478
-563
lines changed

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,28 +136,30 @@ import { useUserStore } from '~/store/user'
136136
137137
const { token, login } = $toRefs(useUserStore())
138138
// convert to:
139-
const { token, login } = $(toRefs(useUserStore()))
140-
login()
139+
const { token, login } = toRefs(useUserStore())
140+
login.value()
141141
142142
const text = $inject$('text', token)
143143
// convert to:
144-
const text = $(inject('text', $$(defaultText)))
144+
const text = inject('text', token)
145145
146146
const { base64 } = $useBase64$(text)
147147
// convert to:
148-
const { base64 } = $(useBase64($$(text)))
148+
const { base64 } = useBase64(text)
149149
150150
provide$('base64', base64)
151151
// convert to:
152-
provide('base64', $$(base64))
152+
provide('base64', base64)
153153
154154
const stop = watch$(base64, () => {
155+
console.log(base64)
155156
console.log$(base64)
156157
stop()
157158
})
158159
// convert to:
159-
const stop = watch($$(base64), () => {
160-
console.log($$(base64))
160+
const stop = watch(base64, () => {
161+
console.log(base64.value)
162+
console.log(base64)
161163
stop()
162164
})
163165
@@ -166,14 +168,14 @@ defineExpose$({
166168
})
167169
// convert to:
168170
defineExpose({
169-
base64: $$(base64),
171+
base64,
170172
})
171173
172174
let compRef = $useRef()
173175
defineRender(<Comp ref$={compRef} />)
174176
// convert to:
175-
let compRef = $(useRef())
176-
defineRender(<Comp ref={$$(compRef)} />)
177+
let compRef = useRef()
178+
defineRender(<Comp ref={compRef} />)
177179
</script>
178180
```
179181

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,17 @@
7676
"prepublishOnly": "pnpm run build"
7777
},
7878
"dependencies": {
79-
"@vue-macros/common": "^1.10.4",
80-
"muggle-string": "^0.4.1",
81-
"ts-macro": "^0.1.5",
82-
"unplugin": "^1.11.0"
79+
"@babel/parser": "^7.27.0",
80+
"@babel/traverse": "^7.27.0",
81+
"@vue-macros/common": "3.0.0-beta.8",
82+
"ts-macro": "^0.1.25",
83+
"unplugin": "^2.3.2"
8384
},
8485
"devDependencies": {
85-
"@babel/types": "^7.24.9",
86+
"@babel/types": "^7.27.0",
8687
"@sxzz/eslint-config": "^3.14.0",
8788
"@sxzz/prettier-config": "^2.0.2",
89+
"@types/babel__traverse": "^7.20.7",
8890
"@types/node": "^20.14.11",
8991
"@vue-macros/reactivity-transform": "^0.4.6",
9092
"@vue-macros/test-utils": "^1.4.0",
@@ -97,7 +99,7 @@
9799
"tsup": "^8.2.2",
98100
"tsx": "^4.16.2",
99101
"typescript": "^5.6.3",
100-
"vite": "^5.3.4",
102+
"vite": "^6.3.0",
101103
"vitest": "^2.0.3",
102104
"vue": "^3.5.13"
103105
},

0 commit comments

Comments
 (0)