wip(vitest-migration): compiler-core tests passing

This commit is contained in:
Evan You 2023-01-26 16:20:59 +08:00
parent f0d78e8c8f
commit 5804406fac
14 changed files with 584 additions and 584 deletions

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compiler: codegen ArrayExpression 1`] = ` exports[`compiler: codegen > ArrayExpression 1`] = `
" "
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
@ -12,14 +12,14 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: codegen CacheExpression 1`] = ` exports[`compiler: codegen > CacheExpression 1`] = `
" "
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return _cache[1] || (_cache[1] = foo) return _cache[1] || (_cache[1] = foo)
}" }"
`; `;
exports[`compiler: codegen CacheExpression w/ isVNode: true 1`] = ` exports[`compiler: codegen > CacheExpression w/ isVNode: true 1`] = `
" "
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return _cache[1] || ( return _cache[1] || (
@ -31,7 +31,7 @@ export function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: codegen ConditionalExpression 1`] = ` exports[`compiler: codegen > ConditionalExpression 1`] = `
" "
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
@ -44,31 +44,31 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: codegen Element (callExpression + objectExpression + TemplateChildNode[]) 1`] = ` exports[`compiler: codegen > Element (callExpression + objectExpression + TemplateChildNode[]) 1`] = `
" "
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
return _createElementVNode("div", { return _createElementVNode(\\"div\\", {
id: "foo", id: \\"foo\\",
[prop]: bar, [prop]: bar,
[foo + bar]: bar [foo + bar]: bar
}, [ }, [
_createElementVNode("p", { "some-key": "foo" }) _createElementVNode(\\"p\\", { \\"some-key\\": \\"foo\\" })
], 16) ], 16)
} }
}" }"
`; `;
exports[`compiler: codegen assets + temps 1`] = ` exports[`compiler: codegen > assets + temps 1`] = `
" "
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const _component_Foo = _resolveComponent("Foo") const _component_Foo = _resolveComponent(\\"Foo\\")
const _component_bar_baz = _resolveComponent("bar-baz") const _component_bar_baz = _resolveComponent(\\"bar-baz\\")
const _component_barbaz = _resolveComponent("barbaz") const _component_barbaz = _resolveComponent(\\"barbaz\\")
const _component_Qux = _resolveComponent("Qux", true) const _component_Qux = _resolveComponent(\\"Qux\\", true)
const _directive_my_dir_0 = _resolveDirective("my_dir_0") const _directive_my_dir_0 = _resolveDirective(\\"my_dir_0\\")
const _directive_my_dir_1 = _resolveDirective("my_dir_1") const _directive_my_dir_1 = _resolveDirective(\\"my_dir_1\\")
let _temp0, _temp1, _temp2 let _temp0, _temp1, _temp2
return null return null
@ -76,16 +76,16 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: codegen comment 1`] = ` exports[`compiler: codegen > comment 1`] = `
" "
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
return _createCommentVNode("foo") return _createCommentVNode(\\"foo\\")
} }
}" }"
`; `;
exports[`compiler: codegen compound expression 1`] = ` exports[`compiler: codegen > compound expression 1`] = `
" "
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
@ -94,7 +94,7 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: codegen forNode 1`] = ` exports[`compiler: codegen > forNode 1`] = `
" "
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
@ -103,7 +103,7 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: codegen forNode with constant expression 1`] = ` exports[`compiler: codegen > forNode with constant expression 1`] = `
" "
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
@ -112,7 +112,7 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: codegen function mode preamble 1`] = ` exports[`compiler: codegen > function mode preamble 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -124,7 +124,7 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: codegen function mode preamble w/ prefixIdentifiers: true 1`] = ` exports[`compiler: codegen > function mode preamble w/ prefixIdentifiers: true 1`] = `
"const { createVNode: _createVNode, resolveDirective: _resolveDirective } = Vue "const { createVNode: _createVNode, resolveDirective: _resolveDirective } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -132,10 +132,10 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: codegen hoists 1`] = ` exports[`compiler: codegen > hoists 1`] = `
" "
const _hoisted_1 = hello const _hoisted_1 = hello
const _hoisted_2 = { id: "foo" } const _hoisted_2 = { id: \\"foo\\" }
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
@ -144,7 +144,7 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: codegen ifNode 1`] = ` exports[`compiler: codegen > ifNode 1`] = `
" "
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
@ -155,7 +155,7 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: codegen interpolation 1`] = ` exports[`compiler: codegen > interpolation 1`] = `
" "
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
@ -164,16 +164,16 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: codegen module mode preamble 1`] = ` exports[`compiler: codegen > module mode preamble 1`] = `
"import { createVNode as _createVNode, resolveDirective as _resolveDirective } from "vue" "import { createVNode as _createVNode, resolveDirective as _resolveDirective } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return null return null
}" }"
`; `;
exports[`compiler: codegen module mode preamble w/ optimizeImports: true 1`] = ` exports[`compiler: codegen > module mode preamble w/ optimizeImports: true 1`] = `
"import { createVNode, resolveDirective } from "vue" "import { createVNode, resolveDirective } from \\"vue\\"
// Binding optimization for webpack code-split // Binding optimization for webpack code-split
const _createVNode = createVNode, _resolveDirective = resolveDirective const _createVNode = createVNode, _resolveDirective = resolveDirective
@ -183,16 +183,16 @@ export function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: codegen static text 1`] = ` exports[`compiler: codegen > static text 1`] = `
" "
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
return "hello" return \\"hello\\"
} }
}" }"
`; `;
exports[`compiler: codegen temps 1`] = ` exports[`compiler: codegen > temps 1`] = `
" "
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {

View File

@ -1,25 +1,25 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compiler: integration tests function mode 1`] = ` exports[`compiler: integration tests > function mode 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, Fragment: _Fragment, renderList: _renderList, createElementVNode: _createElementVNode, normalizeClass: _normalizeClass } = _Vue const { toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, Fragment: _Fragment, renderList: _renderList, createElementVNode: _createElementVNode, normalizeClass: _normalizeClass } = _Vue
return (_openBlock(), _createElementBlock("div", { return (_openBlock(), _createElementBlock(\\"div\\", {
id: "foo", id: \\"foo\\",
class: _normalizeClass(bar.baz) class: _normalizeClass(bar.baz)
}, [ }, [
_createTextVNode(_toDisplayString(world.burn()) + " ", 1 /* TEXT */), _createTextVNode(_toDisplayString(world.burn()) + \\" \\", 1 /* TEXT */),
ok ok
? (_openBlock(), _createElementBlock("div", { key: 0 }, "yes")) ? (_openBlock(), _createElementBlock(\\"div\\", { key: 0 }, \\"yes\\"))
: (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [ : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
_createTextVNode("no") _createTextVNode(\\"no\\")
], 64 /* STABLE_FRAGMENT */)), ], 64 /* STABLE_FRAGMENT */)),
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(list, (value, index) => { (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(list, (value, index) => {
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_createElementVNode("span", null, _toDisplayString(value + index), 1 /* TEXT */) _createElementVNode(\\"span\\", null, _toDisplayString(value + index), 1 /* TEXT */)
])) ]))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
], 2 /* CLASS */)) ], 2 /* CLASS */))
@ -27,46 +27,46 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: integration tests function mode w/ prefixIdentifiers: true 1`] = ` exports[`compiler: integration tests > function mode w/ prefixIdentifiers: true 1`] = `
"const { toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, Fragment: _Fragment, renderList: _renderList, createElementVNode: _createElementVNode, normalizeClass: _normalizeClass } = Vue "const { toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, Fragment: _Fragment, renderList: _renderList, createElementVNode: _createElementVNode, normalizeClass: _normalizeClass } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", { return (_openBlock(), _createElementBlock(\\"div\\", {
id: "foo", id: \\"foo\\",
class: _normalizeClass(_ctx.bar.baz) class: _normalizeClass(_ctx.bar.baz)
}, [ }, [
_createTextVNode(_toDisplayString(_ctx.world.burn()) + " ", 1 /* TEXT */), _createTextVNode(_toDisplayString(_ctx.world.burn()) + \\" \\", 1 /* TEXT */),
(_ctx.ok) (_ctx.ok)
? (_openBlock(), _createElementBlock("div", { key: 0 }, "yes")) ? (_openBlock(), _createElementBlock(\\"div\\", { key: 0 }, \\"yes\\"))
: (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [ : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
_createTextVNode("no") _createTextVNode(\\"no\\")
], 64 /* STABLE_FRAGMENT */)), ], 64 /* STABLE_FRAGMENT */)),
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.list, (value, index) => { (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.list, (value, index) => {
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_createElementVNode("span", null, _toDisplayString(value + index), 1 /* TEXT */) _createElementVNode(\\"span\\", null, _toDisplayString(value + index), 1 /* TEXT */)
])) ]))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
], 2 /* CLASS */)) ], 2 /* CLASS */))
}" }"
`; `;
exports[`compiler: integration tests module mode 1`] = ` exports[`compiler: integration tests > module mode 1`] = `
"import { toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createTextVNode as _createTextVNode, Fragment as _Fragment, renderList as _renderList, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass } from "vue" "import { toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createTextVNode as _createTextVNode, Fragment as _Fragment, renderList as _renderList, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", { return (_openBlock(), _createElementBlock(\\"div\\", {
id: "foo", id: \\"foo\\",
class: _normalizeClass(_ctx.bar.baz) class: _normalizeClass(_ctx.bar.baz)
}, [ }, [
_createTextVNode(_toDisplayString(_ctx.world.burn()) + " ", 1 /* TEXT */), _createTextVNode(_toDisplayString(_ctx.world.burn()) + \\" \\", 1 /* TEXT */),
(_ctx.ok) (_ctx.ok)
? (_openBlock(), _createElementBlock("div", { key: 0 }, "yes")) ? (_openBlock(), _createElementBlock(\\"div\\", { key: 0 }, \\"yes\\"))
: (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [ : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
_createTextVNode("no") _createTextVNode(\\"no\\")
], 64 /* STABLE_FRAGMENT */)), ], 64 /* STABLE_FRAGMENT */)),
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.list, (value, index) => { (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.list, (value, index) => {
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_createElementVNode("span", null, _toDisplayString(value + index), 1 /* TEXT */) _createElementVNode(\\"span\\", null, _toDisplayString(value + index), 1 /* TEXT */)
])) ]))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
], 2 /* CLASS */)) ], 2 /* CLASS */))

