Skip to content

Commit

Permalink
test: update
Browse files Browse the repository at this point in the history
Co-authored-by: sxzz <[email protected]>
Co-authored-by: Doctor-wu <[email protected]>
Co-authored-by: ShenQingchuan <[email protected]>
  • Loading branch information
4 people committed May 16, 2024
1 parent 25193a7 commit 43dd14e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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 */)
Expand All @@ -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")
Expand All @@ -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 */)
Expand Down Expand Up @@ -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())
Expand Down
2 changes: 2 additions & 0 deletions packages/compiler-core/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { defaultOnError, defaultOnWarn } from './errors'
import {
CREATE_COMMENT,
FRAGMENT,
HOIST_LAZY,
TO_DISPLAY_STRING,
helperNameMap,
} from './runtimeHelpers'
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 0 additions & 2 deletions packages/compiler-core/src/transforms/hoistStatic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand Down

0 comments on commit 43dd14e

Please sign in to comment.