File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,10 @@ export function getLiteralExpressionValue(
6767export const isConstant = ( node : Node | null | undefined ) : boolean => {
6868 if ( ! node ) return false
6969 if ( node . type === 'Identifier' ) {
70- return node . name === 'undefined'
70+ return node . name === 'undefined' || isGloballyAllowed ( node . name )
71+ }
72+ if ( [ 'JSXElement' , 'JSXFragment' , 'NullLiteral' ] . includes ( node . type ) ) {
73+ return true
7174 }
7275 if ( node . type === 'ArrayExpression' ) {
7376 const { elements } = node
Original file line number Diff line number Diff line change @@ -91,15 +91,15 @@ function normalizeNode(node: any, anchor?: Node): Block {
9191 }
9292}
9393
94- function resolveValue ( current : Block , value : any , anchor ?: Node ) {
95- const node = normalizeNode ( value , anchor )
94+ function resolveValue ( current : Block , value : any , _anchor ?: Node ) {
95+ const node = normalizeNode ( value , _anchor )
9696 if ( current ) {
9797 if ( isFragment ( current ) ) {
9898 const { anchor } = current
9999 if ( anchor && anchor . parentNode ) {
100100 remove ( current . nodes , anchor . parentNode )
101101 insert ( node , anchor . parentNode , anchor )
102- anchor . parentNode . removeChild ( anchor )
102+ ! _anchor && anchor . parentNode . removeChild ( anchor )
103103 }
104104 } else if ( current instanceof Node ) {
105105 if ( isFragment ( node ) && current . parentNode ) {
You can’t perform that action at this time.
0 commit comments