File tree Expand file tree Collapse file tree 11 files changed +184
-2
lines changed
conditional-exports-or-conditional
conditional-exports-or-false
conditional-exports-or-null
conditional-exports-or-true
conditional-exports-true-or-conditional Expand file tree Collapse file tree 11 files changed +184
-2
lines changed Original file line number Diff line number Diff line change 11export { default as isReference } from 'is-reference' ;
22
3+ function triStateAnd ( a , b ) {
4+ if ( a === false ) return false ;
5+ if ( b === false ) return false ;
6+ if ( a === true && b === true ) return true ;
7+ return null ;
8+ }
9+
10+ function triStateOr ( a , b ) {
11+ if ( a === true ) return true ;
12+ if ( b === true ) return true ;
13+ if ( a === false && b === false ) return false ;
14+ return null ;
15+ }
16+
317const operators = {
418 '==' : ( x ) => equals ( x . left , x . right , false ) ,
519
@@ -11,9 +25,9 @@ const operators = {
1125
1226 '!' : ( x ) => isFalsy ( x . argument ) ,
1327
14- '&&' : ( x ) => isTruthy ( x . left ) && isTruthy ( x . right ) ,
28+ '&&' : ( x ) => triStateAnd ( isTruthy ( x . left ) , isTruthy ( x . right ) ) ,
1529
16- '||' : ( x ) => isTruthy ( x . left ) || isTruthy ( x . right )
30+ '||' : ( x ) => triStateOr ( isTruthy ( x . left ) , isTruthy ( x . right ) )
1731} ;
1832
1933function not ( value ) {
Original file line number Diff line number Diff line change 1+ var condition1 = typeof global !== 'undefined' && global . env && global . env . USE_FEATURE_A ;
2+ var condition2 = typeof global !== 'undefined' && global . env && global . env . USE_FEATURE_B ;
3+
4+ function featureHandler ( ) { return 'feature' ; }
5+ function defaultHandler ( ) { return 'default' ; }
6+
7+ if ( condition1 || condition2 ) {
8+ exports . handler = featureHandler ;
9+ } else {
10+ exports . handler = defaultHandler ;
11+ }
Original file line number Diff line number Diff line change 1+ import * as commonjsHelpers from "_commonjsHelpers.js" ;
2+ import { __exports as input } from "\u0000fixtures/form/conditional-exports-or-conditional/input.js?commonjs-exports" ;
3+
4+ var hasRequiredInput ;
5+
6+ function requireInput ( ) {
7+ if ( hasRequiredInput ) return input ;
8+ hasRequiredInput = 1 ;
9+ var condition1 = typeof commonjsHelpers . commonjsGlobal !== 'undefined' && commonjsHelpers . commonjsGlobal . env && commonjsHelpers . commonjsGlobal . env . USE_FEATURE_A ;
10+ var condition2 = typeof commonjsHelpers . commonjsGlobal !== 'undefined' && commonjsHelpers . commonjsGlobal . env && commonjsHelpers . commonjsGlobal . env . USE_FEATURE_B ;
11+
12+ function featureHandler ( ) { return 'feature' ; }
13+ function defaultHandler ( ) { return 'default' ; }
14+
15+ if ( condition1 || condition2 ) {
16+ input . handler = featureHandler ;
17+ } else {
18+ input . handler = defaultHandler ;
19+ }
20+ return input ;
21+ }
22+
23+ export { requireInput as __require } ;
Original file line number Diff line number Diff line change 1+ var crypto = ( typeof global !== 'undefined' && global . crypto ) || null ;
2+
3+ function randomFill ( ) { return 'randomFill' ; }
4+ function randomFillSync ( ) { return 'randomFillSync' ; }
5+ function oldBrowser ( ) { throw new Error ( 'not supported' ) ; }
6+
7+ if ( ( crypto && crypto . getRandomValues ) || false ) {
8+ exports . randomFill = randomFill ;
9+ exports . randomFillSync = randomFillSync ;
10+ } else {
11+ exports . randomFill = oldBrowser ;
12+ exports . randomFillSync = oldBrowser ;
13+ }
Original file line number Diff line number Diff line change 1+ import * as commonjsHelpers from "_commonjsHelpers.js" ;
2+ import { __exports as input } from "\u0000fixtures/form/conditional-exports-or-false/input.js?commonjs-exports" ;
3+
4+ var hasRequiredInput ;
5+
6+ function requireInput ( ) {
7+ if ( hasRequiredInput ) return input ;
8+ hasRequiredInput = 1 ;
9+ var crypto = ( typeof commonjsHelpers . commonjsGlobal !== 'undefined' && commonjsHelpers . commonjsGlobal . crypto ) || null ;
10+
11+ function randomFill ( ) { return 'randomFill' ; }
12+ function randomFillSync ( ) { return 'randomFillSync' ; }
13+ function oldBrowser ( ) { throw new Error ( 'not supported' ) ; }
14+
15+ if ( ( crypto && crypto . getRandomValues ) || false ) {
16+ input . randomFill = randomFill ;
17+ input . randomFillSync = randomFillSync ;
18+ } else {
19+ input . randomFill = oldBrowser ;
20+ input . randomFillSync = oldBrowser ;
21+ }
22+ return input ;
23+ }
24+
25+ export { requireInput as __require } ;
Original file line number Diff line number Diff line change 1+ var crypto = ( typeof global !== 'undefined' && global . crypto ) || null ;
2+
3+ function secureHandler ( ) { return 'secure' ; }
4+ function fallbackHandler ( ) { return 'fallback' ; }
5+
6+ if ( ( crypto && crypto . getRandomValues ) || null ) {
7+ exports . handler = secureHandler ;
8+ } else {
9+ exports . handler = fallbackHandler ;
10+ }
Original file line number Diff line number Diff line change 1+ import * as commonjsHelpers from "_commonjsHelpers.js" ;
2+ import { __exports as input } from "\u0000fixtures/form/conditional-exports-or-null/input.js?commonjs-exports" ;
3+
4+ var hasRequiredInput ;
5+
6+ function requireInput ( ) {
7+ if ( hasRequiredInput ) return input ;
8+ hasRequiredInput = 1 ;
9+ var crypto = ( typeof commonjsHelpers . commonjsGlobal !== 'undefined' && commonjsHelpers . commonjsGlobal . crypto ) || null ;
10+
11+ function secureHandler ( ) { return 'secure' ; }
12+ function fallbackHandler ( ) { return 'fallback' ; }
13+
14+ if ( ( crypto && crypto . getRandomValues ) || null ) {
15+ input . handler = secureHandler ;
16+ } else {
17+ input . handler = fallbackHandler ;
18+ }
19+ return input ;
20+ }
21+
22+ export { requireInput as __require } ;
Original file line number Diff line number Diff line change 1+ var condition = typeof global !== 'undefined' && global . env && global . env . NODE_ENV ;
2+
3+ function prodHandler ( ) { return 'production' ; }
4+ function defaultHandler ( ) { return 'default' ; }
5+
6+ if ( condition || true ) {
7+ exports . handler = prodHandler ;
8+ } else {
9+ exports . handler = defaultHandler ;
10+ }
Original file line number Diff line number Diff line change 1+ import * as commonjsHelpers from "_commonjsHelpers.js" ;
2+ import { __exports as input } from "\u0000fixtures/form/conditional-exports-or-true/input.js?commonjs-exports" ;
3+
4+ var hasRequiredInput ;
5+
6+ function requireInput ( ) {
7+ if ( hasRequiredInput ) return input ;
8+ hasRequiredInput = 1 ;
9+ var condition = typeof commonjsHelpers . commonjsGlobal !== 'undefined' && commonjsHelpers . commonjsGlobal . env && commonjsHelpers . commonjsGlobal . env . NODE_ENV ;
10+
11+ function prodHandler ( ) { return 'production' ; }
12+ function defaultHandler ( ) { return 'default' ; }
13+
14+ if ( condition || true ) {
15+ input . handler = prodHandler ;
16+ } else {
17+ exports . handler = defaultHandler ;
18+ }
19+ return input ;
20+ }
21+
22+ export { requireInput as __require } ;
Original file line number Diff line number Diff line change 1+ var condition = typeof global !== 'undefined' && global . env && global . env . DEBUG ;
2+
3+ function enabledHandler ( ) { return 'enabled' ; }
4+ function disabledHandler ( ) { return 'disabled' ; }
5+
6+ if ( true || condition ) {
7+ exports . handler = enabledHandler ;
8+ } else {
9+ exports . handler = disabledHandler ;
10+ }
You can’t perform that action at this time.
0 commit comments