Skip to content

Commit 5488d60

Browse files
author
Robert Mosolgo
committed
Merge pull request #309 from rmosolgo/update-reactjs-version
Update reactjs version
2 parents 79b8cf5 + e282c7b commit 5488d60

File tree

7 files changed

+155
-92
lines changed

7 files changed

+155
-92
lines changed

Rakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require 'pathname'
1010
namespace :react do
1111
task :update do
1212
FileUtils.rm_f('vendor/react/.bower.json')
13-
system('bower install react')
13+
`bower install react`
1414
assets_path = Pathname.new(File.dirname(__FILE__)).join('lib/assets/')
1515
copy_react_asset('JSXTransformer.js', assets_path.join('javascripts/JSXTransformer.js'))
1616
copy_react_asset('react.js', assets_path.join('react-source/development/react.js'))

VERSIONS.md

+3-26
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,21 @@
11
# Versions
22

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

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

98
## Bundled Versions
109

1110
| Gem | React.js |
1211
|----------|----------|
13-
| master | ~> 0.13 |
12+
| master | 0.13.3 |
1413
| 1.0.0 | ~> 0.13 |
1514
| 0.13.0.0 | 0.13.0 |
1615
| 0.12.2.0 | 0.12.2 |
1716
| 0.12.1.0 | 0.12.1 |
1817
| 0.12.0.0 | 0.12.0 |
1918

20-
21-
## React-Source Version
22-
23-
The [`react-source` gem](https://rubygems.org/gems/react-source) provides JS files to `react-rails`.
24-
25-
You can specify a React.js version by locking to a specific `react-source` in your Gemfile. For example:
26-
27-
```ruby
28-
gem 'react-rails'
29-
# always use React version 0.13.1:
30-
gem 'react-source', '0.13.1'
31-
```
32-
3319
## Drop-in Version
3420

35-
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.
36-
37-
To use the _same version in all environments_, put files in `app/vendor/assets/react/`.
38-
39-
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/`.
40-
41-
42-
43-
44-
21+
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/`).

