Skip to content

Update reactjs version #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require 'pathname'
namespace :react do
task :update do
FileUtils.rm_f('vendor/react/.bower.json')
system('bower install react')
`bower install react`
assets_path = Pathname.new(File.dirname(__FILE__)).join('lib/assets/')
copy_react_asset('JSXTransformer.js', assets_path.join('javascripts/JSXTransformer.js'))
copy_react_asset('react.js', assets_path.join('react-source/development/react.js'))
Expand Down
29 changes: 3 additions & 26 deletions VERSIONS.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,21 @@
# Versions

There are three ways to control what version of React.js (and JSXTransformer) is used by `react-rails`:
You can control what version of React.js (and JSXTransformer) is used by `react-rails`:

- Use the [bundled version](#bundled-versions) that comes with the gem
- Specify a [react-source version](#react-source-version)
- [Drop in a copy](#drop-in-version) of React.js

## Bundled Versions

| Gem | React.js |
|----------|----------|
| master | ~> 0.13 |
| master | 0.13.3 |
| 1.0.0 | ~> 0.13 |
| 0.13.0.0 | 0.13.0 |
| 0.12.2.0 | 0.12.2 |
| 0.12.1.0 | 0.12.1 |
| 0.12.0.0 | 0.12.0 |


## React-Source Version

The [`react-source` gem](https://rubygems.org/gems/react-source) provides JS files to `react-rails`.

You can specify a React.js version by locking to a specific `react-source` in your Gemfile. For example:

```ruby
gem 'react-rails'
# always use React version 0.13.1:
gem 'react-source', '0.13.1'
```

## Drop-in Version

You can also provide your own copies of React.js and JSXTransformer. Just add `react.js` or `JSXTransformer.js` (case-sensitive) files in directories where `react-rails` expects to find them.

To use the _same version in all environments_, put files in `app/vendor/assets/react/`.

If you need _different versions in different environments_, put them in directories that match `config.react.variant`. For example, if you set `config.react.variant = :development`, you could put a copy of `react.js` in `app/vendor/assets/react/development/`.





You can also provide your own copies of React.js and JSXTransformer. Just add `react.js` or `JSXTransformer.js` (case-sensitive) files to the asset pipeline (eg, `app/assets/vendor/`).
2 changes: 1 addition & 1 deletion lib/assets/javascripts/JSXTransformer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* JSXTransformer v0.13.2
* JSXTransformer v0.13.3
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSXTransformer = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/**
Expand Down
98 changes: 71 additions & 27 deletions lib/assets/react-source/development-with-addons/react.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* React (with addons) v0.13.2
* React (with addons) v0.13.3
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/**
Expand Down Expand Up @@ -4485,7 +4485,7 @@ if ("production" !== "development") {
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
console.debug(
'Download the React DevTools for a better development experience: ' +
'http://fb.me/react-devtools'
'https://fb.me/react-devtools'
);
}
}
Expand All @@ -4512,15 +4512,15 @@ if ("production" !== "development") {
if (!expectedFeatures[i]) {
console.error(
'One or more ES5 shim/shams expected by React are not available: ' +
'http://fb.me/react-warning-polyfills'
'https://fb.me/react-warning-polyfills'
);
break;
}
}
}
}

React.version = '0.13.2';
React.version = '0.13.3';

module.exports = React;

Expand Down Expand Up @@ -6239,7 +6239,7 @@ var ReactClass = {
("production" !== "development" ? warning(
this instanceof Constructor,
'Something is calling a React component directly. Use a factory or ' +
'JSX instead. See: http://fb.me/react-legacyfactory'
'JSX instead. See: https://fb.me/react-legacyfactory'
) : null);
}

Expand Down Expand Up @@ -6449,20 +6449,38 @@ ReactComponent.prototype.forceUpdate = function(callback) {
*/
if ("production" !== "development") {
var deprecatedAPIs = {
getDOMNode: 'getDOMNode',
isMounted: 'isMounted',
replaceProps: 'replaceProps',
replaceState: 'replaceState',
setProps: 'setProps'
getDOMNode: [
'getDOMNode',
'Use React.findDOMNode(component) instead.'
],
isMounted: [
'isMounted',
'Instead, make sure to clean up subscriptions and pending requests in ' +
'componentWillUnmount to prevent memory leaks.'
],
replaceProps: [
'replaceProps',
'Instead call React.render again at the top level.'
],
replaceState: [
'replaceState',
'Refactor your code to use setState instead (see ' +
'https://github.com/facebook/react/issues/3236).'
],
setProps: [
'setProps',
'Instead call React.render again at the top level.'
]
};
var defineDeprecationWarning = function(methodName, displayName) {
var defineDeprecationWarning = function(methodName, info) {
try {
Object.defineProperty(ReactComponent.prototype, methodName, {
get: function() {
("production" !== "development" ? warning(
false,
'%s(...) is deprecated in plain JavaScript React classes.',
displayName
'%s(...) is deprecated in plain JavaScript React classes. %s',
info[0],
info[1]
) : null);
return undefined;
}
Expand Down Expand Up @@ -6856,6 +6874,7 @@ var ReactCompositeComponentMixin = {
this._pendingReplaceState = false;
this._pendingForceUpdate = false;

var childContext;
var renderedElement;

var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
Expand All @@ -6870,7 +6889,8 @@ var ReactCompositeComponentMixin = {
}
}

renderedElement = this._renderValidatedComponent();
childContext = this._getValidatedChildContext(context);
renderedElement = this._renderValidatedComponent(childContext);
} finally {
ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
}
Expand All @@ -6884,7 +6904,7 @@ var ReactCompositeComponentMixin = {
this._renderedComponent,
rootID,
transaction,
this._processChildContext(context)
this._mergeChildContext(context, childContext)
);
if (inst.componentDidMount) {
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
Expand Down Expand Up @@ -7014,7 +7034,7 @@ var ReactCompositeComponentMixin = {
* @return {object}
* @private
*/
_processChildContext: function(currentContext) {
_getValidatedChildContext: function(currentContext) {
var inst = this._instance;
var childContext = inst.getChildContext && inst.getChildContext();
if (childContext) {
Expand All @@ -7039,6 +7059,13 @@ var ReactCompositeComponentMixin = {
name
) : invariant(name in inst.constructor.childContextTypes));
}
return childContext;
}
return null;
},

_mergeChildContext: function(currentContext, childContext) {
if (childContext) {
return assign({}, currentContext, childContext);
}
return currentContext;
Expand Down Expand Up @@ -7298,6 +7325,10 @@ var ReactCompositeComponentMixin = {
return inst.state;
}

if (replace && queue.length === 1) {
return queue[0];
}

var nextState = assign({}, replace ? queue[0] : inst.state);
for (var i = replace ? 1 : 0; i < queue.length; i++) {
var partial = queue[i];
Expand Down Expand Up @@ -7367,13 +7398,14 @@ var ReactCompositeComponentMixin = {
_updateRenderedComponent: function(transaction, context) {
var prevComponentInstance = this._renderedComponent;
var prevRenderedElement = prevComponentInstance._currentElement;
var nextRenderedElement = this._renderValidatedComponent();
var childContext = this._getValidatedChildContext();
var nextRenderedElement = this._renderValidatedComponent(childContext);
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
ReactReconciler.receiveComponent(
prevComponentInstance,
nextRenderedElement,
transaction,
this._processChildContext(context)
this._mergeChildContext(context, childContext)
);
} else {
// These two IDs are actually the same! But nothing should rely on that.
Expand All @@ -7389,7 +7421,7 @@ var ReactCompositeComponentMixin = {
this._renderedComponent,
thisID,
transaction,
this._processChildContext(context)
this._mergeChildContext(context, childContext)
);
this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
}
Expand Down Expand Up @@ -7427,11 +7459,12 @@ var ReactCompositeComponentMixin = {
/**
* @private
*/
_renderValidatedComponent: function() {
_renderValidatedComponent: function(childContext) {
var renderedComponent;
var previousContext = ReactContext.current;
ReactContext.current = this._processChildContext(
this._currentElement._context
ReactContext.current = this._mergeChildContext(
this._currentElement._context,
childContext
);
ReactCurrentOwner.current = this;
try {
Expand Down Expand Up @@ -7796,6 +7829,7 @@ var ReactDOM = mapObject({

// SVG
circle: 'circle',
clipPath: 'clipPath',
defs: 'defs',
ellipse: 'ellipse',
g: 'g',
Expand Down Expand Up @@ -7945,11 +7979,13 @@ function assertValidProps(props) {
'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
) : invariant(props.children == null));
("production" !== "development" ? invariant(
props.dangerouslySetInnerHTML.__html != null,
typeof props.dangerouslySetInnerHTML === 'object' &&
'__html' in props.dangerouslySetInnerHTML,
'`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
'Please visit http://fb.me/react-invariant-dangerously-set-inner-html ' +
'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' +
'for more information.'
) : invariant(props.dangerouslySetInnerHTML.__html != null));
) : invariant(typeof props.dangerouslySetInnerHTML === 'object' &&
'__html' in props.dangerouslySetInnerHTML));
}
if ("production" !== "development") {
("production" !== "development" ? warning(
Expand Down Expand Up @@ -10741,7 +10777,7 @@ function warnAndMonitorForKeyUse(message, element, parentType) {

("production" !== "development" ? warning(
false,
message + '%s%s See http://fb.me/react-warning-keys for more information.',
message + '%s%s See https://fb.me/react-warning-keys for more information.',
parentOrOwnerAddendum,
childOwnerAddendum
) : null);
Expand Down Expand Up @@ -15256,6 +15292,7 @@ var ReactUpdates = _dereq_(100);
var SyntheticEvent = _dereq_(108);

var assign = _dereq_(29);
var emptyObject = _dereq_(130);

var topLevelTypes = EventConstants.topLevelTypes;

Expand Down Expand Up @@ -15597,6 +15634,9 @@ assign(
);

ReactShallowRenderer.prototype.render = function(element, context) {
if (!context) {
context = emptyObject;
}
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
this._render(element, transaction, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
Expand Down Expand Up @@ -15737,7 +15777,7 @@ for (eventType in topLevelTypes) {

module.exports = ReactTestUtils;

},{"100":100,"108":108,"16":16,"18":18,"21":21,"29":29,"31":31,"33":33,"43":43,"63":63,"65":65,"72":72,"73":73,"77":77}],96:[function(_dereq_,module,exports){
},{"100":100,"108":108,"130":130,"16":16,"18":18,"21":21,"29":29,"31":31,"33":33,"43":43,"63":63,"65":65,"72":72,"73":73,"77":77}],96:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
Expand Down Expand Up @@ -16782,6 +16822,7 @@ var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;

var SVGDOMPropertyConfig = {
Properties: {
clipPath: MUST_USE_ATTRIBUTE,
cx: MUST_USE_ATTRIBUTE,
cy: MUST_USE_ATTRIBUTE,
d: MUST_USE_ATTRIBUTE,
Expand Down Expand Up @@ -16827,6 +16868,7 @@ var SVGDOMPropertyConfig = {
y: MUST_USE_ATTRIBUTE
},
DOMAttributeNames: {
clipPath: 'clip-path',
fillOpacity: 'fill-opacity',
fontFamily: 'font-family',
fontSize: 'font-size',
Expand Down Expand Up @@ -19733,6 +19775,7 @@ var shouldWrap = {
// Force wrapping for SVG elements because if they get created inside a <div>,
// they will be initialized in the wrong namespace (and will not display).
'circle': true,
'clipPath': true,
'defs': true,
'ellipse': true,
'g': true,
Expand Down Expand Up @@ -19775,6 +19818,7 @@ var markupWrap = {
'th': trWrap,

'circle': svgWrap,
'clipPath': svgWrap,
'defs': svgWrap,
'ellipse': svgWrap,
'g': svgWrap,
Expand Down
Loading