View File

@ -1,14 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`scopeId compiler support should push scopeId for hoisted nodes 1`] = ` exports[`scopeId compiler support > should push scopeId for hoisted nodes 1`] = `
"import { createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue" "import { createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \\"vue\\"
const _withScopeId = n => (_pushScopeId("test"),n=n(),_popScopeId(),n) const _withScopeId = n => (_pushScopeId(\\"test\\"),n=n(),_popScopeId(),n)
const _hoisted_1 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode("div", null, "hello", -1 /* HOISTED */)) const _hoisted_1 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\\"div\\", null, \\"hello\\", -1 /* HOISTED */))
const _hoisted_2 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode("div", null, "world", -1 /* HOISTED */)) const _hoisted_2 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\\"div\\", null, \\"world\\", -1 /* HOISTED */))
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_hoisted_1, _hoisted_1,
_createTextVNode(_toDisplayString(_ctx.foo), 1 /* TEXT */), _createTextVNode(_toDisplayString(_ctx.foo), 1 /* TEXT */),
_hoisted_2 _hoisted_2
@ -16,42 +16,42 @@ export function render(_ctx, _cache) {
}" }"
`; `;
exports[`scopeId compiler support should wrap default slot 1`] = ` exports[`scopeId compiler support > should wrap default slot 1`] = `
"import { createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from "vue" "import { createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
const _component_Child = _resolveComponent("Child") const _component_Child = _resolveComponent(\\"Child\\")
return (_openBlock(), _createBlock(_component_Child, null, { return (_openBlock(), _createBlock(_component_Child, null, {
default: _withCtx(() => [ default: _withCtx(() => [
_createElementVNode("div") _createElementVNode(\\"div\\")
]), ]),
_: 1 /* STABLE */ _: 1 /* STABLE */
})) }))
}" }"
`; `;
exports[`scopeId compiler support should wrap dynamic slots 1`] = ` exports[`scopeId compiler support > should wrap dynamic slots 1`] = `
"import { createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, renderList as _renderList, createSlots as _createSlots, openBlock as _openBlock, createBlock as _createBlock } from "vue" "import { createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, renderList as _renderList, createSlots as _createSlots, openBlock as _openBlock, createBlock as _createBlock } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
const _component_Child = _resolveComponent("Child") const _component_Child = _resolveComponent(\\"Child\\")
return (_openBlock(), _createBlock(_component_Child, null, _createSlots({ _: 2 /* DYNAMIC */ }, [ return (_openBlock(), _createBlock(_component_Child, null, _createSlots({ _: 2 /* DYNAMIC */ }, [
(_ctx.ok) (_ctx.ok)
? { ? {
name: "foo", name: \\"foo\\",
fn: _withCtx(() => [ fn: _withCtx(() => [
_createElementVNode("div") _createElementVNode(\\"div\\")
]), ]),
key: "0" key: \\"0\\"
} }
: undefined, : undefined,
_renderList(_ctx.list, (i) => { _renderList(_ctx.list, (i) => {
return { return {
name: i, name: i,
fn: _withCtx(() => [ fn: _withCtx(() => [
_createElementVNode("div") _createElementVNode(\\"div\\")
]) ])
} }
}) })
@ -59,18 +59,18 @@ export function render(_ctx, _cache) {
}" }"
`; `;
exports[`scopeId compiler support should wrap named slots 1`] = ` exports[`scopeId compiler support > should wrap named slots 1`] = `
"import { toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from "vue" "import { toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
const _component_Child = _resolveComponent("Child") const _component_Child = _resolveComponent(\\"Child\\")
return (_openBlock(), _createBlock(_component_Child, null, { return (_openBlock(), _createBlock(_component_Child, null, {
foo: _withCtx(({ msg }) => [ foo: _withCtx(({ msg }) => [
_createTextVNode(_toDisplayString(msg), 1 /* TEXT */) _createTextVNode(_toDisplayString(msg), 1 /* TEXT */)
]), ]),
bar: _withCtx(() => [ bar: _withCtx(() => [
_createElementVNode("div") _createElementVNode(\\"div\\")
]), ]),
_: 1 /* STABLE */ _: 1 /* STABLE */
})) }))

View File

@ -631,7 +631,7 @@ describe('compiler: codegen', () => {
test('tag only', () => { test('tag only', () => {
expect(genCode(createVNodeCall(null, `"div"`))).toMatchInlineSnapshot(` expect(genCode(createVNodeCall(null, `"div"`))).toMatchInlineSnapshot(`
"return _createElementVNode("div") "return _createElementVNode(\\"div\\")
" "
`) `)
expect(genCode(createVNodeCall(null, FRAGMENT))).toMatchInlineSnapshot(` expect(genCode(createVNodeCall(null, FRAGMENT))).toMatchInlineSnapshot(`
@ -643,7 +643,7 @@ describe('compiler: codegen', () => {
test('with props', () => { test('with props', () => {
expect(genCode(createVNodeCall(null, `"div"`, mockProps))) expect(genCode(createVNodeCall(null, `"div"`, mockProps)))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
"return _createElementVNode("div", { foo: "bar" }) "return _createElementVNode(\\"div\\", { foo: \\"bar\\" })
" "
`) `)
}) })
@ -651,7 +651,7 @@ describe('compiler: codegen', () => {
test('with children, no props', () => { test('with children, no props', () => {
expect(genCode(createVNodeCall(null, `"div"`, undefined, mockChildren))) expect(genCode(createVNodeCall(null, `"div"`, undefined, mockChildren)))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
"return _createElementVNode("div", null, children) "return _createElementVNode(\\"div\\", null, children)
" "
`) `)
}) })
@ -659,7 +659,7 @@ describe('compiler: codegen', () => {
test('with children + props', () => { test('with children + props', () => {
expect(genCode(createVNodeCall(null, `"div"`, mockProps, mockChildren))) expect(genCode(createVNodeCall(null, `"div"`, mockProps, mockChildren)))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
"return _createElementVNode("div", { foo: "bar" }, children) "return _createElementVNode(\\"div\\", { foo: \\"bar\\" }, children)
" "
`) `)
}) })
@ -667,7 +667,7 @@ describe('compiler: codegen', () => {
test('with patchFlag and no children/props', () => { test('with patchFlag and no children/props', () => {
expect(genCode(createVNodeCall(null, `"div"`, undefined, undefined, '1'))) expect(genCode(createVNodeCall(null, `"div"`, undefined, undefined, '1')))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
"return _createElementVNode("div", null, null, 1) "return _createElementVNode(\\"div\\", null, null, 1)
" "
`) `)
}) })
@ -687,7 +687,7 @@ describe('compiler: codegen', () => {
) )
) )
).toMatchInlineSnapshot(` ).toMatchInlineSnapshot(`
"return (_openBlock(), _createElementBlock("div", { foo: "bar" }, children)) "return (_openBlock(), _createElementBlock(\\"div\\", { foo: \\"bar\\" }, children))
" "
`) `)
}) })
@ -708,7 +708,7 @@ describe('compiler: codegen', () => {
) )
) )
).toMatchInlineSnapshot(` ).toMatchInlineSnapshot(`
"return (_openBlock(true), _createElementBlock("div", { foo: "bar" }, children)) "return (_openBlock(true), _createElementBlock(\\"div\\", { foo: \\"bar\\" }, children))
" "
`) `)
}) })
@ -727,7 +727,7 @@ describe('compiler: codegen', () => {
) )
) )
).toMatchInlineSnapshot(` ).toMatchInlineSnapshot(`
"return _withDirectives(_createElementVNode("div", { foo: "bar" }, children), [ "return _withDirectives(_createElementVNode(\\"div\\", { foo: \\"bar\\" }, children), [
[foo, bar] [foo, bar]
]) ])
" "
@ -749,7 +749,7 @@ describe('compiler: codegen', () => {
) )
) )
).toMatchInlineSnapshot(` ).toMatchInlineSnapshot(`
"return _withDirectives((_openBlock(), _createElementBlock("div", { foo: "bar" }, children)), [ "return _withDirectives((_openBlock(), _createElementBlock(\\"div\\", { foo: \\"bar\\" }, children)), [
[foo, bar] [foo, bar]
]) ])
" "

View File