lib/assets/javascripts/JSXTransformer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* JSXTransformer v0.13.2
2+
* JSXTransformer v0.13.3
33
*/
44
(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){
55
/**

lib/assets/react-source/development-with-addons/react.js

+71-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* React (with addons) v0.13.2
2+
* React (with addons) v0.13.3
33
*/
44
(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){
55
/**
@@ -4485,7 +4485,7 @@ if ("production" !== "development") {
44854485
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
44864486
console.debug(
44874487
'Download the React DevTools for a better development experience: ' +
4488-
'http://fb.me/react-devtools'
4488+
'https://fb.me/react-devtools'
44894489
);
44904490
}
44914491
}
@@ -4512,15 +4512,15 @@ if ("production" !== "development") {
45124512
if (!expectedFeatures[i]) {
45134513
console.error(
45144514
'One or more ES5 shim/shams expected by React are not available: ' +
4515-
'http://fb.me/react-warning-polyfills'
4515+
'https://fb.me/react-warning-polyfills'
45164516
);
45174517
break;
45184518
}
45194519
}
45204520
}
45214521
}
45224522

4523-
React.version = '0.13.2';
4523+
React.version = '0.13.3';
45244524

45254525
module.exports = React;
45264526

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

@@ -6449,20 +6449,38 @@ ReactComponent.prototype.forceUpdate = function(callback) {
64496449
*/
64506450
if ("production" !== "development") {
64516451
var deprecatedAPIs = {
6452-
getDOMNode: 'getDOMNode',
6453-
isMounted: 'isMounted',
6454-
replaceProps: 'replaceProps',
6455-
replaceState: 'replaceState',
6456-
setProps: 'setProps'
6452+
getDOMNode: [
6453+
'getDOMNode',
6454+
'Use React.findDOMNode(component) instead.'
6455+
],
6456+
isMounted: [
6457+
'isMounted',
6458+
'Instead, make sure to clean up subscriptions and pending requests in ' +
6459+
'componentWillUnmount to prevent memory leaks.'
6460+
],
6461+
replaceProps: [
6462+
'replaceProps',
6463+
'Instead call React.render again at the top level.'
6464+
],
6465+
replaceState: [
6466+
'replaceState',
6467+
'Refactor your code to use setState instead (see ' +
6468+
'https://github.com/facebook/react/issues/3236).'
6469+
],
6470+
setProps: [
6471+
'setProps',
6472+
'Instead call React.render again at the top level.'
6473+
]
64576474
};
6458-
var defineDeprecationWarning = function(methodName, displayName) {
6475+
var defineDeprecationWarning = function(methodName, info) {
64596476
try {
64606477
Object.defineProperty(ReactComponent.prototype, methodName, {
64616478
get: function() {
64626479
("production" !== "development" ? warning(
64636480
false,
6464-
'%s(...) is deprecated in plain JavaScript React classes.',
6465-
displayName
6481+
'%s(...) is deprecated in plain JavaScript React classes. %s',
6482+
info[0],
6483+
info[1]
64666484
) : null);
64676485
return undefined;
64686486
}
@@ -6856,6 +6874,7 @@ var ReactCompositeComponentMixin = {
68566874
this._pendingReplaceState = false;
68576875
this._pendingForceUpdate = false;
68586876

6877+
var childContext;
68596878
var renderedElement;
68606879

68616880
var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
@@ -6870,7 +6889,8 @@ var ReactCompositeComponentMixin = {
68706889
}
68716890
}
68726891

6873-
renderedElement = this._renderValidatedComponent();
6892+
childContext = this._getValidatedChildContext(context);
6893+
renderedElement = this._renderValidatedComponent(childContext);
68746894
} finally {
68756895
ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
68766896
}
@@ -6884,7 +6904,7 @@ var ReactCompositeComponentMixin = {
68846904
this._renderedComponent,
68856905
rootID,
68866906
transaction,
6887-
this._processChildContext(context)
6907+
this._mergeChildContext(context, childContext)
68886908
);
68896909
if (inst.componentDidMount) {
68906910
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
@@ -7014,7 +7034,7 @@ var ReactCompositeComponentMixin = {
70147034
* @return {object}
70157035
* @private
70167036
*/
7017-
_processChildContext: function(currentContext) {
7037+
_getValidatedChildContext: function(currentContext) {
70187038
var inst = this._instance;
70197039
var childContext = inst.getChildContext && inst.getChildContext();
70207040
if (childContext) {
@@ -7039,6 +7059,13 @@ var ReactCompositeComponentMixin = {
70397059
name
70407060
) : invariant(name in inst.constructor.childContextTypes));
70417061
}
7062+
return childContext;
7063+
}
7064+
return null;
7065+
},
7066+
7067+
_mergeChildContext: function(currentContext, childContext) {
7068+
if (childContext) {
70427069
return assign({}, currentContext, childContext);
70437070
}
70447071
return currentContext;
@@ -7298,6 +7325,10 @@ var ReactCompositeComponentMixin = {
72987325
return inst.state;
72997326
}
73007327

7328+
if (replace && queue.length === 1) {
7329+
return queue[0];
7330+
}
7331+
73017332
var nextState = assign({}, replace ? queue[0] : inst.state);
73027333
for (var i = replace ? 1 : 0; i < queue.length; i++) {
73037334
var partial = queue[i];
@@ -7367,13 +7398,14 @@ var ReactCompositeComponentMixin = {
73677398
_updateRenderedComponent: function(transaction, context) {
73687399
var prevComponentInstance = this._renderedComponent;
73697400
var prevRenderedElement = prevComponentInstance._currentElement;
7370-
var nextRenderedElement = this._renderValidatedComponent();
7401+
var childContext = this._getValidatedChildContext();
7402+
var nextRenderedElement = this._renderValidatedComponent(childContext);
73717403
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
73727404
ReactReconciler.receiveComponent(
73737405
prevComponentInstance,
73747406
nextRenderedElement,
73757407
transaction,
7376-
this._processChildContext(context)
7408+
this._mergeChildContext(context, childContext)
73777409
);
73787410
} else {
73797411
// These two IDs are actually the same! But nothing should rely on that.
@@ -7389,7 +7421,7 @@ var ReactCompositeComponentMixin = {
73897421
this._renderedComponent,
73907422
thisID,
73917423
transaction,
7392-
this._processChildContext(context)
7424+
this._mergeChildContext(context, childContext)
73937425
);
73947426
this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
73957427
}
@@ -7427,11 +7459,12 @@ var ReactCompositeComponentMixin = {
74277459
/**
74287460
* @private
74297461
*/
7430-
_renderValidatedComponent: function() {
7462+
_renderValidatedComponent: function(childContext) {
74317463
var renderedComponent;
74327464
var previousContext = ReactContext.current;
7433-
ReactContext.current = this._processChildContext(
7434-
this._currentElement._context
7465+
ReactContext.current = this._mergeChildContext(
7466+
this._currentElement._context,
7467+
childContext
74357468
);
74367469
ReactCurrentOwner.current = this;
74377470
try {
@@ -7796,6 +7829,7 @@ var ReactDOM = mapObject({
77967829

77977830
// SVG
77987831
circle: 'circle',
7832+
clipPath: 'clipPath',
77997833
defs: 'defs',
78007834
ellipse: 'ellipse',
78017835
g: 'g',
@@ -7945,11 +7979,13 @@ function assertValidProps(props) {
79457979
'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
79467980
) : invariant(props.children == null));
79477981
("production" !== "development" ? invariant(
7948-
props.dangerouslySetInnerHTML.__html != null,
7982+
typeof props.dangerouslySetInnerHTML === 'object' &&
7983+
'__html' in props.dangerouslySetInnerHTML,
79497984
'`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
7950-
'Please visit http://fb.me/react-invariant-dangerously-set-inner-html ' +
7985+
'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' +
79517986
'for more information.'
7952-
) : invariant(props.dangerouslySetInnerHTML.__html != null));
7987+
) : invariant(typeof props.dangerouslySetInnerHTML === 'object' &&
7988+
'__html' in props.dangerouslySetInnerHTML));
79537989
}
79547990
if ("production" !== "development") {
79557991
("production" !== "development" ? warning(
@@ -10741,7 +10777,7 @@ function warnAndMonitorForKeyUse(message, element, parentType) {
1074110777

1074210778
("production" !== "development" ? warning(
1074310779
false,
10744-
message + '%s%s See http://fb.me/react-warning-keys for more information.',
10780+
message + '%s%s See https://fb.me/react-warning-keys for more information.',
1074510781
parentOrOwnerAddendum,
1074610782
childOwnerAddendum
1074710783
) : null);
@@ -15256,6 +15292,7 @@ var ReactUpdates = _dereq_(100);
1525615292
var SyntheticEvent = _dereq_(108);
1525715293

1525815294
var assign = _dereq_(29);
15295+
var emptyObject = _dereq_(130);
1525915296

1526015297
var topLevelTypes = EventConstants.topLevelTypes;
1526115298

@@ -15597,6 +15634,9 @@ assign(
1559715634
);
1559815635

1559915636
ReactShallowRenderer.prototype.render = function(element, context) {
15637+
if (!context) {
15638+
context = emptyObject;
15639+
}
1560015640
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
1560115641
this._render(element, transaction, context);
1560215642
ReactUpdates.ReactReconcileTransaction.release(transaction);
@@ -15737,7 +15777,7 @@ for (eventType in topLevelTypes) {
1573715777

1573815778
module.exports = ReactTestUtils;
1573915779

15740-
},{"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){
15780+
},{"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){
1574115781
/**
1574215782
* Copyright 2013-2015, Facebook, Inc.
1574315783
* All rights reserved.
@@ -16782,6 +16822,7 @@ var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
1678216822

1678316823
var SVGDOMPropertyConfig = {
1678416824
Properties: {
16825+
clipPath: MUST_USE_ATTRIBUTE,
1678516826
cx: MUST_USE_ATTRIBUTE,
1678616827
cy: MUST_USE_ATTRIBUTE,
1678716828
d: MUST_USE_ATTRIBUTE,
@@ -16827,6 +16868,7 @@ var SVGDOMPropertyConfig = {
1682716868
y: MUST_USE_ATTRIBUTE
1682816869
},
1682916870
DOMAttributeNames: {
16871+
clipPath: 'clip-path',
1683016872
fillOpacity: 'fill-opacity',
1683116873
fontFamily: 'font-family',
1683216874
fontSize: 'font-size',
@@ -19733,6 +19775,7 @@ var shouldWrap = {
1973319775
// Force wrapping for SVG elements because if they get created inside a <div>,
1973419776
// they will be initialized in the wrong namespace (and will not display).
1973519777
'circle': true,
19778+
'clipPath': true,
1973619779
'defs': true,
1973719780
'ellipse': true,
1973819781
'g': true,
@@ -19775,6 +19818,7 @@ var markupWrap = {
1977519818
'th': trWrap,
1977619819

1977719820
'circle': svgWrap,
19821+
'clipPath': svgWrap,
1977819822
'defs': svgWrap,
1977919823
'ellipse': svgWrap,
1978019824
'g': svgWrap,

0 commit comments

Comments
 (0)