瀏覽代碼

chore(shared): update patch flag name (#12831)

Arman Tang 10 月之前
父節點
當前提交
4aa7a4aba3

+ 13 - 13
packages/compiler-core/__tests__/transforms/__snapshots__/cacheStatic.spec.ts.snap

@@ -8,7 +8,7 @@ return function render(_ctx, _cache) {
     const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
 
     return (_openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
-      _createElementVNode("div", { key: "foo" }, null, -1 /* HOISTED */)
+      _createElementVNode("div", { key: "foo" }, null, -1 /* CACHED */)
     ])))
   }
 }"
@@ -25,11 +25,11 @@ return function render(_ctx, _cache) {
       _createElementVNode("p", null, [
         _createElementVNode("span"),
         _createElementVNode("span")
-      ], -1 /* HOISTED */),
+      ], -1 /* CACHED */),
       _createElementVNode("p", null, [
         _createElementVNode("span"),
         _createElementVNode("span")
-      ], -1 /* HOISTED */)
+      ], -1 /* CACHED */)
     ])))
   }
 }"
@@ -45,7 +45,7 @@ return function render(_ctx, _cache) {
     return (_openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
       _createElementVNode("div", null, [
         _createCommentVNode("comment")
-      ], -1 /* HOISTED */)
+      ], -1 /* CACHED */)
     ])))
   }
 }"
@@ -59,9 +59,9 @@ return function render(_ctx, _cache) {
     const { createElementVNode: _createElementVNode, createTextVNode: _createTextVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
 
     return (_openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
-      _createElementVNode("span", null, null, -1 /* HOISTED */),
+      _createElementVNode("span", null, null, -1 /* CACHED */),
       _createTextVNode("foo"),
-      _createElementVNode("div", null, null, -1 /* HOISTED */)
+      _createElementVNode("div", null, null, -1 /* CACHED */)
     ])))
   }
 }"
@@ -75,7 +75,7 @@ return function render(_ctx, _cache) {
     const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
 
     return (_openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
-      _createElementVNode("span", { class: "inline" }, "hello", -1 /* HOISTED */)
+      _createElementVNode("span", { class: "inline" }, "hello", -1 /* CACHED */)
     ])))
   }
 }"
@@ -148,7 +148,7 @@ return function render(_ctx, _cache) {
     const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
 
     return (_openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
-      _createElementVNode("span", null, "foo " + _toDisplayString(1) + " " + _toDisplayString(true), -1 /* HOISTED */)
+      _createElementVNode("span", null, "foo " + _toDisplayString(1) + " " + _toDisplayString(true), -1 /* CACHED */)
     ])))
   }
 }"
@@ -162,7 +162,7 @@ return function render(_ctx, _cache) {
     const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
 
     return (_openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
-      _createElementVNode("span", { foo: 0 }, _toDisplayString(1), -1 /* HOISTED */)
+      _createElementVNode("span", { foo: 0 }, _toDisplayString(1), -1 /* CACHED */)
     ])))
   }
 }"
@@ -178,7 +178,7 @@ return function render(_ctx, _cache) {
     return (_openBlock(), _createElementBlock("div", null, [
       (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(1, (i) => {
         return (_openBlock(), _createElementBlock("div", null, [...(_cache[0] || (_cache[0] = [
-          _createElementVNode("span", { class: "hi" }, null, -1 /* HOISTED */)
+          _createElementVNode("span", { class: "hi" }, null, -1 /* CACHED */)
         ]))]))
       }), 256 /* UNKEYED_FRAGMENT */))
     ]))
