diff --git a/scripts/rollup/forwarding/EventPluginHub.js b/scripts/rollup/forwarding/EventPluginHub.js new file mode 100644 index 0000000000..40d1fe1162 --- /dev/null +++ b/scripts/rollup/forwarding/EventPluginHub.js @@ -0,0 +1,19 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule EventPluginHub + * @flow + */ + +'use strict'; + +const { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, +} = require('ReactDOM-fb'); + +module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.EventPluginHub; diff --git a/scripts/rollup/forwarding/PooledClass.js b/scripts/rollup/forwarding/PooledClass.js new file mode 100644 index 0000000000..565c9c362b --- /dev/null +++ b/scripts/rollup/forwarding/PooledClass.js @@ -0,0 +1,19 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule PooledClass + * @flow + */ + +'use strict'; + +const { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, +} = require('ReactDOM-fb'); + +module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.PooledClass; diff --git a/scripts/rollup/forwarding/ReactDOMComponentTree.js b/scripts/rollup/forwarding/ReactDOMComponentTree.js new file mode 100644 index 0000000000..afb20bfec1 --- /dev/null +++ b/scripts/rollup/forwarding/ReactDOMComponentTree.js @@ -0,0 +1,19 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ReactDOMComponentTree + * @flow + */ + +'use strict'; + +const { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, +} = require('ReactDOM-fb'); + +module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactDOMComponentTree; diff --git a/scripts/rollup/forwarding/ReactDOMInputSelection.js b/scripts/rollup/forwarding/ReactDOMInputSelection.js new file mode 100644 index 0000000000..40f4557719 --- /dev/null +++ b/scripts/rollup/forwarding/ReactDOMInputSelection.js @@ -0,0 +1,19 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ReactDOMInputSelection + * @flow + */ + +'use strict'; + +const { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, +} = require('ReactDOM-fb'); + +module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactDOMInputSelection; diff --git a/scripts/rollup/forwarding/ReactDOMSelection.js b/scripts/rollup/forwarding/ReactDOMSelection.js new file mode 100644 index 0000000000..5154cb9874 --- /dev/null +++ b/scripts/rollup/forwarding/ReactDOMSelection.js @@ -0,0 +1,19 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ReactDOMSelection + * @flow + */ + +'use strict'; + +const { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, +} = require('ReactDOM-fb'); + +module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactDOMSelection; diff --git a/scripts/rollup/forwarding/SyntheticKeyboardEvent.js b/scripts/rollup/forwarding/SyntheticKeyboardEvent.js new file mode 100644 index 0000000000..4ca0db871c --- /dev/null +++ b/scripts/rollup/forwarding/SyntheticKeyboardEvent.js @@ -0,0 +1,19 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule SyntheticKeyboardEvent + * @flow + */ + +'use strict'; + +const { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, +} = require('ReactDOM-fb'); + +module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SyntheticKeyboardEvent; diff --git a/scripts/rollup/forwarding/SyntheticMouseEvent.js b/scripts/rollup/forwarding/SyntheticMouseEvent.js new file mode 100644 index 0000000000..97e42801af --- /dev/null +++ b/scripts/rollup/forwarding/SyntheticMouseEvent.js @@ -0,0 +1,19 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule SyntheticMouseEvent + * @flow + */ + +'use strict'; + +const { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, +} = require('ReactDOM-fb'); + +module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SyntheticMouseEvent; diff --git a/scripts/rollup/forwarding/adler32.js b/scripts/rollup/forwarding/adler32.js new file mode 100644 index 0000000000..fee1f09b01 --- /dev/null +++ b/scripts/rollup/forwarding/adler32.js @@ -0,0 +1,19 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule adler32 + * @flow + */ + +'use strict'; + +const { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, +} = require('ReactDOM-fb'); + +module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.adler32; diff --git a/scripts/rollup/forwarding/findDOMNode.js b/scripts/rollup/forwarding/findDOMNode.js new file mode 100644 index 0000000000..d1efcd3054 --- /dev/null +++ b/scripts/rollup/forwarding/findDOMNode.js @@ -0,0 +1,19 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule findDOMNode + * @flow + */ + +'use strict'; + +const { + findDOMNode, +} = require('ReactDOM-fb'); + +module.exports = findDOMNode; diff --git a/scripts/rollup/forwarding/getEventKey.js b/scripts/rollup/forwarding/getEventKey.js new file mode 100644 index 0000000000..44a0377b5d --- /dev/null +++ b/scripts/rollup/forwarding/getEventKey.js @@ -0,0 +1,19 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule getEventKey + * @flow + */ + +'use strict'; + +const { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, +} = require('ReactDOM-fb'); + +module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.getEventKey; diff --git a/scripts/rollup/forwarding/getEventTarget.js b/scripts/rollup/forwarding/getEventTarget.js new file mode 100644 index 0000000000..37bb87693c --- /dev/null +++ b/scripts/rollup/forwarding/getEventTarget.js @@ -0,0 +1,19 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule getEventTarget + * @flow + */ + +'use strict'; + +const { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, +} = require('ReactDOM-fb'); + +module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.getEventTarget; diff --git a/scripts/rollup/forwarding/onlyChild.js b/scripts/rollup/forwarding/onlyChild.js index 229bb1a0a5..7b8a6f9b2f 100644 --- a/scripts/rollup/forwarding/onlyChild.js +++ b/scripts/rollup/forwarding/onlyChild.js @@ -10,30 +10,6 @@ */ 'use strict'; -var { isValidElement } = require('React-fb'); +var { Children } = require('React-fb'); -var invariant = require('invariant'); - -/** - * Returns the first child in a collection of children and verifies that there - * is only one child in the collection. - * - * See https://facebook.github.io/react/docs/react-api.html#react.children.only - * - * The current implementation of this function assumes that a single child gets - * passed without a wrapper, but the purpose of this helper function is to - * abstract away the particular structure of children. - * - * @param {?object} children Child collection structure. - * @return {ReactElement} The first and only `ReactElement` contained in the - * structure. - */ -function onlyChild(children) { - invariant( - isValidElement(children), - 'React.Children.only expected to receive a single React element child.' - ); - return children; -} - -module.exports = onlyChild; +module.exports = Children.only; diff --git a/scripts/rollup/forwarding/setInnerHTML.js b/scripts/rollup/forwarding/setInnerHTML.js new file mode 100644 index 0000000000..360310cb1d --- /dev/null +++ b/scripts/rollup/forwarding/setInnerHTML.js @@ -0,0 +1,19 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule setInnerHTML + * @flow + */ + +'use strict'; + +const { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, +} = require('ReactDOM-fb'); + +module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.setInnerHTML; diff --git a/scripts/rollup/forwarding/setTextContent.js b/scripts/rollup/forwarding/setTextContent.js new file mode 100644 index 0000000000..2b47f8b5e8 --- /dev/null +++ b/scripts/rollup/forwarding/setTextContent.js @@ -0,0 +1,19 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule setTextContent + * @flow + */ + +'use strict'; + +const { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, +} = require('ReactDOM-fb'); + +module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.setTextContent; diff --git a/src/fb/ReactDOMFBEntry.js b/src/fb/ReactDOMFBEntry.js index 179293230d..df0775f2fc 100644 --- a/src/fb/ReactDOMFBEntry.js +++ b/src/fb/ReactDOMFBEntry.js @@ -15,12 +15,26 @@ var React = require('React'); var ReactDOM = require('ReactDOM'); ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { - ReactBrowserEventEmitter: require('ReactBrowserEventEmitter'), + // These should be easy to copy into react_contrib and remove from here: + adler32: require('adler32'), getVendorPrefixedEventName: require('getVendorPrefixedEventName'), getEventCharCode: require('getEventCharCode'), - ReactInputSelection: require('ReactInputSelection'), + getEventKey: require('getEventKey'), + getEventTarget: require('getEventTarget'), isEventSupported: require('isEventSupported'), + setInnerHTML: require('setInnerHTML'), + setTextContent: require('setTextContent'), + PooledClass: require('PooledClass'), + // These are mostly used in incorrect Flow typings and are codemoddable: SyntheticEvent: require('SyntheticEvent'), + SyntheticKeyboardEvent: require('SyntheticKeyboardEvent'), + SyntheticMouseEvent: require('SyntheticMouseEvent'), + // These are real internal dependencies that are trickier to remove: + EventPluginHub: require('EventPluginHub'), + ReactBrowserEventEmitter: require('ReactBrowserEventEmitter'), + ReactDOMComponentTree: require('ReactDOMComponentTree'), + ReactDOMSelection: require('ReactDOMSelection'), + ReactInputSelection: require('ReactInputSelection'), ReactInstanceMap: require('react-dom/lib/ReactInstanceMap'), }; diff --git a/src/fb/ReactDOMFiberFBEntry.js b/src/fb/ReactDOMFiberFBEntry.js index 9cca7dfb05..fd90aa3a09 100644 --- a/src/fb/ReactDOMFiberFBEntry.js +++ b/src/fb/ReactDOMFiberFBEntry.js @@ -14,12 +14,26 @@ var ReactDOMFiber = require('ReactDOMFiber'); ReactDOMFiber.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { - ReactBrowserEventEmitter: require('ReactBrowserEventEmitter'), + // These should be easy to copy into react_contrib and remove from here: + adler32: require('adler32'), getVendorPrefixedEventName: require('getVendorPrefixedEventName'), getEventCharCode: require('getEventCharCode'), - ReactInputSelection: require('ReactInputSelection'), + getEventKey: require('getEventKey'), + getEventTarget: require('getEventTarget'), isEventSupported: require('isEventSupported'), + setInnerHTML: require('setInnerHTML'), + setTextContent: require('setTextContent'), + PooledClass: require('PooledClass'), + // These are mostly used in incorrect Flow typings and are codemoddable: SyntheticEvent: require('SyntheticEvent'), + SyntheticKeyboardEvent: require('SyntheticKeyboardEvent'), + SyntheticMouseEvent: require('SyntheticMouseEvent'), + // These are real internal dependencies that are trickier to remove: + EventPluginHub: require('EventPluginHub'), + ReactBrowserEventEmitter: require('ReactBrowserEventEmitter'), + ReactDOMComponentTree: require('ReactDOMComponentTree'), + ReactDOMSelection: require('ReactDOMSelection'), + ReactInputSelection: require('ReactInputSelection'), ReactInstanceMap: require('react-dom/lib/ReactInstanceMap'), };