Skip to content

Commit 4df4624

Browse files
committed
chore: make vapor compiler tests pass
1 parent f2b69d7 commit 4df4624

19 files changed

+368
-381
lines changed

packages/compiler-vapor/__tests__/__snapshots__/compile.spec.ts.snap

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

33
exports[`compile > bindings 1`] = `
4-
"import { renderEffect as _renderEffect, setText as _setText, template as _template } from 'vue/vapor';
4+
"import { renderEffect as _renderEffect, setText as _setText, template as _template } from 'vue';
55
const t0 = _template("<div></div>")
66
77
export function render(_ctx, $props, $emit, $attrs, $slots) {
@@ -12,7 +12,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
1212
`;
1313

1414
exports[`compile > custom directive > basic 1`] = `
15-
"import { resolveDirective as _resolveDirective, withDirectives as _withDirectives, template as _template } from 'vue/vapor';
15+
"import { resolveDirective as _resolveDirective, withDirectives as _withDirectives, template as _template } from 'vue';
1616
const t0 = _template("<div></div>")
1717
1818
export function render(_ctx) {
@@ -25,35 +25,33 @@ export function render(_ctx) {
2525
`;
2626

2727
exports[`compile > custom directive > component 1`] = `
28-
"import { resolveComponent as _resolveComponent, resolveDirective as _resolveDirective, createComponent as _createComponent, withDirectives as _withDirectives, insert as _insert, createIf as _createIf, template as _template } from 'vue/vapor';
28+
"import { resolveComponent as _resolveComponent, resolveDirective as _resolveDirective, createComponentWithFallback as _createComponentWithFallback, withDirectives as _withDirectives, insert as _insert, createIf as _createIf, template as _template } from 'vue';
2929
const t0 = _template("<div></div>")
3030
3131
export function render(_ctx) {
3232
const _component_Bar = _resolveComponent("Bar")
3333
const _component_Comp = _resolveComponent("Comp")
3434
const _directive_hello = _resolveDirective("hello")
3535
const _directive_test = _resolveDirective("test")
36-
const n4 = _createComponent(_component_Comp, null, [
37-
{
38-
"default": () => {
39-
const n0 = _createIf(() => (true), () => {
40-
const n3 = t0()
41-
const n2 = _createComponent(_component_Bar)
42-
_withDirectives(n2, [[_directive_hello, void 0, void 0, { world: true }]])
43-
_insert(n2, n3)
44-
return n3
45-
})
46-
return n0
47-
}
36+
const n4 = _createComponentWithFallback(_component_Comp, null, {
37+
"default": () => {
38+
const n0 = _createIf(() => (true), () => {
39+
const n3 = t0()
40+
const n2 = _createComponentWithFallback(_component_Bar)
41+
_withDirectives(n2, [[_directive_hello, void 0, void 0, { world: true }]])
42+
_insert(n2, n3)
43+
return n3
44+
})
45+
return n0
4846
}
49-
], true)
47+
}, true)
5048
_withDirectives(n4, [[_directive_test]])
5149
return n4
5250
}"
5351
`;
5452

5553
exports[`compile > directives > custom directive > basic 1`] = `
56-
"import { withDirectives as _withDirectives, template as _template } from 'vue/vapor';
54+
"import { withDirectives as _withDirectives, template as _template } from 'vue';
5755
const t0 = _template("<div></div>")
5856
5957
export function render(_ctx, $props, $emit, $attrs, $slots) {
@@ -64,7 +62,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
6462
`;
6563

6664
exports[`compile > directives > custom directive > binding value 1`] = `
67-
"import { withDirectives as _withDirectives, template as _template } from 'vue/vapor';
65+
"import { withDirectives as _withDirectives, template as _template } from 'vue';
6866
const t0 = _template("<div></div>")
6967
7068
export function render(_ctx, $props, $emit, $attrs, $slots) {
@@ -75,7 +73,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
7573
`;
7674

