test: update

Co-authored-by: sxzz <sxzz@users.noreply.github.com>
Co-authored-by: Doctor-wu <Doctor-wu@users.noreply.github.com>
Co-authored-by: ShenQingchuan <ShenQingchuan@users.noreply.github.com>
This commit is contained in:
Anthony Fu 2024-05-16 19:43:48 +02:00
parent 25193a7c0b
commit 43dd14eb27
5 changed files with 9 additions and 9 deletions

View File

@ -105,7 +105,7 @@ const _hoisted_1 = /*#__PURE__*/ _hoistLazy(() => ({ id: "foo" }))
return function render(_ctx, _cache) {
with (_ctx) {
const { resolveDirective: _resolveDirective, createElementVNode: _createElementVNode, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
const { resolveDirective: _resolveDirective, createElementVNode: _createElementVNode, withDirectives: _withDirectives, hoistLazy: _hoistLazy, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
const _directive_foo = _resolveDirective("foo")
@ -126,7 +126,7 @@ const _hoisted_1 = /*#__PURE__*/ _hoistLazy(() => ({ id: "foo" }))
return function render(_ctx, _cache) {
with (_ctx) {
const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, hoistLazy: _hoistLazy, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, [
_createElementVNode("div", _hoisted_1(), _toDisplayString(hello), 1 /* TEXT */)
@ -143,7 +143,7 @@ const _hoisted_1 = /*#__PURE__*/ _hoistLazy(() => ({ id: "foo" }))
return function render(_ctx, _cache) {
with (_ctx) {
const { resolveComponent: _resolveComponent, createVNode: _createVNode, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
const { resolveComponent: _resolveComponent, createVNode: _createVNode, createElementVNode: _createElementVNode, hoistLazy: _hoistLazy, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
const _component_Comp = _resolveComponent("Comp")
@ -166,7 +166,7 @@ const _hoisted_1 = /*#__PURE__*/ _hoistLazy(() => ({
return function render(_ctx, _cache) {
with (_ctx) {
const { toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
const { toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, createElementVNode: _createElementVNode, hoistLazy: _hoistLazy, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, [
_createElementVNode("span", _hoisted_1(), _toDisplayString(_ctx.bar), 1 /* TEXT */)
@ -373,7 +373,7 @@ const _hoisted_1 = /*#__PURE__*/ _hoistLazy(() => (["id"]))
return function render(_ctx, _cache) {
with (_ctx) {
const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
const { createElementVNode: _createElementVNode, hoistLazy: _hoistLazy, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", null, [
_createElementVNode("div", { id: foo }, null, 8 /* PROPS */, _hoisted_1())

View File

@ -34,6 +34,7 @@ import { defaultOnError, defaultOnWarn } from './errors'
import {
CREATE_COMMENT,
FRAGMENT,
HOIST_LAZY,
TO_DISPLAY_STRING,
helperNameMap,
} from './runtimeHelpers'
@ -285,6 +286,7 @@ export function createTransformContext(
}
},
hoist(exp) {
context.helper(HOIST_LAZY)
if (isString(exp)) exp = createSimpleExpression(exp)
context.hoists.push(exp)
const identifier = createSimpleExpression(

View File

@ -21,7 +21,6 @@ import { PatchFlags, isArray, isString, isSymbol } from '@vue/shared'
import { isSlotOutlet } from '../utils'
import {
GUARD_REACTIVE_PROPS,
HOIST_LAZY,
NORMALIZE_CLASS,
NORMALIZE_PROPS,
NORMALIZE_STYLE,
@ -71,7 +70,6 @@ function walk(
: getConstantType(child, context)
if (constantType > ConstantTypes.NOT_CONSTANT) {
if (constantType >= ConstantTypes.CAN_HOIST) {
context.helper(HOIST_LAZY)
;(child.codegenNode as VNodeCall).patchFlag =
PatchFlags.HOISTED + (__DEV__ ? ` /* HOISTED */` : ``)
child.codegenNode = context.hoist(child.codegenNode!)

View File

@ -33,7 +33,7 @@ export function render(_ctx, _cache) {
`;
exports[`compiler sfc: transform asset url > support uri fragment 1`] = `
"import { createElementVNode as _createElementVNode, hoistLazy as _hoistLazy, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue"
"import { hoistLazy as _hoistLazy, createElementVNode as _createElementVNode, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue"
import _imports_0 from '@svg/file.svg'

View File

@ -1,7 +1,7 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`compiler sfc: transform srcset > srcset w/ explicit base option 1`] = `
"import { createElementVNode as _createElementVNode, hoistLazy as _hoistLazy, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue"
"import { hoistLazy as _hoistLazy, createElementVNode as _createElementVNode, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue"
import _imports_0 from '@/logo.png'