react/scripts/jest
Dan Abramov 46f7b0d945
Fix dead code elimination for feature flags (#11453)
* Fix dead code elimination for feature flags

Turning flags into named exports fixes dead code elimination.

This required some restructuring of how we verify that flag types match up. I used the Check<> trick combined with import typeof, as suggested by @calebmer.

For www, we can no longer re-export `require('ReactFeatureFlags')` directly, and instead destructure it. This means flags have to be known at init time. This is already the case so it's not a problem. In fact it may be better since it removes extra property access in tight paths.

For things that we *want* to be dynamic on www (currently, only performance flag) we can export a function to toggle it, and then put it on the secret exports. In fact this is better than just letting everyone mutate the flag at arbitrary times since we can provide, e.g., a ref counting interface to it.

* Record sizes
2017-11-06 14:14:48 +00:00
..
environment.js Convert current build system to Rollup and adopt flat bundles (#9327) 2017-04-05 16:47:29 +01:00
jest.d.ts Upgrade to jest-cli@0.9 and use Jasmine2 2016-05-25 21:48:32 +01:00
preprocessor.js Convert the Source to ES Modules (#11389) 2017-11-02 19:50:03 +00:00
setup.js Fix dead code elimination for feature flags (#11453) 2017-11-06 14:14:48 +00:00
setupSpecEquivalenceReporter.js Update license headers BSD+Patents -> MIT 2017-09-25 18:17:44 -07:00
test-framework-setup.js Deterministic updates (#10715) 2017-10-13 17:21:25 -07:00
ts-preprocessor.js Prettier 1.2 (#9462) 2017-04-20 11:18:33 -07:00