@ -1,10 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compiler: hoistStatic transform hoist element with static key 1`] = ` exports[`compiler: hoistStatic transform > hoist element with static key 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode } = _Vue const { createElementVNode: _createElementVNode } = _Vue
const _hoisted_1 = /*#__PURE__*/_createElementVNode("div", { key: "foo" }, null, -1 /* HOISTED */) const _hoisted_1 = /*#__PURE__*/_createElementVNode(\\"div\\", { key: \\"foo\\" }, null, -1 /* HOISTED */)
const _hoisted_2 = [ const _hoisted_2 = [
_hoisted_1 _hoisted_1
] ]
@ -13,18 +13,18 @@ return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, _hoisted_2)) return (_openBlock(), _createElementBlock(\\"div\\", null, _hoisted_2))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform hoist nested static tree 1`] = ` exports[`compiler: hoistStatic transform > hoist nested static tree 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode } = _Vue const { createElementVNode: _createElementVNode } = _Vue
const _hoisted_1 = /*#__PURE__*/_createElementVNode("p", null, [ const _hoisted_1 = /*#__PURE__*/_createElementVNode(\\"p\\", null, [
/*#__PURE__*/_createElementVNode("span"), /*#__PURE__*/_createElementVNode(\\"span\\"),
/*#__PURE__*/_createElementVNode("span") /*#__PURE__*/_createElementVNode(\\"span\\")
], -1 /* HOISTED */) ], -1 /* HOISTED */)
const _hoisted_2 = [ const _hoisted_2 = [
_hoisted_1 _hoisted_1
@ -34,17 +34,17 @@ return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, _hoisted_2)) return (_openBlock(), _createElementBlock(\\"div\\", null, _hoisted_2))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform hoist nested static tree with comments 1`] = ` exports[`compiler: hoistStatic transform > hoist nested static tree with comments 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
const _hoisted_1 = /*#__PURE__*/_createElementVNode("div", null, [ const _hoisted_1 = /*#__PURE__*/_createElementVNode(\\"div\\", null, [
/*#__PURE__*/_createCommentVNode("comment") /*#__PURE__*/_createCommentVNode(\\"comment\\")
], -1 /* HOISTED */) ], -1 /* HOISTED */)
const _hoisted_2 = [ const _hoisted_2 = [
_hoisted_1 _hoisted_1
@ -54,17 +54,17 @@ return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { createCommentVNode: _createCommentVNode, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { createCommentVNode: _createCommentVNode, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, _hoisted_2)) return (_openBlock(), _createElementBlock(\\"div\\", null, _hoisted_2))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform hoist siblings with common non-hoistable parent 1`] = ` exports[`compiler: hoistStatic transform > hoist siblings with common non-hoistable parent 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode } = _Vue const { createElementVNode: _createElementVNode } = _Vue
const _hoisted_1 = /*#__PURE__*/_createElementVNode("span", null, null, -1 /* HOISTED */) const _hoisted_1 = /*#__PURE__*/_createElementVNode(\\"span\\", null, null, -1 /* HOISTED */)
const _hoisted_2 = /*#__PURE__*/_createElementVNode("div", null, null, -1 /* HOISTED */) const _hoisted_2 = /*#__PURE__*/_createElementVNode(\\"div\\", null, null, -1 /* HOISTED */)
const _hoisted_3 = [ const _hoisted_3 = [
_hoisted_1, _hoisted_1,
_hoisted_2 _hoisted_2
@ -74,16 +74,16 @@ return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, _hoisted_3)) return (_openBlock(), _createElementBlock(\\"div\\", null, _hoisted_3))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform hoist simple element 1`] = ` exports[`compiler: hoistStatic transform > hoist simple element 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode } = _Vue const { createElementVNode: _createElementVNode } = _Vue
const _hoisted_1 = /*#__PURE__*/_createElementVNode("span", { class: "inline" }, "hello", -1 /* HOISTED */) const _hoisted_1 = /*#__PURE__*/_createElementVNode(\\"span\\", { class: \\"inline\\" }, \\"hello\\", -1 /* HOISTED */)
const _hoisted_2 = [ const _hoisted_2 = [
_hoisted_1 _hoisted_1
] ]
@ -92,25 +92,25 @@ return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, _hoisted_2)) return (_openBlock(), _createElementBlock(\\"div\\", null, _hoisted_2))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform hoist static props for elements with directives 1`] = ` exports[`compiler: hoistStatic transform > hoist static props for elements with directives 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode } = _Vue const { createElementVNode: _createElementVNode } = _Vue
const _hoisted_1 = { id: "foo" } const _hoisted_1 = { id: \\"foo\\" }
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { resolveDirective: _resolveDirective, createElementVNode: _createElementVNode, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { resolveDirective: _resolveDirective, createElementVNode: _createElementVNode, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
const _directive_foo = _resolveDirective("foo") const _directive_foo = _resolveDirective(\\"foo\\")
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_withDirectives(_createElementVNode("div", _hoisted_1, null, 512 /* NEED_PATCH */), [ _withDirectives(_createElementVNode(\\"div\\", _hoisted_1, null, 512 /* NEED_PATCH */), [
[_directive_foo] [_directive_foo]
]) ])
])) ]))
@ -118,37 +118,37 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: hoistStatic transform hoist static props for elements with dynamic text children 1`] = ` exports[`compiler: hoistStatic transform > hoist static props for elements with dynamic text children 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode } = _Vue const { createElementVNode: _createElementVNode } = _Vue
const _hoisted_1 = { id: "foo" } const _hoisted_1 = { id: \\"foo\\" }
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_createElementVNode("div", _hoisted_1, _toDisplayString(hello), 1 /* TEXT */) _createElementVNode(\\"div\\", _hoisted_1, _toDisplayString(hello), 1 /* TEXT */)
])) ]))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform hoist static props for elements with unhoistable children 1`] = ` exports[`compiler: hoistStatic transform > hoist static props for elements with unhoistable children 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createVNode: _createVNode, createElementVNode: _createElementVNode } = _Vue const { createVNode: _createVNode, createElementVNode: _createElementVNode } = _Vue
const _hoisted_1 = { id: "foo" } const _hoisted_1 = { id: \\"foo\\" }
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { resolveComponent: _resolveComponent, createVNode: _createVNode, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { resolveComponent: _resolveComponent, createVNode: _createVNode, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_createElementVNode("div", _hoisted_1, [ _createElementVNode(\\"div\\", _hoisted_1, [
_createVNode(_component_Comp) _createVNode(_component_Comp)
]) ])
])) ]))
@ -156,7 +156,7 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: hoistStatic transform prefixIdentifiers hoist class with static object value 1`] = ` exports[`compiler: hoistStatic transform > prefixIdentifiers > hoist class with static object value 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode } = _Vue const { createElementVNode: _createElementVNode } = _Vue
@ -168,18 +168,18 @@ return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_createElementVNode("span", _hoisted_1, _toDisplayString(_ctx.bar), 1 /* TEXT */) _createElementVNode(\\"span\\", _hoisted_1, _toDisplayString(_ctx.bar), 1 /* TEXT */)
])) ]))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform prefixIdentifiers hoist nested static tree with static interpolation 1`] = ` exports[`compiler: hoistStatic transform > prefixIdentifiers > hoist nested static tree with static interpolation 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode } = _Vue const { createElementVNode: _createElementVNode } = _Vue
const _hoisted_1 = /*#__PURE__*/_createElementVNode("span", null, "foo " + /*#__PURE__*/_toDisplayString(1) + " " + /*#__PURE__*/_toDisplayString(true), -1 /* HOISTED */) const _hoisted_1 = /*#__PURE__*/_createElementVNode(\\"span\\", null, \\"foo \\" + /*#__PURE__*/_toDisplayString(1) + \\" \\" + /*#__PURE__*/_toDisplayString(true), -1 /* HOISTED */)
const _hoisted_2 = [ const _hoisted_2 = [
_hoisted_1 _hoisted_1
] ]
@ -188,16 +188,16 @@ return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, _hoisted_2)) return (_openBlock(), _createElementBlock(\\"div\\", null, _hoisted_2))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform prefixIdentifiers hoist nested static tree with static prop value 1`] = ` exports[`compiler: hoistStatic transform > prefixIdentifiers > hoist nested static tree with static prop value 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode } = _Vue const { createElementVNode: _createElementVNode } = _Vue
const _hoisted_1 = /*#__PURE__*/_createElementVNode("span", { foo: 0 }, /*#__PURE__*/_toDisplayString(1), -1 /* HOISTED */) const _hoisted_1 = /*#__PURE__*/_createElementVNode(\\"span\\", { foo: 0 }, /*#__PURE__*/_toDisplayString(1), -1 /* HOISTED */)
const _hoisted_2 = [ const _hoisted_2 = [
_hoisted_1 _hoisted_1
] ]
@ -206,16 +206,16 @@ return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, _hoisted_2)) return (_openBlock(), _createElementBlock(\\"div\\", null, _hoisted_2))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist SVG with directives 1`] = ` exports[`compiler: hoistStatic transform > prefixIdentifiers > should NOT hoist SVG with directives 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode } = _Vue const { createElementVNode: _createElementVNode } = _Vue
const _hoisted_1 = /*#__PURE__*/_createElementVNode("path", { d: "M2,3H5.5L12" }, null, -1 /* HOISTED */) const _hoisted_1 = /*#__PURE__*/_createElementVNode(\\"path\\", { d: \\"M2,3H5.5L12\\" }, null, -1 /* HOISTED */)
const _hoisted_2 = [ const _hoisted_2 = [
_hoisted_1 _hoisted_1
] ]
@ -224,10 +224,10 @@ return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { createElementVNode: _createElementVNode, resolveDirective: _resolveDirective, openBlock: _openBlock, createElementBlock: _createElementBlock, withDirectives: _withDirectives } = _Vue const { createElementVNode: _createElementVNode, resolveDirective: _resolveDirective, openBlock: _openBlock, createElementBlock: _createElementBlock, withDirectives: _withDirectives } = _Vue
const _directive_foo = _resolveDirective("foo") const _directive_foo = _resolveDirective(\\"foo\\")
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_withDirectives((_openBlock(), _createElementBlock("svg", null, _hoisted_2)), [ _withDirectives((_openBlock(), _createElementBlock(\\"svg\\", null, _hoisted_2)), [
[_directive_foo] [_directive_foo]
]) ])
])) ]))
@ -235,13 +235,13 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist elements with cached handlers + other bindings 1`] = ` exports[`compiler: hoistStatic transform > prefixIdentifiers > should NOT hoist elements with cached handlers + other bindings 1`] = `
"import { normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue" "import { normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_createElementVNode("div", null, [ _createElementVNode(\\"div\\", null, [
_createElementVNode("div", { _createElementVNode(\\"div\\", {
class: _normalizeClass({}), class: _normalizeClass({}),
onClick: _cache[0] || (_cache[0] = (...args) => (_ctx.foo && _ctx.foo(...args))) onClick: _cache[0] || (_cache[0] = (...args) => (_ctx.foo && _ctx.foo(...args)))
}) })
@ -250,13 +250,13 @@ export function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist elements with cached handlers 1`] = ` exports[`compiler: hoistStatic transform > prefixIdentifiers > should NOT hoist elements with cached handlers 1`] = `
"import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue" "import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_createElementVNode("div", null, [ _createElementVNode(\\"div\\", null, [
_createElementVNode("div", { _createElementVNode(\\"div\\", {
onClick: _cache[0] || (_cache[0] = (...args) => (_ctx.foo && _ctx.foo(...args))) onClick: _cache[0] || (_cache[0] = (...args) => (_ctx.foo && _ctx.foo(...args)))
}) })
]) ])
@ -264,17 +264,17 @@ export function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expressions that refer scope variables (2) 1`] = ` exports[`compiler: hoistStatic transform > prefixIdentifiers > should NOT hoist expressions that refer scope variables (2) 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, createElementVNode: _createElementVNode } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, createElementVNode: _createElementVNode } = _Vue
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.list, (o) => { (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.list, (o) => {
return (_openBlock(), _createElementBlock("p", null, [ return (_openBlock(), _createElementBlock(\\"p\\", null, [
_createElementVNode("span", null, _toDisplayString(o + 'foo'), 1 /* TEXT */) _createElementVNode(\\"span\\", null, _toDisplayString(o + 'foo'), 1 /* TEXT */)
])) ]))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
])) ]))
@ -282,14 +282,14 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expressions that refer scope variables (v-slot) 1`] = ` exports[`compiler: hoistStatic transform > prefixIdentifiers > should NOT hoist expressions that refer scope variables (v-slot) 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue const { toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, { return (_openBlock(), _createBlock(_component_Comp, null, {
default: _withCtx(({ foo }) => [ default: _withCtx(({ foo }) => [
@ -301,17 +301,17 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expressions that refer scope variables 1`] = ` exports[`compiler: hoistStatic transform > prefixIdentifiers > should NOT hoist expressions that refer scope variables 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, createElementVNode: _createElementVNode } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, createElementVNode: _createElementVNode } = _Vue
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.list, (o) => { (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.list, (o) => {
return (_openBlock(), _createElementBlock("p", null, [ return (_openBlock(), _createElementBlock(\\"p\\", null, [
_createElementVNode("span", null, _toDisplayString(o), 1 /* TEXT */) _createElementVNode(\\"span\\", null, _toDisplayString(o), 1 /* TEXT */)
])) ]))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
])) ]))
@ -319,101 +319,101 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist keyed template v-for with plain element child 1`] = ` exports[`compiler: hoistStatic transform > prefixIdentifiers > should NOT hoist keyed template v-for with plain element child 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => {
return (_openBlock(), _createElementBlock("span", { key: item })) return (_openBlock(), _createElementBlock(\\"span\\", { key: item }))
}), 128 /* KEYED_FRAGMENT */)) }), 128 /* KEYED_FRAGMENT */))
])) ]))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform should NOT hoist components 1`] = ` exports[`compiler: hoistStatic transform > should NOT hoist components 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { resolveComponent: _resolveComponent, createVNode: _createVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { resolveComponent: _resolveComponent, createVNode: _createVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_createVNode(_component_Comp) _createVNode(_component_Comp)
])) ]))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform should NOT hoist element with dynamic key 1`] = ` exports[`compiler: hoistStatic transform > should NOT hoist element with dynamic key 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
(_openBlock(), _createElementBlock("div", { key: foo })) (_openBlock(), _createElementBlock(\\"div\\", { key: foo }))
])) ]))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform should NOT hoist element with dynamic props (but hoist the props list) 1`] = ` exports[`compiler: hoistStatic transform > should NOT hoist element with dynamic props (but hoist the props list) 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode } = _Vue const { createElementVNode: _createElementVNode } = _Vue
const _hoisted_1 = ["id"] const _hoisted_1 = [\\"id\\"]
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_createElementVNode("div", { id: foo }, null, 8 /* PROPS */, _hoisted_1) _createElementVNode(\\"div\\", { id: foo }, null, 8 /* PROPS */, _hoisted_1)
])) ]))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform should NOT hoist element with dynamic ref 1`] = ` exports[`compiler: hoistStatic transform > should NOT hoist element with dynamic ref 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_createElementVNode("div", { ref: foo }, null, 512 /* NEED_PATCH */) _createElementVNode(\\"div\\", { ref: foo }, null, 512 /* NEED_PATCH */)
])) ]))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform should NOT hoist root node 1`] = ` exports[`compiler: hoistStatic transform > should NOT hoist root node 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div")) return (_openBlock(), _createElementBlock(\\"div\\"))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform should hoist v-for children if static 1`] = ` exports[`compiler: hoistStatic transform > should hoist v-for children if static 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode } = _Vue const { createElementVNode: _createElementVNode } = _Vue
const _hoisted_1 = { id: "foo" } const _hoisted_1 = { id: \\"foo\\" }
const _hoisted_2 = /*#__PURE__*/_createElementVNode("span", null, null, -1 /* HOISTED */) const _hoisted_2 = /*#__PURE__*/_createElementVNode(\\"span\\", null, null, -1 /* HOISTED */)
const _hoisted_3 = [ const _hoisted_3 = [
_hoisted_2 _hoisted_2
] ]
@ -422,24 +422,24 @@ return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createElementVNode: _createElementVNode } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createElementVNode: _createElementVNode } = _Vue
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(list, (i) => { (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(list, (i) => {
return (_openBlock(), _createElementBlock("div", _hoisted_1, _hoisted_3)) return (_openBlock(), _createElementBlock(\\"div\\", _hoisted_1, _hoisted_3))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
])) ]))
} }
}" }"
`; `;
exports[`compiler: hoistStatic transform should hoist v-if props/children if static 1`] = ` exports[`compiler: hoistStatic transform > should hoist v-if props/children if static 1`] = `
"const _Vue = Vue "const _Vue = Vue
const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
const _hoisted_1 = { const _hoisted_1 = {
key: 0, key: 0,
id: "foo" id: \\"foo\\"
} }
const _hoisted_2 = /*#__PURE__*/_createElementVNode("span", null, null, -1 /* HOISTED */) const _hoisted_2 = /*#__PURE__*/_createElementVNode(\\"span\\", null, null, -1 /* HOISTED */)
const _hoisted_3 = [ const _hoisted_3 = [
_hoisted_2 _hoisted_2
] ]
@ -448,10 +448,10 @@ return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode } = _Vue const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode } = _Vue
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
ok ok
? (_openBlock(), _createElementBlock("div", _hoisted_1, _hoisted_3)) ? (_openBlock(), _createElementBlock(\\"div\\", _hoisted_1, _hoisted_3))
: _createCommentVNode("v-if", true) : _createCommentVNode(\\"v-if\\", true)
])) ]))
} }
}" }"

