From d46df6bdb14b0509eb2134b3f85297a306821c61 Mon Sep 17 00:00:00 2001 From: chenfan <83797583+chenfan0@users.noreply.github.com> Date: Wed, 13 Mar 2024 21:48:45 +0800 Subject: [PATCH] perf: add `__NO_SIDE_EFFECTS__` comments (#9053) Co-authored-by: Haoqun Jiang --- packages/runtime-core/src/devtools.ts | 1 + packages/server-renderer/src/helpers/ssrRenderAttrs.ts | 2 +- packages/shared/src/makeMap.ts | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/src/devtools.ts b/packages/runtime-core/src/devtools.ts index 870cb4748bd..5bff57a4165 100644 --- a/packages/runtime-core/src/devtools.ts +++ b/packages/runtime-core/src/devtools.ts @@ -123,6 +123,7 @@ export const devtoolsComponentRemoved = ( } } +/*! #__NO_SIDE_EFFECTS__ */ function createDevtoolsComponentHook(hook: DevtoolsHooks) { return (component: ComponentInternalInstance) => { emit( diff --git a/packages/server-renderer/src/helpers/ssrRenderAttrs.ts b/packages/server-renderer/src/helpers/ssrRenderAttrs.ts index 5eb77116b19..5a7baaac3a2 100644 --- a/packages/server-renderer/src/helpers/ssrRenderAttrs.ts +++ b/packages/server-renderer/src/helpers/ssrRenderAttrs.ts @@ -17,7 +17,7 @@ import { } from '@vue/shared' // leading comma for empty string "" -const shouldIgnoreProp = makeMap( +const shouldIgnoreProp = /*#__PURE__*/ makeMap( `,key,ref,innerHTML,textContent,ref_key,ref_for`, ) diff --git a/packages/shared/src/makeMap.ts b/packages/shared/src/makeMap.ts index f11cc407c6f..3fa2b09c94a 100644 --- a/packages/shared/src/makeMap.ts +++ b/packages/shared/src/makeMap.ts @@ -5,6 +5,8 @@ * \/\*#\_\_PURE\_\_\*\/ * So that rollup can tree-shake them if necessary. */ + +/*! #__NO_SIDE_EFFECTS__ */ export function makeMap( str: string, expectsLowerCase?: boolean,