7775
exports[`compile > directives > custom directive > dynamic parameters 1`] = `
78-
"import { withDirectives as _withDirectives, template as _template } from 'vue/vapor';
76+
"import { withDirectives as _withDirectives, template as _template } from 'vue';
7977
const t0 = _template("<div></div>")
8078
8179
export function render(_ctx, $props, $emit, $attrs, $slots) {
@@ -86,7 +84,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
8684
`;
8785

8886
exports[`compile > directives > custom directive > modifiers 1`] = `
89-
"import { withDirectives as _withDirectives, template as _template } from 'vue/vapor';
87+
"import { withDirectives as _withDirectives, template as _template } from 'vue';
9088
const t0 = _template("<div></div>")
9189
9290
export function render(_ctx, $props, $emit, $attrs, $slots) {
@@ -97,7 +95,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
9795
`;
9896

9997
exports[`compile > directives > custom directive > modifiers w/o binding 1`] = `
100-
"import { withDirectives as _withDirectives, template as _template } from 'vue/vapor';
98+
"import { withDirectives as _withDirectives, template as _template } from 'vue';
10199
const t0 = _template("<div></div>")
102100
103101
export function render(_ctx, $props, $emit, $attrs, $slots) {
@@ -108,7 +106,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
108106
`;
109107

110108
exports[`compile > directives > custom directive > static parameters 1`] = `
111-
"import { withDirectives as _withDirectives, template as _template } from 'vue/vapor';
109+
"import { withDirectives as _withDirectives, template as _template } from 'vue';
112110
const t0 = _template("<div></div>")
113111
114112
export function render(_ctx, $props, $emit, $attrs, $slots) {
@@ -119,7 +117,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
119117
`;
120118

121119
exports[`compile > directives > custom directive > static parameters and modifiers 1`] = `
122-
"import { withDirectives as _withDirectives, template as _template } from 'vue/vapor';
120+
"import { withDirectives as _withDirectives, template as _template } from 'vue';
123121
const t0 = _template("<div></div>")
124122
125123
export function render(_ctx, $props, $emit, $attrs, $slots) {
@@ -130,7 +128,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
130128
`;
131129

132130
exports[`compile > directives > v-cloak > basic 1`] = `
133-
"import { template as _template } from 'vue/vapor';
131+
"import { template as _template } from 'vue';
134132
const t0 = _template("<div>test</div>")
135133
136134
export function render(_ctx) {
@@ -140,7 +138,7 @@ export function render(_ctx) {
140138
`;
141139