View File

@ -1,15 +1,15 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compiler: expression transform bindingMetadata inline mode 1`] = ` exports[`compiler: expression transform > bindingMetadata > inline mode 1`] = `
"(_ctx, _cache) => { "(_ctx, _cache) => {
return (_openBlock(), _createElementBlock("div", null, _toDisplayString(__props.props) + " " + _toDisplayString(_unref(setup)) + " " + _toDisplayString(setupConst) + " " + _toDisplayString(_ctx.data) + " " + _toDisplayString(_ctx.options), 1 /* TEXT */)) return (_openBlock(), _createElementBlock(\\"div\\", null, _toDisplayString(__props.props) + \\" \\" + _toDisplayString(_unref(setup)) + \\" \\" + _toDisplayString(setupConst) + \\" \\" + _toDisplayString(_ctx.data) + \\" \\" + _toDisplayString(_ctx.options), 1 /* TEXT */))
}" }"
`; `;
exports[`compiler: expression transform bindingMetadata non-inline mode 1`] = ` exports[`compiler: expression transform > bindingMetadata > non-inline mode 1`] = `
"const { toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue "const { toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue
return function render(_ctx, _cache, $props, $setup, $data, $options) { return function render(_ctx, _cache, $props, $setup, $data, $options) {
return (_openBlock(), _createElementBlock("div", null, _toDisplayString($props.props) + " " + _toDisplayString($setup.setup) + " " + _toDisplayString($data.data) + " " + _toDisplayString($options.options), 1 /* TEXT */)) return (_openBlock(), _createElementBlock(\\"div\\", null, _toDisplayString($props.props) + \\" \\" + _toDisplayString($setup.setup) + \\" \\" + _toDisplayString($data.data) + \\" \\" + _toDisplayString($options.options), 1 /* TEXT */))
}" }"
`; `;

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compiler: transform text <template v-for> 1`] = ` exports[`compiler: transform text > <template v-for> 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -9,26 +9,26 @@ return function render(_ctx, _cache) {
return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(list, (i) => { return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(list, (i) => {
return (_openBlock(), _createElementBlock(_Fragment, null, [ return (_openBlock(), _createElementBlock(_Fragment, null, [
_createTextVNode("foo") _createTextVNode(\\"foo\\")
], 64 /* STABLE_FRAGMENT */)) ], 64 /* STABLE_FRAGMENT */))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: transform text consecutive text 1`] = ` exports[`compiler: transform text > consecutive text 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { toDisplayString: _toDisplayString } = _Vue const { toDisplayString: _toDisplayString } = _Vue
return _toDisplayString(foo) + " bar " + _toDisplayString(baz) return _toDisplayString(foo) + \\" bar \\" + _toDisplayString(baz)
} }
}" }"
`; `;
exports[`compiler: transform text consecutive text between elements 1`] = ` exports[`compiler: transform text > consecutive text between elements 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -36,15 +36,15 @@ return function render(_ctx, _cache) {
const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock(_Fragment, null, [ return (_openBlock(), _createElementBlock(_Fragment, null, [
_createElementVNode("div"), _createElementVNode(\\"div\\"),
_createTextVNode(_toDisplayString(foo) + " bar " + _toDisplayString(baz), 1 /* TEXT */), _createTextVNode(_toDisplayString(foo) + \\" bar \\" + _toDisplayString(baz), 1 /* TEXT */),
_createElementVNode("div") _createElementVNode(\\"div\\")
], 64 /* STABLE_FRAGMENT */)) ], 64 /* STABLE_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: transform text consecutive text mixed with elements 1`] = ` exports[`compiler: transform text > consecutive text mixed with elements 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -52,26 +52,26 @@ return function render(_ctx, _cache) {
const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock(_Fragment, null, [ return (_openBlock(), _createElementBlock(_Fragment, null, [
_createElementVNode("div"), _createElementVNode(\\"div\\"),
_createTextVNode(_toDisplayString(foo) + " bar " + _toDisplayString(baz), 1 /* TEXT */), _createTextVNode(_toDisplayString(foo) + \\" bar \\" + _toDisplayString(baz), 1 /* TEXT */),
_createElementVNode("div"), _createElementVNode(\\"div\\"),
_createTextVNode("hello"), _createTextVNode(\\"hello\\"),
_createElementVNode("div") _createElementVNode(\\"div\\")
], 64 /* STABLE_FRAGMENT */)) ], 64 /* STABLE_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: transform text element with custom directives and only one text child node 1`] = ` exports[`compiler: transform text > element with custom directives and only one text child node 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, resolveDirective: _resolveDirective, openBlock: _openBlock, createElementBlock: _createElementBlock, withDirectives: _withDirectives } = _Vue const { toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, resolveDirective: _resolveDirective, openBlock: _openBlock, createElementBlock: _createElementBlock, withDirectives: _withDirectives } = _Vue
const _directive_foo = _resolveDirective("foo") const _directive_foo = _resolveDirective(\\"foo\\")
return _withDirectives((_openBlock(), _createElementBlock("p", null, [ return _withDirectives((_openBlock(), _createElementBlock(\\"p\\", null, [
_createTextVNode(_toDisplayString(foo), 1 /* TEXT */) _createTextVNode(_toDisplayString(foo), 1 /* TEXT */)
])), [ ])), [
[_directive_foo] [_directive_foo]
@ -80,7 +80,7 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform text no consecutive text 1`] = ` exports[`compiler: transform text > no consecutive text 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -92,7 +92,7 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform text text between elements (static) 1`] = ` exports[`compiler: transform text > text between elements (static) 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -100,18 +100,18 @@ return function render(_ctx, _cache) {
const { createElementVNode: _createElementVNode, createTextVNode: _createTextVNode, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { createElementVNode: _createElementVNode, createTextVNode: _createTextVNode, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock(_Fragment, null, [ return (_openBlock(), _createElementBlock(_Fragment, null, [
_createElementVNode("div"), _createElementVNode(\\"div\\"),
_createTextVNode("hello"), _createTextVNode(\\"hello\\"),
_createElementVNode("div") _createElementVNode(\\"div\\")
], 64 /* STABLE_FRAGMENT */)) ], 64 /* STABLE_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: transform text with prefixIdentifiers: true 1`] = ` exports[`compiler: transform text > with prefixIdentifiers: true 1`] = `
"const { toDisplayString: _toDisplayString } = Vue "const { toDisplayString: _toDisplayString } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
return _toDisplayString(_ctx.foo) + " bar " + _toDisplayString(_ctx.baz + _ctx.qux) return _toDisplayString(_ctx.foo) + \\" bar \\" + _toDisplayString(_ctx.baz + _ctx.qux)
}" }"
`; `;

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compiler: v-for codegen basic v-for 1`] = ` exports[`compiler: v-for > codegen > basic v-for 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -8,13 +8,13 @@ return function render(_ctx, _cache) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => {
return (_openBlock(), _createElementBlock("span")) return (_openBlock(), _createElementBlock(\\"span\\"))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-for codegen keyed template v-for 1`] = ` exports[`compiler: v-for > codegen > keyed template v-for 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -23,15 +23,15 @@ return function render(_ctx, _cache) {
return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => {
return (_openBlock(), _createElementBlock(_Fragment, { key: item }, [ return (_openBlock(), _createElementBlock(_Fragment, { key: item }, [
"hello", \\"hello\\",
_createElementVNode("span") _createElementVNode(\\"span\\")
], 64 /* STABLE_FRAGMENT */)) ], 64 /* STABLE_FRAGMENT */))
}), 128 /* KEYED_FRAGMENT */)) }), 128 /* KEYED_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-for codegen keyed v-for 1`] = ` exports[`compiler: v-for > codegen > keyed v-for 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -39,13 +39,13 @@ return function render(_ctx, _cache) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => {
return (_openBlock(), _createElementBlock("span", { key: item })) return (_openBlock(), _createElementBlock(\\"span\\", { key: item }))
}), 128 /* KEYED_FRAGMENT */)) }), 128 /* KEYED_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-for codegen skipped key 1`] = ` exports[`compiler: v-for > codegen > skipped key 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -53,13 +53,13 @@ return function render(_ctx, _cache) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item, __, index) => { return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item, __, index) => {
return (_openBlock(), _createElementBlock("span")) return (_openBlock(), _createElementBlock(\\"span\\"))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-for codegen skipped value & key 1`] = ` exports[`compiler: v-for > codegen > skipped value & key 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -67,13 +67,13 @@ return function render(_ctx, _cache) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (_, __, index) => { return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (_, __, index) => {
return (_openBlock(), _createElementBlock("span")) return (_openBlock(), _createElementBlock(\\"span\\"))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-for codegen skipped value 1`] = ` exports[`compiler: v-for > codegen > skipped value 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -81,13 +81,13 @@ return function render(_ctx, _cache) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (_, key, index) => { return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (_, key, index) => {
return (_openBlock(), _createElementBlock("span")) return (_openBlock(), _createElementBlock(\\"span\\"))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-for codegen template v-for 1`] = ` exports[`compiler: v-for > codegen > template v-for 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -96,15 +96,15 @@ return function render(_ctx, _cache) {
return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => {
return (_openBlock(), _createElementBlock(_Fragment, null, [ return (_openBlock(), _createElementBlock(_Fragment, null, [
"hello", \\"hello\\",
_createElementVNode("span") _createElementVNode(\\"span\\")
], 64 /* STABLE_FRAGMENT */)) ], 64 /* STABLE_FRAGMENT */))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-for codegen template v-for key injection with single child 1`] = ` exports[`compiler: v-for > codegen > template v-for key injection with single child 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -112,16 +112,16 @@ return function render(_ctx, _cache) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => {
return (_openBlock(), _createElementBlock("span", { return (_openBlock(), _createElementBlock(\\"span\\", {
key: item.id, key: item.id,
id: item.id id: item.id
}, null, 8 /* PROPS */, ["id"])) }, null, 8 /* PROPS */, [\\"id\\"]))
}), 128 /* KEYED_FRAGMENT */)) }), 128 /* KEYED_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-for codegen template v-for w/ <slot/> 1`] = ` exports[`compiler: v-for > codegen > template v-for w/ <slot/> 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -129,13 +129,13 @@ return function render(_ctx, _cache) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, renderSlot: _renderSlot } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, renderSlot: _renderSlot } = _Vue
return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => {
return _renderSlot($slots, "default") return _renderSlot($slots, \\"default\\")
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-for codegen v-for on <slot/> 1`] = ` exports[`compiler: v-for > codegen > v-for on <slot/> 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -143,23 +143,23 @@ return function render(_ctx, _cache) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, renderSlot: _renderSlot } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, renderSlot: _renderSlot } = _Vue
return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => {
return _renderSlot($slots, "default") return _renderSlot($slots, \\"default\\")
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-for codegen v-for on element with custom directive 1`] = ` exports[`compiler: v-for > codegen > v-for on element with custom directive 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, resolveDirective: _resolveDirective, withDirectives: _withDirectives } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, resolveDirective: _resolveDirective, withDirectives: _withDirectives } = _Vue
const _directive_foo = _resolveDirective("foo") const _directive_foo = _resolveDirective(\\"foo\\")
return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(list, (i) => { return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(list, (i) => {
return _withDirectives((_openBlock(), _createElementBlock("div", null, null, 512 /* NEED_PATCH */)), [ return _withDirectives((_openBlock(), _createElementBlock(\\"div\\", null, null, 512 /* NEED_PATCH */)), [
[_directive_foo] [_directive_foo]
]) ])
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
@ -167,7 +167,7 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: v-for codegen v-for with constant expression 1`] = ` exports[`compiler: v-for > codegen > v-for with constant expression 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -175,13 +175,13 @@ return function render(_ctx, _cache) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, createElementVNode: _createElementVNode } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, createElementVNode: _createElementVNode } = _Vue
return (_openBlock(), _createElementBlock(_Fragment, null, _renderList(10, (item) => { return (_openBlock(), _createElementBlock(_Fragment, null, _renderList(10, (item) => {
return _createElementVNode("p", null, _toDisplayString(item), 1 /* TEXT */) return _createElementVNode(\\"p\\", null, _toDisplayString(item), 1 /* TEXT */)
}), 64 /* STABLE_FRAGMENT */)) }), 64 /* STABLE_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-for codegen v-if + v-for 1`] = ` exports[`compiler: v-for > codegen > v-if + v-for 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -190,14 +190,14 @@ return function render(_ctx, _cache) {
return ok return ok
? (_openBlock(true), _createElementBlock(_Fragment, { key: 0 }, _renderList(list, (i) => { ? (_openBlock(true), _createElementBlock(_Fragment, { key: 0 }, _renderList(list, (i) => {
return (_openBlock(), _createElementBlock("div")) return (_openBlock(), _createElementBlock(\\"div\\"))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
: _createCommentVNode("v-if", true) : _createCommentVNode(\\"v-if\\", true)
} }
}" }"
`; `;
exports[`compiler: v-for codegen v-if + v-for on <template> 1`] = ` exports[`compiler: v-for > codegen > v-if + v-for on <template> 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -208,12 +208,12 @@ return function render(_ctx, _cache) {
? (_openBlock(true), _createElementBlock(_Fragment, { key: 0 }, _renderList(list, (i) => { ? (_openBlock(true), _createElementBlock(_Fragment, { key: 0 }, _renderList(list, (i) => {
return (_openBlock(), _createElementBlock(_Fragment, null, [], 64 /* STABLE_FRAGMENT */)) return (_openBlock(), _createElementBlock(_Fragment, null, [], 64 /* STABLE_FRAGMENT */))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
: _createCommentVNode("v-if", true) : _createCommentVNode(\\"v-if\\", true)
} }
}" }"
`; `;
exports[`compiler: v-for codegen value + key + index 1`] = ` exports[`compiler: v-for > codegen > value + key + index 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -221,7 +221,7 @@ return function render(_ctx, _cache) {
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item, key, index) => { return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item, key, index) => {
return (_openBlock(), _createElementBlock("span")) return (_openBlock(), _createElementBlock(\\"span\\"))
}), 256 /* UNKEYED_FRAGMENT */)) }), 256 /* UNKEYED_FRAGMENT */))
} }
}" }"

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compiler: v-if codegen basic v-if 1`] = ` exports[`compiler: v-if > codegen > basic v-if 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -8,13 +8,13 @@ return function render(_ctx, _cache) {
const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode } = _Vue const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode } = _Vue
return ok return ok
? (_openBlock(), _createElementBlock("div", { key: 0 })) ? (_openBlock(), _createElementBlock(\\"div\\", { key: 0 }))
: _createCommentVNode("v-if", true) : _createCommentVNode(\\"v-if\\", true)
} }
}" }"
`; `;
exports[`compiler: v-if codegen increasing key: v-if + v-else-if + v-else 1`] = ` exports[`compiler: v-if > codegen > increasing key: v-if + v-else-if + v-else 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -23,19 +23,19 @@ return function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock(_Fragment, null, [ return (_openBlock(), _createElementBlock(_Fragment, null, [
ok ok
? (_openBlock(), _createElementBlock("div", { key: 0 })) ? (_openBlock(), _createElementBlock(\\"div\\", { key: 0 }))
: (_openBlock(), _createElementBlock("p", { key: 1 })), : (_openBlock(), _createElementBlock(\\"p\\", { key: 1 })),
another another
? (_openBlock(), _createElementBlock("div", { key: 2 })) ? (_openBlock(), _createElementBlock(\\"div\\", { key: 2 }))
: orNot : orNot
? (_openBlock(), _createElementBlock("p", { key: 3 })) ? (_openBlock(), _createElementBlock(\\"p\\", { key: 3 }))
: (_openBlock(), _createElementBlock("p", { key: 4 })) : (_openBlock(), _createElementBlock(\\"p\\", { key: 4 }))
], 64 /* STABLE_FRAGMENT */)) ], 64 /* STABLE_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-if codegen multiple v-if that are sibling nodes should have different keys 1`] = ` exports[`compiler: v-if > codegen > multiple v-if that are sibling nodes should have different keys 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -44,17 +44,17 @@ return function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock(_Fragment, null, [ return (_openBlock(), _createElementBlock(_Fragment, null, [
ok ok
? (_openBlock(), _createElementBlock("div", { key: 0 })) ? (_openBlock(), _createElementBlock(\\"div\\", { key: 0 }))
: _createCommentVNode("v-if", true), : _createCommentVNode(\\"v-if\\", true),
orNot orNot
? (_openBlock(), _createElementBlock("p", { key: 1 })) ? (_openBlock(), _createElementBlock(\\"p\\", { key: 1 }))
: _createCommentVNode("v-if", true) : _createCommentVNode(\\"v-if\\", true)
], 64 /* STABLE_FRAGMENT */)) ], 64 /* STABLE_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-if codegen template v-if 1`] = ` exports[`compiler: v-if > codegen > template v-if 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -63,16 +63,16 @@ return function render(_ctx, _cache) {
return ok return ok
? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [ ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [
_createElementVNode("div"), _createElementVNode(\\"div\\"),
"hello", \\"hello\\",
_createElementVNode("p") _createElementVNode(\\"p\\")
], 64 /* STABLE_FRAGMENT */)) ], 64 /* STABLE_FRAGMENT */))
: _createCommentVNode("v-if", true) : _createCommentVNode(\\"v-if\\", true)
} }
}" }"
`; `;
exports[`compiler: v-if codegen template v-if w/ single <slot/> child 1`] = ` exports[`compiler: v-if > codegen > template v-if w/ single <slot/> child 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -80,13 +80,13 @@ return function render(_ctx, _cache) {
const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue
return ok return ok
? _renderSlot($slots, "default", { key: 0 }) ? _renderSlot($slots, \\"default\\", { key: 0 })
: _createCommentVNode("v-if", true) : _createCommentVNode(\\"v-if\\", true)
} }
}" }"
`; `;
exports[`compiler: v-if codegen v-if + v-else 1`] = ` exports[`compiler: v-if > codegen > v-if + v-else 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -94,13 +94,13 @@ return function render(_ctx, _cache) {
const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode } = _Vue const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode } = _Vue
return ok return ok
? (_openBlock(), _createElementBlock("div", { key: 0 })) ? (_openBlock(), _createElementBlock(\\"div\\", { key: 0 }))
: (_openBlock(), _createElementBlock("p", { key: 1 })) : (_openBlock(), _createElementBlock(\\"p\\", { key: 1 }))
} }
}" }"
`; `;
exports[`compiler: v-if codegen v-if + v-else-if + v-else 1`] = ` exports[`compiler: v-if > codegen > v-if + v-else-if + v-else 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -108,15 +108,15 @@ return function render(_ctx, _cache) {
const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment } = _Vue const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment } = _Vue
return ok return ok
? (_openBlock(), _createElementBlock("div", { key: 0 })) ? (_openBlock(), _createElementBlock(\\"div\\", { key: 0 }))
: orNot : orNot
? (_openBlock(), _createElementBlock("p", { key: 1 })) ? (_openBlock(), _createElementBlock(\\"p\\", { key: 1 }))
: (_openBlock(), _createElementBlock(_Fragment, { key: 2 }, ["fine"], 64 /* STABLE_FRAGMENT */)) : (_openBlock(), _createElementBlock(_Fragment, { key: 2 }, [\\"fine\\"], 64 /* STABLE_FRAGMENT */))
} }
}" }"
`; `;
exports[`compiler: v-if codegen v-if + v-else-if 1`] = ` exports[`compiler: v-if > codegen > v-if + v-else-if 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -124,15 +124,15 @@ return function render(_ctx, _cache) {
const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode } = _Vue const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode } = _Vue
return ok return ok
? (_openBlock(), _createElementBlock("div", { key: 0 })) ? (_openBlock(), _createElementBlock(\\"div\\", { key: 0 }))
: orNot : orNot
? (_openBlock(), _createElementBlock("p", { key: 1 })) ? (_openBlock(), _createElementBlock(\\"p\\", { key: 1 }))
: _createCommentVNode("v-if", true) : _createCommentVNode(\\"v-if\\", true)
} }
}" }"
`; `;
exports[`compiler: v-if codegen v-if on <slot/> 1`] = ` exports[`compiler: v-if > codegen > v-if on <slot/> 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -140,8 +140,8 @@ return function render(_ctx, _cache) {
const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue
return ok return ok
? _renderSlot($slots, "default", { key: 0 }) ? _renderSlot($slots, \\"default\\", { key: 0 })
: _createCommentVNode("v-if", true) : _createCommentVNode(\\"v-if\\", true)
} }
}" }"
`; `;

