chore(compiler-core/codegen): avoid generate indent spaces of empty lines. (#701)
This commit is contained in:
parent
42db2fef9d
commit
782db6d7f5
@ -72,14 +72,16 @@ return function render() {
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`compiler: codegen assets 1`] = `
|
||||
exports[`compiler: codegen assets + temps 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
with (this) {
|
||||
const _component_Foo = _resolveComponent(\\"Foo\\")
|
||||
const _component_bar_baz = _resolveComponent(\\"bar-baz\\")
|
||||
const _component_barbaz = _resolveComponent(\\"barbaz\\")
|
||||
const _directive_my_dir = _resolveDirective(\\"my_dir\\")
|
||||
const _directive_my_dir_0 = _resolveDirective(\\"my_dir_0\\")
|
||||
const _directive_my_dir_1 = _resolveDirective(\\"my_dir_1\\")
|
||||
let _temp0, _temp1, _temp2
|
||||
|
||||
return null
|
||||
}
|
||||
@ -119,7 +121,7 @@ exports[`compiler: codegen function mode preamble 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, resolveDirective: _resolveDirective } = _Vue
|
||||
|
||||
|
||||
return null
|
||||
}
|
||||
}"
|
||||
|
@ -6,7 +6,7 @@ exports[`compiler: integration tests function mode 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment, renderList: _renderList, createTextVNode: _createTextVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", {
|
||||
id: \\"foo\\",
|
||||
class: bar.baz
|
||||
|
@ -119,10 +119,11 @@ describe('compiler: codegen', () => {
|
||||
expect(code).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('assets', () => {
|
||||
test('assets + temps', () => {
|
||||
const root = createRoot({
|
||||
components: [`Foo`, `bar-baz`, `barbaz`],
|
||||
directives: [`my_dir`]
|
||||
directives: [`my_dir_0`, `my_dir_1`],
|
||||
temps: 3
|
||||
})
|
||||
const { code } = generate(root, { mode: 'function' })
|
||||
expect(code).toMatch(
|
||||
@ -139,10 +140,16 @@ describe('compiler: codegen', () => {
|
||||
}("barbaz")\n`
|
||||
)
|
||||
expect(code).toMatch(
|
||||
`const _directive_my_dir = _${
|
||||
`const _directive_my_dir_0 = _${
|
||||
helperNameMap[RESOLVE_DIRECTIVE]
|
||||
}("my_dir")\n`
|
||||
}("my_dir_0")\n`
|
||||
)
|
||||
expect(code).toMatch(
|
||||
`const _directive_my_dir_1 = _${
|
||||
helperNameMap[RESOLVE_DIRECTIVE]
|
||||
}("my_dir_1")\n`
|
||||
)
|
||||
expect(code).toMatch(`let _temp0, _temp1, _temp2`)
|
||||
expect(code).toMatchSnapshot()
|
||||
})
|
||||
|
||||
|
@ -9,7 +9,7 @@ const _hoisted_1 = _createVNode(\\"div\\", { key: \\"foo\\" })
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_hoisted_1
|
||||
]))
|
||||
@ -29,7 +29,7 @@ const _hoisted_1 = _createVNode(\\"p\\", null, [
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_hoisted_1
|
||||
]))
|
||||
@ -48,7 +48,7 @@ const _hoisted_1 = _createVNode(\\"div\\", null, [
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createCommentVNode: _createCommentVNode, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_hoisted_1
|
||||
]))
|
||||
@ -66,7 +66,7 @@ const _hoisted_2 = _createVNode(\\"div\\")
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_hoisted_1,
|
||||
_hoisted_2
|
||||
@ -84,7 +84,7 @@ const _hoisted_1 = _createVNode(\\"span\\", { class: \\"inline\\" }, \\"hello\\"
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_hoisted_1
|
||||
]))
|
||||
@ -101,7 +101,7 @@ const _hoisted_1 = { id: \\"foo\\" }
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
const _directive_foo = _resolveDirective(\\"foo\\")
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@ -122,7 +122,7 @@ const _hoisted_1 = { id: \\"foo\\" }
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_createVNode(\\"div\\", _hoisted_1, _toDisplayString(hello), 1 /* TEXT */)
|
||||
]))
|
||||
@ -139,7 +139,7 @@ const _hoisted_1 = { id: \\"foo\\" }
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@ -160,7 +160,7 @@ const _hoisted_1 = { class: { foo: true } }
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_createVNode(\\"span\\", _hoisted_1, _toDisplayString(_ctx.bar), 1 /* TEXT */)
|
||||
]))
|
||||
@ -182,7 +182,7 @@ const _hoisted_1 = _createVNode(\\"span\\", null, [
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_hoisted_1
|
||||
]))
|
||||
@ -199,7 +199,7 @@ const _hoisted_1 = _createVNode(\\"span\\", { foo: 0 }, _toDisplayString(1))
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_hoisted_1
|
||||
]))
|
||||
@ -229,7 +229,7 @@ exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expr
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toDisplayString: _toDisplayString, createVNode: _createVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
(_openBlock(false), _createBlock(_Fragment, null, _renderList(_ctx.list, (o) => {
|
||||
return (_openBlock(), _createBlock(\\"p\\", null, [
|
||||
@ -247,7 +247,7 @@ exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expr
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
return (_openBlock(), _createBlock(_component_Comp, null, {
|
||||
@ -264,7 +264,7 @@ exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expr
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toDisplayString: _toDisplayString, createVNode: _createVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
(_openBlock(false), _createBlock(_Fragment, null, _renderList(_ctx.list, (o) => {
|
||||
return (_openBlock(), _createBlock(\\"p\\", null, [
|
||||
@ -282,7 +282,7 @@ exports[`compiler: hoistStatic transform should NOT hoist components 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@ -298,7 +298,7 @@ exports[`compiler: hoistStatic transform should NOT hoist element with dynamic k
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_createVNode(\\"div\\", { key: foo })
|
||||
]))
|
||||
@ -312,7 +312,7 @@ exports[`compiler: hoistStatic transform should NOT hoist element with dynamic p
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_createVNode(\\"div\\", { id: foo }, null, 8 /* PROPS */, [\\"id\\"])
|
||||
]))
|
||||
@ -326,7 +326,7 @@ exports[`compiler: hoistStatic transform should NOT hoist element with dynamic r
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_createVNode(\\"div\\", { ref: foo }, null, 32 /* NEED_PATCH */)
|
||||
]))
|
||||
@ -340,7 +340,7 @@ exports[`compiler: hoistStatic transform should NOT hoist root node 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\"))
|
||||
}
|
||||
}"
|
||||
@ -356,7 +356,7 @@ const _hoisted_2 = _createVNode(\\"span\\")
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
(_openBlock(false), _createBlock(_Fragment, null, _renderList(list, (i) => {
|
||||
return (_openBlock(), _createBlock(\\"div\\", _hoisted_1, [
|
||||
@ -381,7 +381,7 @@ const _hoisted_2 = _createVNode(\\"span\\")
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
(_openBlock(), ok
|
||||
? _createBlock(\\"div\\", _hoisted_1, [
|
||||
|
@ -6,7 +6,7 @@ exports[`compiler: transform text <template v-for> 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createTextVNode: _createTextVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(false), _createBlock(_Fragment, null, _renderList(list, (i) => {
|
||||
return (_openBlock(), _createBlock(_Fragment, null, [
|
||||
_createTextVNode(\\"foo\\")
|
||||
@ -22,7 +22,7 @@ exports[`compiler: transform text consecutive text 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString } = _Vue
|
||||
|
||||
|
||||
return _toDisplayString(foo) + \\" bar \\" + _toDisplayString(baz)
|
||||
}
|
||||
}"
|
||||
@ -34,7 +34,7 @@ exports[`compiler: transform text consecutive text between elements 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(_Fragment, null, [
|
||||
_createVNode(\\"div\\"),
|
||||
_createTextVNode(_toDisplayString(foo) + \\" bar \\" + _toDisplayString(baz), 1 /* TEXT */),
|
||||
@ -50,7 +50,7 @@ exports[`compiler: transform text consecutive text mixed with elements 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(_Fragment, null, [
|
||||
_createVNode(\\"div\\"),
|
||||
_createTextVNode(_toDisplayString(foo) + \\" bar \\" + _toDisplayString(baz), 1 /* TEXT */),
|
||||
@ -68,7 +68,7 @@ exports[`compiler: transform text no consecutive text 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString } = _Vue
|
||||
|
||||
|
||||
return _toDisplayString(foo)
|
||||
}
|
||||
}"
|
||||
@ -80,7 +80,7 @@ exports[`compiler: transform text text between elements (static) 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(_Fragment, null, [
|
||||
_createVNode(\\"div\\"),
|
||||
_createTextVNode(\\"hello\\"),
|
||||
|
@ -6,7 +6,7 @@ exports[`compiler: v-for codegen basic v-for 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(false), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||
return (_openBlock(), _createBlock(\\"span\\"))
|
||||
}), 256 /* UNKEYED_FRAGMENT */))
|
||||
@ -20,7 +20,7 @@ exports[`compiler: v-for codegen keyed template v-for 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(false), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||
return (_openBlock(), _createBlock(_Fragment, { key: item }, [
|
||||
\\"hello\\",
|
||||
@ -37,7 +37,7 @@ exports[`compiler: v-for codegen keyed v-for 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(false), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||
return (_openBlock(), _createBlock(\\"span\\", { key: item }))
|
||||
}), 128 /* KEYED_FRAGMENT */))
|
||||
@ -51,7 +51,7 @@ exports[`compiler: v-for codegen skipped key 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(false), _createBlock(_Fragment, null, _renderList(items, (item, __, index) => {
|
||||
return (_openBlock(), _createBlock(\\"span\\"))
|
||||
}), 256 /* UNKEYED_FRAGMENT */))
|
||||
@ -65,7 +65,7 @@ exports[`compiler: v-for codegen skipped value & key 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(false), _createBlock(_Fragment, null, _renderList(items, (_, __, index) => {
|
||||
return (_openBlock(), _createBlock(\\"span\\"))
|
||||
}), 256 /* UNKEYED_FRAGMENT */))
|
||||
@ -79,7 +79,7 @@ exports[`compiler: v-for codegen skipped value 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(false), _createBlock(_Fragment, null, _renderList(items, (_, key, index) => {
|
||||
return (_openBlock(), _createBlock(\\"span\\"))
|
||||
}), 256 /* UNKEYED_FRAGMENT */))
|
||||
@ -93,7 +93,7 @@ exports[`compiler: v-for codegen template v-for 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(false), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||
return (_openBlock(), _createBlock(_Fragment, null, [
|
||||
\\"hello\\",
|
||||
@ -110,7 +110,7 @@ exports[`compiler: v-for codegen template v-for w/ <slot/> 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, renderSlot: _renderSlot } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(false), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||
return _renderSlot($slots, \\"default\\")
|
||||
}), 256 /* UNKEYED_FRAGMENT */))
|
||||
@ -124,7 +124,7 @@ exports[`compiler: v-for codegen v-for on <slot/> 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, renderSlot: _renderSlot } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(false), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||
return _renderSlot($slots, \\"default\\")
|
||||
}), 256 /* UNKEYED_FRAGMENT */))
|
||||
@ -138,7 +138,7 @@ exports[`compiler: v-for codegen v-for on element with custom directive 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective } = _Vue
|
||||
|
||||
|
||||
const _directive_foo = _resolveDirective(\\"foo\\")
|
||||
|
||||
return (_openBlock(false), _createBlock(_Fragment, null, _renderList(list, (i) => {
|
||||
@ -156,7 +156,7 @@ exports[`compiler: v-for codegen v-if + v-for 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), ok
|
||||
? _createBlock(_Fragment, { key: 0 }, _renderList(list, (i) => {
|
||||
return (_openBlock(), _createBlock(\\"div\\"))
|
||||
@ -172,7 +172,7 @@ exports[`compiler: v-for codegen value + key + index 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(false), _createBlock(_Fragment, null, _renderList(items, (item, key, index) => {
|
||||
return (_openBlock(), _createBlock(\\"span\\"))
|
||||
}), 256 /* UNKEYED_FRAGMENT */))
|
||||
|
@ -6,7 +6,7 @@ exports[`compiler: v-if codegen basic v-if 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), ok
|
||||
? _createBlock(\\"div\\", { key: 0 })
|
||||
: _createCommentVNode(\\"v-if\\", true))
|
||||
@ -20,7 +20,7 @@ exports[`compiler: v-if codegen template v-if 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, Fragment: _Fragment, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), ok
|
||||
? _createBlock(_Fragment, { key: 0 }, [
|
||||
_createVNode(\\"div\\"),
|
||||
@ -38,7 +38,7 @@ exports[`compiler: v-if codegen template v-if w/ single <slot/> child 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderSlot: _renderSlot, openBlock: _openBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), ok
|
||||
? _renderSlot($slots, \\"default\\", { key: 0 })
|
||||
: _createCommentVNode(\\"v-if\\", true))
|
||||
@ -52,7 +52,7 @@ exports[`compiler: v-if codegen v-if + v-else 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), ok
|
||||
? _createBlock(\\"div\\", { key: 0 })
|
||||
: _createBlock(\\"p\\", { key: 1 }))
|
||||
@ -66,7 +66,7 @@ exports[`compiler: v-if codegen v-if + v-else-if + v-else 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), ok
|
||||
? _createBlock(\\"div\\", { key: 0 })
|
||||
: orNot
|
||||
@ -82,7 +82,7 @@ exports[`compiler: v-if codegen v-if + v-else-if 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), ok
|
||||
? _createBlock(\\"div\\", { key: 0 })
|
||||
: orNot
|
||||
@ -98,7 +98,7 @@ exports[`compiler: v-if codegen v-if on <slot/> 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { renderSlot: _renderSlot, openBlock: _openBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), ok
|
||||
? _renderSlot($slots, \\"default\\", { key: 0 })
|
||||
: _createCommentVNode(\\"v-if\\", true))
|
||||
@ -112,7 +112,7 @@ exports[`compiler: v-if codegen v-if with key 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), ok
|
||||
? _createBlock(\\"div\\", { key: \\"some-key\\" })
|
||||
: _createCommentVNode(\\"v-if\\", true))
|
||||
|
@ -18,7 +18,7 @@ exports[`compiler: transform v-model compound expression 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"input\\", {
|
||||
modelValue: model[index],
|
||||
\\"onUpdate:modelValue\\": $event => (model[index] = $event)
|
||||
@ -45,7 +45,7 @@ exports[`compiler: transform v-model simple exprssion 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"input\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
@ -60,7 +60,7 @@ exports[`compiler: transform v-model with argument 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"input\\", {
|
||||
value: model,
|
||||
\\"onUpdate:value\\": $event => (model = $event)
|
||||
@ -87,7 +87,7 @@ exports[`compiler: transform v-model with dynamic argument 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"input\\", {
|
||||
[value]: model,
|
||||
[\\"onUpdate:\\" + value]: $event => (model = $event)
|
||||
|
@ -7,7 +7,7 @@ return function render() {
|
||||
with (this) {
|
||||
const { setBlockTracking: _setBlockTracking, createVNode: _createVNode } = _Vue
|
||||
const _cache = $cache
|
||||
|
||||
|
||||
return _cache[1] || (
|
||||
_setBlockTracking(-1),
|
||||
_cache[1] = _createVNode(\\"div\\", { id: foo }, null, 8 /* PROPS */, [\\"id\\"]),
|
||||
@ -25,7 +25,7 @@ return function render() {
|
||||
with (this) {
|
||||
const { setBlockTracking: _setBlockTracking, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const _cache = $cache
|
||||
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
@ -47,7 +47,7 @@ return function render() {
|
||||
with (this) {
|
||||
const { setBlockTracking: _setBlockTracking, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const _cache = $cache
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_cache[1] || (
|
||||
_setBlockTracking(-1),
|
||||
@ -67,7 +67,7 @@ return function render() {
|
||||
with (this) {
|
||||
const { setBlockTracking: _setBlockTracking, renderSlot: _renderSlot, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const _cache = $cache
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_cache[1] || (
|
||||
_setBlockTracking(-1),
|
||||
@ -87,7 +87,7 @@ return function render() {
|
||||
with (this) {
|
||||
const { setBlockTracking: _setBlockTracking, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const _cache = $cache
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_cache[1] || (
|
||||
_setBlockTracking(-1),
|
||||
|
@ -73,7 +73,7 @@ exports[`compiler: transform component slots named slot with v-if + v-else-if +
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { resolveComponent: _resolveComponent, createSlots: _createSlots, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _compiled: true }, [
|
||||
@ -102,7 +102,7 @@ exports[`compiler: transform component slots named slot with v-if 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { resolveComponent: _resolveComponent, createSlots: _createSlots, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _compiled: true }, [
|
||||
@ -138,7 +138,7 @@ exports[`compiler: transform component slots named slots w/ implicit default slo
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, resolveComponent: _resolveComponent, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
return (_openBlock(), _createBlock(_component_Comp, null, {
|
||||
|
@ -216,11 +216,11 @@ export function generate(
|
||||
.map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
|
||||
.join(', ')} } = _Vue`
|
||||
)
|
||||
newline()
|
||||
if (ast.cached > 0) {
|
||||
push(`const _cache = $cache`)
|
||||
newline()
|
||||
push(`const _cache = $cache`)
|
||||
}
|
||||
push(`\n`)
|
||||
newline()
|
||||
}
|
||||
} else if (!__BROWSER__ && !ssr) {
|
||||
@ -235,18 +235,24 @@ export function generate(
|
||||
// generate asset resolution statements
|
||||
if (ast.components.length) {
|
||||
genAssets(ast.components, 'component', context)
|
||||
if (ast.directives.length || ast.temps > 0) {
|
||||
newline()
|
||||
}
|
||||
}
|
||||
if (ast.directives.length) {
|
||||
genAssets(ast.directives, 'directive', context)
|
||||
if (ast.temps > 0) {
|
||||
newline()
|
||||
}
|
||||
}
|
||||
if (ast.temps > 0) {
|
||||
push(`let `)
|
||||
for (let i = 0; i < ast.temps; i++) {
|
||||
push(`${i > 0 ? `, ` : ``}_temp${i}`)
|
||||
}
|
||||
push(`\n`)
|
||||
}
|
||||
if (ast.components.length || ast.directives.length || ast.temps) {
|
||||
push(`\n`)
|
||||
newline()
|
||||
}
|
||||
|
||||
@ -419,8 +425,6 @@ function genAssets(
|
||||
)
|
||||
if (i < assets.length - 1) {
|
||||
newline()
|
||||
} else {
|
||||
push(`\n`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ const _hoisted_1 = {}
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _createBlock(_Fragment, null, [
|
||||
_createVNode(\\"div\\", { textContent: text }, null, 8 /* PROPS */, [\\"textContent\\"]),
|
||||
_createVNode(\\"div\\", { innerHTML: html }, null, 8 /* PROPS */, [\\"innerHTML\\"]),
|
||||
|
@ -6,7 +6,7 @@ exports[`compiler: transform v-model input w/ dynamic v-bind 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { vModelDynamic: _vModelDynamic, mergeProps: _mergeProps, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", _mergeProps(obj, {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
@ -23,7 +23,7 @@ exports[`compiler: transform v-model input w/ dynamic v-bind 2`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { vModelDynamic: _vModelDynamic, createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
const _directive_bind = _resolveDirective(\\"bind\\")
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
@ -43,7 +43,7 @@ exports[`compiler: transform v-model modifiers .lazy 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
@ -65,7 +65,7 @@ exports[`compiler: transform v-model modifiers .number 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
@ -87,7 +87,7 @@ exports[`compiler: transform v-model modifiers .trim 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
@ -109,7 +109,7 @@ exports[`compiler: transform v-model simple expression 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
@ -126,7 +126,7 @@ exports[`compiler: transform v-model simple expression for input (checkbox) 1`]
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { vModelCheckbox: _vModelCheckbox, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
type: \\"checkbox\\",
|
||||
modelValue: model,
|
||||
@ -144,7 +144,7 @@ exports[`compiler: transform v-model simple expression for input (dynamic type)
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { vModelDynamic: _vModelDynamic, createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
const _directive_bind = _resolveDirective(\\"bind\\")
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
@ -164,7 +164,7 @@ exports[`compiler: transform v-model simple expression for input (radio) 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { vModelRadio: _vModelRadio, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
type: \\"radio\\",
|
||||
modelValue: model,
|
||||
@ -182,7 +182,7 @@ exports[`compiler: transform v-model simple expression for input (text) 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"input\\", {
|
||||
type: \\"text\\",
|
||||
modelValue: model,
|
||||
@ -200,7 +200,7 @@ exports[`compiler: transform v-model simple expression for select 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { vModelSelect: _vModelSelect, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"select\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
@ -217,7 +217,7 @@ exports[`compiler: transform v-model simple expression for textarea 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"textarea\\", {
|
||||
modelValue: model,
|
||||
\\"onUpdate:modelValue\\": $event => (model = $event)
|
||||
|
@ -6,7 +6,7 @@ exports[`compiler: v-show transform simple expression 1`] = `
|
||||
return function render() {
|
||||
with (this) {
|
||||
const { vShow: _vShow, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
||||
return (_openBlock(), _withDirectives(_createBlock(\\"div\\", null, null, 32 /* NEED_PATCH */), [
|
||||
[_vShow, a]
|
||||
]))
|
||||
|
Loading…
Reference in New Issue
Block a user