react/packages/shared
Sebastian Markbåge 60016c448b
Export React as Named Exports instead of CommonJS (#18106)
* Add options for forked entry points

We currently fork .fb.js entry points. This adds a few more options.

.modern.fb.js - experimental FB builds
.classic.fb.js - stable FB builds
.fb.js - if no other FB build, use this for FB builds
.experimental.js - experimental builds
.stable.js - stable builds
.js - used if no other override exists

This will be used to have different ES exports for different builds.

* Switch React to named exports

* Export named exports from the export point itself

We need to re-export the Flow exported types so we can use them in our code.

We don't want to use the Flow types from upstream since it doesn't have the non-public APIs that we have.

This should be able to use export * but I don't know why it doesn't work.

This actually enables Flow typing of React which was just "any" before.
This exposed some Flow errors that needs fixing.

* Create forks for the react entrypoint

None of our builds expose all exports and they all differ in at least one
way, so we need four forks.

* Set esModule flag to false

We don't want to emit the esModule compatibility flag on our CommonJS
output. For now we treat our named exports as if they're CommonJS.

This is a potentially breaking change for scheduler (but all those apis
are unstable), react-is and use-subscription. However, it seems unlikely
that anyone would rely on this since these only have named exports.

* Remove unused Feature Flags

* Let jest observe the stable fork for stable tests

This lets it do the negative test by ensuring that the right tests fail.

However, this in turn will make other tests that are not behind
__EXPERIMENTAL__ fail. So I need to do that next.

* Put all tests that depend on exports behind __EXPERIMENTAL__

Since there's no way to override the exports using feature flags
in .intern.js anymore we can't use these APIs in stable.

The tradeoff here is that we can either enable the negative tests on
"stable" that means experimental are expected to fail, or we can disable
tests on stable. This is unfortunate since some of these APIs now run on
a "stable" config at FB instead of the experimental.

* Switch ReactDOM to named exports

Same strategy as React.

I moved the ReactDOMFB runtime injection to classic.fb.js

Since we only fork the entrypoint, the `/testing` entrypoint needs to
be forked too to re-export the same things plus `act`. This is a bit
unfortunate. If it becomes a pattern we can consider forking in the
module resolution deeply.

fix flow

* Fix ReactDOM Flow Types

Now that ReactDOM is Flow type checked we need to fix up its types.

* Configure jest to use stable entry for ReactDOM in non-experimental

* Remove additional FeatureFlags that are no longer needed

These are only flagging the exports and no implementation details so we
can control them fully through the export overrides.
2020-02-25 13:54:27 -08:00
..
__tests__ Pass prod error messages directly to constructor (#17063) 2019-10-11 09:10:40 -07:00
forks Export React as Named Exports instead of CommonJS (#18106) 2020-02-25 13:54:27 -08:00
ExecutionEnvironment.js give `canUseDOM` with a possibility to be a constant (#14194) 2019-04-25 11:28:53 +01:00
HostConfigWithNoHydration.js Event Replaying (#16725) 2019-09-23 11:21:10 -07:00
HostConfigWithNoMutation.js Hide timed-out children instead of deleting them so their state is preserved (#13823) 2018-10-18 15:37:16 -07:00
HostConfigWithNoPersistence.js Adds experimental fundamental interface (#16049) 2019-07-19 22:20:28 +01:00
ReactDOMTypes.js Update Flow to 0.84 (#17805) 2020-01-09 14:50:44 +00:00
ReactElementType.js Update Flow to 0.84 (#17805) 2020-01-09 14:50:44 +00:00
ReactErrorUtils.js Drop the year from Facebook copyright headers and the LICENSE file. (#13593) 2018-09-07 15:11:23 -07:00
ReactFeatureFlags.js Export React as Named Exports instead of CommonJS (#18106) 2020-02-25 13:54:27 -08:00
ReactInstanceMap.js Drop the year from Facebook copyright headers and the LICENSE file. (#13593) 2018-09-07 15:11:23 -07:00
ReactLazyComponent.js Update Flow to 0.84 (#17805) 2020-01-09 14:50:44 +00:00
ReactPortal.js Drop the year from Facebook copyright headers and the LICENSE file. (#13593) 2018-09-07 15:11:23 -07:00
ReactRootTags.js Split ReactDOM entry point (#17331) 2019-11-10 13:43:29 +00:00
ReactSharedInternals.js Export React as Named Exports instead of CommonJS (#18106) 2020-02-25 13:54:27 -08:00
ReactSideEffectTags.js [Partial Hydration] Dispatching events should not work until hydration commits (#16532) 2019-08-22 08:46:20 -07:00
ReactSymbols.js Rename Chunks API to Blocks (#18086) 2020-02-20 23:56:40 -08:00
ReactTreeTraversal.js Drop the year from Facebook copyright headers and the LICENSE file. (#13593) 2018-09-07 15:11:23 -07:00
ReactTypes.js [react-interactions] Remove deprecated Scope APIs + update Focus components/docs (#17859) 2020-01-17 12:16:39 +00:00
ReactVersion.js update version numbers for 16.12 2019-11-14 16:02:18 -08:00
ReactWorkTags.js Rename Chunks API to Blocks (#18086) 2020-02-20 23:56:40 -08:00
consoleWithStackDev.js Fix missing stacks in WWW warnings (#17638) 2019-12-17 15:21:18 +00:00
createEventResponder.js [react-interactions] Add Portal propagation configuration (#16889) 2019-09-25 16:56:51 +02:00
createFundamentalComponent.js Adds experimental fundamental interface (#16049) 2019-07-19 22:20:28 +01:00
createScope.js [react-interactions] Modify Scope query mechanism (#17095) 2019-10-15 15:57:02 +02:00
describeComponentFrame.js Drop the year from Facebook copyright headers and the LICENSE file. (#13593) 2018-09-07 15:11:23 -07:00
endsWith.js [Flare] Revise responder event types (#16081) 2019-07-08 14:35:59 +01:00
enqueueTask.js make testing builds for React/ReactDOM (#17915) 2020-02-03 23:31:31 +00:00
formatProdErrorMessage.js Pass prod error messages directly to constructor (#17063) 2019-10-11 09:10:40 -07:00
getComponentName.js Rename Chunks API to Blocks (#18086) 2020-02-20 23:56:40 -08:00
hasBadMapPolyfill.js Adds experimental fundamental interface (#16049) 2019-07-19 22:20:28 +01:00
invariant.js Compile invariant directly to throw expressions (#15071) 2019-03-18 13:58:03 -07:00
invokeGuardedCallbackImpl.js fix spelling mistakes (#14805) 2019-02-09 16:43:49 -08:00
isTextInputElement.js Update Flow to 0.84 (#17805) 2020-01-09 14:50:44 +00:00
isValidElementType.js Rename Chunks API to Blocks (#18086) 2020-02-20 23:56:40 -08:00
objectIs.js Update to flow 0.97 (#17892) 2020-01-24 10:52:38 -08:00
package.json Drop Haste (#11303) 2017-10-25 02:55:00 +03:00
shallowEqual.js Separate Object.is polyfill (#14334) 2019-01-08 14:21:12 +00:00