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(
67
67
export const isConstant = ( node : Node | null | undefined ) : boolean => {
68
68
if ( ! node ) return false
69
69
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
71
74
}
72
75
if ( node . type === 'ArrayExpression' ) {
73
76
const { elements } = node
Original file line number Diff line number Diff line change @@ -91,15 +91,15 @@ function normalizeNode(node: any, anchor?: Node): Block {
91
91
}
92
92
}
93
93
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 )
96
96
if ( current ) {
97
97
if ( isFragment ( current ) ) {
98
98
const { anchor } = current
99
99
if ( anchor && anchor . parentNode ) {
100
100
remove ( current . nodes , anchor . parentNode )
101
101
insert ( node , anchor . parentNode , anchor )
102
- anchor . parentNode . removeChild ( anchor )
102
+ ! _anchor && anchor . parentNode . removeChild ( anchor )
103
103
}
104
104
} else if ( current instanceof Node ) {
105
105
if ( isFragment ( node ) && current . parentNode ) {
You can’t perform that action at this time.
0 commit comments