142140
exports[`compile > directives > v-pre > basic 1`] = `
143-
"import { setInheritAttrs as _setInheritAttrs, template as _template } from 'vue/vapor';
141+
"import { setInheritAttrs as _setInheritAttrs, template as _template } from 'vue';
144142
const t0 = _template("<div :id=\\"foo\\"><Comp></Comp>{{ bar }}</div>")
145143
146144
export function render(_ctx, $props, $emit, $attrs, $slots) {
@@ -151,15 +149,15 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
151149
`;
152150
153151
exports[`compile > directives > v-pre > should not affect siblings after it 1`] = `
154-
"import { resolveComponent as _resolveComponent, createComponent as _createComponent, createTextNode as _createTextNode, insert as _insert, renderEffect as _renderEffect, setDOMProp as _setDOMProp, template as _template } from 'vue/vapor';
152+
"import { resolveComponent as _resolveComponent, createComponentWithFallback as _createComponentWithFallback, createTextNode as _createTextNode, insert as _insert, renderEffect as _renderEffect, setDOMProp as _setDOMProp, template as _template } from 'vue';
155153
const t0 = _template("<div :id=\\"foo\\"><Comp></Comp>{{ bar }}</div>")
156154
const t1 = _template("<div></div>")
157155
158156
export function render(_ctx, $props, $emit, $attrs, $slots) {
159157
const _component_Comp = _resolveComponent("Comp")
160158
const n0 = t0()
161159
const n3 = t1()
162-
const n1 = _createComponent(_component_Comp)
160+
const n1 = _createComponentWithFallback(_component_Comp)
163161
const n2 = _createTextNode(() => [_ctx.bar])
164162
_insert([n1, n2], n3)
165163
_renderEffect(() => _setDOMProp(n3, "id", _ctx.foo))
@@ -168,7 +166,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
168166
`;
169167
170168
exports[`compile > dynamic root 1`] = `
171-
"import { createTextNode as _createTextNode } from 'vue/vapor';
169+
"import { createTextNode as _createTextNode } from 'vue';
172170
173171
export function render(_ctx) {
174172
const n0 = _createTextNode(() => [1, 2])
@@ -177,7 +175,7 @@ export function render(_ctx) {
177175
`;
178176
179177
exports[`compile > dynamic root nodes and interpolation 1`] = `
180-
"import { delegate as _delegate, setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setText as _setText, setDOMProp as _setDOMProp, delegateEvents as _delegateEvents, template as _template } from 'vue/vapor';
178+
"import { delegate as _delegate, setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setText as _setText, setDOMProp as _setDOMProp, delegateEvents as _delegateEvents, template as _template } from 'vue';
181179
const t0 = _template("<button></button>")
182180
_delegateEvents("click")
183181
@@ -208,7 +206,7 @@ exports[`compile > expression parsing > v-bind 1`] = `
208206
`;
209207
210208
exports[`compile > fragment 1`] = `
211-
"import { template as _template } from 'vue/vapor';
209+
"import { template as _template } from 'vue';
212210
const t0 = _template("<p></p>")
213211
const t1 = _template("<span></span>")
214212
const t2 = _template("<div></div>")
@@ -222,7 +220,7 @@ export function render(_ctx) {
222220
`;
223221
224222
exports[`compile > static + dynamic root 1`] = `
225-
"import { createTextNode as _createTextNode } from 'vue/vapor';
223+
"import { createTextNode as _createTextNode } from 'vue';
226224
227225
export function render(_ctx) {
228226
const n0 = _createTextNode(() => [1, 2, "3", 4, 5, "6", 7, 8, "9", 'A', 'B'])
@@ -231,7 +229,7 @@ export function render(_ctx) {
231229
`;
232230
233231
exports[`compile > static template 1`] = `
234-
"import { template as _template } from 'vue/vapor';
232+
"import { template as _template } from 'vue';
235233
const t0 = _template("<div><p>hello</p><input><span></span></div>")
236234
237235
export function render(_ctx) {

packages/compiler-vapor/__tests__/transforms/__snapshots__/expression.spec.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

33
exports[`compiler: expression > basic 1`] = `
4-
"import { createTextNode as _createTextNode } from 'vue/vapor';
4+
"import { createTextNode as _createTextNode } from 'vue';
55
66
export function render(_ctx) {
77
const n0 = _createTextNode(() => [_ctx.a])
@@ -10,7 +10,7 @@ export function render(_ctx) {
1010
`;
1111

1212
exports[`compiler: expression > props 1`] = `
13-
"import { createTextNode as _createTextNode } from 'vue/vapor';
13+
"import { createTextNode as _createTextNode } from 'vue';
1414
1515
export function render(_ctx, $props, $emit, $attrs, $slots) {
1616
const n0 = _createTextNode(() => [$props.foo])
@@ -19,7 +19,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
1919
`;
2020

2121
exports[`compiler: expression > props aliased 1`] = `
22-
"import { createTextNode as _createTextNode } from 'vue/vapor';
22+
"import { createTextNode as _createTextNode } from 'vue';
2323
2424
export function render(_ctx, $props, $emit, $attrs, $slots) {
2525
const n0 = _createTextNode(() => [$props['bar']])

packages/compiler-vapor/__tests__/transforms/__snapshots__/transformChildren.spec.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

33
exports[`compiler: children transform > children & sibling references 1`] = `
4-
"import { next as _next, createTextNode as _createTextNode, insert as _insert, renderEffect as _renderEffect, setText as _setText, template as _template } from 'vue/vapor';
4+
"import { next as _next, createTextNode as _createTextNode, insert as _insert, renderEffect as _renderEffect, setText as _setText, template as _template } from 'vue';
55
const t0 = _template("<div><p></p> <!><p></p></div>")
66
77
export function render(_ctx) {

0 commit comments

Comments
 (0)