Skip to content

Commit

Permalink
perf: add __NO_SIDE_EFFECTS__ comment
Browse files Browse the repository at this point in the history
  • Loading branch information
chenfan0 committed Sep 5, 2023
1 parent 2ffe3d5 commit 8ca9f68
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/reactivity/src/collectionHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ const [
shallowReadonlyInstrumentations
] = /* #__PURE__*/ createInstrumentations()

/*! #__NO_SIDE_EFFECTS__ */
function createInstrumentationGetter(isReadonly: boolean, shallow: boolean) {
const instrumentations = shallow
? isReadonly
Expand Down
1 change: 1 addition & 0 deletions packages/runtime-core/src/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export const devtoolsComponentRemoved = (
}
}

/*! #__NO_SIDE_EFFECTS__ */
function createDevtoolsComponentHook(hook: DevtoolsHooks) {
return (component: ComponentInternalInstance) => {
emit(
Expand Down
2 changes: 1 addition & 1 deletion packages/server-renderer/src/helpers/ssrRenderAttrs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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`
)

Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const isOn = (key: string) => onRE.test(key)

export const isModelListener = (key: string) => key.startsWith('onUpdate:')

/*! #__NO_SIDE_EFFECTS__ */
export const extend = Object.assign

export const remove = <T>(arr: T[], el: T) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/makeMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* \/\*#\_\_PURE\_\_\*\/
* So that rollup can tree-shake them if necessary.
*/

/*! #__NO_SIDE_EFFECTS__ */
export function makeMap(
str: string,
expectsLowerCase?: boolean
Expand Down

0 comments on commit 8ca9f68

Please sign in to comment.