@@ -216,7 +216,7 @@ return function render(_ctx, _cache) {
 
     return (_openBlock(), _createElementBlock("div", null, [
       _withDirectives((_openBlock(), _createElementBlock("svg", null, _cache[0] || (_cache[0] = [
-        _createElementVNode("path", { d: "M2,3H5.5L12" }, null, -1 /* HOISTED */)
+        _createElementVNode("path", { d: "M2,3H5.5L12" }, null, -1 /* CACHED */)
       ]))), [
         [_directive_foo]
       ])
@@ -402,7 +402,7 @@ return function render(_ctx, _cache) {
     return (_openBlock(), _createElementBlock("div", null, [
       ok
         ? (_openBlock(), _createElementBlock("div", _hoisted_1, _cache[0] || (_cache[0] = [
-            _createElementVNode("span", null, null, -1 /* HOISTED */)
+            _createElementVNode("span", null, null, -1 /* CACHED */)
           ])))
         : _createCommentVNode("v-if", true)
     ]))
@@ -423,7 +423,7 @@ return function render(_ctx, _cache) {
     return (_openBlock(), _createElementBlock("div", null, [
       (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(list, (i) => {
         return (_openBlock(), _createElementBlock("div", _hoisted_1, _cache[0] || (_cache[0] = [
-          _createElementVNode("span", null, null, -1 /* HOISTED */)
+          _createElementVNode("span", null, null, -1 /* CACHED */)
         ])))
       }), 256 /* UNKEYED_FRAGMENT */))
     ]))

+ 4 - 4
packages/compiler-dom/__tests__/transforms/__snapshots__/stringifyStatic.spec.ts.snap

@@ -6,7 +6,7 @@ exports[`stringify static html > eligible content (elements > 20) + non-eligible
 return function render(_ctx, _cache) {
   return (_openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
     _createStaticVNode("<span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span>", 20),
-    _createElementVNode("div", { key: "1" }, "1", -1 /* HOISTED */),
+    _createElementVNode("div", { key: "1" }, "1", -1 /* CACHED */),
     _createStaticVNode("<span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span>", 20)
   ])))
 }"
@@ -54,7 +54,7 @@ return function render(_ctx, _cache) {
       _createElementVNode("option", { value: "1" }),
       _createElementVNode("option", { value: "1" }),
       _createElementVNode("option", { value: "1" })
-    ], -1 /* HOISTED */)
+    ], -1 /* CACHED */)
   ])))
 }"
 `;
@@ -70,7 +70,7 @@ return function render(_ctx, _cache) {
       _createElementVNode("option", { value: 1 }),
       _createElementVNode("option", { value: 1 }),
       _createElementVNode("option", { value: 1 })
-    ], -1 /* HOISTED */)
+    ], -1 /* CACHED */)
   ])))
 }"
 `;
@@ -87,7 +87,7 @@ return function render(_ctx, _cache) {
       _createElementVNode("span", { class: "foo" }, "foo"),
       _createElementVNode("span", { class: "foo" }, "foo"),
       _createElementVNode("img", { src: _imports_0_ })
-    ], -1 /* HOISTED */)
+    ], -1 /* CACHED */)
   ])))
 }"
 `;

+ 1 - 1
packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap

@@ -861,7 +861,7 @@ export default {
 return (_ctx, _cache) => {
   return (_openBlock(), _createElementBlock(_Fragment, null, [
     _createElementVNode("div", null, _toDisplayString(count.value), 1 /* TEXT */),
-    _cache[0] || (_cache[0] = _createElementVNode("div", null, "static", -1 /* HOISTED */))
+    _cache[0] || (_cache[0] = _createElementVNode("div", null, "static", -1 /* CACHED */))
   ], 64 /* STABLE_FRAGMENT */))
 }
 }

+ 2 - 2
packages/compiler-sfc/__tests__/__snapshots__/templateTransformAssetUrl.spec.ts.snap

@@ -41,8 +41,8 @@ const _hoisted_1 = _imports_0 + '#fragment'
 
 export function render(_ctx, _cache) {
   return (_openBlock(), _createElementBlock(_Fragment, null, [
-    _cache[0] || (_cache[0] = _createElementVNode("use", { href: _hoisted_1 }, null, -1 /* HOISTED */)),
-    _cache[1] || (_cache[1] = _createElementVNode("use", { href: _hoisted_1 }, null, -1 /* HOISTED */))
+    _cache[0] || (_cache[0] = _createElementVNode("use", { href: _hoisted_1 }, null, -1 /* CACHED */)),
+    _cache[1] || (_cache[1] = _createElementVNode("use", { href: _hoisted_1 }, null, -1 /* CACHED */))
   ], 64 /* STABLE_FRAGMENT */))
 }"
 `;

+ 38 - 38
packages/compiler-sfc/__tests__/__snapshots__/templateTransformSrcset.spec.ts.snap

@@ -10,8 +10,8 @@ const _hoisted_2 = _imports_0 + ' 1x, ' + "/foo/logo.png" + ' 2x'
 
 export function render(_ctx, _cache) {
   return (_openBlock(), _createElementBlock(_Fragment, null, [
-    _cache[0] || (_cache[0] = _createElementVNode("img", { srcset: _hoisted_1 }, null, -1 /* HOISTED */)),
-    _cache[1] || (_cache[1] = _createElementVNode("img", { srcset: _hoisted_2 }, null, -1 /* HOISTED */))
+    _cache[0] || (_cache[0] = _createElementVNode("img", { srcset: _hoisted_1 }, null, -1 /* CACHED */)),
+    _cache[1] || (_cache[1] = _createElementVNode("img", { srcset: _hoisted_2 }, null, -1 /* CACHED */))
   ], 64 /* STABLE_FRAGMENT */))
 }"
 `;
