File tree 2 files changed +42
-2
lines changed
react-devtools-shared/src/backend
react-devtools-shell/src/e2e-regression 2 files changed +42
-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 ,
@@ -142,6 +141,29 @@ type ReactPriorityLevelsType = {
142
141
NoPriority : number ,
143
142
} ;
144
143
144
+ // https://www.npmjs.com/package/semver-compare
145
+ function semvercmp ( a : string = '' , b : string = '' ) {
146
+ const pa = a . split ( '.' ) ;
147
+ const pb = b . split ( '.' ) ;
148
+ for ( var i = 0 ; i < 3 ; i ++ ) {
149
+ const na = Number ( pa [ i ] ) ;
150
+ const 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
+
145
167
function getFiberFlags ( fiber : Fiber ) : number {
146
168
// The name of this field changed from "effectTag" to "flags"
147
169
return fiber . flags !== undefined ? fiber . flags : ( fiber : any ) . effectTag ;
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' ;
10
9
const version = process . env . E2E_APP_REACT_VERSION ;
11
10
11
+ // https://www.npmjs.com/package/semver-compare
12
+ function semvercmp ( a : string = '' , b : string = '' ) {
13
+ const pa = a . split ( '.' ) ;
14
+ const pb = b . split ( '.' ) ;
15
+ for ( var i = 0 ; i < 3 ; i ++ ) {
16
+ const na = Number ( pa [ i ] ) ;
17
+ const 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
+
12
30
function mountApp ( App : ( ) = > React$Node ) {
13
31
const container = document . createElement ( 'div' ) ;
14
32
You can’t perform that action at this time.
0 commit comments