File tree Expand file tree Collapse file tree 3 files changed +26
-14
lines changed Expand file tree Collapse file tree 3 files changed +26
-14
lines changed Original file line number Diff line number Diff line change @@ -9,13 +9,14 @@ defineInlineTest(
9
9
'transform `new Vue()` to createApp()'
10
10
)
11
11
12
- defineInlineTest (
13
- transform ,
14
- { } ,
15
- `new Vue()` ,
16
- `Vue.createApp()` ,
17
- 'transform `new Vue()` to createApp() with no arguments'
18
- )
12
+ // Vue.prototype.$baseEventBus = new Vue() will be transform to Vue.prototype.$baseEventBus = new createApp()
13
+ // defineInlineTest(
14
+ // transform,
15
+ // {},
16
+ // `new Vue()`,
17
+ // `Vue.createApp()`,
18
+ // 'transform `new Vue()` to createApp() with no arguments'
19
+ // )
19
20
20
21
defineInlineTest (
21
22
transform ,
@@ -83,3 +84,11 @@ defineInlineTest(
83
84
'transform `new MyComponent` with `el` prop'
84
85
)
85
86
87
+ defineInlineTest (
88
+ transform ,
89
+ { } ,
90
+ `Vue.prototype.$baseEventBus = new Vue()` ,
91
+ `Vue.prototype.$baseEventBus = new Vue()` ,
92
+ 'mitt and tiny-emitter are recommended in vue-next'
93
+ )
94
+
Original file line number Diff line number Diff line change @@ -22,12 +22,16 @@ export const transformAST: ASTTransformation<Params | void> = (
22
22
const { j, root } = context
23
23
const { includeMaybeComponents = true } = params
24
24
25
- const newVue = root . find ( j . NewExpression , {
26
- callee : {
27
- type : 'Identifier' ,
28
- name : 'Vue'
29
- }
30
- } )
25
+ const newVue = root
26
+ . find ( j . NewExpression , {
27
+ callee : {
28
+ type : 'Identifier' ,
29
+ name : 'Vue'
30
+ }
31
+ } )
32
+ . filter ( ( { node } ) => {
33
+ return node . arguments . length > 0
34
+ } )
31
35
32
36
// new Vue() -> Vue.createApp()
33
37
newVue . replaceWith ( ( { node } ) => {
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import type { ASTTransformation } from '../../src/wrapAstTransformation'
3
3
4
4
// addRoute() addRoutes()-> forEach addRoute
5
5
export const transformAST : ASTTransformation = context => {
6
-
7
6
const { root, j } = context
8
7
const addRouteExpression = root . find ( j . CallExpression , {
9
8
callee : {
You can’t perform that action at this time.
0 commit comments