View File

@ -1,44 +1,44 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compiler: v-memo transform on component 1`] = ` exports[`compiler: v-memo transform > on component 1`] = `
"import { resolveComponent as _resolveComponent, createVNode as _createVNode, withMemo as _withMemo, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue" "import { resolveComponent as _resolveComponent, createVNode as _createVNode, withMemo as _withMemo, openBlock as _openBlock, createElementBlock as _createElementBlock } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_withMemo([_ctx.x], () => _createVNode(_component_Comp), _cache, 0) _withMemo([_ctx.x], () => _createVNode(_component_Comp), _cache, 0)
])) ]))
}" }"
`; `;
exports[`compiler: v-memo transform on normal element 1`] = ` exports[`compiler: v-memo transform > on normal element 1`] = `
"import { openBlock as _openBlock, createElementBlock as _createElementBlock, withMemo as _withMemo } from "vue" "import { openBlock as _openBlock, createElementBlock as _createElementBlock, withMemo as _withMemo } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_withMemo([_ctx.x], () => (_openBlock(), _createElementBlock("div")), _cache, 0) _withMemo([_ctx.x], () => (_openBlock(), _createElementBlock(\\"div\\")), _cache, 0)
])) ]))
}" }"
`; `;
exports[`compiler: v-memo transform on root element 1`] = ` exports[`compiler: v-memo transform > on root element 1`] = `
"import { openBlock as _openBlock, createElementBlock as _createElementBlock, withMemo as _withMemo } from "vue" "import { openBlock as _openBlock, createElementBlock as _createElementBlock, withMemo as _withMemo } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return _withMemo([_ctx.x], () => (_openBlock(), _createElementBlock("div")), _cache, 0) return _withMemo([_ctx.x], () => (_openBlock(), _createElementBlock(\\"div\\")), _cache, 0)
}" }"
`; `;
exports[`compiler: v-memo transform on template v-for 1`] = ` exports[`compiler: v-memo transform > on template v-for 1`] = `
"import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, isMemoSame as _isMemoSame, withMemo as _withMemo } from "vue" "import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, isMemoSame as _isMemoSame, withMemo as _withMemo } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.list, ({ x, y }, __, ___, _cached) => { (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.list, ({ x, y }, __, ___, _cached) => {
const _memo = ([x, y === _ctx.z]) const _memo = ([x, y === _ctx.z])
if (_cached && _cached.key === x && _isMemoSame(_cached, _memo)) return _cached if (_cached && _cached.key === x && _isMemoSame(_cached, _memo)) return _cached
const _item = (_openBlock(), _createElementBlock("span", { key: x }, "foobar")) const _item = (_openBlock(), _createElementBlock(\\"span\\", { key: x }, \\"foobar\\"))
_item.memo = _memo _item.memo = _memo
return _item return _item
}, _cache, 0), 128 /* KEYED_FRAGMENT */)) }, _cache, 0), 128 /* KEYED_FRAGMENT */))
@ -46,16 +46,16 @@ export function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: v-memo transform on v-for 1`] = ` exports[`compiler: v-memo transform > on v-for 1`] = `
"import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createElementVNode as _createElementVNode, isMemoSame as _isMemoSame, withMemo as _withMemo } from "vue" "import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createElementVNode as _createElementVNode, isMemoSame as _isMemoSame, withMemo as _withMemo } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.list, ({ x, y }, __, ___, _cached) => { (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.list, ({ x, y }, __, ___, _cached) => {
const _memo = ([x, y === _ctx.z]) const _memo = ([x, y === _ctx.z])
if (_cached && _cached.key === x && _isMemoSame(_cached, _memo)) return _cached if (_cached && _cached.key === x && _isMemoSame(_cached, _memo)) return _cached
const _item = (_openBlock(), _createElementBlock("div", { key: x }, [ const _item = (_openBlock(), _createElementBlock(\\"div\\", { key: x }, [
_createElementVNode("span", null, "foobar") _createElementVNode(\\"span\\", null, \\"foobar\\")
])) ]))
_item.memo = _memo _item.memo = _memo
return _item return _item
@ -64,17 +64,17 @@ export function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: v-memo transform on v-if 1`] = ` exports[`compiler: v-memo transform > on v-if 1`] = `
"import { createElementVNode as _createElementVNode, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, withMemo as _withMemo, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createBlock as _createBlock } from "vue" "import { createElementVNode as _createElementVNode, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, withMemo as _withMemo, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createBlock as _createBlock } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
(_ctx.ok) (_ctx.ok)
? _withMemo([_ctx.x], () => (_openBlock(), _createElementBlock("div", { key: 0 }, [ ? _withMemo([_ctx.x], () => (_openBlock(), _createElementBlock(\\"div\\", { key: 0 }, [
_createElementVNode("span", null, "foo"), _createElementVNode(\\"span\\", null, \\"foo\\"),
_createTextVNode("bar") _createTextVNode(\\"bar\\")
])), _cache, 0) ])), _cache, 0)
: _withMemo([_ctx.x], () => (_openBlock(), _createBlock(_component_Comp, { key: 1 })), _cache, 1) : _withMemo([_ctx.x], () => (_openBlock(), _createBlock(_component_Comp, { key: 1 })), _cache, 1)
])) ]))

View File

@ -1,116 +1,116 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compiler: transform v-model compound expression (with prefixIdentifiers) 1`] = ` exports[`compiler: transform v-model > compound expression (with prefixIdentifiers) 1`] = `
"import { openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue" "import { openBlock as _openBlock, createElementBlock as _createElementBlock } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("input", { return (_openBlock(), _createElementBlock(\\"input\\", {
modelValue: _ctx.model[_ctx.index], modelValue: _ctx.model[_ctx.index],
"onUpdate:modelValue": $event => ((_ctx.model[_ctx.index]) = $event) \\"onUpdate:modelValue\\": $event => ((_ctx.model[_ctx.index]) = $event)
}, null, 8 /* PROPS */, ["modelValue", "onUpdate:modelValue"])) }, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]))
}" }"
`; `;
exports[`compiler: transform v-model compound expression 1`] = ` exports[`compiler: transform v-model > compound expression 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("input", { return (_openBlock(), _createElementBlock(\\"input\\", {
modelValue: model[index], modelValue: model[index],
"onUpdate:modelValue": $event => ((model[index]) = $event) \\"onUpdate:modelValue\\": $event => ((model[index]) = $event)
}, null, 8 /* PROPS */, ["modelValue", "onUpdate:modelValue"])) }, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]))
} }
}" }"
`; `;
exports[`compiler: transform v-model simple expression (with multilines) 1`] = ` exports[`compiler: transform v-model > simple expression (with multilines) 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("input", { return (_openBlock(), _createElementBlock(\\"input\\", {
modelValue: modelValue:
model model
. .
foo foo
, ,
"onUpdate:modelValue": $event => (( \\"onUpdate:modelValue\\": $event => ((
model model
. .
foo foo
) = $event) ) = $event)
}, null, 8 /* PROPS */, ["modelValue", "onUpdate:modelValue"])) }, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]))
} }
}" }"
`; `;
exports[`compiler: transform v-model simple expression (with prefixIdentifiers) 1`] = ` exports[`compiler: transform v-model > simple expression (with prefixIdentifiers) 1`] = `
"import { openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue" "import { openBlock as _openBlock, createElementBlock as _createElementBlock } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("input", { return (_openBlock(), _createElementBlock(\\"input\\", {
modelValue: _ctx.model, modelValue: _ctx.model,
"onUpdate:modelValue": $event => ((_ctx.model) = $event) \\"onUpdate:modelValue\\": $event => ((_ctx.model) = $event)
}, null, 8 /* PROPS */, ["modelValue", "onUpdate:modelValue"])) }, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]))
}" }"
`; `;
exports[`compiler: transform v-model simple expression 1`] = ` exports[`compiler: transform v-model > simple expression 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("input", { return (_openBlock(), _createElementBlock(\\"input\\", {
modelValue: model, modelValue: model,
"onUpdate:modelValue": $event => ((model) = $event) \\"onUpdate:modelValue\\": $event => ((model) = $event)
}, null, 8 /* PROPS */, ["modelValue", "onUpdate:modelValue"])) }, null, 8 /* PROPS */, [\\"modelValue\\", \\"onUpdate:modelValue\\"]))
} }
}" }"
`; `;
exports[`compiler: transform v-model with argument 1`] = ` exports[`compiler: transform v-model > with argument 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("input", { return (_openBlock(), _createElementBlock(\\"input\\", {
"foo-value": model, \\"foo-value\\": model,
"onUpdate:fooValue": $event => ((model) = $event) \\"onUpdate:fooValue\\": $event => ((model) = $event)
}, null, 40 /* PROPS, HYDRATE_EVENTS */, ["foo-value", "onUpdate:fooValue"])) }, null, 40 /* PROPS, HYDRATE_EVENTS */, [\\"foo-value\\", \\"onUpdate:fooValue\\"]))
} }
}" }"
`; `;
exports[`compiler: transform v-model with dynamic argument (with prefixIdentifiers) 1`] = ` exports[`compiler: transform v-model > with dynamic argument (with prefixIdentifiers) 1`] = `
"import { normalizeProps as _normalizeProps, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue" "import { normalizeProps as _normalizeProps, openBlock as _openBlock, createElementBlock as _createElementBlock } from \\"vue\\"
export function render(_ctx, _cache) { export function render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("input", _normalizeProps({ return (_openBlock(), _createElementBlock(\\"input\\", _normalizeProps({
[_ctx.value]: _ctx.model, [_ctx.value]: _ctx.model,
["onUpdate:" + _ctx.value]: $event => ((_ctx.model) = $event) [\\"onUpdate:\\" + _ctx.value]: $event => ((_ctx.model) = $event)
}), null, 16 /* FULL_PROPS */)) }), null, 16 /* FULL_PROPS */))
}" }"
`; `;
exports[`compiler: transform v-model with dynamic argument 1`] = ` exports[`compiler: transform v-model > with dynamic argument 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { normalizeProps: _normalizeProps, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { normalizeProps: _normalizeProps, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("input", _normalizeProps({ return (_openBlock(), _createElementBlock(\\"input\\", _normalizeProps({
[value]: model, [value]: model,
["onUpdate:" + value]: $event => ((model) = $event) [\\"onUpdate:\\" + value]: $event => ((model) = $event)
}), null, 16 /* FULL_PROPS */)) }), null, 16 /* FULL_PROPS */))
} }
}" }"

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compiler: v-once transform as root node 1`] = ` exports[`compiler: v-once transform > as root node 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
@ -9,7 +9,7 @@ return function render(_ctx, _cache) {
return _cache[0] || ( return _cache[0] || (
_setBlockTracking(-1), _setBlockTracking(-1),
_cache[0] = _createElementVNode("div", { id: foo }, null, 8 /* PROPS */, ["id"]), _cache[0] = _createElementVNode(\\"div\\", { id: foo }, null, 8 /* PROPS */, [\\"id\\"]),
_setBlockTracking(1), _setBlockTracking(1),
_cache[0] _cache[0]
) )
@ -17,19 +17,19 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: v-once transform on component 1`] = ` exports[`compiler: v-once transform > on component 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { setBlockTracking: _setBlockTracking, resolveComponent: _resolveComponent, createVNode: _createVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { setBlockTracking: _setBlockTracking, resolveComponent: _resolveComponent, createVNode: _createVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_cache[0] || ( _cache[0] || (
_setBlockTracking(-1), _setBlockTracking(-1),
_cache[0] = _createVNode(_component_Comp, { id: foo }, null, 8 /* PROPS */, ["id"]), _cache[0] = _createVNode(_component_Comp, { id: foo }, null, 8 /* PROPS */, [\\"id\\"]),
_setBlockTracking(1), _setBlockTracking(1),
_cache[0] _cache[0]
) )
@ -38,17 +38,17 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: v-once transform on nested plain element 1`] = ` exports[`compiler: v-once transform > on nested plain element 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { setBlockTracking: _setBlockTracking, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { setBlockTracking: _setBlockTracking, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_cache[0] || ( _cache[0] || (
_setBlockTracking(-1), _setBlockTracking(-1),
_cache[0] = _createElementVNode("div", { id: foo }, null, 8 /* PROPS */, ["id"]), _cache[0] = _createElementVNode(\\"div\\", { id: foo }, null, 8 /* PROPS */, [\\"id\\"]),
_setBlockTracking(1), _setBlockTracking(1),
_cache[0] _cache[0]
) )
@ -57,17 +57,17 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: v-once transform on slot outlet 1`] = ` exports[`compiler: v-once transform > on slot outlet 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { setBlockTracking: _setBlockTracking, renderSlot: _renderSlot, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { setBlockTracking: _setBlockTracking, renderSlot: _renderSlot, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_cache[0] || ( _cache[0] || (
_setBlockTracking(-1), _setBlockTracking(-1),
_cache[0] = _renderSlot($slots, "default"), _cache[0] = _renderSlot($slots, \\"default\\"),
_setBlockTracking(1), _setBlockTracking(1),
_cache[0] _cache[0]
) )
@ -76,17 +76,17 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: v-once transform with hoistStatic: true 1`] = ` exports[`compiler: v-once transform > with hoistStatic: true 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { setBlockTracking: _setBlockTracking, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue const { setBlockTracking: _setBlockTracking, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, [ return (_openBlock(), _createElementBlock(\\"div\\", null, [
_cache[0] || ( _cache[0] || (
_setBlockTracking(-1), _setBlockTracking(-1),
_cache[0] = _createElementVNode("div"), _cache[0] = _createElementVNode(\\"div\\"),
_setBlockTracking(1), _setBlockTracking(1),
_cache[0] _cache[0]
) )

View File

@ -1,10 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Vitest Snapshot v1
exports[`compiler: transform component slots dynamically named slots 1`] = ` exports[`compiler: transform component slots > dynamically named slots 1`] = `
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, { return (_openBlock(), _createBlock(_component_Comp, null, {
[_ctx.one]: _withCtx(({ foo }) => [_toDisplayString(foo), _toDisplayString(_ctx.bar)]), [_ctx.one]: _withCtx(({ foo }) => [_toDisplayString(foo), _toDisplayString(_ctx.bar)]),
@ -14,26 +14,26 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform component slots implicit default slot 1`] = ` exports[`compiler: transform component slots > implicit default slot 1`] = `
"const { createElementVNode: _createElementVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue "const { createElementVNode: _createElementVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, { return (_openBlock(), _createBlock(_component_Comp, null, {
default: _withCtx(() => [ default: _withCtx(() => [
_createElementVNode("div") _createElementVNode(\\"div\\")
]), ]),
_: 1 /* STABLE */ _: 1 /* STABLE */
})) }))
}" }"
`; `;
exports[`compiler: transform component slots named slot with v-for w/ prefixIdentifiers: true 1`] = ` exports[`compiler: transform component slots > named slot with v-for w/ prefixIdentifiers: true 1`] = `
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, renderList: _renderList, createSlots: _createSlots, openBlock: _openBlock, createBlock: _createBlock } = Vue "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, renderList: _renderList, createSlots: _createSlots, openBlock: _openBlock, createBlock: _createBlock } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _: 2 /* DYNAMIC */ }, [ return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _: 2 /* DYNAMIC */ }, [
_renderList(_ctx.list, (name) => { _renderList(_ctx.list, (name) => {
@ -46,71 +46,71 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform component slots named slot with v-if + prefixIdentifiers: true 1`] = ` exports[`compiler: transform component slots > named slot with v-if + prefixIdentifiers: true 1`] = `
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, createSlots: _createSlots, openBlock: _openBlock, createBlock: _createBlock } = Vue "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, createSlots: _createSlots, openBlock: _openBlock, createBlock: _createBlock } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _: 2 /* DYNAMIC */ }, [ return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _: 2 /* DYNAMIC */ }, [
(_ctx.ok) (_ctx.ok)
? { ? {
name: "one", name: \\"one\\",
fn: _withCtx((props) => [_toDisplayString(props)]), fn: _withCtx((props) => [_toDisplayString(props)]),
key: "0" key: \\"0\\"
} }
: undefined : undefined
]), 1024 /* DYNAMIC_SLOTS */)) ]), 1024 /* DYNAMIC_SLOTS */))
}" }"
`; `;
exports[`compiler: transform component slots named slot with v-if + v-else-if + v-else 1`] = ` exports[`compiler: transform component slots > named slot with v-if + v-else-if + v-else 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { resolveComponent: _resolveComponent, withCtx: _withCtx, createSlots: _createSlots, openBlock: _openBlock, createBlock: _createBlock } = _Vue const { resolveComponent: _resolveComponent, withCtx: _withCtx, createSlots: _createSlots, openBlock: _openBlock, createBlock: _createBlock } = _Vue
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _: 2 /* DYNAMIC */ }, [ return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _: 2 /* DYNAMIC */ }, [
ok ok
? { ? {
name: "one", name: \\"one\\",
fn: _withCtx(() => ["foo"]), fn: _withCtx(() => [\\"foo\\"]),
key: "0" key: \\"0\\"
} }
: orNot : orNot
? { ? {
name: "two", name: \\"two\\",
fn: _withCtx((props) => ["bar"]), fn: _withCtx((props) => [\\"bar\\"]),
key: "1" key: \\"1\\"
} }
: { : {
name: "one", name: \\"one\\",
fn: _withCtx(() => ["baz"]), fn: _withCtx(() => [\\"baz\\"]),
key: "2" key: \\"2\\"
} }
]), 1024 /* DYNAMIC_SLOTS */)) ]), 1024 /* DYNAMIC_SLOTS */))
} }
}" }"
`; `;
exports[`compiler: transform component slots named slot with v-if 1`] = ` exports[`compiler: transform component slots > named slot with v-if 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { resolveComponent: _resolveComponent, withCtx: _withCtx, createSlots: _createSlots, openBlock: _openBlock, createBlock: _createBlock } = _Vue const { resolveComponent: _resolveComponent, withCtx: _withCtx, createSlots: _createSlots, openBlock: _openBlock, createBlock: _createBlock } = _Vue
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _: 2 /* DYNAMIC */ }, [ return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _: 2 /* DYNAMIC */ }, [
ok ok
? { ? {
name: "one", name: \\"one\\",
fn: _withCtx(() => ["hello"]), fn: _withCtx(() => [\\"hello\\"]),
key: "0" key: \\"0\\"
} }
: undefined : undefined
]), 1024 /* DYNAMIC_SLOTS */)) ]), 1024 /* DYNAMIC_SLOTS */))
@ -118,20 +118,20 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform component slots named slots w/ implicit default slot 1`] = ` exports[`compiler: transform component slots > named slots w/ implicit default slot 1`] = `
"const _Vue = Vue "const _Vue = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
with (_ctx) { with (_ctx) {
const { createElementVNode: _createElementVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue const { createElementVNode: _createElementVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, { return (_openBlock(), _createBlock(_component_Comp, null, {
one: _withCtx(() => ["foo"]), one: _withCtx(() => [\\"foo\\"]),
default: _withCtx(() => [ default: _withCtx(() => [
"bar", \\"bar\\",
_createElementVNode("span") _createElementVNode(\\"span\\")
]), ]),
_: 1 /* STABLE */ _: 1 /* STABLE */
})) }))
@ -139,12 +139,12 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform component slots nested slots scoping 1`] = ` exports[`compiler: transform component slots > nested slots scoping 1`] = `
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = Vue "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
const _component_Inner = _resolveComponent("Inner") const _component_Inner = _resolveComponent(\\"Inner\\")
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, { return (_openBlock(), _createBlock(_component_Comp, null, {
default: _withCtx(({ foo }) => [ default: _withCtx(({ foo }) => [
@ -152,7 +152,7 @@ return function render(_ctx, _cache) {
default: _withCtx(({ bar }) => [_toDisplayString(foo), _toDisplayString(bar), _toDisplayString(_ctx.baz)]), default: _withCtx(({ bar }) => [_toDisplayString(foo), _toDisplayString(bar), _toDisplayString(_ctx.baz)]),
_: 2 /* DYNAMIC */ _: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */), }, 1024 /* DYNAMIC_SLOTS */),
" ", \\" \\",
_toDisplayString(foo), _toDisplayString(foo),
_toDisplayString(_ctx.bar), _toDisplayString(_ctx.bar),
_toDisplayString(_ctx.baz) _toDisplayString(_ctx.baz)
@ -162,11 +162,11 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform component slots on component dynamically named slot 1`] = ` exports[`compiler: transform component slots > on component dynamically named slot 1`] = `
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, { return (_openBlock(), _createBlock(_component_Comp, null, {
[_ctx.named]: _withCtx(({ foo }) => [_toDisplayString(foo), _toDisplayString(_ctx.bar)]), [_ctx.named]: _withCtx(({ foo }) => [_toDisplayString(foo), _toDisplayString(_ctx.bar)]),
@ -175,11 +175,11 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform component slots on component named slot 1`] = ` exports[`compiler: transform component slots > on component named slot 1`] = `
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, { return (_openBlock(), _createBlock(_component_Comp, null, {
named: _withCtx(({ foo }) => [_toDisplayString(foo), _toDisplayString(_ctx.bar)]), named: _withCtx(({ foo }) => [_toDisplayString(foo), _toDisplayString(_ctx.bar)]),
@ -188,11 +188,11 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform component slots on-component default slot 1`] = ` exports[`compiler: transform component slots > on-component default slot 1`] = `
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, { return (_openBlock(), _createBlock(_component_Comp, null, {
default: _withCtx(({ foo }) => [_toDisplayString(foo), _toDisplayString(_ctx.bar)]), default: _withCtx(({ foo }) => [_toDisplayString(foo), _toDisplayString(_ctx.bar)]),
@ -201,11 +201,11 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform component slots template named slots 1`] = ` exports[`compiler: transform component slots > template named slots 1`] = `
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, { return (_openBlock(), _createBlock(_component_Comp, null, {
one: _withCtx(({ foo }) => [_toDisplayString(foo), _toDisplayString(_ctx.bar)]), one: _withCtx(({ foo }) => [_toDisplayString(foo), _toDisplayString(_ctx.bar)]),
@ -215,46 +215,46 @@ return function render(_ctx, _cache) {
}" }"
`; `;
exports[`compiler: transform component slots with whitespace: 'preserve' implicit default slot 1`] = ` exports[`compiler: transform component slots > with whitespace: 'preserve' > implicit default slot 1`] = `
"const { createElementVNode: _createElementVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue "const { createElementVNode: _createElementVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, { return (_openBlock(), _createBlock(_component_Comp, null, {
header: _withCtx(() => [" Header "]), header: _withCtx(() => [\\" Header \\"]),
default: _withCtx(() => [ default: _withCtx(() => [
" ", \\" \\",
_createElementVNode("p") _createElementVNode(\\"p\\")
]), ]),
_: 1 /* STABLE */ _: 1 /* STABLE */
})) }))
}" }"
`; `;
exports[`compiler: transform component slots with whitespace: 'preserve' named default slot + implicit whitespace content 1`] = ` exports[`compiler: transform component slots > with whitespace: 'preserve' > named default slot + implicit whitespace content 1`] = `
"const { resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue "const { resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, { return (_openBlock(), _createBlock(_component_Comp, null, {
header: _withCtx(() => [" Header "]), header: _withCtx(() => [\\" Header \\"]),
default: _withCtx(() => [" Default "]), default: _withCtx(() => [\\" Default \\"]),
_: 1 /* STABLE */ _: 1 /* STABLE */
})) }))
}" }"
`; `;
exports[`compiler: transform component slots with whitespace: 'preserve' should not generate whitespace only default slot 1`] = ` exports[`compiler: transform component slots > with whitespace: 'preserve' > should not generate whitespace only default slot 1`] = `
"const { resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue "const { resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = Vue
return function render(_ctx, _cache) { return function render(_ctx, _cache) {
const _component_Comp = _resolveComponent("Comp") const _component_Comp = _resolveComponent(\\"Comp\\")
return (_openBlock(), _createBlock(_component_Comp, null, { return (_openBlock(), _createBlock(_component_Comp, null, {
header: _withCtx(() => [" Header "]), header: _withCtx(() => [\\" Header \\"]),
footer: _withCtx(() => [" Footer "]), footer: _withCtx(() => [\\" Footer \\"]),
_: 1 /* STABLE */ _: 1 /* STABLE */
})) }))
}" }"