aboutsummaryrefslogtreecommitdiff
path: root/node_modules/react/lib/React.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-08-14 05:01:11 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-08-14 05:02:09 +0200
commit363723fc84f7b8477592e0105aeb331ec9a017af (patch)
tree29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/react/lib/React.js
parent5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff)
node_modules
Diffstat (limited to 'node_modules/react/lib/React.js')
-rw-r--r--node_modules/react/lib/React.js62
1 files changed, 45 insertions, 17 deletions
diff --git a/node_modules/react/lib/React.js b/node_modules/react/lib/React.js
index 0d4b1dc09..ac0829ba6 100644
--- a/node_modules/react/lib/React.js
+++ b/node_modules/react/lib/React.js
@@ -12,23 +12,22 @@
var _assign = require('object-assign');
+var ReactBaseClasses = require('./ReactBaseClasses');
var ReactChildren = require('./ReactChildren');
-var ReactComponent = require('./ReactComponent');
-var ReactPureComponent = require('./ReactPureComponent');
-var ReactClass = require('./ReactClass');
var ReactDOMFactories = require('./ReactDOMFactories');
var ReactElement = require('./ReactElement');
var ReactPropTypes = require('./ReactPropTypes');
var ReactVersion = require('./ReactVersion');
+var createReactClass = require('./createClass');
var onlyChild = require('./onlyChild');
-var warning = require('fbjs/lib/warning');
var createElement = ReactElement.createElement;
var createFactory = ReactElement.createFactory;
var cloneElement = ReactElement.cloneElement;
if (process.env.NODE_ENV !== 'production') {
+ var lowPriorityWarning = require('./lowPriorityWarning');
var canDefineProperty = require('./canDefineProperty');
var ReactElementValidator = require('./ReactElementValidator');
var didWarnPropTypesDeprecated = false;
@@ -38,18 +37,27 @@ if (process.env.NODE_ENV !== 'production') {
}
var __spread = _assign;
+var createMixin = function (mixin) {
+ return mixin;
+};
if (process.env.NODE_ENV !== 'production') {
- var warned = false;
+ var warnedForSpread = false;
+ var warnedForCreateMixin = false;
__spread = function () {
- process.env.NODE_ENV !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0;
- warned = true;
+ lowPriorityWarning(warnedForSpread, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.');
+ warnedForSpread = true;
return _assign.apply(null, arguments);
};
+
+ createMixin = function (mixin) {
+ lowPriorityWarning(warnedForCreateMixin, 'React.createMixin is deprecated and should not be used. ' + 'In React v16.0, it will be removed. ' + 'You can use this mixin directly instead. ' + 'See https://fb.me/createmixin-was-never-implemented for more info.');
+ warnedForCreateMixin = true;
+ return mixin;
+ };
}
var React = {
-
// Modern
Children: {
@@ -60,8 +68,8 @@ var React = {
only: onlyChild
},
- Component: ReactComponent,
- PureComponent: ReactPureComponent,
+ Component: ReactBaseClasses.Component,
+ PureComponent: ReactBaseClasses.PureComponent,
createElement: createElement,
cloneElement: cloneElement,
@@ -70,12 +78,9 @@ var React = {
// Classic
PropTypes: ReactPropTypes,
- createClass: ReactClass.createClass,
+ createClass: createReactClass,
createFactory: createFactory,
- createMixin: function (mixin) {
- // Currently a noop. Will be used to validate and trace mixins.
- return mixin;
- },
+ createMixin: createMixin,
// This looks DOM specific but these are actually isomorphic helpers
// since they are just generating DOM strings.
@@ -87,17 +92,40 @@ var React = {
__spread: __spread
};
-// TODO: Fix tests so that this deprecation warning doesn't cause failures.
if (process.env.NODE_ENV !== 'production') {
+ var warnedForCreateClass = false;
if (canDefineProperty) {
Object.defineProperty(React, 'PropTypes', {
get: function () {
- process.env.NODE_ENV !== 'production' ? warning(didWarnPropTypesDeprecated, 'Accessing PropTypes via the main React package is deprecated. Use ' + 'the prop-types package from npm instead.') : void 0;
+ lowPriorityWarning(didWarnPropTypesDeprecated, 'Accessing PropTypes via the main React package is deprecated,' + ' and will be removed in React v16.0.' + ' Use the latest available v15.* prop-types package from npm instead.' + ' For info on usage, compatibility, migration and more, see ' + 'https://fb.me/prop-types-docs');
didWarnPropTypesDeprecated = true;
return ReactPropTypes;
}
});
+
+ Object.defineProperty(React, 'createClass', {
+ get: function () {
+ lowPriorityWarning(warnedForCreateClass, 'Accessing createClass via the main React package is deprecated,' + ' and will be removed in React v16.0.' + " Use a plain JavaScript class instead. If you're not yet " + 'ready to migrate, create-react-class v15.* is available ' + 'on npm as a temporary, drop-in replacement. ' + 'For more info see https://fb.me/react-create-class');
+ warnedForCreateClass = true;
+ return createReactClass;
+ }
+ });
}
+
+ // React.DOM factories are deprecated. Wrap these methods so that
+ // invocations of the React.DOM namespace and alert users to switch
+ // to the `react-dom-factories` package.
+ React.DOM = {};
+ var warnedForFactories = false;
+ Object.keys(ReactDOMFactories).forEach(function (factory) {
+ React.DOM[factory] = function () {
+ if (!warnedForFactories) {
+ lowPriorityWarning(false, 'Accessing factories like React.DOM.%s has been deprecated ' + 'and will be removed in v16.0+. Use the ' + 'react-dom-factories package instead. ' + ' Version 1.0 provides a drop-in replacement.' + ' For more info, see https://fb.me/react-dom-factories', factory);
+ warnedForFactories = true;
+ }
+ return ReactDOMFactories[factory].apply(ReactDOMFactories, arguments);
+ };
+ });
}
module.exports = React; \ No newline at end of file