File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed
react-devtools-shared/src/backend
react-devtools-shell/src/e2e-regression Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 7
7
* @flow
8
8
*/
9
9
10
- import { gt , gte } from 'semver' ;
11
10
import {
12
11
ComponentFilterDisplayName ,
13
12
ComponentFilterElementType ,
@@ -39,6 +38,7 @@ import {
39
38
utfEncodeString ,
40
39
} from 'react-devtools-shared/src/utils' ;
41
40
import { sessionStorageGetItem } from 'react-devtools-shared/src/storage' ;
41
+ import { gt , gte } from 'react-devtools-shared/src/backend/utils' ;
42
42
import {
43
43
cleanForBridge ,
44
44
copyToClipboard ,
Original file line number Diff line number Diff line change @@ -275,3 +275,26 @@ export function isSynchronousXHRSupported(): boolean {
275
275
window . document . featurePolicy . allowsFeature ( 'sync-xhr' )
276
276
) ;
277
277
}
278
+
279
+ // https://www.npmjs.com/package/semver-compare
280
+ export function semvercmp ( a : string = '' , b : string = '' ) : number {
281
+ const pa = a . split ( '.' ) ;
282
+ const pb = b . split ( '.' ) ;
283
+ for ( let i = 0 ; i < 3 ; i ++ ) {
284
+ const na = + pa [ i ] ;
285
+ const nb = + pb [ i ] ;
286
+ if ( na > nb ) return 1 ;
287
+ if ( nb > na ) return - 1 ;
288
+ if ( ! isNaN ( na ) && isNaN ( nb ) ) return 1 ;
289
+ if ( isNaN ( na ) && ! isNaN ( nb ) ) return - 1 ;
290
+ }
291
+ return 0 ;
292
+ }
293
+
294
+ export function gt ( a : string = '' , b : string = '' ) : boolean {
295
+ return semvercmp ( a , b ) === 1 ;
296
+ }
297
+
298
+ export function gte ( a : string = '' , b : string = '' ) : boolean {
299
+ return semvercmp ( a , b ) > - 1 ;
300
+ }
Original file line number Diff line number Diff line change 4
4
5
5
import * as React from 'react' ;
6
6
import * as ReactDOM from 'react-dom' ;
7
- import { gte } from 'semver' ;
8
7
import ListApp from '../e2e-apps/ListApp' ;
9
8
import ListAppLegacy from '../e2e-apps/ListAppLegacy' ;
9
+ import { gte } from 'react-devtools-shared/src/backend/utils' ;
10
+
10
11
const version = process . env . E2E_APP_REACT_VERSION ;
11
12
12
13
function mountApp ( App : ( ) = > React$Node ) {
You can’t perform that action at this time.
0 commit comments