File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
packages/@ember/template-compiler/lib Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 44 STRICT_MODE_KEYWORDS ,
55 STRICT_MODE_TRANSFORMS ,
66} from './plugins/index' ;
7+ import { ALLOWED_GLOBALS } from './plugins/allowed-globals' ;
78import type { EmberPrecompileOptions , PluginFunc } from './types' ;
89import COMPONENT_NAME_SIMPLE_DASHERIZE_CACHE from './dasherize-component-name' ;
910
@@ -39,6 +40,10 @@ function buildCompileOptions(_options: EmberPrecompileOptions): EmberPrecompileO
3940 const globalScopeEvaluator = ( value : string ) => new Function ( `return ${ value } ;` ) ( ) ;
4041
4142 options . lexicalScope = ( variable : string ) => {
43+ if ( ALLOWED_GLOBALS . has ( variable ) ) {
44+ return true ;
45+ }
46+
4247 if ( inScope ( variable , localScopeEvaluator ) ) {
4348 return ! inScope ( variable , globalScopeEvaluator ) ;
4449 }
@@ -52,7 +57,13 @@ function buildCompileOptions(_options: EmberPrecompileOptions): EmberPrecompileO
5257 if ( 'scope' in options ) {
5358 const scope = ( options . scope as ( ) => Record < string , unknown > ) ( ) ;
5459
55- options . lexicalScope = ( variable : string ) => variable in scope ;
60+ options . lexicalScope = ( variable : string ) => {
61+ if ( ALLOWED_GLOBALS . has ( variable ) ) {
62+ return true ;
63+ }
64+
65+ return variable in scope ;
66+ } ;
5667
5768 delete options . scope ;
5869 }
You can’t perform that action at this time.
0 commit comments