@@ -35,51 +35,51 @@ export function render(_ctx, _cache) {
     _cache[0] || (_cache[0] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: ""
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[1] || (_cache[1] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_1
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[2] || (_cache[2] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_2
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[3] || (_cache[3] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_3
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[4] || (_cache[4] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_4
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[5] || (_cache[5] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_5
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[6] || (_cache[6] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_6
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[7] || (_cache[7] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_7
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[8] || (_cache[8] = _createElementVNode("img", {
       src: "/logo.png",
       srcset: "/logo.png, /logo.png 2x"
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[9] || (_cache[9] = _createElementVNode("img", {
       src: "https://example.com/logo.png",
       srcset: "https://example.com/logo.png, https://example.com/logo.png 2x"
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[10] || (_cache[10] = _createElementVNode("img", {
       src: "/logo.png",
       srcset: _hoisted_8
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[11] || (_cache[11] = _createElementVNode("img", {
       src: "data:image/png;base64,i",
       srcset: "data:image/png;base64,i 1x, data:image/png;base64,i 2x"
-    }, null, -1 /* HOISTED */))
+    }, null, -1 /* CACHED */))
   ], 64 /* STABLE_FRAGMENT */))
 }"
 `;
@@ -92,51 +92,51 @@ export function render(_ctx, _cache) {
     _cache[0] || (_cache[0] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: ""
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[1] || (_cache[1] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: "/foo/logo.png"
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[2] || (_cache[2] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: "/foo/logo.png 2x"
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[3] || (_cache[3] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: "/foo/logo.png 2x"
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[4] || (_cache[4] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: "/foo/logo.png, /foo/logo.png 2x"
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[5] || (_cache[5] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: "/foo/logo.png 2x, /foo/logo.png"
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[6] || (_cache[6] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: "/foo/logo.png 2x, /foo/logo.png 3x"
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[7] || (_cache[7] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: "/foo/logo.png, /foo/logo.png 2x, /foo/logo.png 3x"
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[8] || (_cache[8] = _createElementVNode("img", {
       src: "/logo.png",
       srcset: "/logo.png, /logo.png 2x"
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[9] || (_cache[9] = _createElementVNode("img", {
       src: "https://example.com/logo.png",
       srcset: "https://example.com/logo.png, https://example.com/logo.png 2x"
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[10] || (_cache[10] = _createElementVNode("img", {
       src: "/logo.png",
       srcset: "/logo.png, /foo/logo.png 2x"
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[11] || (_cache[11] = _createElementVNode("img", {
       src: "data:image/png;base64,i",
       srcset: "data:image/png;base64,i 1x, data:image/png;base64,i 2x"
-    }, null, -1 /* HOISTED */))
+    }, null, -1 /* CACHED */))
   ], 64 /* STABLE_FRAGMENT */))
 }"
 `;
@@ -162,51 +162,51 @@ export function render(_ctx, _cache) {
     _cache[0] || (_cache[0] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: ""
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[1] || (_cache[1] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_1
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[2] || (_cache[2] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_2
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[3] || (_cache[3] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_3
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[4] || (_cache[4] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_4
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[5] || (_cache[5] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_5
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[6] || (_cache[6] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_6
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[7] || (_cache[7] = _createElementVNode("img", {
       src: "./logo.png",
       srcset: _hoisted_7
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[8] || (_cache[8] = _createElementVNode("img", {
       src: "/logo.png",
       srcset: _hoisted_8
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[9] || (_cache[9] = _createElementVNode("img", {
       src: "https://example.com/logo.png",
       srcset: "https://example.com/logo.png, https://example.com/logo.png 2x"
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[10] || (_cache[10] = _createElementVNode("img", {
       src: "/logo.png",
       srcset: _hoisted_9
-    }, null, -1 /* HOISTED */)),
+    }, null, -1 /* CACHED */)),
     _cache[11] || (_cache[11] = _createElementVNode("img", {
       src: "data:image/png;base64,i",
       srcset: "data:image/png;base64,i 1x, data:image/png;base64,i 2x"
-    }, null, -1 /* HOISTED */))
+    }, null, -1 /* CACHED */))
   ], 64 /* STABLE_FRAGMENT */))
 }"
 `;

+ 1 - 1
packages/shared/src/patchFlags.ts

@@ -139,6 +139,6 @@ export const PatchFlagNames: Record<PatchFlags, string> = {
   [PatchFlags.NEED_PATCH]: `NEED_PATCH`,
   [PatchFlags.DYNAMIC_SLOTS]: `DYNAMIC_SLOTS`,
   [PatchFlags.DEV_ROOT_FRAGMENT]: `DEV_ROOT_FRAGMENT`,
-  [PatchFlags.CACHED]: `HOISTED`,
+  [PatchFlags.CACHED]: `CACHED`,
   [PatchFlags.BAIL]: `BAIL`,
 }