Skip to content

Commit 02f3ac7

Browse files
committed
chore: use __NO_SIDE_EFFECTS__ to replace __PURE__
1 parent 2ffe3d5 commit 02f3ac7

File tree

21 files changed

+48
-53
lines changed

21 files changed

+48
-53
lines changed

packages/compiler-core/src/parse.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,7 @@ const enum TagType {
507507
End
508508
}
509509

510-
const isSpecialTemplateDirective = /*#__PURE__*/ makeMap(
511-
`if,else,else-if,for,slot`
512-
)
510+
const isSpecialTemplateDirective = makeMap(`if,else,else-if,for,slot`)
513511

514512
/**
515513
* Parse a tag (E.g. `<div id=a>`) with that type (start tag or end tag).

packages/compiler-core/src/transforms/transformExpression.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import { parse } from '@babel/parser'
4343
import { IS_REF, UNREF } from '../runtimeHelpers'
4444
import { BindingTypes } from '../options'
4545

46-
const isLiteralWhitelisted = /*#__PURE__*/ makeMap('true,false,null,this')
46+
const isLiteralWhitelisted = makeMap('true,false,null,this')
4747

4848
// a heuristic safeguard to bail constant expressions on presence of
4949
// likely function invocation and member access

packages/compiler-dom/src/parserOptions.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ import { TRANSITION, TRANSITION_GROUP } from './runtimeHelpers'
1010
import { decodeHtml } from './decodeHtml'
1111
import { decodeHtmlBrowser } from './decodeHtmlBrowser'
1212

13-
const isRawTextContainer = /*#__PURE__*/ makeMap(
14-
'style,iframe,script,noscript',
15-
true
16-
)
13+
const isRawTextContainer = makeMap('style,iframe,script,noscript', true)
1714

1815
export const enum DOMNamespaces {
1916
HTML = 0 /* Namespaces.HTML */,

packages/compiler-dom/src/transforms/stringifyStatic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ const replaceHoist = (
167167
context.hoists[context.hoists.indexOf(hoistToReplace)] = replacement
168168
}
169169

170-
const isNonStringifiable = /*#__PURE__*/ makeMap(
170+
const isNonStringifiable = makeMap(
171171
`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
172172
)
173173

packages/compiler-dom/src/transforms/vOn.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import {
1717
import { V_ON_WITH_MODIFIERS, V_ON_WITH_KEYS } from '../runtimeHelpers'
1818
import { makeMap, capitalize } from '@vue/shared'
1919

20-
const isEventOptionModifier = /*#__PURE__*/ makeMap(`passive,once,capture`)
21-
const isNonKeyModifier = /*#__PURE__*/ makeMap(
20+
const isEventOptionModifier = makeMap(`passive,once,capture`)
21+
const isNonKeyModifier = makeMap(
2222
// event propagation management
2323
`stop,prevent,self,` +
2424
// system modifiers + exact
@@ -27,11 +27,8 @@ const isNonKeyModifier = /*#__PURE__*/ makeMap(
2727
`middle`
2828
)
2929
// left & right could be mouse or key modifiers based on event type
30-
const maybeKeyModifier = /*#__PURE__*/ makeMap('left,right')
31-
const isKeyboardEvent = /*#__PURE__*/ makeMap(
32-
`onkeyup,onkeydown,onkeypress`,
33-
true
34-
)
30+
const maybeKeyModifier = makeMap('left,right')
31+
const isKeyboardEvent = makeMap(`onkeyup,onkeydown,onkeypress`, true)
3532

3633
const resolveModifiers = (
3734
key: ExpressionNode,

packages/reactivity/src/baseHandlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
import { isRef } from './ref'
3232
import { warn } from './warning'
3333

34-
const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`)
34+
const isNonTrackableKeys = makeMap(`__proto__,__v_isRef,__isVue`)
3535

3636
const builtInSymbols = new Set(
3737
/*#__PURE__*/

packages/reactivity/src/collectionHandlers.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ const [
331331
shallowReadonlyInstrumentations
332332
] = /* #__PURE__*/ createInstrumentations()
333333

334+
/*! #__NO_SIDE_EFFECTS__ */
334335
function createInstrumentationGetter(isReadonly: boolean, shallow: boolean) {
335336
const instrumentations = shallow
336337
? isReadonly
@@ -364,20 +365,20 @@ function createInstrumentationGetter(isReadonly: boolean, shallow: boolean) {
364365
}
365366

366367
export const mutableCollectionHandlers: ProxyHandler<CollectionTypes> = {
367-
get: /*#__PURE__*/ createInstrumentationGetter(false, false)
368+
get: createInstrumentationGetter(false, false)
368369
}
369370

370371
export const shallowCollectionHandlers: ProxyHandler<CollectionTypes> = {
371-
get: /*#__PURE__*/ createInstrumentationGetter(false, true)
372+
get: createInstrumentationGetter(false, true)
372373
}
373374

374375
export const readonlyCollectionHandlers: ProxyHandler<CollectionTypes> = {
375-
get: /*#__PURE__*/ createInstrumentationGetter(true, false)
376+
get: createInstrumentationGetter(true, false)
376377
}
377378

378379
export const shallowReadonlyCollectionHandlers: ProxyHandler<CollectionTypes> =
379380
{
380-
get: /*#__PURE__*/ createInstrumentationGetter(true, true)
381+
get: createInstrumentationGetter(true, true)
381382
}
382383

383384
function checkIdentityKeys(

packages/runtime-core/src/compat/renderFn.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export function compatH(
170170
}
171171
}
172172

173-
const skipLegacyRootLevelProps = /*#__PURE__*/ makeMap(
173+
const skipLegacyRootLevelProps = makeMap(
174174
'staticStyle,staticClass,directives,model,hook'
175175
)
176176

packages/runtime-core/src/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ export const unsetCurrentInstance = () => {
638638
internalSetCurrentInstance(null)
639639
}
640640

641-
const isBuiltInTag = /*#__PURE__*/ makeMap('slot,component')
641+
const isBuiltInTag = makeMap('slot,component')
642642

643643
export function validateComponentName(name: string, config: AppConfig) {
644644
const appIsNativeTag = config.isNativeTag || NO

packages/runtime-core/src/componentProps.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,7 @@ function validateProp(
680680
}
681681
}
682682

683-
const isSimpleType = /*#__PURE__*/ makeMap(
684-
'String,Number,Boolean,Function,Symbol,BigInt'
685-
)
683+
const isSimpleType = makeMap('String,Number,Boolean,Function,Symbol,BigInt')
686684

687685
type AssertionResult = {
688686
valid: boolean

0 commit comments

Comments
 (0)