refactor(compiler): provide _ctx and _cache via arguments
This commit is contained in:
parent
ade07c64a1
commit
47e984d31f
@ -2,7 +2,7 @@
|
||||
|
||||
exports[`compiler: codegen ArrayExpression 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
return [
|
||||
foo,
|
||||
@ -14,18 +14,14 @@ return function render() {
|
||||
|
||||
exports[`compiler: codegen CacheExpression 1`] = `
|
||||
"
|
||||
export function render() {
|
||||
const _ctx = this
|
||||
const _cache = _ctx.$cache
|
||||
export function render(_ctx, _cache) {
|
||||
return _cache[1] || (_cache[1] = foo)
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`compiler: codegen CacheExpression w/ isVNode: true 1`] = `
|
||||
"
|
||||
export function render() {
|
||||
const _ctx = this
|
||||
const _cache = _ctx.$cache
|
||||
export function render(_ctx, _cache) {
|
||||
return _cache[1] || (
|
||||
_setBlockTracking(-1),
|
||||
_cache[1] = foo,
|
||||
@ -37,7 +33,7 @@ export function render() {
|
||||
|
||||
exports[`compiler: codegen ConditionalExpression 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
return ok
|
||||
? foo()
|
||||
@ -50,7 +46,7 @@ return function render() {
|
||||
|
||||
exports[`compiler: codegen Element (callExpression + objectExpression + TemplateChildNode[]) 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
return _createVNode(\\"div\\", {
|
||||
id: \\"foo\\",
|
||||
@ -65,7 +61,7 @@ return function render() {
|
||||
|
||||
exports[`compiler: codegen SequenceExpression 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
return (foo, bar(baz))
|
||||
}
|
||||
@ -74,7 +70,7 @@ return function render() {
|
||||
|
||||
exports[`compiler: codegen assets + temps 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const _component_Foo = _resolveComponent(\\"Foo\\")
|
||||
const _component_bar_baz = _resolveComponent(\\"bar-baz\\")
|
||||
@ -90,7 +86,7 @@ return function render() {
|
||||
|
||||
exports[`compiler: codegen comment 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
return _createCommentVNode(\\"foo\\")
|
||||
}
|
||||
@ -99,7 +95,7 @@ return function render() {
|
||||
|
||||
exports[`compiler: codegen compound expression 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
return _ctx.foo + _toDisplayString(bar) + nested
|
||||
}
|
||||
@ -108,7 +104,7 @@ return function render() {
|
||||
|
||||
exports[`compiler: codegen forNode 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
return (foo, bar)
|
||||
}
|
||||
@ -118,7 +114,7 @@ return function render() {
|
||||
exports[`compiler: codegen function mode preamble 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, resolveDirective: _resolveDirective } = _Vue
|
||||
|
||||
@ -130,8 +126,7 @@ return function render() {
|
||||
exports[`compiler: codegen function mode preamble w/ prefixIdentifiers: true 1`] = `
|
||||
"const { createVNode: _createVNode, resolveDirective: _resolveDirective } = Vue
|
||||
|
||||
return function render() {
|
||||
const _ctx = this
|
||||
return function render(_ctx, _cache) {
|
||||
return null
|
||||
}"
|
||||
`;
|
||||
@ -141,7 +136,7 @@ exports[`compiler: codegen hoists 1`] = `
|
||||
const _hoisted_1 = hello
|
||||
const _hoisted_2 = { id: \\"foo\\" }
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
return null
|
||||
}
|
||||
@ -150,7 +145,7 @@ return function render() {
|
||||
|
||||
exports[`compiler: codegen ifNode 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
return (foo, bar)
|
||||
}
|
||||
@ -159,7 +154,7 @@ return function render() {
|
||||
|
||||
exports[`compiler: codegen interpolation 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
return _toDisplayString(hello)
|
||||
}
|
||||
@ -169,8 +164,7 @@ return function render() {
|
||||
exports[`compiler: codegen module mode preamble 1`] = `
|
||||
"import { createVNode as _createVNode, resolveDirective as _resolveDirective } from \\"vue\\"
|
||||
|
||||
export function render() {
|
||||
const _ctx = this
|
||||
export function render(_ctx, _cache) {
|
||||
return null
|
||||
}"
|
||||
`;
|
||||
@ -181,23 +175,14 @@ exports[`compiler: codegen module mode preamble w/ optimizeBindings: true 1`] =
|
||||
// Binding optimization for webpack code-split
|
||||
const _createVNode = createVNode, _resolveDirective = resolveDirective
|
||||
|
||||
export function render() {
|
||||
const _ctx = this
|
||||
return null
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`compiler: codegen prefixIdentifiers: true should inject _ctx statement 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
const _ctx = this
|
||||
export function render(_ctx, _cache) {
|
||||
return null
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`compiler: codegen static text 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
return \\"hello\\"
|
||||
}
|
||||
@ -206,7 +191,7 @@ return function render() {
|
||||
|
||||
exports[`compiler: codegen temps 1`] = `
|
||||
"
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
let _temp0, _temp1, _temp2
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
exports[`compiler: integration tests function mode 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment, renderList: _renderList, createTextVNode: _createTextVNode } = _Vue
|
||||
|
||||
@ -28,8 +28,7 @@ return function render() {
|
||||
exports[`compiler: integration tests function mode w/ prefixIdentifiers: true 1`] = `
|
||||
"const { toDisplayString: _toDisplayString, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment, renderList: _renderList, createTextVNode: _createTextVNode } = Vue
|
||||
|
||||
return function render() {
|
||||
const _ctx = this
|
||||
return function render(_ctx, _cache) {
|
||||
return (_openBlock(), _createBlock(\\"div\\", {
|
||||
id: \\"foo\\",
|
||||
class: _ctx.bar.baz
|
||||
@ -50,8 +49,7 @@ return function render() {
|
||||
exports[`compiler: integration tests module mode 1`] = `
|
||||
"import { toDisplayString as _toDisplayString, createVNode as _createVNode, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, Fragment as _Fragment, renderList as _renderList, createTextVNode as _createTextVNode } from \\"vue\\"
|
||||
|
||||
export function render() {
|
||||
const _ctx = this
|
||||
export function render(_ctx, _cache) {
|
||||
return (_openBlock(), _createBlock(\\"div\\", {
|
||||
id: \\"foo\\",
|
||||
class: _ctx.bar.baz
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`scopeId compiler support should push scopeId for hoisted nodes 1`] = `
|
||||
"import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock, withScopeId as _withScopeId, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \\"vue\\"
|
||||
"import { createVNode as _createVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createBlock as _createBlock, openBlock as _openBlock, withScopeId as _withScopeId, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \\"vue\\"
|
||||
const _withId = _withScopeId(\\"test\\")
|
||||
|
||||
_pushScopeId(\\"test\\")
|
||||
@ -9,10 +9,10 @@ const _hoisted_1 = _createVNode(\\"div\\", null, \\"hello\\")
|
||||
const _hoisted_2 = _createVNode(\\"div\\", null, \\"world\\")
|
||||
_popScopeId()
|
||||
|
||||
export const render = _withId(function render() {
|
||||
const _ctx = this
|
||||
export const render = _withId(function render(_ctx, _cache) {
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_hoisted_1,
|
||||
_createTextVNode(_toDisplayString(_ctx.foo), 1 /* TEXT */),
|
||||
_hoisted_2
|
||||
]))
|
||||
})"
|
||||
@ -22,8 +22,7 @@ exports[`scopeId compiler support should wrap default slot 1`] = `
|
||||
"import { createVNode as _createVNode, resolveComponent as _resolveComponent, createBlock as _createBlock, openBlock as _openBlock, withScopeId as _withScopeId } from \\"vue\\"
|
||||
const _withId = _withScopeId(\\"test\\")
|
||||
|
||||
export const render = _withId(function render() {
|
||||
const _ctx = this
|
||||
export const render = _withId(function render(_ctx, _cache) {
|
||||
const _component_Child = _resolveComponent(\\"Child\\")
|
||||
|
||||
return (_openBlock(), _createBlock(_component_Child, null, {
|
||||
@ -39,8 +38,7 @@ exports[`scopeId compiler support should wrap dynamic slots 1`] = `
|
||||
"import { createVNode as _createVNode, resolveComponent as _resolveComponent, renderList as _renderList, createSlots as _createSlots, createBlock as _createBlock, openBlock as _openBlock, withScopeId as _withScopeId } from \\"vue\\"
|
||||
const _withId = _withScopeId(\\"test\\")
|
||||
|
||||
export const render = _withId(function render() {
|
||||
const _ctx = this
|
||||
export const render = _withId(function render(_ctx, _cache) {
|
||||
const _component_Child = _resolveComponent(\\"Child\\")
|
||||
|
||||
return (_openBlock(), _createBlock(_component_Child, null, _createSlots({ _compiled: true }, [
|
||||
@ -68,8 +66,7 @@ exports[`scopeId compiler support should wrap named slots 1`] = `
|
||||
"import { toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createVNode as _createVNode, resolveComponent as _resolveComponent, createBlock as _createBlock, openBlock as _openBlock, withScopeId as _withScopeId } from \\"vue\\"
|
||||
const _withId = _withScopeId(\\"test\\")
|
||||
|
||||
export const render = _withId(function render() {
|
||||
const _ctx = this
|
||||
export const render = _withId(function render(_ctx, _cache) {
|
||||
const _component_Child = _resolveComponent(\\"Child\\")
|
||||
|
||||
return (_openBlock(), _createBlock(_component_Child, null, {
|
||||
@ -88,8 +85,7 @@ exports[`scopeId compiler support should wrap render function 1`] = `
|
||||
"import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock, withScopeId as _withScopeId } from \\"vue\\"
|
||||
const _withId = _withScopeId(\\"test\\")
|
||||
|
||||
export const render = _withId(function render() {
|
||||
const _ctx = this
|
||||
export const render = _withId(function render(_ctx, _cache) {
|
||||
return (_openBlock(), _createBlock(\\"div\\"))
|
||||
})"
|
||||
`;
|
||||
|
@ -183,12 +183,6 @@ describe('compiler: codegen', () => {
|
||||
expect(code).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('prefixIdentifiers: true should inject _ctx statement', () => {
|
||||
const { code } = generate(createRoot(), { prefixIdentifiers: true })
|
||||
expect(code).toMatch(`const _ctx = this\n`)
|
||||
expect(code).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test('static text', () => {
|
||||
const { code } = generate(
|
||||
createRoot({
|
||||
@ -422,7 +416,6 @@ describe('compiler: codegen', () => {
|
||||
prefixIdentifiers: true
|
||||
}
|
||||
)
|
||||
expect(code).toMatch(`const _cache = _ctx.$cache`)
|
||||
expect(code).toMatch(`_cache[1] || (_cache[1] = foo)`)
|
||||
expect(code).toMatchSnapshot()
|
||||
})
|
||||
@ -442,7 +435,6 @@ describe('compiler: codegen', () => {
|
||||
prefixIdentifiers: true
|
||||
}
|
||||
)
|
||||
expect(code).toMatch(`const _cache = _ctx.$cache`)
|
||||
expect(code).toMatch(
|
||||
`
|
||||
_cache[1] || (
|
||||
@ -596,7 +588,7 @@ describe('compiler: codegen', () => {
|
||||
)
|
||||
expect(code).toMatchInlineSnapshot(`
|
||||
"
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
return foo = bar
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ describe('scopeId compiler support', () => {
|
||||
})
|
||||
expect(ast.helpers).toContain(WITH_SCOPE_ID)
|
||||
expect(code).toMatch(`const _withId = _withScopeId("test")`)
|
||||
expect(code).toMatch(`export const render = _withId(function render() {`)
|
||||
expect(code).toMatch(`export const render = _withId(function render(`)
|
||||
expect(code).toMatchSnapshot()
|
||||
})
|
||||
|
||||
@ -68,7 +68,7 @@ describe('scopeId compiler support', () => {
|
||||
|
||||
test('should push scopeId for hoisted nodes', () => {
|
||||
const { ast, code } = baseCompile(
|
||||
`<div><div>hello</div><div>world</div></div>`,
|
||||
`<div><div>hello</div>{{ foo }}<div>world</div></div>`,
|
||||
{
|
||||
mode: 'module',
|
||||
scopeId: 'test',
|
||||
|
@ -6,7 +6,7 @@ const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = _createVNode(\\"div\\", { key: \\"foo\\" })
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -26,7 +26,7 @@ const _hoisted_1 = _createVNode(\\"p\\", null, [
|
||||
_createVNode(\\"span\\")
|
||||
])
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -45,7 +45,7 @@ const _hoisted_1 = _createVNode(\\"div\\", null, [
|
||||
_createCommentVNode(\\"comment\\")
|
||||
])
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createCommentVNode: _createCommentVNode, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -63,7 +63,7 @@ const { createVNode: _createVNode } = _Vue
|
||||
const _hoisted_1 = _createVNode(\\"span\\")
|
||||
const _hoisted_2 = _createVNode(\\"div\\")
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -81,7 +81,7 @@ const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = _createVNode(\\"span\\", { class: \\"inline\\" }, \\"hello\\")
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -98,7 +98,7 @@ const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = { id: \\"foo\\" }
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -119,7 +119,7 @@ const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = { id: \\"foo\\" }
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -136,7 +136,7 @@ const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = { id: \\"foo\\" }
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -157,7 +157,7 @@ const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = { class: { foo: true } }
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -179,7 +179,7 @@ const _hoisted_1 = _createVNode(\\"span\\", null, [
|
||||
_toDisplayString(true)
|
||||
])
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -196,7 +196,7 @@ const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = _createVNode(\\"span\\", { foo: 0 }, _toDisplayString(1))
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -210,9 +210,7 @@ return function render() {
|
||||
exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist elements with cached handlers 1`] = `
|
||||
"import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock } from \\"vue\\"
|
||||
|
||||
export function render() {
|
||||
const _ctx = this
|
||||
const _cache = _ctx.$cache
|
||||
export function render(_ctx, _cache) {
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_createVNode(\\"div\\", null, [
|
||||
_createVNode(\\"div\\", {
|
||||
@ -226,7 +224,7 @@ export function render() {
|
||||
exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expressions that refer scope variables (2) 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toDisplayString: _toDisplayString, createVNode: _createVNode } = _Vue
|
||||
|
||||
@ -244,7 +242,7 @@ return function render() {
|
||||
exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expressions that refer scope variables (v-slot) 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -261,7 +259,7 @@ return function render() {
|
||||
exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expressions that refer scope variables 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toDisplayString: _toDisplayString, createVNode: _createVNode } = _Vue
|
||||
|
||||
@ -279,7 +277,7 @@ return function render() {
|
||||
exports[`compiler: hoistStatic transform should NOT hoist components 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -295,7 +293,7 @@ return function render() {
|
||||
exports[`compiler: hoistStatic transform should NOT hoist element with dynamic key 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -309,7 +307,7 @@ return function render() {
|
||||
exports[`compiler: hoistStatic transform should NOT hoist element with dynamic props 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -323,7 +321,7 @@ return function render() {
|
||||
exports[`compiler: hoistStatic transform should NOT hoist element with dynamic ref 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -337,7 +335,7 @@ return function render() {
|
||||
exports[`compiler: hoistStatic transform should NOT hoist root node 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -353,7 +351,7 @@ const { createVNode: _createVNode } = _Vue
|
||||
const _hoisted_1 = { id: \\"foo\\" }
|
||||
const _hoisted_2 = _createVNode(\\"span\\")
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
@ -378,7 +376,7 @@ const _hoisted_1 = {
|
||||
}
|
||||
const _hoisted_2 = _createVNode(\\"span\\")
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
exports[`compiler: transform text <template v-for> 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createTextVNode: _createTextVNode } = _Vue
|
||||
|
||||
@ -19,7 +19,7 @@ return function render() {
|
||||
exports[`compiler: transform text consecutive text 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString } = _Vue
|
||||
|
||||
@ -31,7 +31,7 @@ return function render() {
|
||||
exports[`compiler: transform text consecutive text between elements 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -47,7 +47,7 @@ return function render() {
|
||||
exports[`compiler: transform text consecutive text mixed with elements 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -65,7 +65,7 @@ return function render() {
|
||||
exports[`compiler: transform text no consecutive text 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { toDisplayString: _toDisplayString } = _Vue
|
||||
|
||||
@ -77,7 +77,7 @@ return function render() {
|
||||
exports[`compiler: transform text text between elements (static) 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -93,8 +93,7 @@ return function render() {
|
||||
exports[`compiler: transform text with prefixIdentifiers: true 1`] = `
|
||||
"const { toDisplayString: _toDisplayString } = Vue
|
||||
|
||||
return function render() {
|
||||
const _ctx = this
|
||||
return function render(_ctx, _cache) {
|
||||
return _toDisplayString(_ctx.foo) + \\" bar \\" + _toDisplayString(_ctx.baz + _ctx.qux)
|
||||
}"
|
||||
`;
|
||||
|
@ -3,7 +3,7 @@
|
||||
exports[`compiler: v-for codegen basic v-for 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
@ -17,7 +17,7 @@ return function render() {
|
||||
exports[`compiler: v-for codegen keyed template v-for 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
@ -34,7 +34,7 @@ return function render() {
|
||||
exports[`compiler: v-for codegen keyed v-for 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
@ -48,7 +48,7 @@ return function render() {
|
||||
exports[`compiler: v-for codegen skipped key 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
@ -62,7 +62,7 @@ return function render() {
|
||||
exports[`compiler: v-for codegen skipped value & key 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
@ -76,7 +76,7 @@ return function render() {
|
||||
exports[`compiler: v-for codegen skipped value 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
@ -90,7 +90,7 @@ return function render() {
|
||||
exports[`compiler: v-for codegen template v-for 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
@ -107,7 +107,7 @@ return function render() {
|
||||
exports[`compiler: v-for codegen template v-for w/ <slot/> 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, renderSlot: _renderSlot } = _Vue
|
||||
|
||||
@ -121,7 +121,7 @@ return function render() {
|
||||
exports[`compiler: v-for codegen v-for on <slot/> 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, renderSlot: _renderSlot } = _Vue
|
||||
|
||||
@ -135,7 +135,7 @@ return function render() {
|
||||
exports[`compiler: v-for codegen v-for on element with custom directive 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective } = _Vue
|
||||
|
||||
@ -153,7 +153,7 @@ return function render() {
|
||||
exports[`compiler: v-for codegen v-if + v-for 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
@ -169,7 +169,7 @@ return function render() {
|
||||
exports[`compiler: v-for codegen value + key + index 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
exports[`compiler: v-if codegen basic v-if 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
@ -17,7 +17,7 @@ return function render() {
|
||||
exports[`compiler: v-if codegen template v-if 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, Fragment: _Fragment, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
@ -35,7 +35,7 @@ return function render() {
|
||||
exports[`compiler: v-if codegen template v-if w/ single <slot/> child 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderSlot: _renderSlot, openBlock: _openBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
@ -49,7 +49,7 @@ return function render() {
|
||||
exports[`compiler: v-if codegen v-if + v-else 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
@ -63,7 +63,7 @@ return function render() {
|
||||
exports[`compiler: v-if codegen v-if + v-else-if + v-else 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment } = _Vue
|
||||
|
||||
@ -79,7 +79,7 @@ return function render() {
|
||||
exports[`compiler: v-if codegen v-if + v-else-if 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
@ -95,7 +95,7 @@ return function render() {
|
||||
exports[`compiler: v-if codegen v-if on <slot/> 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { renderSlot: _renderSlot, openBlock: _openBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
@ -109,7 +109,7 @@ return function render() {
|
||||
exports[`compiler: v-if codegen v-if with key 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
|
||||
|
||||
|
@ -3,8 +3,7 @@
|
||||
exports[`compiler: transform v-model compound expression (with prefixIdentifiers) 1`] = `
|
||||
"import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock } from \\"vue\\"
|
||||
|
||||
export function render() {
|
||||
const _ctx = this
|
||||
export function render(_ctx, _cache) {
|
||||
return (_openBlock(), _createBlock(\\"input\\", {
|
||||
modelValue: _ctx.model[_ctx.index],
|
||||
\\"onUpdate:modelValue\\": $event => (_ctx.model[_ctx.index] = $event)
|
||||
@ -15,7 +14,7 @@ export function render() {
|
||||
exports[`compiler: transform v-model compound expression 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -30,8 +29,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model simple exprssion (with prefixIdentifiers) 1`] = `
|
||||
"import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock } from \\"vue\\"
|
||||
|
||||
export function render() {
|
||||
const _ctx = this
|
||||
export function render(_ctx, _cache) {
|
||||
return (_openBlock(), _createBlock(\\"input\\", {
|
||||
modelValue: _ctx.model,
|
||||
\\"onUpdate:modelValue\\": $event => (_ctx.model = $event)
|
||||
@ -42,7 +40,7 @@ export function render() {
|
||||
exports[`compiler: transform v-model simple exprssion 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -57,7 +55,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model with argument 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -72,8 +70,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model with dynamic argument (with prefixIdentifiers) 1`] = `
|
||||
"import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock } from \\"vue\\"
|
||||
|
||||
export function render() {
|
||||
const _ctx = this
|
||||
export function render(_ctx, _cache) {
|
||||
return (_openBlock(), _createBlock(\\"input\\", {
|
||||
[_ctx.value]: _ctx.model,
|
||||
[\\"onUpdate:\\" + _ctx.value]: $event => (_ctx.model = $event)
|
||||
@ -84,7 +81,7 @@ export function render() {
|
||||
exports[`compiler: transform v-model with dynamic argument 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
@ -3,10 +3,9 @@
|
||||
exports[`compiler: v-once transform as root node 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { setBlockTracking: _setBlockTracking, createVNode: _createVNode } = _Vue
|
||||
const _cache = $cache
|
||||
|
||||
return _cache[1] || (
|
||||
_setBlockTracking(-1),
|
||||
@ -21,10 +20,9 @@ return function render() {
|
||||
exports[`compiler: v-once transform on component 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { setBlockTracking: _setBlockTracking, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const _cache = $cache
|
||||
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
@ -43,10 +41,9 @@ return function render() {
|
||||
exports[`compiler: v-once transform on nested plain element 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { setBlockTracking: _setBlockTracking, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const _cache = $cache
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_cache[1] || (
|
||||
@ -63,10 +60,9 @@ return function render() {
|
||||
exports[`compiler: v-once transform on slot outlet 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { setBlockTracking: _setBlockTracking, renderSlot: _renderSlot, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const _cache = $cache
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_cache[1] || (
|
||||
@ -83,10 +79,9 @@ return function render() {
|
||||
exports[`compiler: v-once transform with hoistStatic: true 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { setBlockTracking: _setBlockTracking, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
const _cache = $cache
|
||||
|
||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||
_cache[1] || (
|
||||
|
@ -3,8 +3,7 @@
|
||||
exports[`compiler: transform component slots dynamically named slots 1`] = `
|
||||
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = Vue
|
||||
|
||||
return function render() {
|
||||
const _ctx = this
|
||||
return function render(_ctx, _cache) {
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
return (_openBlock(), _createBlock(_component_Comp, null, {
|
||||
@ -18,8 +17,7 @@ return function render() {
|
||||
exports[`compiler: transform component slots implicit default slot 1`] = `
|
||||
"const { createVNode: _createVNode, resolveComponent: _resolveComponent, createBlock: _createBlock, openBlock: _openBlock } = Vue
|
||||
|
||||
return function render() {
|
||||
const _ctx = this
|
||||
return function render(_ctx, _cache) {
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
return (_openBlock(), _createBlock(_component_Comp, null, {
|
||||
@ -34,8 +32,7 @@ return function render() {
|
||||
exports[`compiler: transform component slots named slot with v-for w/ prefixIdentifiers: true 1`] = `
|
||||
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, renderList: _renderList, createSlots: _createSlots, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = Vue
|
||||
|
||||
return function render() {
|
||||
const _ctx = this
|
||||
return function render(_ctx, _cache) {
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _compiled: true }, [
|
||||
@ -52,8 +49,7 @@ return function render() {
|
||||
exports[`compiler: transform component slots named slot with v-if + prefixIdentifiers: true 1`] = `
|
||||
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createSlots: _createSlots, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = Vue
|
||||
|
||||
return function render() {
|
||||
const _ctx = this
|
||||
return function render(_ctx, _cache) {
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _compiled: true }, [
|
||||
@ -70,7 +66,7 @@ return function render() {
|
||||
exports[`compiler: transform component slots named slot with v-if + v-else-if + v-else 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { resolveComponent: _resolveComponent, createSlots: _createSlots, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -99,7 +95,7 @@ return function render() {
|
||||
exports[`compiler: transform component slots named slot with v-if 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { resolveComponent: _resolveComponent, createSlots: _createSlots, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -120,8 +116,7 @@ return function render() {
|
||||
exports[`compiler: transform component slots named slots 1`] = `
|
||||
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = Vue
|
||||
|
||||
return function render() {
|
||||
const _ctx = this
|
||||
return function render(_ctx, _cache) {
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
return (_openBlock(), _createBlock(_component_Comp, null, {
|
||||
@ -135,7 +130,7 @@ return function render() {
|
||||
exports[`compiler: transform component slots named slots w/ implicit default slot 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, resolveComponent: _resolveComponent, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -156,8 +151,7 @@ return function render() {
|
||||
exports[`compiler: transform component slots nested slots scoping 1`] = `
|
||||
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = Vue
|
||||
|
||||
return function render() {
|
||||
const _ctx = this
|
||||
return function render(_ctx, _cache) {
|
||||
const _component_Inner = _resolveComponent(\\"Inner\\")
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
@ -180,8 +174,7 @@ return function render() {
|
||||
exports[`compiler: transform component slots on-component default slot 1`] = `
|
||||
"const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = Vue
|
||||
|
||||
return function render() {
|
||||
const _ctx = this
|
||||
return function render(_ctx, _cache) {
|
||||
const _component_Comp = _resolveComponent(\\"Comp\\")
|
||||
|
||||
return (_openBlock(), _createBlock(_component_Comp, null, {
|
||||
|
@ -199,7 +199,7 @@ export function generate(
|
||||
push(`const render = _withId(`)
|
||||
}
|
||||
if (!ssr) {
|
||||
push(`function render() {`)
|
||||
push(`function render(_ctx, _cache) {`)
|
||||
} else {
|
||||
push(`function ssrRender(_ctx, _push, _parent) {`)
|
||||
}
|
||||
@ -216,20 +216,9 @@ export function generate(
|
||||
.map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
|
||||
.join(', ')} } = _Vue`
|
||||
)
|
||||
if (ast.cached > 0) {
|
||||
newline()
|
||||
push(`const _cache = $cache`)
|
||||
}
|
||||
push(`\n`)
|
||||
newline()
|
||||
}
|
||||
} else if (!__BROWSER__ && !ssr) {
|
||||
push(`const _ctx = this`)
|
||||
if (ast.cached > 0) {
|
||||
newline()
|
||||
push(`const _cache = _ctx.$cache`)
|
||||
}
|
||||
newline()
|
||||
}
|
||||
|
||||
// generate asset resolution statements
|
||||
|
@ -6,7 +6,7 @@ const { createVNode: _createVNode } = _Vue
|
||||
|
||||
const _hoisted_1 = {}
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { createVNode: _createVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
exports[`compiler: transform v-model input w/ dynamic v-bind 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelDynamic: _vModelDynamic, mergeProps: _mergeProps, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -20,7 +20,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model input w/ dynamic v-bind 2`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelDynamic: _vModelDynamic, createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -40,7 +40,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model modifiers .lazy 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -62,7 +62,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model modifiers .number 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -84,7 +84,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model modifiers .trim 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -106,7 +106,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model simple expression 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -123,7 +123,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model simple expression for input (checkbox) 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelCheckbox: _vModelCheckbox, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -141,7 +141,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model simple expression for input (dynamic type) 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelDynamic: _vModelDynamic, createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -161,7 +161,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model simple expression for input (radio) 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelRadio: _vModelRadio, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -179,7 +179,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model simple expression for input (text) 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -197,7 +197,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model simple expression for select 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelSelect: _vModelSelect, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
@ -214,7 +214,7 @@ return function render() {
|
||||
exports[`compiler: transform v-model simple expression for textarea 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
exports[`compiler: v-show transform simple expression 1`] = `
|
||||
"const _Vue = Vue
|
||||
|
||||
return function render() {
|
||||
return function render(_ctx, _cache) {
|
||||
with (this) {
|
||||
const { vShow: _vShow, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
exports[`source map 1`] = `
|
||||
Object {
|
||||
"mappings": ";;;;UAAA,cACE,aAA8B;IAAzB,aAAmB,4BAAbA,WAAM",
|
||||
"mappings": ";;;UAAA,cACE,aAA8B;IAAzB,aAAmB,4BAAbA,WAAM",
|
||||
"names": Array [
|
||||
"render",
|
||||
],
|
||||
|
@ -7,8 +7,7 @@ import _imports_0 from '@svg/file.svg'
|
||||
|
||||
const _hoisted_1 = _imports_0 + '#fragment'
|
||||
|
||||
export function render() {
|
||||
const _ctx = this
|
||||
export function render(_ctx, _cache) {
|
||||
return (_openBlock(), _createBlock(\\"use\\", { href: _hoisted_1 }))
|
||||
}"
|
||||
`;
|
||||
@ -16,8 +15,7 @@ export function render() {
|
||||
exports[`compiler sfc: transform asset url support uri is empty 1`] = `
|
||||
"import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock } from \\"vue\\"
|
||||
|
||||
export function render() {
|
||||
const _ctx = this
|
||||
export function render(_ctx, _cache) {
|
||||
return (_openBlock(), _createBlock(\\"use\\", { href: '' }))
|
||||
}"
|
||||
`;
|
||||
@ -28,8 +26,7 @@ import _imports_0 from './logo.png'
|
||||
import _imports_1 from 'fixtures/logo.png'
|
||||
|
||||
|
||||
export function render() {
|
||||
const _ctx = this
|
||||
export function render(_ctx, _cache) {
|
||||
return (_openBlock(), _createBlock(_Fragment, null, [
|
||||
_createVNode(\\"img\\", { src: _imports_0 }),
|
||||
_createVNode(\\"img\\", { src: _imports_1 }),
|
||||
|
@ -14,8 +14,7 @@ const _hoisted_6 = _imports_0 + '2x, ' + _imports_0 + '3x'
|
||||
const _hoisted_7 = _imports_0 + ', ' + _imports_0 + '2x, ' + _imports_0 + '3x'
|
||||
const _hoisted_8 = \\"/logo.png\\" + ', ' + _imports_0 + '2x'
|
||||
|
||||
export function render() {
|
||||
const _ctx = this
|
||||
export function render(_ctx, _cache) {
|
||||
return (_openBlock(), _createBlock(_Fragment, null, [
|
||||
_createVNode(\\"img\\", {
|
||||
src: \\"./logo.png\\",
|
||||
|
@ -9,7 +9,7 @@ test('should work', () => {
|
||||
expect(result.errors.length).toBe(0)
|
||||
expect(result.source).toBe(source)
|
||||
// should expose render fn
|
||||
expect(result.code).toMatch(`export function render()`)
|
||||
expect(result.code).toMatch(`export function render(`)
|
||||
})
|
||||
|
||||
test('preprocess pug', () => {
|
||||
|
@ -47,7 +47,8 @@ export function renderComponentRoot(
|
||||
slots,
|
||||
attrs,
|
||||
vnodeHooks,
|
||||
emit
|
||||
emit,
|
||||
renderCache
|
||||
} = instance
|
||||
|
||||
let result
|
||||
@ -57,7 +58,9 @@ export function renderComponentRoot(
|
||||
}
|
||||
try {
|
||||
if (vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT) {
|
||||
result = normalizeVNode(instance.render!.call(withProxy || proxy))
|
||||
result = normalizeVNode(
|
||||
instance.render!.call(withProxy || proxy, proxy, renderCache)
|
||||
)
|
||||
} else {
|
||||
// functional
|
||||
const render = Component as FunctionalComponent
|
||||
|
Loading…
x
Reference in New Issue
Block a user