File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
packages/react-devtools-shared/src Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ export function formatWithStyles(
187187 return inputArgs ;
188188 }
189189
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)
191191 const REGEXP = / ( [ ^ % ] | ^ ) ( % ( [ o O d i s f ] ) ) / g;
192192 if ( inputArgs [ 0 ] . match ( REGEXP ) ) {
193193 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 {
180180 inputArgs === undefined ||
181181 inputArgs === null ||
182182 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) ) ||
184186 style === undefined
185187 ) {
186188 return inputArgs ;
187189 }
188190
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;
190193 if ( inputArgs [ 0 ] . match ( REGEXP ) ) {
191194 return [ `%c${ inputArgs [ 0 ] } ` , style, ...inputArgs . slice ( 1 ) ] ;
192195 } else {
You can’t perform that action at this time.
0 commit comments