]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: rename globals allow list
authorEvan You <yyx990803@gmail.com>
Fri, 26 May 2023 16:07:13 +0000 (11:07 -0500)
committerEvan You <yyx990803@gmail.com>
Fri, 26 May 2023 16:07:13 +0000 (11:07 -0500)
close #8416

packages/compiler-core/src/transforms/transformExpression.ts
packages/runtime-core/src/componentPublicInstance.ts
packages/shared/src/globalsAllowList.ts [moved from packages/shared/src/globalsWhitelist.ts with 70% similarity]
packages/shared/src/index.ts

index 3e75923d0d4ed2bacae5d705d74893f2caa468fd..eab6b237f13fb97234abb46c45c1343a3e876315 100644 (file)
@@ -25,7 +25,7 @@ import {
 } from '../babelUtils'
 import { advancePositionWithClone, isSimpleIdentifier } from '../utils'
 import {
-  isGloballyWhitelisted,
+  isGloballyAllowed,
   makeMap,
   hasOwn,
   isString,
@@ -225,7 +225,7 @@ export function processExpression(
 
   if (isSimpleIdentifier(rawExp)) {
     const isScopeVarReference = context.identifiers[rawExp]
-    const isAllowedGlobal = isGloballyWhitelisted(rawExp)
+    const isAllowedGlobal = isGloballyAllowed(rawExp)
     const isLiteral = isLiteralWhitelisted(rawExp)
     if (!asParams && !isScopeVarReference && !isAllowedGlobal && !isLiteral) {
       // const bindings exposed from setup can be skipped for patching but
@@ -358,7 +358,7 @@ export function processExpression(
 
 function canPrefix(id: Identifier) {
   // skip whitelisted globals
-  if (isGloballyWhitelisted(id.name)) {
+  if (isGloballyAllowed(id.name)) {
     return false
   }
   // special case for webpack compilation
index 78a9acd147fddc9946dbdea5773a7252ec5e30c0..dc575aafff92b6a2d629d40825c8653fc061420a 100644 (file)
@@ -9,7 +9,7 @@ import { instanceWatch, WatchOptions, WatchStopHandle } from './apiWatch'
 import {
   EMPTY_OBJ,
   hasOwn,
-  isGloballyWhitelisted,
+  isGloballyAllowed,
   NOOP,
   extend,
   isString,
@@ -511,7 +511,7 @@ export const RuntimeCompiledPublicInstanceProxyHandlers = /*#__PURE__*/ extend(
       return PublicInstanceProxyHandlers.get!(target, key, target)
     },
     has(_: ComponentRenderContext, key: string) {
-      const has = key[0] !== '_' && !isGloballyWhitelisted(key)
+      const has = key[0] !== '_' && !isGloballyAllowed(key)
       if (__DEV__ && !has && PublicInstanceProxyHandlers.has!(_, key)) {
         warn(
           `Property ${JSON.stringify(
similarity index 70%
rename from packages/shared/src/globalsWhitelist.ts
rename to packages/shared/src/globalsAllowList.ts
index 9485a41dafa7822859a145d90fabffa9db7fb388..c303be11d4cf2d06065257c8ae36dacecd3d4ddd 100644 (file)
@@ -1,8 +1,8 @@
 import { makeMap } from './makeMap'
 
-const GLOBALS_WHITE_LISTED =
+const GLOBALS_ALLOWED =
   'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
   'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
   'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console'
 
-export const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED)
+export const isGloballyAllowed = /*#__PURE__*/ makeMap(GLOBALS_ALLOWED)
index 2e7292f0eac8943ae00aaf6190c59a70e9d6923a..11580a064352eb01a1fd9013914119d19515c74a 100644 (file)
@@ -3,7 +3,7 @@ export * from './general'
 export * from './patchFlags'
 export * from './shapeFlags'
 export * from './slotFlags'
-export * from './globalsWhitelist'
+export * from './globalsAllowList'
 export * from './codeframe'
 export * from './normalizeProp'
 export * from './domTagConfig'