Skip to content

Commit 0574d52

Browse files
committed
Merge branch 'main' of github.com:yooouuri/vite-plugin-vue-ssr into add-h3
2 parents b2237f5 + 0a20253 commit 0574d52

File tree

4 files changed

+64
-64
lines changed

4 files changed

+64
-64
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vite-plugin-vue-ssr",
3-
"version": "0.12.1",
3+
"version": "0.12.2",
44
"packageManager": "[email protected]",
55
"type": "module",
66
"license": "MIT",

playground/pinia-example/vite.config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@ export default defineConfig({
1313
'@': fileURLToPath(new URL('./src', import.meta.url)),
1414
},
1515
},
16-
build: {
17-
target: [ 'es2022', 'edge89', 'firefox89', 'chrome89', 'safari15' ],
18-
},
1916
})

playground/vue-router/vite.config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@ export default defineConfig({
1313
'@': fileURLToPath(new URL('./src', import.meta.url)),
1414
},
1515
},
16-
build: {
17-
target: [ 'es2022', 'edge89', 'firefox89', 'chrome89', 'safari15' ],
18-
},
1916
})

src/plugin/transformEntrypoint.ts

Lines changed: 63 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -21,66 +21,72 @@ export function transformEntrypoint(code: string, ssr: boolean, ssrBuild: boolea
2121
ExportDefaultDeclaration(path) {
2222
path.replaceWithMultiple(
2323
[
24-
t.variableDeclaration(
25-
'const',
26-
[
27-
t.variableDeclarator(
28-
t.objectPattern([
29-
t.objectProperty(
30-
t.identifier('app'),
31-
t.identifier('app'),
32-
false,
33-
true
34-
),
35-
t.objectProperty(
36-
t.identifier('router'),
37-
t.identifier('router'),
38-
false,
39-
true
40-
)
41-
]),
42-
t.awaitExpression(
43-
t.callExpression(
44-
t.identifier('vueSSR'),
45-
[ ...path.node.declaration.arguments, t.identifier(ssrBuild ? 'true' : 'false') ]
46-
)
47-
),
48-
),
49-
]
50-
),
51-
t.expressionStatement(
52-
t.callExpression(
53-
t.memberExpression(
54-
t.callExpression(
55-
t.memberExpression(
56-
t.identifier('router'),
57-
t.identifier('isReady')
58-
),
59-
[]
60-
),
61-
t.identifier('then')
24+
t.callExpression(
25+
t.memberExpression(
26+
t.callExpression(
27+
t.identifier('vueSSR'),
28+
[ ...path.node.declaration.arguments, t.identifier(ssrBuild ? 'true' : 'false') ]
6229
),
63-
[
64-
t.arrowFunctionExpression(
65-
[],
66-
t.blockStatement(
67-
[
68-
t.expressionStatement(
69-
t.callExpression(
70-
t.memberExpression(
71-
t.identifier('app'),
72-
t.identifier('mount')
30+
t.identifier('then')
31+
),
32+
[
33+
t.arrowFunctionExpression(
34+
[
35+
t.objectPattern([
36+
t.objectProperty(
37+
t.identifier('app'),
38+
t.identifier('app'),
39+
false,
40+
true
41+
),
42+
t.objectProperty(
43+
t.identifier('router'),
44+
t.identifier('router'),
45+
false,
46+
true
47+
),
48+
]),
49+
],
50+
t.blockStatement(
51+
[
52+
t.expressionStatement(
53+
t.callExpression(
54+
t.memberExpression(
55+
t.callExpression(
56+
t.memberExpression(
57+
t.identifier('router'),
58+
t.identifier('isReady')
59+
),
60+
[]
7361
),
74-
[
75-
t.stringLiteral('#app')
76-
]
77-
)
78-
),
79-
]
80-
)
62+
t.identifier('then')
63+
),
64+
[
65+
t.arrowFunctionExpression(
66+
[],
67+
t.blockStatement(
68+
[
69+
t.expressionStatement(
70+
t.callExpression(
71+
t.memberExpression(
72+
t.identifier('app'),
73+
t.identifier('mount')
74+
),
75+
[
76+
t.stringLiteral('#app')
77+
]
78+
)
79+
),
80+
]
81+
)
82+
)
83+
]
84+
)
85+
)
86+
]
8187
)
82-
]
83-
)
88+
)
89+
]
8490
)
8591
]
8692
)

0 commit comments

Comments
 (0)