Files
react/addons/create-react-class/create-react-class.min.js
T
Flarnie Marchan 207f3ef457 Update minified version of 'create-react-class' (#9939)
**what is the change?:**
We ran the latest version of
`addons/create-react-class/create-react-class.js` through https://jscompress.com/

**why make this change?:**
The last corner case I'm thinking of is this:
 - The `createClass` deprecation warning never went out in 15.5, and is going out now for real in 15.6.
 - The `createClass` UMD build is broken for AMD/CommonJS, but we fixed it. But not for the minified version of the file.
 - If someone see the warning, and tries to use the UMD build, then it's going to be broken in some cases.
 - Since we're skipping mentioning the add-ons in the blog post, and this might be a new warning for them, this could be a nasty surprise for folks.

We can do a quick 15.5.4 release of that package, we would at least fix that case.

This diverges from what @gaearon is doing to fix the add-ons. I would
probably try to use cherry-pick and interactive rebase to move this
commit to right after
https://github.com/facebook/react/commit/ce3ecfb1dfaacb311fb4b37eede56c2667014cfc
and then do the patch release of `create-react-class` from that spot in
history.

Alternately I can merge this into the forked branch
`15.6-before-addon-reconstruction` and then do the patch release from
there.

**test plan:**
I didn't test this. Ideally minifying this file won't break anything,
and it's high cost to test add-ons until we have some repeatable tests
in place.

**issue:**
https://github.com/facebook/react/issues/9765
2017-06-12 16:41:59 -07:00

1 line
10 KiB
JavaScript

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var e;if(void 0===(e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).React)throw Error("React module should be required before createClass");e.createReactClass=t(e.React)}}(function(t){return function t(e,n,o){function r(a,s){if(!n[a]){if(!e[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var p=n[a]={exports:{}};e[a][0].call(p.exports,function(t){var n=e[a][1][t];return r(n||t)},p,p.exports,t,e,n,o)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<o.length;a++)r(o[a]);return r}({1:[function(t,e,n){"use strict";function o(t){return t}function r(t,e,n){function r(t,e,n){for(var o in e)e.hasOwnProperty(o)&&u("function"==typeof e[o],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",t.displayName||"ReactClass",i[n],o)}function l(t,e){var n=_.hasOwnProperty(e)?_[e]:null;w.hasOwnProperty(e)&&c("OVERRIDE_BASE"===n,"ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.",e),t&&c("DEFINE_MANY"===n||"DEFINE_MANY_MERGED"===n,"ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",e)}function f(t,n){if(!n){var o=typeof n;return void u("object"===o&&null!==n,"%s: You're attempting to include a mixin that is either null or not an object. Check the mixins included by the component, as well as any mixins they include themselves. Expected object but got %s.",t.displayName||"ReactClass",null===n?null:o)}c("function"!=typeof n,"ReactClass: You're attempting to use a component class or function as a mixin. Instead, just use a regular object."),c(!e(n),"ReactClass: You're attempting to use a component as a mixin. Instead, just use a regular object.");var r=t.prototype,i=r.__reactAutoBindPairs;n.hasOwnProperty(p)&&N.mixins(t,n.mixins);for(var a in n)if(n.hasOwnProperty(a)&&a!==p){var s=n[a],f=r.hasOwnProperty(a);if(l(f,a),N.hasOwnProperty(a))N[a](t,s);else{var d=_.hasOwnProperty(a);if("function"==typeof s&&!d&&!f&&!1!==n.autobind)i.push(a,s),r[a]=s;else if(f){var m=_[a];c(d&&("DEFINE_MANY_MERGED"===m||"DEFINE_MANY"===m),"ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.",m,a),"DEFINE_MANY_MERGED"===m?r[a]=h(r[a],s):"DEFINE_MANY"===m&&(r[a]=y(r[a],s))}else r[a]=s,"function"==typeof s&&n.displayName&&(r[a].displayName=n.displayName+"_"+a)}}}function d(t,e){if(e)for(var n in e){var o=e[n];e.hasOwnProperty(n)&&(c(!(n in N),'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.',n),c(!(n in t),"ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",n),t[n]=o)}}function m(t,e){c(t&&e&&"object"==typeof t&&"object"==typeof e,"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.");for(var n in e)e.hasOwnProperty(n)&&(c(void 0===t[n],"mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.",n),t[n]=e[n]);return t}function h(t,e){return function(){var n=t.apply(this,arguments),o=e.apply(this,arguments);if(null==n)return o;if(null==o)return n;var r={};return m(r,n),m(r,o),r}}function y(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function g(t,e){var n=e.bind(t);n.__reactBoundContext=t,n.__reactBoundMethod=e,n.__reactBoundArguments=null;var o=t.constructor.displayName,r=n.bind;return n.bind=function(i){for(var a=arguments.length,s=Array(a>1?a-1:0),c=1;c<a;c++)s[c-1]=arguments[c];if(i!==t&&null!==i)u(!1,"bind(): React component methods may only be bound to the component instance. See %s",o);else if(!s.length)return u(!1,"bind(): You are binding a component method to the component. React does this for you automatically in a high-performance way, so you can safely remove this call. See %s",o),n;var p=r.apply(n,arguments);return p.__reactBoundContext=t,p.__reactBoundMethod=e,p.__reactBoundArguments=s,p},n}function E(t){for(var e=t.__reactAutoBindPairs,n=0;n<e.length;n+=2){var o=e[n],r=e[n+1];t[o]=g(t,r)}}function v(t){var e=o(function(t,o,r){u(this instanceof e,"Something is calling a React component directly. Use a factory or JSX instead. See: https://fb.me/react-legacyfactory"),this.__reactAutoBindPairs.length&&E(this),this.props=t,this.context=o,this.refs=s,this.updater=r||n,this.state=null;var i=this.getInitialState?this.getInitialState():null;void 0===i&&this.getInitialState._isMockFunction&&(i=null),c("object"==typeof i&&!Array.isArray(i),"%s.getInitialState(): must return an object or null",e.displayName||"ReactCompositeComponent"),this.state=i});e.prototype=new x,e.prototype.constructor=e,e.prototype.__reactAutoBindPairs=[],b.forEach(f.bind(null,e)),f(e,D),f(e,t),e.getDefaultProps&&(e.defaultProps=e.getDefaultProps()),e.getDefaultProps&&(e.getDefaultProps.isReactClassApproved={}),e.prototype.getInitialState&&(e.prototype.getInitialState.isReactClassApproved={}),c(e.prototype.render,"createClass(...): Class specification must implement a `render` method."),u(!e.prototype.componentShouldUpdate,"%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.",t.displayName||"A component"),u(!e.prototype.componentWillRecieveProps,"%s has a method called componentWillRecieveProps(). Did you mean componentWillReceiveProps()?",t.displayName||"A component");for(var r in _)e.prototype[r]||(e.prototype[r]=null);return e}var b=[],_={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},N={displayName:function(t,e){t.displayName=e},mixins:function(t,e){if(e)for(var n=0;n<e.length;n++)f(t,e[n])},childContextTypes:function(t,e){r(t,e,"childContext"),t.childContextTypes=a({},t.childContextTypes,e)},contextTypes:function(t,e){r(t,e,"context"),t.contextTypes=a({},t.contextTypes,e)},getDefaultProps:function(t,e){t.getDefaultProps?t.getDefaultProps=h(t.getDefaultProps,e):t.getDefaultProps=e},propTypes:function(t,e){r(t,e,"prop"),t.propTypes=a({},t.propTypes,e)},statics:function(t,e){d(t,e)},autobind:function(){}},D={componentDidMount:function(){this.__isMounted=!0},componentWillUnmount:function(){this.__isMounted=!1}},w={replaceState:function(t,e){this.updater.enqueueReplaceState(this,t,e)},isMounted:function(){return u(this.__didWarnIsMounted,"%s: isMounted is deprecated. Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks.",this.constructor&&this.constructor.displayName||this.name||"Component"),this.__didWarnIsMounted=!0,!!this.__isMounted}},x=function(){};return a(x.prototype,t.prototype,w),v}var i,a=t("object-assign"),s=t("fbjs/lib/emptyObject"),c=t("fbjs/lib/invariant"),u=t("fbjs/lib/warning"),p="mixins";i={prop:"prop",context:"context",childContext:"child context"},e.exports=r},{"fbjs/lib/emptyObject":4,"fbjs/lib/invariant":5,"fbjs/lib/warning":6,"object-assign":7}],2:[function(e,n,o){"use strict";var r=e("./factory"),i=(new t.Component).updater;n.exports=r(t.Component,t.isValidElement,i)},{"./factory":1}],3:[function(t,e,n){"use strict";function o(t){return function(){return t}}var r=function(){};r.thatReturns=o,r.thatReturnsFalse=o(!1),r.thatReturnsTrue=o(!0),r.thatReturnsNull=o(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(t){return t},e.exports=r},{}],4:[function(t,e,n){"use strict";var o={};Object.freeze(o),e.exports=o},{}],5:[function(t,e,n){"use strict";function o(t,e,n,o,i,a,s,c){if(r(e),!t){var u;if(void 0===e)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,o,i,a,s,c],l=0;(u=new Error(e.replace(/%s/g,function(){return p[l++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}}var r=function(t){};r=function(t){if(void 0===t)throw new Error("invariant requires an error message argument")},e.exports=o},{}],6:[function(t,e,n){"use strict";var o=t("./emptyFunction");!function(){var t=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),o=1;o<e;o++)n[o-1]=arguments[o];var r=0,i="Warning: "+t.replace(/%s/g,function(){return n[r++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(t){}};o=function(e,n){if(void 0===n)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==n.indexOf("Failed Composite propType: ")&&!e){for(var o=arguments.length,r=Array(o>2?o-2:0),i=2;i<o;i++)r[i-2]=arguments[i];t.apply(void 0,[n].concat(r))}}}(),e.exports=o},{"./emptyFunction":3}],7:[function(t,e,n){"use strict";function o(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,s,c=o(t),u=1;u<arguments.length;u++){n=Object(arguments[u]);for(var p in n)i.call(n,p)&&(c[p]=n[p]);if(r){s=r(n);for(var l=0;l<s.length;l++)a.call(n,s[l])&&(c[s[l]]=n[s[l]])}}return c}},{}]},{},[2])(2)});