File tree 2 files changed +6
-3
lines changed
packages/react-devtools-shared/src 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ export function formatWithStyles(
187
187
return inputArgs ;
188
188
}
189
189
190
- // Matches any of %(o|O|i|s|f), but not %%(o|O|i|s|f)
190
+ // Matches any of %(o|O|d| i|s|f), but not %%(o|O|d |i|s|f)
191
191
const REGEXP = / ( [ ^ % ] | ^ ) ( % ( [ o O d i s f ] ) ) / g;
192
192
if ( inputArgs [ 0 ] . match ( REGEXP ) ) {
193
193
return [ `%c${ inputArgs [ 0 ] } ` , style, ...inputArgs . slice ( 1 ) ] ;
Original file line number Diff line number Diff line change @@ -180,13 +180,16 @@ export function installHook(target: any): DevToolsHook | null {
180
180
inputArgs === undefined ||
181
181
inputArgs === null ||
182
182
inputArgs . length === 0 ||
183
- ( typeof inputArgs [ 0 ] === 'string' && inputArgs [ 0 ] . includes ( '%c' ) ) ||
183
+ // Matches any of %c but not %%c
184
+ ( typeof inputArgs [ 0 ] === 'string' &&
185
+ inputArgs [ 0 ] . match ( / ( [ ^ % ] | ^ ) ( % c ) / g) ) ||
184
186
style === undefined
185
187
) {
186
188
return inputArgs ;
187
189
}
188
190
189
- const REGEXP = / ( % ? ) ( % ( [ o O d i s f ] ) ) / g;
191
+ // Matches any of %(o|O|d|i|s|f), but not %%(o|O|d|i|s|f)
192
+ const REGEXP = / ( [ ^ % ] | ^ ) ( % ( [ o O d i s f ] ) ) / g;
190
193
if ( inputArgs [ 0 ] . match ( REGEXP ) ) {
191
194
return [ `%c${ inputArgs [ 0 ] } ` , style, ...inputArgs . slice ( 1 ) ] ;
192
195
} else {
You can’t perform that action at this time.
0 commit comments