File tree Expand file tree Collapse file tree
react-devtools-shared/src/backend
react-devtools-shell/src/e2e-regression Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 * @flow
88 */
99
10- import { gt , gte } from 'semver' ;
1110import {
1211 ComponentFilterDisplayName ,
1312 ComponentFilterElementType ,
@@ -142,6 +141,29 @@ type ReactPriorityLevelsType = {
142141 NoPriority : number ,
143142} ;
144143
144+ // https://www.npmjs.com/package/semver-compare
145+ function semvercmp ( a : string , b : string ) {
146+ var pa = a . split ( '.' ) ;
147+ var pb = b . split ( '.' ) ;
148+ for ( var i = 0 ; i < 3 ; i ++ ) {
149+ var na = Number ( pa [ i ] ) ;
150+ var nb = Number ( pb [ i ] ) ;
151+ if ( na > nb ) return 1 ;
152+ if ( nb > na ) return - 1 ;
153+ if ( ! isNaN ( na ) && isNaN ( nb ) ) return 1 ;
154+ if ( isNaN ( na ) && ! isNaN ( nb ) ) return - 1 ;
155+ }
156+ return 0 ;
157+ }
158+
159+ function gt ( a : string , b : string ) {
160+ return semvercmp ( a , b ) === 1 ;
161+ }
162+
163+ function gte ( a : string , b : string ) {
164+ return semvercmp ( a , b ) > - 1 ;
165+ }
166+
145167function getFiberFlags ( fiber : Fiber ) : number {
146168 // The name of this field changed from "effectTag" to "flags"
147169 return fiber . flags !== undefined ? fiber . flags : ( fiber : any ) . effectTag ;
Original file line number Diff line number Diff line change 44
55import * as React from 'react' ;
66import * as ReactDOM from 'react-dom' ;
7- import { gte } from 'semver' ;
87import ListApp from '../e2e-apps/ListApp' ;
98import ListAppLegacy from '../e2e-apps/ListAppLegacy' ;
109const version = process . env . E2E_APP_REACT_VERSION ;
1110
11+ // https://www.npmjs.com/package/semver-compare
12+ function semvercmp ( a : string , b : string ) {
13+ var pa = a . split ( '.' ) ;
14+ var pb = b . split ( '.' ) ;
15+ for ( var i = 0 ; i < 3 ; i ++ ) {
16+ var na = Number ( pa [ i ] ) ;
17+ var nb = Number ( pb [ i ] ) ;
18+ if ( na > nb ) return 1 ;
19+ if ( nb > na ) return - 1 ;
20+ if ( ! isNaN ( na ) && isNaN ( nb ) ) return 1 ;
21+ if ( isNaN ( na ) && ! isNaN ( nb ) ) return - 1 ;
22+ }
23+ return 0 ;
24+ }
25+
26+ function gte ( a : string , b : string ) {
27+ return semvercmp ( a , b ) > - 1 ;
28+ }
29+
1230function mountApp ( App : ( ) = > React$Node ) {
1331 const container = document . createElement ( 'div' ) ;
1432
You can’t perform that action at this time.
0 commit comments