@samitouri / QOS-React-2 / commits / 34e4352cba

Delete addons (#9209)

* Delete addons * Remove ReactFragment dependency from tests * Remove addons testing from fixtures * Don't mention createFragment() in a warning * Address feedback * Remove unused variables * Remove mention of deleted file * Add a missing key to the test * Fix lint

Dan Abramov committed Mar 20, 2017 at 16:15 UTC 34e4352cba3bbba0a5afd5b826cc0f91e33318bc
70 files changed +88 -3768
.travis.yml
-2
@@ -63,8 +63,6 @@ script:
63 curl \
64 -F "react=@build/react.js" \
65 -F "react.min=@build/react.min.js" \
66 - -F "react-with-addons=@build/react-with-addons.js" \
67 - -F "react-with-addons.min=@build/react-with-addons.min.js" \
66 -F "react-dom=@build/react-dom.js" \
67 -F "react-dom.min=@build/react-dom.min.js" \
68 -F "react-dom-server=@build/react-dom-server.js" \
Gruntfile.js
-16
@@ -84,10 +84,6 @@ module.exports = function(grunt) {
84 grunt.registerTask('npm-react-native:release', npmReactNativeTasks.buildRelease);
85 grunt.registerTask('npm-react-native:pack', npmReactNativeTasks.packRelease);
86
87 - var npmReactAddonsTasks = require('./grunt/tasks/npm-react-addons');
88 - grunt.registerTask('npm-react-addons:release', npmReactAddonsTasks.buildReleases);
89 - grunt.registerTask('npm-react-addons:pack', npmReactAddonsTasks.packReleases);
90 -
87 var npmReactTestRendererTasks = require('./grunt/tasks/npm-react-test');
88 grunt.registerTask('npm-react-test:release', npmReactTestRendererTasks.buildRelease);
89 grunt.registerTask('npm-react-test:pack', npmReactTestRendererTasks.packRelease);
@@ -106,19 +102,11 @@ module.exports = function(grunt) {
102 'version-check',
103 'browserify:basic',
104 ]);
109 - grunt.registerTask('build:addons', [
110 - 'build-modules',
111 - 'browserify:addons',
112 - ]);
105 grunt.registerTask('build:min', [
106 'build-modules',
107 'version-check',
108 'browserify:min',
109 ]);
118 - grunt.registerTask('build:addons-min', [
119 - 'build-modules',
120 - 'browserify:addonsMin',
121 - ]);
110 grunt.registerTask('build:dom', [
111 'build-modules',
112 'version-check',
@@ -169,9 +157,7 @@ module.exports = function(grunt) {
157 'build-modules',
158 'version-check',
159 'browserify:basic',
172 - 'browserify:addons',
160 'browserify:min',
174 - 'browserify:addonsMin',
161 'browserify:dom',
162 'browserify:domMin',
163 'browserify:domServer',
@@ -184,8 +170,6 @@ module.exports = function(grunt) {
170 'npm-react-dom:pack',
171 'npm-react-native:release',
172 'npm-react-native:pack',
187 - 'npm-react-addons:release',
188 - 'npm-react-addons:pack',
173 'npm-react-test:release',
174 'npm-react-test:pack',
175 'npm-react-noop:release',
docs/Rakefile
-2
@@ -37,8 +37,6 @@ task :update_hashes do
37 map = {
38 'react.js' => 'dev',
39 'react.min.js' => 'prod',
40 - 'react-with-addons.js' => 'addons_dev',
41 - 'react-with-addons.min.js' => 'addons_prod',
40 'react-dom.js' => 'dom_dev',
41 'react-dom.min.js' => 'dom_prod',
42 'react-dom-server.js' => 'dom_server_dev',
fixtures/packaging/README.md
+2 -2
@@ -6,7 +6,7 @@ If you use React you don't need to worry about it.
6 These fixtures verify that the built React distributions are usable in different environments.
7 **They are not running automatically.** (At least not yet, feel free to contribute to automate them.)
8
9 -Run them when you make changes to how we package React, ReactDOM, and addons.
9 +Run them when you make changes to how we package React and ReactDOM.
10
11 ## How to Run
12
@@ -46,5 +46,5 @@ open http://localhost:9000/fixtures/webpack-alias/index.html
46
47 You should see two things:
48
49 -* "Hello World" fading in with an animation.
49 +* "Hello World" is rendered.
50 * No errors in the console.
fixtures/packaging/browserify/index.html
-10
@@ -1,15 +1,5 @@
1 <html>
2 <body>
3 - <style>
4 - .example-appear {
5 - opacity: 0.01;
6 - }
7 -
8 - .example-appear.example-appear-active {
9 - opacity: 1;
10 - transition: opacity .5s ease-in;
11 - }
12 - </style>
3 <div id="container"></div>
4 <script src="output.js"></script>
5 </body>
fixtures/packaging/browserify/input.js
+1 -10
@@ -1,16 +1,7 @@
1 var React = require('react');
2 -var CSSTransitionGroup = require('react-addons-css-transition-group');
2 var ReactDOM = require('react-dom');
3
4 ReactDOM.render(
6 - React.createElement(CSSTransitionGroup, {
7 - transitionName: 'example',
8 - transitionAppear: true,
9 - transitionAppearTimeout: 500,
10 - transitionEnterTimeout: 0,
11 - transitionLeaveTimeout: 0,
12 - }, React.createElement('h1', null,
13 - 'Hello World!'
14 - )),
5 + React.createElement('h1', null, 'Hello World!'),
6 document.getElementById('container')
7 );
fixtures/packaging/brunch/app/initialize.js
+1 -10
@@ -1,16 +1,7 @@
1 var React = require('react');
2 -var CSSTransitionGroup = require('react-addons-css-transition-group');
2 var ReactDOM = require('react-dom');
3
4 ReactDOM.render(
6 - React.createElement(CSSTransitionGroup, {
7 - transitionName: 'example',
8 - transitionAppear: true,
9 - transitionAppearTimeout: 500,
10 - transitionEnterTimeout: 0,
11 - transitionLeaveTimeout: 0,
12 - }, React.createElement('h1', null,
13 - 'Hello World!'
14 - )),
5 + React.createElement('h1', null, 'Hello World!'),
6 document.getElementById('container')
7 );
fixtures/packaging/brunch/index.html
-10
@@ -1,15 +1,5 @@
1 <html>
2 <body>
3 - <style>
4 - .example-appear {
5 - opacity: 0.01;
6 - }
7 -
8 - .example-appear.example-appear-active {
9 - opacity: 1;
10 - transition: opacity .5s ease-in;
11 - }
12 - </style>
3 <div id="container"></div>
4 <script src="output.js"></script>
5 <script>require('initialize');</script>
fixtures/packaging/brunch/input.js
+1 -10
@@ -1,16 +1,7 @@
1 var React = require('react');
2 -var CSSTransitionGroup = require('react-addons-css-transition-group');
2 var ReactDOM = require('react-dom');
3
4 ReactDOM.render(
6 - React.createElement(CSSTransitionGroup, {
7 - transitionName: 'example',
8 - transitionAppear: true,
9 - transitionAppearTimeout: 500,
10 - transitionEnterTimeout: 0,
11 - transitionLeaveTimeout: 0,
12 - }, React.createElement('h1', null,
13 - 'Hello World!'
14 - )),
5 + React.createElement('h1', null, 'Hello World!'),
6 document.getElementById('container')
7 );
fixtures/packaging/brunch/package.json
+1 -1
@@ -5,6 +5,6 @@
5 "javascript-brunch": "^2.0.0"
6 },
7 "scripts": {
8 - "build": "rm -rf public && ln -fs ../../../../build/packages/react node_modules/react && ln -fs ../../../../build/packages/react-dom node_modules/react-dom && ln -fs ../../../../build/packages/react-addons-css-transition-group node_modules/react-addons-css-transition-group && brunch build"
8 + "build": "rm -rf public && ln -fs ../../../../build/packages/react node_modules/react && ln -fs ../../../../build/packages/react-dom node_modules/react-dom && brunch build"
9 }
10 }
\ No newline at end of file
fixtures/packaging/globals.html
+2 -21
@@ -1,30 +1,11 @@
1 <html>
2 <body>
3 - <script src="../../build/react-with-addons.js"></script>
3 + <script src="../../build/react.js"></script>
4 <script src="../../build/react-dom.js"></script>
5 - <style>
6 - .example-appear {
7 - opacity: 0.01;
8 - }
9 -
10 - .example-appear.example-appear-active {
11 - opacity: 1;
12 - transition: opacity .5s ease-in;
13 - }
14 - </style>
5 <div id="container"></div>
6 <script>
17 - var CSSTransitionGroup = React.addons.CSSTransitionGroup;
7 ReactDOM.render(
19 - React.createElement(CSSTransitionGroup, {
20 - transitionName: 'example',
21 - transitionAppear: true,
22 - transitionAppearTimeout: 500,
23 - transitionEnterTimeout: 0,
24 - transitionLeaveTimeout: 0,
25 - }, React.createElement('h1', null,
26 - 'Hello World!'
27 - )),
8 + React.createElement('h1', null, 'Hello World!'),
9 document.getElementById('container')
10 );
11 </script>
fixtures/packaging/requirejs.html
+2 -21
@@ -1,37 +1,18 @@
1 <html>
2 <body>
3 <script src="https://unpkg.com/requirejs@2.3.2/require.js"></script>
4 - <style>
5 - .example-appear {
6 - opacity: 0.01;
7 - }
8 -
9 - .example-appear.example-appear-active {
10 - opacity: 1;
11 - transition: opacity .5s ease-in;
12 - }
13 - </style>
4 <div id="container"></div>
5 <script>
6 requirejs.config({
7 paths: {
18 - react: '../../build/react-with-addons',
8 + react: '../../build/react',
9 'react-dom': '../../build/react-dom'
10 }
11 });
12
13 require(['react', 'react-dom'], function(React, ReactDOM) {
24 - var CSSTransitionGroup = React.addons.CSSTransitionGroup;
14 ReactDOM.render(
26 - React.createElement(CSSTransitionGroup, {
27 - transitionName: 'example',
28 - transitionAppear: true,
29 - transitionAppearTimeout: 500,
30 - transitionEnterTimeout: 0,
31 - transitionLeaveTimeout: 0,
32 - }, React.createElement('h1', null,
33 - 'Hello World!'
34 - )),
15 + React.createElement('h1', null, 'Hello World!'),
16 document.getElementById('container')
17 );
18 });
fixtures/packaging/rjs/config.js
+1 -1
@@ -4,7 +4,7 @@ module.exports = {
4 out: 'output.js',
5 optimize: 'none',
6 paths: {
7 - react: '../../../build/react-with-addons',
7 + react: '../../../build/react',
8 'react-dom': '../../../build/react-dom',
9 },
10 };
fixtures/packaging/rjs/index.html
-10
@@ -1,15 +1,5 @@
1 <html>
2 <body>
3 - <style>
4 - .example-appear {
5 - opacity: 0.01;
6 - }
7 -
8 - .example-appear.example-appear-active {
9 - opacity: 1;
10 - transition: opacity .5s ease-in;
11 - }
12 - </style>
3 <div id="container"></div>
4 <script src="https://unpkg.com/requirejs@2.3.2/require.js"></script>
5 <script src="output.js"></script>
fixtures/packaging/rjs/input.js
+1 -10
@@ -1,15 +1,6 @@
1 require(['react', 'react-dom'], function(React, ReactDOM) {
2 - var CSSTransitionGroup = React.addons.CSSTransitionGroup;
2 ReactDOM.render(
4 - React.createElement(CSSTransitionGroup, {
5 - transitionName: 'example',
6 - transitionAppear: true,
7 - transitionAppearTimeout: 500,
8 - transitionEnterTimeout: 0,
9 - transitionLeaveTimeout: 0,
10 - }, React.createElement('h1', null,
11 - 'Hello World!'
12 - )),
3 + React.createElement('h1', null, 'Hello World!'),
4 document.getElementById('container')
5 );
6 });
fixtures/packaging/systemjs-builder/config.js
+1 -1
@@ -1,6 +1,6 @@
1 System.config({
2 paths: {
3 - react: '../../../build/react-with-addons.js',
3 + react: '../../../build/react.js',
4 'react-dom': '../../../build/react-dom.js',
5 },
6 });
fixtures/packaging/systemjs-builder/index.html
-10
@@ -1,15 +1,5 @@
1 <html>
2 <body>
3 - <style>
4 - .example-appear {
5 - opacity: 0.01;
6 - }
7 -
8 - .example-appear.example-appear-active {
9 - opacity: 1;
10 - transition: opacity .5s ease-in;
11 - }
12 - </style>
3 <div id="container"></div>
4 <script src="output.js"></script>
5 </body>
fixtures/packaging/systemjs-builder/input.js
+1 -10
@@ -1,16 +1,7 @@
1 import React from 'react';
2 import ReactDOM from 'react-dom';
3
4 -var CSSTransitionGroup = React.addons.CSSTransitionGroup;
4 ReactDOM.render(
6 - React.createElement(CSSTransitionGroup, {
7 - transitionName: 'example',
8 - transitionAppear: true,
9 - transitionAppearTimeout: 500,
10 - transitionEnterTimeout: 0,
11 - transitionLeaveTimeout: 0,
12 - }, React.createElement('h1', null,
13 - 'Hello World!'
14 - )),
5 + React.createElement('h1', null, 'Hello World!'),
6 document.getElementById('container')
7 );
fixtures/packaging/systemjs.html
+2 -21
@@ -1,21 +1,11 @@
1 <html>
2 <body>
3 <script src="https://unpkg.com/systemjs@0.19.41/dist/system.js"></script>
4 - <style>
5 - .example-appear {
6 - opacity: 0.01;
7 - }
8 -
9 - .example-appear.example-appear-active {
10 - opacity: 1;
11 - transition: opacity .5s ease-in;
12 - }
13 - </style>
4 <div id="container"></div>
5 <script>
6 System.config({
7 paths: {
18 - react: '../../build/react-with-addons.js',
8 + react: '../../build/react.js',
9 'react-dom': '../../build/react-dom.js'
10 }
11 });
@@ -27,17 +17,8 @@
17 var React = deps[0];
18 var ReactDOM = deps[1];
19
30 - var CSSTransitionGroup = React.addons.CSSTransitionGroup;
20 ReactDOM.render(
32 - React.createElement(CSSTransitionGroup, {
33 - transitionName: 'example',
34 - transitionAppear: true,
35 - transitionAppearTimeout: 500,
36 - transitionEnterTimeout: 0,
37 - transitionLeaveTimeout: 0,
38 - }, React.createElement('h1', null,
39 - 'Hello World!'
40 - )),
21 + React.createElement('h1', null, 'Hello World!'),
22 document.getElementById('container')
23 );
24 });
fixtures/packaging/webpack-alias/config.js
+1 -1
@@ -8,7 +8,7 @@ module.exports = {
8 resolve: {
9 root: path.resolve('../../../build/packages'),
10 alias: {
11 - 'react': 'react/dist/react-with-addons',
11 + 'react': 'react/dist/react',
12 'react-dom': 'react-dom/dist/react-dom',
13 },
14 },
fixtures/packaging/webpack-alias/index.html
-10
@@ -1,15 +1,5 @@
1 <html>
2 <body>
3 - <style>
4 - .example-appear {
5 - opacity: 0.01;
6 - }
7 -
8 - .example-appear.example-appear-active {
9 - opacity: 1;
10 - transition: opacity .5s ease-in;
11 - }
12 - </style>
3 <div id="container"></div>
4 <script src="output.js"></script>
5 </body>
fixtures/packaging/webpack-alias/input.js
+1 -10
@@ -1,16 +1,7 @@
1 var React = require('react');
2 var ReactDOM = require('react-dom');
3
4 -var CSSTransitionGroup = React.addons.CSSTransitionGroup;
4 ReactDOM.render(
6 - React.createElement(CSSTransitionGroup, {
7 - transitionName: 'example',
8 - transitionAppear: true,
9 - transitionAppearTimeout: 500,
10 - transitionEnterTimeout: 0,
11 - transitionLeaveTimeout: 0,
12 - }, React.createElement('h1', null,
13 - 'Hello World!'
14 - )),
5 + React.createElement('h1', null, 'Hello World!'),
6 document.getElementById('container')
7 );
fixtures/packaging/webpack/index.html
-10
@@ -1,15 +1,5 @@
1 <html>
2 <body>
3 - <style>
4 - .example-appear {
5 - opacity: 0.01;
6 - }
7 -
8 - .example-appear.example-appear-active {
9 - opacity: 1;
10 - transition: opacity .5s ease-in;
11 - }
12 - </style>
3 <div id="container"></div>
4 <script src="output.js"></script>
5 </body>
fixtures/packaging/webpack/input.js
+1 -10
@@ -1,16 +1,7 @@
1 var React = require('react');
2 -var CSSTransitionGroup = require('react-addons-css-transition-group');
2 var ReactDOM = require('react-dom');
3
4 ReactDOM.render(
6 - React.createElement(CSSTransitionGroup, {
7 - transitionName: 'example',
8 - transitionAppear: true,
9 - transitionAppearTimeout: 500,
10 - transitionEnterTimeout: 0,
11 - transitionLeaveTimeout: 0,
12 - }, React.createElement('h1', null,
13 - 'Hello World!'
14 - )),
5 + React.createElement('h1', null, 'Hello World!'),
6 document.getElementById('container')
7 );
grunt/config/browserify.js
-39
@@ -21,12 +21,6 @@ var shimSharedModules = aliasify.configure({
21 },
22 });
23
24 -var shimDOMModules = aliasify.configure({
25 - 'aliases': {
26 - './ReactAddonsDOMDependencies': {relative: './ReactAddonsDOMDependenciesUMDShim'},
27 - },
28 -});
29 -
24 var SIMPLE_TEMPLATE =
25 grunt.file.read('./grunt/data/header-template-short.txt');
26
@@ -172,37 +166,6 @@ var min = {
166 after: [minify, bannerify],
167 };
168
175 -var addons = {
176 - entries: [
177 - './build/node_modules/react/lib/ReactWithAddonsUMDEntry.js',
178 - ],
179 - outfile: './build/react-with-addons.js',
180 - debug: false,
181 - standalone: 'React',
182 - packageName: 'React (with addons)',
183 - transforms: [shimDOMModules],
184 - globalTransforms: [envifyDev],
185 - plugins: [collapser],
186 - after: [derequire, simpleBannerify],
187 -};
188 -
189 -var addonsMin = {
190 - entries: [
191 - './build/node_modules/react/lib/ReactWithAddonsUMDEntry.js',
192 - ],
193 - outfile: './build/react-with-addons.min.js',
194 - debug: false,
195 - standalone: 'React',
196 - packageName: 'React (with addons)',
197 - transforms: [shimDOMModules, envifyProd, uglifyify],
198 - globalTransforms: [envifyProd],
199 - plugins: [collapser],
200 - // No need to derequire because the minifier will mangle
201 - // the "require" calls.
202 -
203 - after: [minify, bannerify],
204 -};
205 -
169 // The DOM Builds
170 var dom = {
171 entries: [
@@ -303,8 +266,6 @@ var domFiberMin = {
266 module.exports = {
267 basic: basic,
268 min: min,
306 - addons: addons,
307 - addonsMin: addonsMin,
269 dom: dom,
270 domMin: domMin,
271 domServer: domServer,
grunt/tasks/npm-react-addons.js deleted
-151
@@ -1,151 +0,0 @@
1 -'use strict';
2 -
3 -var fs = require('fs');
4 -var grunt = require('grunt');
5 -var path = require('path');
6 -
7 -var addons = {
8 - CSSTransitionGroup: {
9 - peerDependency: 'react',
10 - module: 'ReactCSSTransitionGroup',
11 - name: 'css-transition-group',
12 - docs: 'animation',
13 - },
14 - LinkedStateMixin: {
15 - peerDependency: 'react',
16 - module: 'LinkedStateMixin',
17 - name: 'linked-state-mixin',
18 - docs: 'two-way-binding-helpers',
19 - },
20 - Perf: {
21 - peerDependency: 'react-dom',
22 - module: 'ReactPerf',
23 - name: 'perf',
24 - docs: 'perf',
25 - },
26 - PureRenderMixin: {
27 - peerDependency: 'react',
28 - module: 'ReactComponentWithPureRenderMixin',
29 - name: 'pure-render-mixin',
30 - docs: 'pure-render-mixin',
31 - },
32 - TestUtils: {
33 - peerDependency: 'react-dom',
34 - module: 'ReactTestUtils',
35 - name: 'test-utils',
36 - docs: 'test-utils',
37 - },
38 - TransitionGroup: {
39 - peerDependency: 'react',
40 - module: 'ReactTransitionGroup',
41 - name: 'transition-group',
42 - docs: 'animation',
43 - },
44 - createFragment: {
45 - peerDependency: 'react',
46 - module: 'ReactFragment',
47 - method: 'create',
48 - name: 'create-fragment',
49 - docs: 'create-fragment',
50 - },
51 - shallowCompare: {
52 - peerDependency: 'react',
53 - module: 'shallowCompare',
54 - name: 'shallow-compare',
55 - docs: 'shallow-compare',
56 - },
57 - updates: {
58 - peerDependency: 'react',
59 - module: 'update',
60 - name: 'update',
61 - docs: 'update',
62 - },
63 -};
64 -
65 -function generateSource(info) {
66 - var pieces = [
67 - 'module.exports = require(\'',
68 - info.peerDependency,
69 - '/lib/',
70 - info.module,
71 - '\')',
72 - ];
73 - if (info.method) {
74 - pieces.push('.', info.method);
75 - }
76 - pieces.push(';');
77 - return pieces.join('');
78 -}
79 -
80 -function buildReleases() {
81 - var pkgTemplate = grunt.file.readJSON('./packages/react-addons/package.json');
82 -
83 - Object.keys(addons).map(function(k) {
84 - var info = addons[k];
85 - var pkgName = 'react-addons-' + info.name;
86 - var destDir = 'build/packages/' + pkgName;
87 - var destLicense = path.join(destDir, 'LICENSE');
88 - var destPatents = path.join(destDir, 'PATENTS');
89 -
90 - var pkgData = Object.assign({}, pkgTemplate);
91 - pkgData.name = pkgName;
92 -
93 - var version = pkgTemplate.peerDependencies.react;
94 - if (info.peerDependency !== 'react') {
95 - pkgData.peerDependencies = {};
96 - pkgData.peerDependencies[info.peerDependency] = version;
97 - }
98 -
99 - grunt.file.mkdir(destDir);
100 - var link = info.docs ? info.docs : 'addons';
101 - link = `https://facebook.github.io/react/docs/${link}.html`;
102 - fs.writeFileSync(path.join(destDir, 'index.js'), generateSource(info));
103 - fs.writeFileSync(path.join(destDir, 'package.json'), JSON.stringify(pkgData, null, 2));
104 - grunt.file.copy('LICENSE', destLicense);
105 - grunt.file.copy('PATENTS', destPatents);
106 - fs.writeFileSync(
107 - path.join(destDir, 'README.md'),
108 - `
109 -# ${pkgName}
110 -
111 -This package provides the React ${k} add-on.
112 -
113 -See <${link}> for more information.`.slice(1)
114 - );
115 - });
116 -
117 -}
118 -
119 -function packReleases() {
120 - var done = this.async();
121 - var count = 0;
122 -
123 - var addonKeys = Object.keys(addons);
124 -
125 - addonKeys.forEach(function(k) {
126 - var info = addons[k];
127 - var pkgName = 'react-addons-' + info.name;
128 - var pkgDir = 'build/packages/' + pkgName;
129 -
130 - var spawnCmd = {
131 - cmd: 'npm',
132 - args: ['pack', pkgDir],
133 - };
134 - grunt.util.spawn(spawnCmd, function() {
135 - var buildSrc = pkgName + '-' + grunt.config.data.pkg.version + '.tgz';
136 - var buildDest = 'build/packages/' + pkgName + '.tgz';
137 - fs.rename(buildSrc, buildDest, maybeDone);
138 - });
139 - });
140 -
141 - function maybeDone() {
142 - if (++count === addonKeys.length) {
143 - done();
144 - }
145 - }
146 -}
147 -
148 -module.exports = {
149 - buildReleases: buildReleases,
150 - packReleases: packReleases,
151 -};
grunt/tasks/npm-react.js
-2
@@ -11,8 +11,6 @@ var dist = dest + 'dist/';
11 var distFiles = [
12 'react.js',
13 'react.min.js',
14 - 'react-with-addons.js',
15 - 'react-with-addons.min.js',
14 ];
15
16 function buildRelease() {
grunt/tasks/release.js
-2
@@ -7,8 +7,6 @@ var BOWER_GLOB = [BOWER_PATH + '*.{js}'];
7 var BOWER_FILES = [
8 'react.js',
9 'react.min.js',
10 - 'react-with-addons.js',
11 - 'react-with-addons.min.js',
10 'react-dom.js',
11 'react-dom.min.js',
12 'react-dom-server.js',
gulp/tasks/version-check.js
-5
@@ -15,7 +15,6 @@ module.exports = function(gulp, plugins) {
15 return function(done) {
16 var reactVersion = require('../../package.json').version;
17
18 - var addonsData = require('../../packages/react-addons/package.json');
18 var versions = {
19 'packages/react/package.json':
20 require('../../packages/react/package.json').version,
@@ -23,10 +22,6 @@ module.exports = function(gulp, plugins) {
22 require('../../packages/react-dom/package.json').version,
23 'packages/react-native-renderer/package.json':
24 require('../../packages/react-native-renderer/package.json').version,
26 - 'packages/react-addons/package.json (version)': addonsData.version,
27 - 'packages/react-addons/package.json (react dependency)':
28 - // Get the "version" without the range bit
29 - addonsData.peerDependencies.react.slice(1),
25 'packages/react-test-renderer/package.json':
26 require('../../packages/react-test-renderer/package.json').version,
27 'src/ReactVersion.js': require('../../src/ReactVersion'),
gulpfile.js
-2
@@ -31,11 +31,9 @@ var paths = {
31 react: {
32 src: [
33 'src/umd/ReactUMDEntry.js',
34 - 'src/umd/ReactWithAddonsUMDEntry.js',
34 'src/umd/shims/**/*.js',
35
36 'src/isomorphic/**/*.js',
38 - 'src/addons/**/*.js',
37
38 'src/ReactVersion.js',
39 'src/shared/**/*.js',
packages/jsx_orphaned_brackets_transformer/.gitignore deleted
-1
@@ -1 +0,0 @@
1 -node_modules
packages/jsx_orphaned_brackets_transformer/README.md deleted
-31
@@ -1,31 +0,0 @@
1 -# JSX Orphaned Brackets Transformer
2 -
3 -React 0.13 no longer parses orphaned > and } as text.
4 -
5 -Take this example block:
6 -
7 -```js
8 -<div>
9 - > }
10 -</div>
11 -```
12 -
13 -In 0.12 and below, this would be transformed to the following:
14 -
15 -```js
16 -React.DOM.div(null,
17 - "> }",
18 -)
19 -```
20 -
21 -In 0.13, this will instead throw a parser error.
22 -
23 -
24 -## Usage
25 -
26 -The `jsx_orphaned_brackets_transformer` module ships an executable which transforms a file or directory of files. Files will be modified in place, so be sure you are prepared for that.
27 -
28 -```sh
29 -$ npm -g install jsx_orphaned_brackets_transformer
30 -$ jsx_orphaned_brackets_transformer <path_to_file_or_files>
31 -```
packages/jsx_orphaned_brackets_transformer/package.json deleted
-17
@@ -1,17 +0,0 @@
1 -{
2 - "name": "jsx_orphaned_brackets_transformer",
3 - "description": "A utility to update your JSX to work with React 0.13.",
4 - "version": "1.0.1",
5 - "main": "run.js",
6 - "dependencies": {
7 - "graceful-fs": "~2.0.0",
8 - "jstransform": "~8.2.0",
9 - "node-find-files": "0.0.2",
10 - "optimist": "~0.6.0"
11 - },
12 - "bin": {
13 - "jsx_orphaned_brackets_transformer": "./run.js"
14 - },
15 - "license": "BSD-3-Clause",
16 - "preferGlobal": true
17 -}
packages/jsx_orphaned_brackets_transformer/run.js deleted
-166
@@ -1,166 +0,0 @@
1 -#!/usr/bin/env node
2 -
3 -'use strict';
4 -
5 -var FileFinder = require('node-find-files');
6 -var fs = require('graceful-fs');
7 -var jstransform = require('jstransform');
8 -var path = require('path');
9 -var visitReactTag = require('./transforms/react').visitReactTag;
10 -/*eslint-disable no-shadow*/
11 -var S = jstransform.Syntax;
12 -
13 -var USAGE =
14 - 'Read a file (or directory of files) from disk, transform any orphaned ' +
15 - '} and > characters to avoid parser errors with React 0.13.';
16 -
17 -function _visitFbt(node, path, state) {
18 - return false;
19 -}
20 -_visitFbt.test = function(node, path, state) {
21 - return node.type === S.XJSElement
22 - && node.openingElement.name.name === 'fbt';
23 -};
24 -
25 -var VISITORS_LIST = [
26 - _visitFbt,
27 - visitReactTag,
28 -];
29 -
30 -function _transformSource(source) {
31 - return jstransform.transform(VISITORS_LIST, source).code;
32 -}
33 -
34 -function transformDir(dirPath, exclude) {
35 - var finder = new FileFinder({
36 - rootFolder: dirPath,
37 - filterFunction: function(path, stat) {
38 - return /\.jsx?$/.test(path) && (!exclude || !exclude.test(path));
39 - },
40 - });
41 -
42 - var numTransforms = 0;
43 - var completeTransforms = 0;
44 - var findingComplete = false;
45 - function _printProgress() {
46 - process.stdout.clearLine();
47 - process.stdout.cursorTo(0);
48 - process.stdout.write(
49 - completeTransforms + '/' + numTransforms + ' transforms complete'
50 - );
51 -
52 - if (findingComplete && completeTransforms === numTransforms) {
53 - console.log('\ndone!');
54 - }
55 - }
56 -
57 - finder.on('match', function(pathStr, stat) {
58 - fs.readFile(pathStr, 'utf8', function(err, data) {
59 - if (err) {
60 - err.message = err.message + ' (' + pathStr + ')';
61 - throw err;
62 - }
63 -
64 - numTransforms++;
65 - _printProgress();
66 -
67 - var transformedData;
68 - try {
69 - transformedData = _transformSource(data);
70 - } catch (e) {
71 - e.message = e.message + ' (' + pathStr + ')';
72 - throw e;
73 - }
74 -
75 - if (transformedData !== data) {
76 - fs.writeFile(pathStr, transformedData, function(err) {
77 - if (err) {
78 - err.message = err.message + ' (' + pathStr + ')';
79 - throw err;
80 - }
81 - completeTransforms++;
82 - _printProgress();
83 - });
84 - } else {
85 - completeTransforms++;
86 - _printProgress();
87 - }
88 - });
89 - });
90 -
91 - finder.on('error', function(err) {
92 - console.log('\nError: ', err.stack);
93 - throw err;
94 - });
95 -
96 - finder.on('complete', function() {
97 - findingComplete = true;
98 - });
99 -
100 - finder.startSearch();
101 -}
102 -
103 -function transformFile(pathStr) {
104 - fs.readFile(pathStr, 'utf8', function(err, data) {
105 - if (err) {
106 - err.message = err.message + ' (' + pathStr + ')';
107 - throw err;
108 - }
109 -
110 - var transformedData;
111 - try {
112 - transformedData = _transformSource(data);
113 - } catch (e) {
114 - e.message = e.message + ' (' + pathStr + ')';
115 - throw e;
116 - }
117 -
118 - if (transformedData !== data) {
119 - fs.writeFile(pathStr, transformedData, function(err) {
120 - if (err) {
121 - err.message = err.message + ' (' + pathStr + ')';
122 - throw err;
123 - }
124 - console.log('done!');
125 - });
126 - } else {
127 - console.log('done!');
128 - }
129 - });
130 -}
131 -
132 -if (require.main === module) {
133 - var argv = require('optimist')
134 - .usage(USAGE)
135 - .argv;
136 -
137 - if (argv._.length === 0) {
138 - throw new Error(
139 - 'Please specify a file or directory path as the first arg!'
140 - );
141 - }
142 -
143 - argv._.forEach(function(arg) {
144 - var absPath = path.resolve(arg);
145 -
146 - fs.stat(absPath, function(err, stat) {
147 - if (err) {
148 - throw err;
149 - }
150 -
151 - if (stat.isFile()) {
152 - transformFile(absPath);
153 - } else if (stat.isDirectory()) {
154 - var exclude = null;
155 - if (argv.exclude) {
156 - exclude = new RegExp(argv.exclude);
157 - }
158 - transformDir(absPath, exclude);
159 - } else {
160 - throw new Error('Unknown filesystem node type: ' + absPath);
161 - }
162 - });
163 - });
164 -}
165 -
166 -exports.transformDir = transformDir;
packages/jsx_orphaned_brackets_transformer/transforms/react.js deleted
-52
@@ -1,52 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - */
9 -/*global exports:true*/
10 -'use strict';
11 -var jstransform = require('jstransform');
12 -var Syntax = jstransform.Syntax;
13 -var utils = require('jstransform/src/utils');
14 -
15 -function visitReactTag(traverse, object, path, state) {
16 - object.openingElement.attributes.forEach(function(attr, index) {
17 - if (attr.value) {
18 - traverse(attr.value, path, state);
19 - }
20 - });
21 -
22 - object.children.forEach(function(child, index) {
23 - if (child.type === Syntax.Literal) {
24 - codemodXJSLiteral(child, state);
25 - } else {
26 - traverse(child, path, state);
27 - }
28 - });
29 -
30 - return false;
31 -}
32 -
33 -visitReactTag.test = function(object, path, state) {
34 - return object.type === Syntax.XJSElement;
35 -};
36 -
37 -function codemodXJSLiteral(object, state) {
38 - var value = object.raw;
39 -
40 - utils.catchup(object.range[0], state);
41 -
42 - var rightCurlyBracket = '&#125;'; // or {'}'}
43 - var rightAngledBracket = '&gt;'; // or {'>'}
44 -
45 - value = value.replace(/\}/g, rightCurlyBracket);
46 - value = value.replace(/\>/g, rightAngledBracket);
47 -
48 - utils.append(value, state);
49 - utils.move(object.range[1], state);
50 -}
51 -
52 -exports.visitReactTag = visitReactTag;
packages/react-addons/package.json deleted
-24
@@ -1,24 +0,0 @@
1 -{
2 - "name": "react-addons-template",
3 - "version": "16.0.0-alpha.4",
4 - "main": "index.js",
5 - "repository": "facebook/react",
6 - "keywords": [
7 - "react",
8 - "react-addon"
9 - ],
10 - "license": "BSD-3-Clause",
11 - "dependencies": {
12 - "fbjs": "^0.8.9",
13 - "object-assign": "^4.1.0"
14 - },
15 - "peerDependencies": {
16 - "react": "^16.0.0-alpha.4"
17 - },
18 - "files": [
19 - "LICENSE",
20 - "PATENTS",
21 - "README.md",
22 - "index.js"
23 - ]
24 -}
packages/react-linked-input/LinkedInput.js deleted
-27
@@ -1,27 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - */
9 -
10 -'use strict';
11 -
12 -var React = require('react');
13 -var LinkedValueUtils = require('react-dom/lib/LinkedValueUtils');
14 -
15 -class LinkedInput extends React.Component {
16 - render() {
17 - var newProps = Object.assign({}, this.props);
18 - newProps.value = LinkedValueUtils.getValue(this.props);
19 - newProps.checked = LinkedValueUtils.getChecked(this.props);
20 - delete newProps.valueLink;
21 - delete newProps.checkedLink;
22 - return React.createElement('input', newProps);
23 - }
24 -}
25 -
26 -module.exports = LinkedInput;
27 -
packages/react-linked-input/README.md deleted
-11
@@ -1,11 +0,0 @@
1 -This component supports the ReactLink API (valueLink, etc) for input components. Support for ReactLink on DOM elements will be removed from React. This component may be used as a migration plan (so your code doesn't break in the next version of React) or may be used if you just like the ReactLink data binding semantics. However, this component is not maintained, so use at your own risk.
2 -
3 -
4 -```
5 -var React = require('react');
6 -var ReactDOM = require('react-dom');
7 -var LinkedInput = require('react-linked-input');
8 -
9 -var link = {value: 'boo', requestChange: function() {}};
10 -React.render(<LinkedInput valueLink={link} />, container);
11 -```
packages/react-linked-input/__test__/LinkedInput-test.js deleted
-42
@@ -1,42 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @emails react-core
10 - */
11 -
12 -'use strict';
13 -
14 -
15 -describe('LinkedStateMixin', function() {
16 - var LinkedInput;
17 - var React;
18 - var ReactDOM;
19 -
20 - beforeEach(function() {
21 - LinkedInput = require('LinkedInput');
22 - React = require('React');
23 - ReactDOM = require('ReactDOM');
24 - });
25 -
26 - it('should basically work', function() {
27 - var container = document.createElement('div');
28 - var component = ReactDOM.render(<LinkedInput value="foo" onChange={function() {}} />, container);
29 - var input = ReactDOM.findDOMNode(component);
30 - expect(input.value).toBe('foo');
31 - ReactDOM.render(<LinkedInput valueLink={{value: 'boo', requestChange: function() {}}} />, container);
32 - expect(input.value).toBe('boo');
33 - });
34 -
35 - it('should throw', function() {
36 - var container = document.createElement('div');
37 - var element = <LinkedInput value="foo" valueLink={{value: 'boo', requestChange: function() {}}} />;
38 - expect(function() {
39 - ReactDOM.render(element, container);
40 - }).toThrow();
41 - });
42 -});
packages/react-linked-input/package.json deleted
-25
@@ -1,25 +0,0 @@
1 -{
2 - "name": "react-linked-input",
3 - "version": "1.0.1",
4 - "description": "LinkedInput supports the ReactLink semantics",
5 - "main": "LinkedInput.js",
6 - "scripts": {
7 - "test": "echo \"Error: no test specified\" && exit 1"
8 - },
9 - "repository": {
10 - "type": "git",
11 - "url": "git+https://github.com/facebook/react.git"
12 - },
13 - "keywords": [
14 - "react",
15 - "linkedinput",
16 - "input",
17 - "linked",
18 - "reactlink"
19 - ],
20 - "author": "",
21 - "license": "BSD-3-Clause",
22 - "peerDependencies": {
23 - "react": "^15.0.1"
24 - }
25 -}
scripts/circleci/upload_build.sh
-2
@@ -6,8 +6,6 @@ if [ -z $CI_PULL_REQUEST ] && [ -n "$BUILD_SERVER_ENDPOINT" ]; then
6 curl \
7 -F "react=@build/react.js" \
8 -F "react.min=@build/react.min.js" \
9 - -F "react-with-addons=@build/react-with-addons.js" \
10 - -F "react-with-addons.min=@build/react-with-addons.min.js" \
9 -F "react-dom=@build/react-dom.js" \
10 -F "react-dom.min=@build/react-dom.min.js" \
11 -F "react-dom-server=@build/react-dom-server.js" \
scripts/fiber/tests-passing.txt
-76
@@ -42,82 +42,6 @@ scripts/error-codes/__tests__/invertObject-test.js
42 * should take the last value when there're duplications in vals
43 * should preserve the original order
44
45 -src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js
46 -* provides a default shouldComponentUpdate implementation
47 -* does not do a deep comparison
48 -
49 -src/addons/__tests__/ReactFragment-test.js
50 -* should throw if a plain object is used as a child
51 -* should throw if a plain object even if it is in an owner
52 -* warns for numeric keys on objects as children
53 -* should warn if passing null to createFragment
54 -* should warn if passing an array to createFragment
55 -* should warn if passing a ReactElement to createFragment
56 -
57 -src/addons/__tests__/renderSubtreeIntoContainer-test.js
58 -* should pass context when rendering subtree elsewhere
59 -* should throw if parentComponent is invalid
60 -* should update context if it changes due to setState
61 -* should update context if it changes due to re-render
62 -* should render portal with non-context-provider parent
63 -* should get context through non-context-provider parent
64 -* should get context through middle non-context-provider layer
65 -
66 -src/addons/__tests__/update-test.js
67 -* pushes
68 -* does not mutate the original object
69 -* only pushes an array
70 -* only pushes unto an array
71 -* unshifts
72 -* does not mutate the original object
73 -* only unshifts an array
74 -* only unshifts unto an array
75 -* splices
76 -* does not mutate the original object
77 -* only splices an array of arrays
78 -* only splices unto an array
79 -* merges
80 -* does not mutate the original object
81 -* only merges with an object
82 -* only merges with an object
83 -* sets
84 -* does not mutate the original object
85 -* applies
86 -* does not mutate the original object
87 -* only applies a function
88 -* should support deep updates
89 -* should require a command
90 -* should perform safe hasOwnProperty check
91 -
92 -src/addons/transitions/__tests__/ReactCSSTransitionGroup-test.js
93 -* should warn if timeouts aren't specified
94 -* should not warn if timeouts is zero
95 -* should clean-up silently after the timeout elapses
96 -* should keep both sets of DOM nodes around
97 -* should switch transitionLeave from false to true
98 -* should work with no children
99 -* should work with a null child
100 -* should transition from one to null
101 -* should transition from false to one
102 -* should use transition-type specific names when they're provided
103 -* should clear transition timeouts when unmounted
104 -* should handle unmounted elements properly
105 -
106 -src/addons/transitions/__tests__/ReactTransitionChildMapping-test.js
107 -* should support getChildMapping
108 -* should support mergeChildMappings for adding keys
109 -* should support mergeChildMappings for removing keys
110 -* should support mergeChildMappings for adding and removing
111 -* should reconcile overlapping insertions and deletions
112 -* should support mergeChildMappings with undefined input
113 -
114 -src/addons/transitions/__tests__/ReactTransitionGroup-test.js
115 -* should handle willEnter correctly
116 -* should handle enter/leave/enter/leave correctly
117 -* should handle enter/leave/enter correctly
118 -* should handle entering/leaving several elements at once
119 -* should warn for duplicated keys
120 -
45 src/isomorphic/__tests__/React-test.js
46 * should log a deprecation warning once when using React.createMixin
47
scripts/release-manager/commands/utils/npm.js
-9
@@ -3,15 +3,6 @@
3 const querystring = require('querystring');
4
5 const PACKAGES = [
6 - 'react-addons-create-fragment',
7 - 'react-addons-css-transition-group',
8 - 'react-addons-linked-state-mixin',
9 - 'react-addons-perf',
10 - 'react-addons-pure-render-mixin',
11 - 'react-addons-shallow-compare',
12 - 'react-addons-test-utils',
13 - 'react-addons-transition-group',
14 - 'react-addons-update',
6 'react-dom',
7 'react-native-renderer',
8 'react-test-renderer',
src/addons/ReactAddonsDOMDependencies.js deleted
-37
@@ -1,37 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @providesModule ReactAddonsDOMDependencies
10 - */
11 -
12 -'use strict';
13 -
14 -var ReactDOM = require('react-dom');
15 -
16 -exports.getReactDOM = function() {
17 - return ReactDOM;
18 -};
19 -
20 -if (__DEV__) {
21 - var ReactPerf;
22 - var ReactTestUtils;
23 -
24 - exports.getReactPerf = function() {
25 - if (!ReactPerf) {
26 - ReactPerf = require('react-dom/lib/ReactPerf');
27 - }
28 - return ReactPerf;
29 - };
30 -
31 - exports.getReactTestUtils = function() {
32 - if (!ReactTestUtils) {
33 - ReactTestUtils = require('react-dom/lib/ReactTestUtils');
34 - }
35 - return ReactTestUtils;
36 - };
37 -}
src/addons/ReactComponentWithPureRenderMixin.js deleted
-48
@@ -1,48 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @providesModule ReactComponentWithPureRenderMixin
10 - */
11 -
12 -'use strict';
13 -
14 -var shallowCompare = require('shallowCompare');
15 -
16 -/**
17 - * If your React component's render function is "pure", e.g. it will render the
18 - * same result given the same props and state, provide this mixin for a
19 - * considerable performance boost.
20 - *
21 - * Most React components have pure render functions.
22 - *
23 - * Example:
24 - *
25 - * var ReactComponentWithPureRenderMixin =
26 - * require('ReactComponentWithPureRenderMixin');
27 - * React.createClass({
28 - * mixins: [ReactComponentWithPureRenderMixin],
29 - *
30 - * render: function() {
31 - * return <div className={this.props.className}>foo</div>;
32 - * }
33 - * });
34 - *
35 - * Note: This only checks shallow equality for props and state. If these contain
36 - * complex data structures this mixin may have false-negatives for deeper
37 - * differences. Only mixin to components which have simple props and state, or
38 - * use `forceUpdate()` when you know deep data structures have changed.
39 - *
40 - * See https://facebook.github.io/react/docs/pure-render-mixin.html
41 - */
42 -var ReactComponentWithPureRenderMixin = {
43 - shouldComponentUpdate: function(nextProps, nextState) {
44 - return shallowCompare(this, nextProps, nextState);
45 - },
46 -};
47 -
48 -module.exports = ReactComponentWithPureRenderMixin;
src/addons/ReactFragment.js deleted
-88
@@ -1,88 +0,0 @@
1 -/**
2 - * Copyright 2015-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @providesModule ReactFragment
10 - */
11 -
12 -'use strict';
13 -
14 -var ReactChildren = require('ReactChildren');
15 -var ReactElement = require('ReactElement');
16 -
17 -var emptyFunction = require('fbjs/lib/emptyFunction');
18 -var invariant = require('fbjs/lib/invariant');
19 -var warning = require('fbjs/lib/warning');
20 -
21 -/**
22 - * We used to allow keyed objects to serve as a collection of ReactElements,
23 - * or nested sets. This allowed us a way to explicitly key a set or fragment of
24 - * components. This is now being replaced with an opaque data structure.
25 - * The upgrade path is to call React.addons.createFragment({ key: value }) to
26 - * create a keyed fragment. The resulting data structure is an array.
27 - */
28 -
29 -var numericPropertyRegex = /^\d+$/;
30 -
31 -var warnedAboutNumeric = false;
32 -
33 -var ReactFragment = {
34 - /**
35 - * Wrap a keyed object in an opaque proxy that warns you if you access any
36 - * of its properties.
37 - * See https://facebook.github.io/react/docs/create-fragment.html
38 - */
39 - create: function(object) {
40 - if (typeof object !== 'object' || !object || Array.isArray(object)) {
41 - warning(
42 - false,
43 - 'React.addons.createFragment only accepts a single object. Got: %s',
44 - object,
45 - );
46 - return object;
47 - }
48 - if (ReactElement.isValidElement(object)) {
49 - warning(
50 - false,
51 - 'React.addons.createFragment does not accept a ReactElement ' +
52 - 'without a wrapper object.',
53 - );
54 - return object;
55 - }
56 -
57 - invariant(
58 - object.nodeType !== 1,
59 - 'React.addons.createFragment(...): Encountered an invalid child; DOM ' +
60 - 'elements are not valid children of React components.',
61 - );
62 -
63 - var result = [];
64 -
65 - for (var key in object) {
66 - if (__DEV__) {
67 - if (!warnedAboutNumeric && numericPropertyRegex.test(key)) {
68 - warning(
69 - false,
70 - 'React.addons.createFragment(...): Child objects should have ' +
71 - 'non-numeric keys so ordering is preserved.',
72 - );
73 - warnedAboutNumeric = true;
74 - }
75 - }
76 - ReactChildren.mapIntoWithKeyPrefixInternal(
77 - object[key],
78 - result,
79 - key,
80 - emptyFunction.thatReturnsArgument,
81 - );
82 - }
83 -
84 - return result;
85 - },
86 -};
87 -
88 -module.exports = ReactFragment;
src/addons/ReactWithAddons.js deleted
-51
@@ -1,51 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @providesModule ReactWithAddons
10 - */
11 -
12 -'use strict';
13 -
14 -var React = require('react');
15 -var ReactAddonsDOMDependencies = require('ReactAddonsDOMDependencies');
16 -var ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin');
17 -var ReactCSSTransitionGroup = require('ReactCSSTransitionGroup');
18 -var ReactFragment = require('ReactFragment');
19 -var ReactTransitionGroup = require('ReactTransitionGroup');
20 -
21 -var shallowCompare = require('shallowCompare');
22 -var update = require('update');
23 -
24 -React.addons = {
25 - CSSTransitionGroup: ReactCSSTransitionGroup,
26 - PureRenderMixin: ReactComponentWithPureRenderMixin,
27 - TransitionGroup: ReactTransitionGroup,
28 -
29 - createFragment: ReactFragment.create,
30 - shallowCompare: shallowCompare,
31 - update: update,
32 -};
33 -
34 -if (__DEV__) {
35 - // For the UMD build we get these lazily from the global since they're tied
36 - // to the DOM renderer and it hasn't loaded yet.
37 - Object.defineProperty(React.addons, 'Perf', {
38 - enumerable: true,
39 - get: function() {
40 - return ReactAddonsDOMDependencies.getReactPerf();
41 - },
42 - });
43 - Object.defineProperty(React.addons, 'TestUtils', {
44 - enumerable: true,
45 - get: function() {
46 - return ReactAddonsDOMDependencies.getReactTestUtils();
47 - },
48 - });
49 -}
50 -
51 -module.exports = React;
src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js deleted
-137
@@ -1,137 +0,0 @@
1 -/**
2 - * Copyright 2015-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @emails react-core
10 - */
11 -
12 -'use strict';
13 -
14 -var React;
15 -var ReactComponentWithPureRenderMixin;
16 -var ReactTestUtils;
17 -
18 -describe('ReactComponentWithPureRenderMixin', () => {
19 - beforeEach(() => {
20 - React = require('react');
21 - ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin');
22 - ReactTestUtils = require('ReactTestUtils');
23 - });
24 -
25 - it('provides a default shouldComponentUpdate implementation', () => {
26 - var renderCalls = 0;
27 - class PlasticWrap extends React.Component {
28 - constructor(props, context) {
29 - super(props, context);
30 - this.state = {
31 - color: 'green',
32 - };
33 - }
34 -
35 - render() {
36 - return <Apple color={this.state.color} ref="apple" />;
37 - }
38 - }
39 -
40 - var Apple = React.createClass({
41 - mixins: [ReactComponentWithPureRenderMixin],
42 -
43 - getInitialState: function() {
44 - return {
45 - cut: false,
46 - slices: 1,
47 - };
48 - },
49 -
50 - cut: function() {
51 - this.setState({
52 - cut: true,
53 - slices: 10,
54 - });
55 - },
56 -
57 - eatSlice: function() {
58 - this.setState({
59 - slices: this.state.slices - 1,
60 - });
61 - },
62 -
63 - render: function() {
64 - renderCalls++;
65 - return <div />;
66 - },
67 - });
68 -
69 - var instance = ReactTestUtils.renderIntoDocument(<PlasticWrap />);
70 - expect(renderCalls).toBe(1);
71 -
72 - // Do not re-render based on props
73 - instance.setState({color: 'green'});
74 - expect(renderCalls).toBe(1);
75 -
76 - // Re-render based on props
77 - instance.setState({color: 'red'});
78 - expect(renderCalls).toBe(2);
79 -
80 - // Re-render base on state
81 - instance.refs.apple.cut();
82 - expect(renderCalls).toBe(3);
83 -
84 - // No re-render based on state
85 - instance.refs.apple.cut();
86 - expect(renderCalls).toBe(3);
87 -
88 - // Re-render based on state again
89 - instance.refs.apple.eatSlice();
90 - expect(renderCalls).toBe(4);
91 - });
92 -
93 - it('does not do a deep comparison', () => {
94 - function getInitialState() {
95 - return {
96 - foo: [1, 2, 3],
97 - bar: {a: 4, b: 5, c: 6},
98 - };
99 - }
100 -
101 - var renderCalls = 0;
102 - var initialSettings = getInitialState();
103 -
104 - var Component = React.createClass({
105 - mixins: [ReactComponentWithPureRenderMixin],
106 -
107 - getInitialState: function() {
108 - return initialSettings;
109 - },
110 -
111 - render: function() {
112 - renderCalls++;
113 - return <div />;
114 - },
115 - });
116 -
117 - var instance = ReactTestUtils.renderIntoDocument(<Component />);
118 - expect(renderCalls).toBe(1);
119 -
120 - // Do not re-render if state is equal
121 - var settings = {
122 - foo: initialSettings.foo,
123 - bar: initialSettings.bar,
124 - };
125 - instance.setState(settings);
126 - expect(renderCalls).toBe(1);
127 -
128 - // Re-render because one field changed
129 - initialSettings.foo = [1, 2, 3];
130 - instance.setState(initialSettings);
131 - expect(renderCalls).toBe(2);
132 -
133 - // Re-render because the object changed
134 - instance.setState(getInitialState());
135 - expect(renderCalls).toBe(3);
136 - });
137 -});
src/addons/__tests__/ReactFragment-test.js deleted
-99
@@ -1,99 +0,0 @@
1 -/**
2 - * Copyright 2015-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @emails react-core
10 - */
11 -
12 -'use strict';
13 -
14 -var React;
15 -var ReactDOM;
16 -var ReactFragment;
17 -
18 -describe('ReactFragment', () => {
19 - beforeEach(() => {
20 - React = require('react');
21 - ReactDOM = require('react-dom');
22 - ReactFragment = require('ReactFragment');
23 - });
24 -
25 - it('should throw if a plain object is used as a child', () => {
26 - var children = {
27 - x: <span />,
28 - y: <span />,
29 - z: <span />,
30 - };
31 - var element = <div>{[children]}</div>;
32 - var container = document.createElement('div');
33 - expect(() => ReactDOM.render(element, container)).toThrowError(
34 - 'Objects are not valid as a React child (found: object with keys ' +
35 - '{x, y, z}). If you meant to render a collection of children, use an ' +
36 - 'array instead or wrap the object using createFragment(object) from ' +
37 - 'the React add-ons.',
38 - );
39 - });
40 -
41 - it('should throw if a plain object even if it is in an owner', () => {
42 - class Foo extends React.Component {
43 - render() {
44 - var children = {
45 - a: <span />,
46 - b: <span />,
47 - c: <span />,
48 - };
49 - return <div>{[children]}</div>;
50 - }
51 - }
52 - var container = document.createElement('div');
53 - expect(() => ReactDOM.render(<Foo />, container)).toThrowError(
54 - 'Objects are not valid as a React child (found: object with keys ' +
55 - '{a, b, c}). If you meant to render a collection of children, use an ' +
56 - 'array instead or wrap the object using createFragment(object) from ' +
57 - 'the React add-ons.\n\nCheck the render method of `Foo`.',
58 - );
59 - });
60 -
61 - it('warns for numeric keys on objects as children', () => {
62 - spyOn(console, 'error');
63 -
64 - ReactFragment.create({1: <span />, 2: <span />});
65 -
66 - expectDev(console.error.calls.count()).toBe(1);
67 - expectDev(console.error.calls.argsFor(0)[0]).toContain(
68 - 'Child objects should have non-numeric keys so ordering is preserved.',
69 - );
70 - });
71 -
72 - it('should warn if passing null to createFragment', () => {
73 - spyOn(console, 'error');
74 - ReactFragment.create(null);
75 - expectDev(console.error.calls.count()).toBe(1);
76 - expectDev(console.error.calls.argsFor(0)[0]).toContain(
77 - 'React.addons.createFragment only accepts a single object.',
78 - );
79 - });
80 -
81 - it('should warn if passing an array to createFragment', () => {
82 - spyOn(console, 'error');
83 - ReactFragment.create([]);
84 - expectDev(console.error.calls.count()).toBe(1);
85 - expectDev(console.error.calls.argsFor(0)[0]).toContain(
86 - 'React.addons.createFragment only accepts a single object.',
87 - );
88 - });
89 -
90 - it('should warn if passing a ReactElement to createFragment', () => {
91 - spyOn(console, 'error');
92 - ReactFragment.create(<div />);
93 - expectDev(console.error.calls.count()).toBe(1);
94 - expectDev(console.error.calls.argsFor(0)[0]).toContain(
95 - 'React.addons.createFragment does not accept a ReactElement without a ' +
96 - 'wrapper object.',
97 - );
98 - });
99 -});
src/addons/__tests__/renderSubtreeIntoContainer-test.js deleted
-300
@@ -1,300 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @emails react-core
10 - */
11 -
12 -'use strict';
13 -
14 -var React = require('react');
15 -var ReactDOM = require('react-dom');
16 -var ReactTestUtils = require('ReactTestUtils');
17 -var renderSubtreeIntoContainer = require('renderSubtreeIntoContainer');
18 -
19 -describe('renderSubtreeIntoContainer', () => {
20 - it('should pass context when rendering subtree elsewhere', () => {
21 - var portal = document.createElement('div');
22 -
23 - class Component extends React.Component {
24 - static contextTypes = {
25 - foo: React.PropTypes.string.isRequired,
26 - };
27 -
28 - render() {
29 - return <div>{this.context.foo}</div>;
30 - }
31 - }
32 -
33 - class Parent extends React.Component {
34 - static childContextTypes = {
35 - foo: React.PropTypes.string.isRequired,
36 - };
37 -
38 - getChildContext() {
39 - return {
40 - foo: 'bar',
41 - };
42 - }
43 -
44 - render() {
45 - return null;
46 - }
47 -
48 - componentDidMount() {
49 - expect(
50 - function() {
51 - renderSubtreeIntoContainer(this, <Component />, portal);
52 - }.bind(this),
53 - ).not.toThrow();
54 - }
55 - }
56 -
57 - ReactTestUtils.renderIntoDocument(<Parent />);
58 - expect(portal.firstChild.innerHTML).toBe('bar');
59 - });
60 -
61 - it('should throw if parentComponent is invalid', () => {
62 - var portal = document.createElement('div');
63 -
64 - class Component extends React.Component {
65 - static contextTypes = {
66 - foo: React.PropTypes.string.isRequired,
67 - };
68 -
69 - render() {
70 - return <div>{this.context.foo}</div>;
71 - }
72 - }
73 -
74 - // ESLint is confused here and thinks Parent is unused, presumably because
75 - // it is only used inside of the class body?
76 - // eslint-disable-next-line no-unused-vars
77 - class Parent extends React.Component {
78 - static childContextTypes = {
79 - foo: React.PropTypes.string.isRequired,
80 - };
81 -
82 - getChildContext() {
83 - return {
84 - foo: 'bar',
85 - };
86 - }
87 -
88 - render() {
89 - return null;
90 - }
91 -
92 - componentDidMount() {
93 - expect(function() {
94 - renderSubtreeIntoContainer(<Parent />, <Component />, portal);
95 - }).toThrowError('parentComponentmust be a valid React Component');
96 - }
97 - }
98 - });
99 -
100 - it('should update context if it changes due to setState', () => {
101 - var container = document.createElement('div');
102 - document.body.appendChild(container);
103 - var portal = document.createElement('div');
104 -
105 - class Component extends React.Component {
106 - static contextTypes = {
107 - foo: React.PropTypes.string.isRequired,
108 - getFoo: React.PropTypes.func.isRequired,
109 - };
110 -
111 - render() {
112 - return <div>{this.context.foo + '-' + this.context.getFoo()}</div>;
113 - }
114 - }
115 -
116 - class Parent extends React.Component {
117 - static childContextTypes = {
118 - foo: React.PropTypes.string.isRequired,
119 - getFoo: React.PropTypes.func.isRequired,
120 - };
121 -
122 - state = {
123 - bar: 'initial',
124 - };
125 -
126 - getChildContext() {
127 - return {
128 - foo: this.state.bar,
129 - getFoo: () => this.state.bar,
130 - };
131 - }
132 -
133 - render() {
134 - return null;
135 - }
136 -
137 - componentDidMount() {
138 - renderSubtreeIntoContainer(this, <Component />, portal);
139 - }
140 -
141 - componentDidUpdate() {
142 - renderSubtreeIntoContainer(this, <Component />, portal);
143 - }
144 - }
145 -
146 - var instance = ReactDOM.render(<Parent />, container);
147 - expect(portal.firstChild.innerHTML).toBe('initial-initial');
148 - instance.setState({bar: 'changed'});
149 - expect(portal.firstChild.innerHTML).toBe('changed-changed');
150 - });
151 -
152 - it('should update context if it changes due to re-render', () => {
153 - var container = document.createElement('div');
154 - document.body.appendChild(container);
155 - var portal = document.createElement('div');
156 -
157 - class Component extends React.Component {
158 - static contextTypes = {
159 - foo: React.PropTypes.string.isRequired,
160 - getFoo: React.PropTypes.func.isRequired,
161 - };
162 -
163 - render() {
164 - return <div>{this.context.foo + '-' + this.context.getFoo()}</div>;
165 - }
166 - }
167 -
168 - class Parent extends React.Component {
169 - static childContextTypes = {
170 - foo: React.PropTypes.string.isRequired,
171 - getFoo: React.PropTypes.func.isRequired,
172 - };
173 -
174 - getChildContext() {
175 - return {
176 - foo: this.props.bar,
177 - getFoo: () => this.props.bar,
178 - };
179 - }
180 -
181 - render() {
182 - return null;
183 - }
184 -
185 - componentDidMount() {
186 - renderSubtreeIntoContainer(this, <Component />, portal);
187 - }
188 -
189 - componentDidUpdate() {
190 - renderSubtreeIntoContainer(this, <Component />, portal);
191 - }
192 - }
193 -
194 - ReactDOM.render(<Parent bar="initial" />, container);
195 - expect(portal.firstChild.innerHTML).toBe('initial-initial');
196 - ReactDOM.render(<Parent bar="changed" />, container);
197 - expect(portal.firstChild.innerHTML).toBe('changed-changed');
198 - });
199 -
200 - it('should render portal with non-context-provider parent', () => {
201 - var container = document.createElement('div');
202 - document.body.appendChild(container);
203 - var portal = document.createElement('div');
204 -
205 - class Parent extends React.Component {
206 - render() {
207 - return null;
208 - }
209 -
210 - componentDidMount() {
211 - renderSubtreeIntoContainer(this, <div>hello</div>, portal);
212 - }
213 - }
214 -
215 - ReactDOM.render(<Parent bar="initial" />, container);
216 - expect(portal.firstChild.innerHTML).toBe('hello');
217 - });
218 -
219 - it('should get context through non-context-provider parent', () => {
220 - var container = document.createElement('div');
221 - document.body.appendChild(container);
222 - var portal = document.createElement('div');
223 -
224 - class Parent extends React.Component {
225 - render() {
226 - return <Middle />;
227 - }
228 - getChildContext() {
229 - return {value: this.props.value};
230 - }
231 - static childContextTypes = {
232 - value: React.PropTypes.string.isRequired,
233 - };
234 - }
235 -
236 - class Middle extends React.Component {
237 - render() {
238 - return null;
239 - }
240 - componentDidMount() {
241 - renderSubtreeIntoContainer(this, <Child />, portal);
242 - }
243 - }
244 -
245 - class Child extends React.Component {
246 - static contextTypes = {
247 - value: React.PropTypes.string.isRequired,
248 - };
249 - render() {
250 - return <div>{this.context.value}</div>;
251 - }
252 - }
253 -
254 - ReactDOM.render(<Parent value="foo" />, container);
255 - expect(portal.textContent).toBe('foo');
256 - });
257 -
258 - it('should get context through middle non-context-provider layer', () => {
259 - var container = document.createElement('div');
260 - document.body.appendChild(container);
261 - var portal1 = document.createElement('div');
262 - var portal2 = document.createElement('div');
263 -
264 - class Parent extends React.Component {
265 - render() {
266 - return null;
267 - }
268 - getChildContext() {
269 - return {value: this.props.value};
270 - }
271 - componentDidMount() {
272 - renderSubtreeIntoContainer(this, <Middle />, portal1);
273 - }
274 - static childContextTypes = {
275 - value: React.PropTypes.string.isRequired,
276 - };
277 - }
278 -
279 - class Middle extends React.Component {
280 - render() {
281 - return null;
282 - }
283 - componentDidMount() {
284 - renderSubtreeIntoContainer(this, <Child />, portal2);
285 - }
286 - }
287 -
288 - class Child extends React.Component {
289 - static contextTypes = {
290 - value: React.PropTypes.string.isRequired,
291 - };
292 - render() {
293 - return <div>{this.context.value}</div>;
294 - }
295 - }
296 -
297 - ReactDOM.render(<Parent value="foo" />, container);
298 - expect(portal2.textContent).toBe('foo');
299 - });
300 -});
src/addons/__tests__/update-test.js deleted
-189
@@ -1,189 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @emails react-core
10 - */
11 -
12 -'use strict';
13 -
14 -var update = require('update');
15 -
16 -describe('update', () => {
17 - describe('$push', () => {
18 - it('pushes', () => {
19 - expect(update([1], {$push: [7]})).toEqual([1, 7]);
20 - });
21 - it('does not mutate the original object', () => {
22 - var obj = [1];
23 - update(obj, {$push: [7]});
24 - expect(obj).toEqual([1]);
25 - });
26 - it('only pushes an array', () => {
27 - expect(update.bind(null, [], {$push: 7})).toThrowError(
28 - 'update(): expected spec of $push to be an array; got 7. Did you ' +
29 - 'forget to wrap your parameter in an array?',
30 - );
31 - });
32 - it('only pushes unto an array', () => {
33 - expect(update.bind(null, 1, {$push: 7})).toThrowError(
34 - 'update(): expected target of $push to be an array; got 1.',
35 - );
36 - });
37 - });
38 -
39 - describe('$unshift', () => {
40 - it('unshifts', () => {
41 - expect(update([1], {$unshift: [7]})).toEqual([7, 1]);
42 - });
43 - it('does not mutate the original object', () => {
44 - var obj = [1];
45 - update(obj, {$unshift: [7]});
46 - expect(obj).toEqual([1]);
47 - });
48 - it('only unshifts an array', () => {
49 - expect(update.bind(null, [], {$unshift: 7})).toThrowError(
50 - 'update(): expected spec of $unshift to be an array; got 7. Did you ' +
51 - 'forget to wrap your parameter in an array?',
52 - );
53 - });
54 - it('only unshifts unto an array', () => {
55 - expect(update.bind(null, 1, {$unshift: 7})).toThrowError(
56 - 'update(): expected target of $unshift to be an array; got 1.',
57 - );
58 - });
59 - });
60 -
61 - describe('$splice', () => {
62 - it('splices', () => {
63 - expect(update([1, 4, 3], {$splice: [[1, 1, 2]]})).toEqual([1, 2, 3]);
64 - });
65 - it('does not mutate the original object', () => {
66 - var obj = [1, 4, 3];
67 - update(obj, {$splice: [[1, 1, 2]]});
68 - expect(obj).toEqual([1, 4, 3]);
69 - });
70 - it('only splices an array of arrays', () => {
71 - expect(update.bind(null, [], {$splice: 1})).toThrowError(
72 - 'update(): expected spec of $splice to be an array of arrays; got 1. ' +
73 - 'Did you forget to wrap your parameters in an array?',
74 - );
75 - expect(update.bind(null, [], {$splice: [1]})).toThrowError(
76 - 'update(): expected spec of $splice to be an array of arrays; got 1. ' +
77 - 'Did you forget to wrap your parameters in an array?',
78 - );
79 - });
80 - it('only splices unto an array', () => {
81 - expect(update.bind(null, 1, {$splice: 7})).toThrowError(
82 - 'Expected $splice target to be an array; got 1',
83 - );
84 - });
85 - });
86 -
87 - describe('$merge', () => {
88 - it('merges', () => {
89 - expect(update({a: 'b'}, {$merge: {c: 'd'}})).toEqual({a: 'b', c: 'd'});
90 - });
91 - it('does not mutate the original object', () => {
92 - var obj = {a: 'b'};
93 - update(obj, {$merge: {c: 'd'}});
94 - expect(obj).toEqual({a: 'b'});
95 - });
96 - it('only merges with an object', () => {
97 - expect(update.bind(null, {}, {$merge: 7})).toThrowError(
98 - "update(): $merge expects a spec of type 'object'; got 7",
99 - );
100 - });
101 - it('only merges with an object', () => {
102 - expect(update.bind(null, 7, {$merge: {a: 'b'}})).toThrowError(
103 - "update(): $merge expects a target of type 'object'; got 7",
104 - );
105 - });
106 - });
107 -
108 - describe('$set', () => {
109 - it('sets', () => {
110 - expect(update({a: 'b'}, {$set: {c: 'd'}})).toEqual({c: 'd'});
111 - });
112 - it('does not mutate the original object', () => {
113 - var obj = {a: 'b'};
114 - update(obj, {$set: {c: 'd'}});
115 - expect(obj).toEqual({a: 'b'});
116 - });
117 - });
118 -
119 - describe('$apply', () => {
120 - var applier = function(node) {
121 - return {v: node.v * 2};
122 - };
123 - it('applies', () => {
124 - expect(update({v: 2}, {$apply: applier})).toEqual({v: 4});
125 - });
126 - it('does not mutate the original object', () => {
127 - var obj = {v: 2};
128 - update(obj, {$apply: applier});
129 - expect(obj).toEqual({v: 2});
130 - });
131 - it('only applies a function', () => {
132 - expect(update.bind(null, 2, {$apply: 123})).toThrowError(
133 - 'update(): expected spec of $apply to be a function; got 123.',
134 - );
135 - });
136 - });
137 -
138 - it('should support deep updates', () => {
139 - expect(
140 - update(
141 - {
142 - a: 'b',
143 - c: {
144 - d: 'e',
145 - f: [1],
146 - g: [2],
147 - h: [3],
148 - i: {j: 'k'},
149 - l: 4,
150 - },
151 - },
152 - {
153 - c: {
154 - d: {$set: 'm'},
155 - f: {$push: [5]},
156 - g: {$unshift: [6]},
157 - h: {$splice: [[0, 1, 7]]},
158 - i: {$merge: {n: 'o'}},
159 - l: {$apply: x => x * 2},
160 - },
161 - },
162 - ),
163 - ).toEqual({
164 - a: 'b',
165 - c: {
166 - d: 'm',
167 - f: [1, 5],
168 - g: [6, 2],
169 - h: [7],
170 - i: {j: 'k', n: 'o'},
171 - l: 8,
172 - },
173 - });
174 - });
175 -
176 - it('should require a command', () => {
177 - expect(update.bind(null, {a: 'b'}, {a: 'c'})).toThrowError(
178 - 'update(): You provided a key path to update() that did not contain ' +
179 - 'one of $push, $unshift, $splice, $set, $merge, $apply. Did you ' +
180 - 'forget to include {$set: ...}?',
181 - );
182 - });
183 -
184 - it('should perform safe hasOwnProperty check', () => {
185 - expect(update({}, {hasOwnProperty: {$set: 'a'}})).toEqual({
186 - hasOwnProperty: 'a',
187 - });
188 - });
189 -});
src/addons/shallowCompare.js deleted
-26
@@ -1,26 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @providesModule shallowCompare
10 - */
11 -
12 -'use strict';
13 -
14 -var shallowEqual = require('fbjs/lib/shallowEqual');
15 -
16 -/**
17 - * Does a shallow comparison for props and state.
18 - * See ReactComponentWithPureRenderMixin
19 - * See also https://facebook.github.io/react/docs/shallow-compare.html
20 - */
21 -function shallowCompare(instance, nextProps, nextState) {
22 - return !shallowEqual(instance.props, nextProps) ||
23 - !shallowEqual(instance.state, nextState);
24 -}
25 -
26 -module.exports = shallowCompare;
src/addons/transitions/ReactCSSTransitionGroup.js deleted
-99
@@ -1,99 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @providesModule ReactCSSTransitionGroup
10 - */
11 -
12 -'use strict';
13 -
14 -var React = require('react');
15 -
16 -var ReactTransitionGroup = require('ReactTransitionGroup');
17 -var ReactCSSTransitionGroupChild = require('ReactCSSTransitionGroupChild');
18 -
19 -function createTransitionTimeoutPropValidator(transitionType) {
20 - var timeoutPropName = 'transition' + transitionType + 'Timeout';
21 - var enabledPropName = 'transition' + transitionType;
22 -
23 - return function(props) {
24 - // If the transition is enabled
25 - if (props[enabledPropName]) {
26 - // If no timeout duration is provided
27 - if (props[timeoutPropName] == null) {
28 - return new Error(
29 - timeoutPropName +
30 - " wasn't supplied to ReactCSSTransitionGroup: " +
31 - "this can cause unreliable animations and won't be supported in " +
32 - 'a future version of React. See ' +
33 - 'https://fb.me/react-animation-transition-group-timeout for more ' +
34 - 'information.',
35 - );
36 -
37 - // If the duration isn't a number
38 - } else if (typeof props[timeoutPropName] !== 'number') {
39 - return new Error(
40 - timeoutPropName + ' must be a number (in milliseconds)',
41 - );
42 - }
43 - }
44 - };
45 -}
46 -
47 -/**
48 - * An easy way to perform CSS transitions and animations when a React component
49 - * enters or leaves the DOM.
50 - * See https://facebook.github.io/react/docs/animation.html#high-level-api-reactcsstransitiongroup
51 - */
52 -class ReactCSSTransitionGroup extends React.Component {
53 - static displayName = 'ReactCSSTransitionGroup';
54 -
55 - static propTypes = {
56 - transitionName: ReactCSSTransitionGroupChild.propTypes.name,
57 -
58 - transitionAppear: React.PropTypes.bool,
59 - transitionEnter: React.PropTypes.bool,
60 - transitionLeave: React.PropTypes.bool,
61 - transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'),
62 - transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'),
63 - transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave'),
64 - };
65 -
66 - static defaultProps = {
67 - transitionAppear: false,
68 - transitionEnter: true,
69 - transitionLeave: true,
70 - };
71 -
72 - _wrapChild = child => {
73 - // We need to provide this childFactory so that
74 - // ReactCSSTransitionGroupChild can receive updates to name, enter, and
75 - // leave while it is leaving.
76 - return React.createElement(
77 - ReactCSSTransitionGroupChild,
78 - {
79 - name: this.props.transitionName,
80 - appear: this.props.transitionAppear,
81 - enter: this.props.transitionEnter,
82 - leave: this.props.transitionLeave,
83 - appearTimeout: this.props.transitionAppearTimeout,
84 - enterTimeout: this.props.transitionEnterTimeout,
85 - leaveTimeout: this.props.transitionLeaveTimeout,
86 - },
87 - child,
88 - );
89 - };
90 -
91 - render() {
92 - return React.createElement(
93 - ReactTransitionGroup,
94 - Object.assign({}, this.props, {childFactory: this._wrapChild}),
95 - );
96 - }
97 -}
98 -
99 -module.exports = ReactCSSTransitionGroup;
src/addons/transitions/ReactCSSTransitionGroupChild.js deleted
-173
@@ -1,173 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @providesModule ReactCSSTransitionGroupChild
10 - */
11 -
12 -'use strict';
13 -
14 -var React = require('react');
15 -var ReactAddonsDOMDependencies = require('ReactAddonsDOMDependencies');
16 -
17 -var CSSCore = require('fbjs/lib/CSSCore');
18 -var ReactTransitionEvents = require('ReactTransitionEvents');
19 -
20 -var onlyChild = require('onlyChild');
21 -
22 -var TICK = 17;
23 -
24 -var ReactCSSTransitionGroupChild = React.createClass({
25 - displayName: 'ReactCSSTransitionGroupChild',
26 -
27 - propTypes: {
28 - name: React.PropTypes.oneOfType([
29 - React.PropTypes.string,
30 - React.PropTypes.shape({
31 - enter: React.PropTypes.string,
32 - leave: React.PropTypes.string,
33 - active: React.PropTypes.string,
34 - }),
35 - React.PropTypes.shape({
36 - enter: React.PropTypes.string,
37 - enterActive: React.PropTypes.string,
38 - leave: React.PropTypes.string,
39 - leaveActive: React.PropTypes.string,
40 - appear: React.PropTypes.string,
41 - appearActive: React.PropTypes.string,
42 - }),
43 - ]).isRequired,
44 -
45 - // Once we require timeouts to be specified, we can remove the
46 - // boolean flags (appear etc.) and just accept a number
47 - // or a bool for the timeout flags (appearTimeout etc.)
48 - appear: React.PropTypes.bool,
49 - enter: React.PropTypes.bool,
50 - leave: React.PropTypes.bool,
51 - appearTimeout: React.PropTypes.number,
52 - enterTimeout: React.PropTypes.number,
53 - leaveTimeout: React.PropTypes.number,
54 - },
55 -
56 - transition: function(animationType, finishCallback, userSpecifiedDelay) {
57 - var node = ReactAddonsDOMDependencies.getReactDOM().findDOMNode(this);
58 -
59 - if (!node) {
60 - if (finishCallback) {
61 - finishCallback();
62 - }
63 - return;
64 - }
65 -
66 - var className = this.props.name[animationType] ||
67 - this.props.name + '-' + animationType;
68 - var activeClassName = this.props.name[animationType + 'Active'] ||
69 - className + '-active';
70 - var timeout = null;
71 -
72 - var endListener = function(e) {
73 - if (e && e.target !== node) {
74 - return;
75 - }
76 -
77 - clearTimeout(timeout);
78 -
79 - CSSCore.removeClass(node, className);
80 - CSSCore.removeClass(node, activeClassName);
81 -
82 - ReactTransitionEvents.removeEndEventListener(node, endListener);
83 -
84 - // Usually this optional callback is used for informing an owner of
85 - // a leave animation and telling it to remove the child.
86 - if (finishCallback) {
87 - finishCallback();
88 - }
89 - };
90 -
91 - CSSCore.addClass(node, className);
92 -
93 - // Need to do this to actually trigger a transition.
94 - this.queueClassAndNode(activeClassName, node);
95 -
96 - // If the user specified a timeout delay.
97 - if (userSpecifiedDelay) {
98 - // Clean-up the animation after the specified delay
99 - timeout = setTimeout(endListener, userSpecifiedDelay);
100 - this.transitionTimeouts.push(timeout);
101 - } else {
102 - // DEPRECATED: this listener will be removed in a future version of react
103 - ReactTransitionEvents.addEndEventListener(node, endListener);
104 - }
105 - },
106 -
107 - queueClassAndNode: function(className, node) {
108 - this.classNameAndNodeQueue.push({
109 - className: className,
110 - node: node,
111 - });
112 -
113 - if (!this.timeout) {
114 - this.timeout = setTimeout(this.flushClassNameAndNodeQueue, TICK);
115 - }
116 - },
117 -
118 - flushClassNameAndNodeQueue: function() {
119 - if (this.isMounted()) {
120 - this.classNameAndNodeQueue.forEach(function(obj) {
121 - CSSCore.addClass(obj.node, obj.className);
122 - });
123 - }
124 - this.classNameAndNodeQueue.length = 0;
125 - this.timeout = null;
126 - },
127 -
128 - componentWillMount: function() {
129 - this.classNameAndNodeQueue = [];
130 - this.transitionTimeouts = [];
131 - },
132 -
133 - componentWillUnmount: function() {
134 - if (this.timeout) {
135 - clearTimeout(this.timeout);
136 - }
137 - this.transitionTimeouts.forEach(function(timeout) {
138 - clearTimeout(timeout);
139 - });
140 -
141 - this.classNameAndNodeQueue.length = 0;
142 - },
143 -
144 - componentWillAppear: function(done) {
145 - if (this.props.appear) {
146 - this.transition('appear', done, this.props.appearTimeout);
147 - } else {
148 - done();
149 - }
150 - },
151 -
152 - componentWillEnter: function(done) {
153 - if (this.props.enter) {
154 - this.transition('enter', done, this.props.enterTimeout);
155 - } else {
156 - done();
157 - }
158 - },
159 -
160 - componentWillLeave: function(done) {
161 - if (this.props.leave) {
162 - this.transition('leave', done, this.props.leaveTimeout);
163 - } else {
164 - done();
165 - }
166 - },
167 -
168 - render: function() {
169 - return onlyChild(this.props.children);
170 - },
171 -});
172 -
173 -module.exports = ReactCSSTransitionGroupChild;
src/addons/transitions/ReactTransitionChildMapping.js deleted
-105
@@ -1,105 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @providesModule ReactTransitionChildMapping
10 - */
11 -
12 -'use strict';
13 -
14 -var flattenChildren = require('flattenChildren');
15 -
16 -var ReactTransitionChildMapping = {
17 - /**
18 - * Given `this.props.children`, return an object mapping key to child. Just
19 - * simple syntactic sugar around flattenChildren().
20 - *
21 - * @param {*} children `this.props.children`
22 - * @param {number=} selfDebugID Optional debugID of the current internal instance.
23 - * @return {object} Mapping of key to child
24 - */
25 - getChildMapping: function(children, selfDebugID) {
26 - if (!children) {
27 - return children;
28 - }
29 -
30 - if (__DEV__) {
31 - return flattenChildren(children, selfDebugID);
32 - }
33 -
34 - return flattenChildren(children);
35 - },
36 -
37 - /**
38 - * When you're adding or removing children some may be added or removed in the
39 - * same render pass. We want to show *both* since we want to simultaneously
40 - * animate elements in and out. This function takes a previous set of keys
41 - * and a new set of keys and merges them with its best guess of the correct
42 - * ordering. In the future we may expose some of the utilities in
43 - * ReactMultiChild to make this easy, but for now React itself does not
44 - * directly have this concept of the union of prevChildren and nextChildren
45 - * so we implement it here.
46 - *
47 - * @param {object} prev prev children as returned from
48 - * `ReactTransitionChildMapping.getChildMapping()`.
49 - * @param {object} next next children as returned from
50 - * `ReactTransitionChildMapping.getChildMapping()`.
51 - * @return {object} a key set that contains all keys in `prev` and all keys
52 - * in `next` in a reasonable order.
53 - */
54 - mergeChildMappings: function(prev, next) {
55 - prev = prev || {};
56 - next = next || {};
57 -
58 - function getValueForKey(key) {
59 - if (next.hasOwnProperty(key)) {
60 - return next[key];
61 - } else {
62 - return prev[key];
63 - }
64 - }
65 -
66 - // For each key of `next`, the list of keys to insert before that key in
67 - // the combined list
68 - var nextKeysPending = {};
69 -
70 - var pendingKeys = [];
71 - for (var prevKey in prev) {
72 - if (next.hasOwnProperty(prevKey)) {
73 - if (pendingKeys.length) {
74 - nextKeysPending[prevKey] = pendingKeys;
75 - pendingKeys = [];
76 - }
77 - } else {
78 - pendingKeys.push(prevKey);
79 - }
80 - }
81 -
82 - var i;
83 - var childMapping = {};
84 - for (var nextKey in next) {
85 - if (nextKeysPending.hasOwnProperty(nextKey)) {
86 - for (i = 0; i < nextKeysPending[nextKey].length; i++) {
87 - var pendingNextKey = nextKeysPending[nextKey][i];
88 - childMapping[nextKeysPending[nextKey][i]] = getValueForKey(
89 - pendingNextKey,
90 - );
91 - }
92 - }
93 - childMapping[nextKey] = getValueForKey(nextKey);
94 - }
95 -
96 - // Finally, add the keys which didn't appear before any key in `next`
97 - for (i = 0; i < pendingKeys.length; i++) {
98 - childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
99 - }
100 -
101 - return childMapping;
102 - },
103 -};
104 -
105 -module.exports = ReactTransitionChildMapping;
src/addons/transitions/ReactTransitionEvents.js deleted
-73
@@ -1,73 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @providesModule ReactTransitionEvents
10 - */
11 -
12 -'use strict';
13 -
14 -var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
15 -
16 -var getVendorPrefixedEventName = require('react-dom/lib/getVendorPrefixedEventName');
17 -
18 -var endEvents = [];
19 -
20 -function detectEvents() {
21 - var animEnd = getVendorPrefixedEventName('animationend');
22 - var transEnd = getVendorPrefixedEventName('transitionend');
23 -
24 - if (animEnd) {
25 - endEvents.push(animEnd);
26 - }
27 -
28 - if (transEnd) {
29 - endEvents.push(transEnd);
30 - }
31 -}
32 -
33 -if (ExecutionEnvironment.canUseDOM) {
34 - detectEvents();
35 -}
36 -
37 -// We use the raw {add|remove}EventListener() call because EventListener
38 -// does not know how to remove event listeners and we really should
39 -// clean up. Also, these events are not triggered in older browsers
40 -// so we should be A-OK here.
41 -
42 -function addEventListener(node, eventName, eventListener) {
43 - node.addEventListener(eventName, eventListener, false);
44 -}
45 -
46 -function removeEventListener(node, eventName, eventListener) {
47 - node.removeEventListener(eventName, eventListener, false);
48 -}
49 -
50 -var ReactTransitionEvents = {
51 - addEndEventListener: function(node, eventListener) {
52 - if (endEvents.length === 0) {
53 - // If CSS transitions are not supported, trigger an "end animation"
54 - // event immediately.
55 - window.setTimeout(eventListener, 0);
56 - return;
57 - }
58 - endEvents.forEach(function(endEvent) {
59 - addEventListener(node, endEvent, eventListener);
60 - });
61 - },
62 -
63 - removeEndEventListener: function(node, eventListener) {
64 - if (endEvents.length === 0) {
65 - return;
66 - }
67 - endEvents.forEach(function(endEvent) {
68 - removeEventListener(node, endEvent, eventListener);
69 - });
70 - },
71 -};
72 -
73 -module.exports = ReactTransitionEvents;
src/addons/transitions/ReactTransitionGroup.js deleted
-243
@@ -1,243 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @providesModule ReactTransitionGroup
10 - */
11 -
12 -'use strict';
13 -
14 -var React = require('react');
15 -var ReactTransitionChildMapping = require('ReactTransitionChildMapping');
16 -
17 -var emptyFunction = require('fbjs/lib/emptyFunction');
18 -
19 -/**
20 - * A basis for animations. When children are declaratively added or removed,
21 - * special lifecycle hooks are called.
22 - * See https://facebook.github.io/react/docs/animation.html#low-level-api-reacttransitiongroup
23 - */
24 -class ReactTransitionGroup extends React.Component {
25 - static displayName = 'ReactTransitionGroup';
26 -
27 - static propTypes = {
28 - component: React.PropTypes.any,
29 - childFactory: React.PropTypes.func,
30 - };
31 -
32 - static defaultProps = {
33 - component: 'span',
34 - childFactory: emptyFunction.thatReturnsArgument,
35 - };
36 -
37 - state = {
38 - // TODO: can we get useful debug information to show at this point?
39 - children: ReactTransitionChildMapping.getChildMapping(this.props.children),
40 - };
41 -
42 - componentWillMount() {
43 - this.currentlyTransitioningKeys = {};
44 - this.keysToEnter = [];
45 - this.keysToLeave = [];
46 - }
47 -
48 - componentDidMount() {
49 - var initialChildMapping = this.state.children;
50 - for (var key in initialChildMapping) {
51 - if (initialChildMapping[key]) {
52 - this.performAppear(key);
53 - }
54 - }
55 - }
56 -
57 - componentWillReceiveProps(nextProps) {
58 - var nextChildMapping = ReactTransitionChildMapping.getChildMapping(
59 - nextProps.children,
60 - );
61 - var prevChildMapping = this.state.children;
62 -
63 - this.setState({
64 - children: ReactTransitionChildMapping.mergeChildMappings(
65 - prevChildMapping,
66 - nextChildMapping,
67 - ),
68 - });
69 -
70 - var key;
71 -
72 - for (key in nextChildMapping) {
73 - var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
74 - if (
75 - nextChildMapping[key] &&
76 - !hasPrev &&
77 - !this.currentlyTransitioningKeys[key]
78 - ) {
79 - this.keysToEnter.push(key);
80 - }
81 - }
82 -
83 - for (key in prevChildMapping) {
84 - var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
85 - if (
86 - prevChildMapping[key] &&
87 - !hasNext &&
88 - !this.currentlyTransitioningKeys[key]
89 - ) {
90 - this.keysToLeave.push(key);
91 - }
92 - }
93 -
94 - // If we want to someday check for reordering, we could do it here.
95 - }
96 -
97 - componentDidUpdate() {
98 - var keysToEnter = this.keysToEnter;
99 - this.keysToEnter = [];
100 - keysToEnter.forEach(this.performEnter);
101 -
102 - var keysToLeave = this.keysToLeave;
103 - this.keysToLeave = [];
104 - keysToLeave.forEach(this.performLeave);
105 - }
106 -
107 - performAppear = key => {
108 - this.currentlyTransitioningKeys[key] = true;
109 -
110 - var component = this.refs[key];
111 -
112 - if (component.componentWillAppear) {
113 - component.componentWillAppear(this._handleDoneAppearing.bind(this, key));
114 - } else {
115 - this._handleDoneAppearing(key);
116 - }
117 - };
118 -
119 - _handleDoneAppearing = key => {
120 - var component = this.refs[key];
121 - if (component.componentDidAppear) {
122 - component.componentDidAppear();
123 - }
124 -
125 - delete this.currentlyTransitioningKeys[key];
126 -
127 - var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
128 - this.props.children,
129 - );
130 -
131 - if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
132 - // This was removed before it had fully appeared. Remove it.
133 - this.performLeave(key);
134 - }
135 - };
136 -
137 - performEnter = key => {
138 - this.currentlyTransitioningKeys[key] = true;
139 -
140 - var component = this.refs[key];
141 -
142 - if (component.componentWillEnter) {
143 - component.componentWillEnter(this._handleDoneEntering.bind(this, key));
144 - } else {
145 - this._handleDoneEntering(key);
146 - }
147 - };
148 -
149 - _handleDoneEntering = key => {
150 - var component = this.refs[key];
151 - if (component.componentDidEnter) {
152 - component.componentDidEnter();
153 - }
154 -
155 - delete this.currentlyTransitioningKeys[key];
156 -
157 - var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
158 - this.props.children,
159 - );
160 -
161 - if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
162 - // This was removed before it had fully entered. Remove it.
163 - this.performLeave(key);
164 - }
165 - };
166 -
167 - performLeave = key => {
168 - this.currentlyTransitioningKeys[key] = true;
169 -
170 - var component = this.refs[key];
171 - if (component.componentWillLeave) {
172 - component.componentWillLeave(this._handleDoneLeaving.bind(this, key));
173 - } else {
174 - // Note that this is somewhat dangerous b/c it calls setState()
175 - // again, effectively mutating the component before all the work
176 - // is done.
177 - this._handleDoneLeaving(key);
178 - }
179 - };
180 -
181 - _handleDoneLeaving = key => {
182 - var component = this.refs[key];
183 -
184 - if (component.componentDidLeave) {
185 - component.componentDidLeave();
186 - }
187 -
188 - delete this.currentlyTransitioningKeys[key];
189 -
190 - var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
191 - this.props.children,
192 - );
193 -
194 - if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
195 - // This entered again before it fully left. Add it again.
196 - this.performEnter(key);
197 - } else {
198 - this.setState(function(state) {
199 - var newChildren = Object.assign({}, state.children);
200 - delete newChildren[key];
201 - return {children: newChildren};
202 - });
203 - }
204 - };
205 -
206 - render() {
207 - // TODO: we could get rid of the need for the wrapper node
208 - // by cloning a single child
209 - var childrenToRender = [];
210 - for (var key in this.state.children) {
211 - var child = this.state.children[key];
212 - if (child) {
213 - // You may need to apply reactive updates to a child as it is leaving.
214 - // The normal React way to do it won't work since the child will have
215 - // already been removed. In case you need this behavior you can provide
216 - // a childFactory function to wrap every child, even the ones that are
217 - // leaving.
218 - childrenToRender.push(
219 - React.cloneElement(this.props.childFactory(child), {
220 - ref: key,
221 - key: key,
222 - }),
223 - );
224 - }
225 - }
226 -
227 - // Do not forward ReactTransitionGroup props to primitive DOM nodes
228 - var props = Object.assign({}, this.props);
229 - delete props.transitionLeave;
230 - delete props.transitionName;
231 - delete props.transitionAppear;
232 - delete props.transitionEnter;
233 - delete props.childFactory;
234 - delete props.transitionLeaveTimeout;
235 - delete props.transitionEnterTimeout;
236 - delete props.transitionAppearTimeout;
237 - delete props.component;
238 -
239 - return React.createElement(this.props.component, props, childrenToRender);
240 - }
241 -}
242 -
243 -module.exports = ReactTransitionGroup;
src/addons/transitions/__tests__/ReactCSSTransitionGroup-test.js deleted
-325
@@ -1,325 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @emails react-core
10 - */
11 -
12 -'use strict';
13 -
14 -var CSSCore = require('fbjs/lib/CSSCore');
15 -
16 -var React;
17 -var ReactDOM;
18 -var ReactCSSTransitionGroup;
19 -
20 -// Most of the real functionality is covered in other unit tests, this just
21 -// makes sure we're wired up correctly.
22 -describe('ReactCSSTransitionGroup', () => {
23 - var container;
24 -
25 - beforeEach(() => {
26 - jest.resetModules();
27 - React = require('react');
28 - ReactDOM = require('react-dom');
29 - ReactCSSTransitionGroup = require('ReactCSSTransitionGroup');
30 -
31 - container = document.createElement('div');
32 - spyOn(console, 'error');
33 - });
34 -
35 - it("should warn if timeouts aren't specified", () => {
36 - ReactDOM.render(
37 - <ReactCSSTransitionGroup
38 - transitionName="yolo"
39 - transitionEnter={false}
40 - transitionLeave={true}>
41 - <span key="one" id="one" />
42 - </ReactCSSTransitionGroup>,
43 - container,
44 - );
45 -
46 - // Warning about the missing transitionLeaveTimeout prop
47 - expectDev(console.error.calls.count()).toBe(1);
48 - });
49 -
50 - it('should not warn if timeouts is zero', () => {
51 - ReactDOM.render(
52 - <ReactCSSTransitionGroup
53 - transitionName="yolo"
54 - transitionEnter={false}
55 - transitionLeave={true}
56 - transitionLeaveTimeout={0}>
57 - <span key="one" id="one" />
58 - </ReactCSSTransitionGroup>,
59 - container,
60 - );
61 -
62 - expectDev(console.error.calls.count()).toBe(0);
63 - });
64 -
65 - it('should clean-up silently after the timeout elapses', () => {
66 - var a = ReactDOM.render(
67 - <ReactCSSTransitionGroup
68 - transitionName="yolo"
69 - transitionEnter={false}
70 - transitionLeaveTimeout={200}>
71 - <span key="one" id="one" />
72 - </ReactCSSTransitionGroup>,
73 - container,
74 - );
75 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
76 -
77 - setTimeout.mock.calls.length = 0;
78 -
79 - ReactDOM.render(
80 - <ReactCSSTransitionGroup
81 - transitionName="yolo"
82 - transitionEnter={false}
83 - transitionLeaveTimeout={200}>
84 - <span key="two" id="two" />
85 - </ReactCSSTransitionGroup>,
86 - container,
87 - );
88 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(2);
89 - expect(ReactDOM.findDOMNode(a).childNodes[0].id).toBe('two');
90 - expect(ReactDOM.findDOMNode(a).childNodes[1].id).toBe('one');
91 -
92 - // For some reason jst is adding extra setTimeout()s and grunt test isn't,
93 - // so we need to do this disgusting hack.
94 - for (var i = 0; i < setTimeout.mock.calls.length; i++) {
95 - if (setTimeout.mock.calls[i][1] === 200) {
96 - setTimeout.mock.calls[i][0]();
97 - break;
98 - }
99 - }
100 -
101 - // No warnings
102 - expectDev(console.error.calls.count()).toBe(0);
103 -
104 - // The leaving child has been removed
105 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
106 - expect(ReactDOM.findDOMNode(a).childNodes[0].id).toBe('two');
107 - });
108 -
109 - it('should keep both sets of DOM nodes around', () => {
110 - var a = ReactDOM.render(
111 - <ReactCSSTransitionGroup transitionName="yolo">
112 - <span key="one" id="one" />
113 - </ReactCSSTransitionGroup>,
114 - container,
115 - );
116 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
117 - ReactDOM.render(
118 - <ReactCSSTransitionGroup transitionName="yolo">
119 - <span key="two" id="two" />
120 - </ReactCSSTransitionGroup>,
121 - container,
122 - );
123 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(2);
124 - expect(ReactDOM.findDOMNode(a).childNodes[0].id).toBe('two');
125 - expect(ReactDOM.findDOMNode(a).childNodes[1].id).toBe('one');
126 - });
127 -
128 - it('should switch transitionLeave from false to true', () => {
129 - var a = ReactDOM.render(
130 - <ReactCSSTransitionGroup
131 - transitionName="yolo"
132 - transitionEnter={false}
133 - transitionLeave={false}>
134 - <span key="one" id="one" />
135 - </ReactCSSTransitionGroup>,
136 - container,
137 - );
138 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
139 - ReactDOM.render(
140 - <ReactCSSTransitionGroup
141 - transitionName="yolo"
142 - transitionEnter={false}
143 - transitionLeave={false}>
144 - <span key="two" id="two" />
145 - </ReactCSSTransitionGroup>,
146 - container,
147 - );
148 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
149 - ReactDOM.render(
150 - <ReactCSSTransitionGroup
151 - transitionName="yolo"
152 - transitionEnter={false}
153 - transitionLeave={true}>
154 - <span key="three" id="three" />
155 - </ReactCSSTransitionGroup>,
156 - container,
157 - );
158 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(2);
159 - expect(ReactDOM.findDOMNode(a).childNodes[0].id).toBe('three');
160 - expect(ReactDOM.findDOMNode(a).childNodes[1].id).toBe('two');
161 - });
162 -
163 - it('should work with no children', () => {
164 - ReactDOM.render(
165 - <ReactCSSTransitionGroup transitionName="yolo" />,
166 - container,
167 - );
168 - });
169 -
170 - it('should work with a null child', () => {
171 - ReactDOM.render(
172 - <ReactCSSTransitionGroup transitionName="yolo">
173 - {[null]}
174 - </ReactCSSTransitionGroup>,
175 - container,
176 - );
177 - });
178 -
179 - it('should transition from one to null', () => {
180 - var a = ReactDOM.render(
181 - <ReactCSSTransitionGroup transitionName="yolo">
182 - <span key="one" id="one" />
183 - </ReactCSSTransitionGroup>,
184 - container,
185 - );
186 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
187 - ReactDOM.render(
188 - <ReactCSSTransitionGroup transitionName="yolo">
189 - {null}
190 - </ReactCSSTransitionGroup>,
191 - container,
192 - );
193 - // (Here, we expect the original child to stick around but test that no
194 - // exception is thrown)
195 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
196 - expect(ReactDOM.findDOMNode(a).childNodes[0].id).toBe('one');
197 - });
198 -
199 - it('should transition from false to one', () => {
200 - var a = ReactDOM.render(
201 - <ReactCSSTransitionGroup transitionName="yolo">
202 - {false}
203 - </ReactCSSTransitionGroup>,
204 - container,
205 - );
206 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(0);
207 - ReactDOM.render(
208 - <ReactCSSTransitionGroup transitionName="yolo">
209 - <span key="one" id="one" />
210 - </ReactCSSTransitionGroup>,
211 - container,
212 - );
213 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
214 - expect(ReactDOM.findDOMNode(a).childNodes[0].id).toBe('one');
215 - });
216 -
217 - it("should use transition-type specific names when they're provided", () => {
218 - var customTransitionNames = {
219 - enter: 'custom-entering',
220 - leave: 'custom-leaving',
221 - };
222 -
223 - var a = ReactDOM.render(
224 - <ReactCSSTransitionGroup
225 - transitionName={customTransitionNames}
226 - transitionEnterTimeout={1}
227 - transitionLeaveTimeout={1}>
228 - <span key="one" id="one" />
229 - </ReactCSSTransitionGroup>,
230 - container,
231 - );
232 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
233 -
234 - // Add an element
235 - ReactDOM.render(
236 - <ReactCSSTransitionGroup
237 - transitionName={customTransitionNames}
238 - transitionEnterTimeout={1}
239 - transitionLeaveTimeout={1}>
240 - <span key="one" id="one" />
241 - <span key="two" id="two" />
242 - </ReactCSSTransitionGroup>,
243 - container,
244 - );
245 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(2);
246 -
247 - var enteringNode = ReactDOM.findDOMNode(a).childNodes[1];
248 - expect(CSSCore.hasClass(enteringNode, 'custom-entering')).toBe(true);
249 -
250 - // Remove an element
251 - ReactDOM.render(
252 - <ReactCSSTransitionGroup
253 - transitionName={customTransitionNames}
254 - transitionEnterTimeout={1}
255 - transitionLeaveTimeout={1}>
256 - <span key="two" id="two" />
257 - </ReactCSSTransitionGroup>,
258 - container,
259 - );
260 - expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(2);
261 -
262 - var leavingNode = ReactDOM.findDOMNode(a).childNodes[0];
263 - expect(CSSCore.hasClass(leavingNode, 'custom-leaving')).toBe(true);
264 - });
265 -
266 - it('should clear transition timeouts when unmounted', () => {
267 - class Component extends React.Component {
268 - render() {
269 - return (
270 - <ReactCSSTransitionGroup
271 - transitionName="yolo"
272 - transitionEnterTimeout={500}>
273 - {this.props.children}
274 - </ReactCSSTransitionGroup>
275 - );
276 - }
277 - }
278 -
279 - ReactDOM.render(<Component />, container);
280 - ReactDOM.render(
281 - <Component><span key="yolo" id="yolo" /></Component>,
282 - container,
283 - );
284 -
285 - ReactDOM.unmountComponentAtNode(container);
286 -
287 - // Testing that no exception is thrown here, as the timeout has been cleared.
288 - jest.runAllTimers();
289 - });
290 -
291 - it('should handle unmounted elements properly', () => {
292 - class Child extends React.Component {
293 - render() {
294 - if (!this.props.show) {
295 - return null;
296 - }
297 - return <div />;
298 - }
299 - }
300 -
301 - class Component extends React.Component {
302 - state = {showChild: true};
303 -
304 - componentDidMount() {
305 - this.setState({showChild: false});
306 - }
307 -
308 - render() {
309 - return (
310 - <ReactCSSTransitionGroup
311 - transitionName="yolo"
312 - transitionAppear={true}
313 - transitionAppearTimeout={0}>
314 - <Child show={this.state.showChild} />
315 - </ReactCSSTransitionGroup>
316 - );
317 - }
318 - }
319 -
320 - ReactDOM.render(<Component />, container);
321 -
322 - // Testing that no exception is thrown here, as the timeout has been cleared.
323 - jest.runAllTimers();
324 - });
325 -});
src/addons/transitions/__tests__/ReactTransitionChildMapping-test.js deleted
-137
@@ -1,137 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @emails react-core
10 - */
11 -
12 -'use strict';
13 -
14 -var React;
15 -var ReactTransitionChildMapping;
16 -
17 -describe('ReactTransitionChildMapping', () => {
18 - beforeEach(() => {
19 - React = require('react');
20 - ReactTransitionChildMapping = require('ReactTransitionChildMapping');
21 - });
22 -
23 - it('should support getChildMapping', () => {
24 - var oneone = <div key="oneone" />;
25 - var onetwo = <div key="onetwo" />;
26 - var one = <div key="one">{oneone}{onetwo}</div>;
27 - var two = <div key="two" />;
28 - var component = <div>{one}{two}</div>;
29 - expect(
30 - ReactTransitionChildMapping.getChildMapping(component.props.children),
31 - ).toEqual({
32 - '.$one': one,
33 - '.$two': two,
34 - });
35 - });
36 -
37 - it('should support mergeChildMappings for adding keys', () => {
38 - var prev = {
39 - one: true,
40 - two: true,
41 - };
42 - var next = {
43 - one: true,
44 - two: true,
45 - three: true,
46 - };
47 - expect(ReactTransitionChildMapping.mergeChildMappings(prev, next)).toEqual({
48 - one: true,
49 - two: true,
50 - three: true,
51 - });
52 - });
53 -
54 - it('should support mergeChildMappings for removing keys', () => {
55 - var prev = {
56 - one: true,
57 - two: true,
58 - three: true,
59 - };
60 - var next = {
61 - one: true,
62 - two: true,
63 - };
64 - expect(ReactTransitionChildMapping.mergeChildMappings(prev, next)).toEqual({
65 - one: true,
66 - two: true,
67 - three: true,
68 - });
69 - });
70 -
71 - it('should support mergeChildMappings for adding and removing', () => {
72 - var prev = {
73 - one: true,
74 - two: true,
75 - three: true,
76 - };
77 - var next = {
78 - one: true,
79 - two: true,
80 - four: true,
81 - };
82 - expect(ReactTransitionChildMapping.mergeChildMappings(prev, next)).toEqual({
83 - one: true,
84 - two: true,
85 - three: true,
86 - four: true,
87 - });
88 - });
89 -
90 - it('should reconcile overlapping insertions and deletions', () => {
91 - var prev = {
92 - one: true,
93 - two: true,
94 - four: true,
95 - five: true,
96 - };
97 - var next = {
98 - one: true,
99 - two: true,
100 - three: true,
101 - five: true,
102 - };
103 - expect(ReactTransitionChildMapping.mergeChildMappings(prev, next)).toEqual({
104 - one: true,
105 - two: true,
106 - three: true,
107 - four: true,
108 - five: true,
109 - });
110 - });
111 -
112 - it('should support mergeChildMappings with undefined input', () => {
113 - var prev = {
114 - one: true,
115 - two: true,
116 - };
117 -
118 - var next = undefined;
119 -
120 - expect(ReactTransitionChildMapping.mergeChildMappings(prev, next)).toEqual({
121 - one: true,
122 - two: true,
123 - });
124 -
125 - prev = undefined;
126 -
127 - next = {
128 - three: true,
129 - four: true,
130 - };
131 -
132 - expect(ReactTransitionChildMapping.mergeChildMappings(prev, next)).toEqual({
133 - three: true,
134 - four: true,
135 - });
136 - });
137 -});
src/addons/transitions/__tests__/ReactTransitionGroup-test.js deleted
-334
@@ -1,334 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @emails react-core
10 - */
11 -
12 -'use strict';
13 -
14 -var React;
15 -var ReactDOM;
16 -var ReactTransitionGroup;
17 -
18 -// Most of the real functionality is covered in other unit tests, this just
19 -// makes sure we're wired up correctly.
20 -describe('ReactTransitionGroup', () => {
21 - var container;
22 -
23 - beforeEach(() => {
24 - React = require('react');
25 - ReactDOM = require('react-dom');
26 - ReactTransitionGroup = require('ReactTransitionGroup');
27 -
28 - container = document.createElement('div');
29 - });
30 -
31 - it('should handle willEnter correctly', () => {
32 - var log = [];
33 -
34 - class Child extends React.Component {
35 - componentDidMount() {
36 - log.push('didMount');
37 - }
38 -
39 - componentWillAppear = cb => {
40 - log.push('willAppear');
41 - cb();
42 - };
43 -
44 - componentDidAppear = () => {
45 - log.push('didAppear');
46 - };
47 -
48 - componentWillEnter = cb => {
49 - log.push('willEnter');
50 - cb();
51 - };
52 -
53 - componentDidEnter = () => {
54 - log.push('didEnter');
55 - };
56 -
57 - componentWillLeave = cb => {
58 - log.push('willLeave');
59 - cb();
60 - };
61 -
62 - componentDidLeave = () => {
63 - log.push('didLeave');
64 - };
65 -
66 - componentWillUnmount() {
67 - log.push('willUnmount');
68 - }
69 -
70 - render() {
71 - return <span />;
72 - }
73 - }
74 -
75 - class Component extends React.Component {
76 - state = {count: 1};
77 -
78 - render() {
79 - var children = [];
80 - for (var i = 0; i < this.state.count; i++) {
81 - children.push(<Child key={i} />);
82 - }
83 - return <ReactTransitionGroup>{children}</ReactTransitionGroup>;
84 - }
85 - }
86 -
87 - var instance = ReactDOM.render(<Component />, container);
88 - expect(log).toEqual(['didMount', 'willAppear', 'didAppear']);
89 -
90 - log = [];
91 - instance.setState({count: 2}, function() {
92 - expect(log).toEqual(['didMount', 'willEnter', 'didEnter']);
93 -
94 - log = [];
95 - instance.setState({count: 1});
96 - });
97 -
98 - expect(log).toEqual(['willLeave', 'didLeave', 'willUnmount']);
99 - });
100 -
101 - it('should handle enter/leave/enter/leave correctly', () => {
102 - var log = [];
103 - var willEnterCb;
104 -
105 - class Child extends React.Component {
106 - componentDidMount() {
107 - log.push('didMount');
108 - }
109 -
110 - componentWillEnter = cb => {
111 - log.push('willEnter');
112 - willEnterCb = cb;
113 - };
114 -
115 - componentDidEnter = () => {
116 - log.push('didEnter');
117 - };
118 -
119 - componentWillLeave = cb => {
120 - log.push('willLeave');
121 - cb();
122 - };
123 -
124 - componentDidLeave = () => {
125 - log.push('didLeave');
126 - };
127 -
128 - componentWillUnmount() {
129 - log.push('willUnmount');
130 - }
131 -
132 - render() {
133 - return <span />;
134 - }
135 - }
136 -
137 - class Component extends React.Component {
138 - state = {count: 1};
139 -
140 - render() {
141 - var children = [];
142 - for (var i = 0; i < this.state.count; i++) {
143 - children.push(<Child key={i} />);
144 - }
145 - return <ReactTransitionGroup>{children}</ReactTransitionGroup>;
146 - }
147 - }
148 -
149 - var instance = ReactDOM.render(<Component />, container);
150 - expect(log).toEqual(['didMount']);
151 - instance.setState({count: 2});
152 - expect(log).toEqual(['didMount', 'didMount', 'willEnter']);
153 - for (var k = 0; k < 5; k++) {
154 - instance.setState({count: 2});
155 - expect(log).toEqual(['didMount', 'didMount', 'willEnter']);
156 - instance.setState({count: 1});
157 - }
158 - // other animations are blocked until willEnterCb is called
159 - willEnterCb();
160 - expect(log).toEqual([
161 - 'didMount',
162 - 'didMount',
163 - 'willEnter',
164 - 'didEnter',
165 - 'willLeave',
166 - 'didLeave',
167 - 'willUnmount',
168 - ]);
169 - });
170 -
171 - it('should handle enter/leave/enter correctly', () => {
172 - var log = [];
173 - var willEnterCb;
174 -
175 - class Child extends React.Component {
176 - componentDidMount() {
177 - log.push('didMount');
178 - }
179 -
180 - componentWillEnter = cb => {
181 - log.push('willEnter');
182 - willEnterCb = cb;
183 - };
184 -
185 - componentDidEnter = () => {
186 - log.push('didEnter');
187 - };
188 -
189 - componentWillLeave = cb => {
190 - log.push('willLeave');
191 - cb();
192 - };
193 -
194 - componentDidLeave = () => {
195 - log.push('didLeave');
196 - };
197 -
198 - componentWillUnmount() {
199 - log.push('willUnmount');
200 - }
201 -
202 - render() {
203 - return <span />;
204 - }
205 - }
206 -
207 - class Component extends React.Component {
208 - state = {count: 1};
209 -
210 - render() {
211 - var children = [];
212 - for (var i = 0; i < this.state.count; i++) {
213 - children.push(<Child key={i} />);
214 - }
215 - return <ReactTransitionGroup>{children}</ReactTransitionGroup>;
216 - }
217 - }
218 -
219 - var instance = ReactDOM.render(<Component />, container);
220 - expect(log).toEqual(['didMount']);
221 - instance.setState({count: 2});
222 - expect(log).toEqual(['didMount', 'didMount', 'willEnter']);
223 - for (var k = 0; k < 5; k++) {
224 - instance.setState({count: 1});
225 - expect(log).toEqual(['didMount', 'didMount', 'willEnter']);
226 - instance.setState({count: 2});
227 - }
228 - willEnterCb();
229 - expect(log).toEqual(['didMount', 'didMount', 'willEnter', 'didEnter']);
230 - });
231 -
232 - it('should handle entering/leaving several elements at once', () => {
233 - var log = [];
234 -
235 - class Child extends React.Component {
236 - componentDidMount() {
237 - log.push('didMount' + this.props.id);
238 - }
239 -
240 - componentWillEnter = cb => {
241 - log.push('willEnter' + this.props.id);
242 - cb();
243 - };
244 -
245 - componentDidEnter = () => {
246 - log.push('didEnter' + this.props.id);
247 - };
248 -
249 - componentWillLeave = cb => {
250 - log.push('willLeave' + this.props.id);
251 - cb();
252 - };
253 -
254 - componentDidLeave = () => {
255 - log.push('didLeave' + this.props.id);
256 - };
257 -
258 - componentWillUnmount() {
259 - log.push('willUnmount' + this.props.id);
260 - }
261 -
262 - render() {
263 - return <span />;
264 - }
265 - }
266 -
267 - class Component extends React.Component {
268 - state = {count: 1};
269 -
270 - render() {
271 - var children = [];
272 - for (var i = 0; i < this.state.count; i++) {
273 - children.push(<Child key={i} id={i} />);
274 - }
275 - return <ReactTransitionGroup>{children}</ReactTransitionGroup>;
276 - }
277 - }
278 -
279 - var instance = ReactDOM.render(<Component />, container);
280 - expect(log).toEqual(['didMount0']);
281 - log = [];
282 -
283 - instance.setState({count: 3});
284 - expect(log).toEqual([
285 - 'didMount1',
286 - 'didMount2',
287 - 'willEnter1',
288 - 'didEnter1',
289 - 'willEnter2',
290 - 'didEnter2',
291 - ]);
292 - log = [];
293 -
294 - instance.setState({count: 0});
295 - expect(log).toEqual([
296 - 'willLeave0',
297 - 'didLeave0',
298 - 'willLeave1',
299 - 'didLeave1',
300 - 'willLeave2',
301 - 'didLeave2',
302 - 'willUnmount0',
303 - 'willUnmount1',
304 - 'willUnmount2',
305 - ]);
306 - });
307 -
308 - it('should warn for duplicated keys', () => {
309 - spyOn(console, 'error');
310 -
311 - class Component extends React.Component {
312 - render() {
313 - var children = [<div key="1" />, <div key="1" />];
314 - return <ReactTransitionGroup>{children}</ReactTransitionGroup>;
315 - }
316 - }
317 -
318 - ReactDOM.render(<Component />, container);
319 -
320 - expectDev(console.error.calls.count()).toBe(2);
321 - expectDev(console.error.calls.argsFor(0)[0]).toBe(
322 - 'Warning: flattenChildren(...): ' +
323 - 'Encountered two children with the same key, `1`. ' +
324 - 'Child keys must be unique; when two children share a key, ' +
325 - 'only the first child will be used.',
326 - );
327 - expectDev(console.error.calls.argsFor(1)[0]).toBe(
328 - 'Warning: flattenChildren(...): ' +
329 - 'Encountered two children with the same key, `1`. ' +
330 - 'Child keys must be unique; when two children share a key, ' +
331 - 'only the first child will be used.',
332 - );
333 - });
334 -});
src/addons/update.js deleted
-169
@@ -1,169 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @providesModule update
10 - */
11 -
12 -/* global hasOwnProperty:true */
13 -
14 -'use strict';
15 -
16 -var invariant = require('fbjs/lib/invariant');
17 -var hasOwnProperty = {}.hasOwnProperty;
18 -
19 -function shallowCopy(x) {
20 - if (Array.isArray(x)) {
21 - return x.concat();
22 - } else if (x && typeof x === 'object') {
23 - return Object.assign(new x.constructor(), x);
24 - } else {
25 - return x;
26 - }
27 -}
28 -
29 -var COMMAND_PUSH = '$push';
30 -var COMMAND_UNSHIFT = '$unshift';
31 -var COMMAND_SPLICE = '$splice';
32 -var COMMAND_SET = '$set';
33 -var COMMAND_MERGE = '$merge';
34 -var COMMAND_APPLY = '$apply';
35 -
36 -var ALL_COMMANDS_LIST = [
37 - COMMAND_PUSH,
38 - COMMAND_UNSHIFT,
39 - COMMAND_SPLICE,
40 - COMMAND_SET,
41 - COMMAND_MERGE,
42 - COMMAND_APPLY,
43 -];
44 -
45 -var ALL_COMMANDS_SET = {};
46 -
47 -ALL_COMMANDS_LIST.forEach(function(command) {
48 - ALL_COMMANDS_SET[command] = true;
49 -});
50 -
51 -function invariantArrayCase(value, spec, command) {
52 - invariant(
53 - Array.isArray(value),
54 - 'update(): expected target of %s to be an array; got %s.',
55 - command,
56 - value,
57 - );
58 - var specValue = spec[command];
59 - invariant(
60 - Array.isArray(specValue),
61 - 'update(): expected spec of %s to be an array; got %s. ' +
62 - 'Did you forget to wrap your parameter in an array?',
63 - command,
64 - specValue,
65 - );
66 -}
67 -
68 -/**
69 - * Returns a updated shallow copy of an object without mutating the original.
70 - * See https://facebook.github.io/react/docs/update.html for details.
71 - */
72 -function update(value, spec) {
73 - invariant(
74 - typeof spec === 'object',
75 - 'update(): You provided a key path to update() that did not contain one ' +
76 - 'of %s. Did you forget to include {%s: ...}?',
77 - ALL_COMMANDS_LIST.join(', '),
78 - COMMAND_SET,
79 - );
80 -
81 - if (hasOwnProperty.call(spec, COMMAND_SET)) {
82 - invariant(
83 - Object.keys(spec).length === 1,
84 - 'Cannot have more than one key in an object with %s',
85 - COMMAND_SET,
86 - );
87 -
88 - return spec[COMMAND_SET];
89 - }
90 -
91 - var nextValue = shallowCopy(value);
92 -
93 - if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
94 - var mergeObj = spec[COMMAND_MERGE];
95 - invariant(
96 - mergeObj && typeof mergeObj === 'object',
97 - "update(): %s expects a spec of type 'object'; got %s",
98 - COMMAND_MERGE,
99 - mergeObj,
100 - );
101 - invariant(
102 - nextValue && typeof nextValue === 'object',
103 - "update(): %s expects a target of type 'object'; got %s",
104 - COMMAND_MERGE,
105 - nextValue,
106 - );
107 - Object.assign(nextValue, spec[COMMAND_MERGE]);
108 - }
109 -
110 - if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
111 - invariantArrayCase(value, spec, COMMAND_PUSH);
112 - spec[COMMAND_PUSH].forEach(function(item) {
113 - nextValue.push(item);
114 - });
115 - }
116 -
117 - if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {
118 - invariantArrayCase(value, spec, COMMAND_UNSHIFT);
119 - spec[COMMAND_UNSHIFT].forEach(function(item) {
120 - nextValue.unshift(item);
121 - });
122 - }
123 -
124 - if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
125 - invariant(
126 - Array.isArray(value),
127 - 'Expected %s target to be an array; got %s',
128 - COMMAND_SPLICE,
129 - value,
130 - );
131 - invariant(
132 - Array.isArray(spec[COMMAND_SPLICE]),
133 - 'update(): expected spec of %s to be an array of arrays; got %s. ' +
134 - 'Did you forget to wrap your parameters in an array?',
135 - COMMAND_SPLICE,
136 - spec[COMMAND_SPLICE],
137 - );
138 - spec[COMMAND_SPLICE].forEach(function(args) {
139 - invariant(
140 - Array.isArray(args),
141 - 'update(): expected spec of %s to be an array of arrays; got %s. ' +
142 - 'Did you forget to wrap your parameters in an array?',
143 - COMMAND_SPLICE,
144 - spec[COMMAND_SPLICE],
145 - );
146 - nextValue.splice.apply(nextValue, args);
147 - });
148 - }
149 -
150 - if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
151 - invariant(
152 - typeof spec[COMMAND_APPLY] === 'function',
153 - 'update(): expected spec of %s to be a function; got %s.',
154 - COMMAND_APPLY,
155 - spec[COMMAND_APPLY],
156 - );
157 - nextValue = spec[COMMAND_APPLY](nextValue);
158 - }
159 -
160 - for (var k in spec) {
161 - if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) {
162 - nextValue[k] = update(value[k], spec[k]);
163 - }
164 - }
165 -
166 - return nextValue;
167 -}
168 -
169 -module.exports = update;
src/isomorphic/children/__tests__/ReactChildren-test.js
+61 -105
@@ -13,12 +13,10 @@
13
14 describe('ReactChildren', () => {
15 var React;
16 - var ReactFragment;
16
17 beforeEach(() => {
18 jest.resetModules();
19 React = require('react');
21 - ReactFragment = require('ReactFragment');
20 });
21
22 it('should support identity for simple', () => {
@@ -150,8 +148,8 @@ describe('ReactChildren', () => {
148 var instance = (
149 <div>
150 {div}
153 - {[ReactFragment.create({span})]}
154 - {ReactFragment.create({a: a})}
151 + {[[span]]}
152 + {[a]}
153 {'string'}
154 {1234}
155 {true}
@@ -164,8 +162,8 @@ describe('ReactChildren', () => {
162 function assertCalls() {
163 expect(callback.calls.count()).toBe(9);
164 expect(callback).toHaveBeenCalledWith(div, 0);
167 - expect(callback).toHaveBeenCalledWith(<span key="span/.$spanNode" />, 1);
168 - expect(callback).toHaveBeenCalledWith(<a key="a/.$aNode" />, 2);
165 + expect(callback).toHaveBeenCalledWith(span, 1);
166 + expect(callback).toHaveBeenCalledWith(a, 2);
167 expect(callback).toHaveBeenCalledWith('string', 3);
168 expect(callback).toHaveBeenCalledWith(1234, 4);
169 expect(callback).toHaveBeenCalledWith(null, 5);
@@ -186,8 +184,8 @@ describe('ReactChildren', () => {
184 assertCalls();
185 expect(mappedChildren).toEqual([
186 <div key=".$divNode" />,
189 - <span key=".1:0:$span/.$spanNode" />,
190 - <a key=".2:$a/.$aNode" />,
187 + <span key=".1:0:$spanNode" />,
188 + <a key=".2:$aNode" />,
189 'string',
190 1234,
191 ]);
@@ -199,12 +197,7 @@ describe('ReactChildren', () => {
197 var two = <div key="keyTwo" />;
198 var three = null;
199 var four = <div key="keyFour" />;
202 - var five = <div key="keyFiveInner" />;
203 - // five is placed into a JS object with a key that is joined to the
204 - // component key attribute.
205 - // Precedence is as follows:
206 - // 1. If grouped in an Object, the object key combined with `key` prop
207 - // 2. If grouped in an Array, the `key` prop, falling back to array index
200 + var five = <div key="keyFive" />;
201
202 var context = {};
203 var callback = jasmine.createSpy().and.callFake(function(kid) {
@@ -213,34 +206,18 @@ describe('ReactChildren', () => {
206
207 var instance = (
208 <div>
216 - {[
217 - ReactFragment.create({
218 - firstHalfKey: [zero, one, two],
219 - secondHalfKey: [three, four],
220 - keyFive: five,
221 - }),
222 - ]}
209 + {[[zero, one, two], [three, four], five]}
210 </div>
211 );
212
213 function assertCalls() {
227 - expect(callback.calls.count()).toBe(4);
228 - expect(callback).toHaveBeenCalledWith(
229 - <div key="firstHalfKey/.$keyZero" />,
230 - 0,
231 - );
232 - expect(callback).toHaveBeenCalledWith(
233 - <div key="firstHalfKey/.$keyTwo" />,
234 - 1,
235 - );
236 - expect(callback).toHaveBeenCalledWith(
237 - <div key="secondHalfKey/.$keyFour" />,
238 - 2,
239 - );
240 - expect(callback).toHaveBeenCalledWith(
241 - <div key="keyFive/.$keyFiveInner" />,
242 - 3,
243 - );
214 + expect(callback.calls.count()).toBe(6);
215 + expect(callback).toHaveBeenCalledWith(zero, 0);
216 + expect(callback).toHaveBeenCalledWith(one, 1);
217 + expect(callback).toHaveBeenCalledWith(two, 2);
218 + expect(callback).toHaveBeenCalledWith(three, 3);
219 + expect(callback).toHaveBeenCalledWith(four, 4);
220 + expect(callback).toHaveBeenCalledWith(five, 5);
221 callback.calls.reset();
222 }
223
@@ -254,10 +231,10 @@ describe('ReactChildren', () => {
231 );
232 assertCalls();
233 expect(mappedChildren).toEqual([
257 - <div key=".0:$firstHalfKey/.$keyZero" />,
258 - <div key=".0:$firstHalfKey/.$keyTwo" />,
259 - <div key=".0:$secondHalfKey/.$keyFour" />,
260 - <div key=".0:$keyFive/.$keyFiveInner" />,
234 + <div key=".0:$keyZero" />,
235 + <div key=".0:$keyTwo" />,
236 + <div key=".1:$keyFour" />,
237 + <div key=".$keyFive" />,
238 ]);
239 });
240
@@ -601,52 +578,49 @@ describe('ReactChildren', () => {
578 var two = <div key="keyTwo" />;
579 var three = null;
580 var four = <div key="keyFour" />;
604 - var five = <div key="keyFiveInner" />;
605 - // five is placed into a JS object with a key that is joined to the
606 - // component key attribute.
607 - // Precedence is as follows:
608 - // 1. If grouped in an Object, the object key combined with `key` prop
609 - // 2. If grouped in an Array, the `key` prop, falling back to array index
581 + var five = <div key="keyFive" />;
582
583 var zeroMapped = <div key="giraffe" />; // Key should be overridden
584 var twoMapped = <div />; // Key should be added even if not supplied!
585 var fourMapped = <div key="keyFour" />;
586 var fiveMapped = <div />;
587
616 - var callback = jasmine.createSpy().and.callFake(function(kid, index) {
617 - return index === 0
618 - ? zeroMapped
619 - : index === 1 ? twoMapped : index === 2 ? fourMapped : fiveMapped;
588 + var callback = jasmine.createSpy().and.callFake(function(kid) {
589 + switch (kid) {
590 + case zero:
591 + return zeroMapped;
592 + case two:
593 + return twoMapped;
594 + case four:
595 + return fourMapped;
596 + case five:
597 + return fiveMapped;
598 + default:
599 + return kid;
600 + }
601 });
602
622 - var frag = ReactFragment.create({
623 - firstHalfKey: [zero, one, two],
624 - secondHalfKey: [three, four],
625 - keyFive: five,
626 - });
603 + var frag = [[zero, one, two], [three, four], five];
604 var instance = <div>{[frag]}</div>;
605
629 - expect([frag[0].key, frag[1].key, frag[2].key, frag[3].key]).toEqual([
630 - 'firstHalfKey/.$keyZero',
631 - 'firstHalfKey/.$keyTwo',
632 - 'secondHalfKey/.$keyFour',
633 - 'keyFive/.$keyFiveInner',
634 - ]);
635 -
606 React.Children.forEach(instance.props.children, callback);
637 - expect(callback.calls.count()).toBe(4);
638 - expect(callback).toHaveBeenCalledWith(frag[0], 0);
639 - expect(callback).toHaveBeenCalledWith(frag[1], 1);
640 - expect(callback).toHaveBeenCalledWith(frag[2], 2);
641 - expect(callback).toHaveBeenCalledWith(frag[3], 3);
607 + expect(callback.calls.count()).toBe(6);
608 + expect(callback).toHaveBeenCalledWith(zero, 0);
609 + expect(callback).toHaveBeenCalledWith(one, 1);
610 + expect(callback).toHaveBeenCalledWith(two, 2);
611 + expect(callback).toHaveBeenCalledWith(three, 3);
612 + expect(callback).toHaveBeenCalledWith(four, 4);
613 + expect(callback).toHaveBeenCalledWith(five, 5);
614 callback.calls.reset();
615
616 var mappedChildren = React.Children.map(instance.props.children, callback);
645 - expect(callback.calls.count()).toBe(4);
646 - expect(callback).toHaveBeenCalledWith(frag[0], 0);
647 - expect(callback).toHaveBeenCalledWith(frag[1], 1);
648 - expect(callback).toHaveBeenCalledWith(frag[2], 2);
649 - expect(callback).toHaveBeenCalledWith(frag[3], 3);
617 + expect(callback.calls.count()).toBe(6);
618 + expect(callback).toHaveBeenCalledWith(zero, 0);
619 + expect(callback).toHaveBeenCalledWith(one, 1);
620 + expect(callback).toHaveBeenCalledWith(two, 2);
621 + expect(callback).toHaveBeenCalledWith(three, 3);
622 + expect(callback).toHaveBeenCalledWith(four, 4);
623 + expect(callback).toHaveBeenCalledWith(five, 5);
624
625 expect(React.Children.count(mappedChildren)).toBe(4);
626 // Keys default to indices.
@@ -656,20 +630,16 @@ describe('ReactChildren', () => {
630 mappedChildren[2].key,
631 mappedChildren[3].key,
632 ]).toEqual([
659 - 'giraffe/.0:$firstHalfKey/.$keyZero',
660 - '.0:$firstHalfKey/.$keyTwo',
661 - 'keyFour/.0:$secondHalfKey/.$keyFour',
662 - '.0:$keyFive/.$keyFiveInner',
633 + 'giraffe/.0:0:$keyZero',
634 + '.0:0:$keyTwo',
635 + '.0:1:$keyFour',
636 + '.0:$keyFive',
637 ]);
638
665 - expect(mappedChildren[0]).toEqual(
666 - <div key="giraffe/.0:$firstHalfKey/.$keyZero" />,
667 - );
668 - expect(mappedChildren[1]).toEqual(<div key=".0:$firstHalfKey/.$keyTwo" />);
669 - expect(mappedChildren[2]).toEqual(
670 - <div key="keyFour/.0:$secondHalfKey/.$keyFour" />,
671 - );
672 - expect(mappedChildren[3]).toEqual(<div key=".0:$keyFive/.$keyFiveInner" />);
639 + expect(mappedChildren[0]).toEqual(<div key="giraffe/.0:0:$keyZero" />);
640 + expect(mappedChildren[1]).toEqual(<div key=".0:0:$keyTwo" />);
641 + expect(mappedChildren[2]).toEqual(<div key=".0:1:$keyFour" />);
642 + expect(mappedChildren[3]).toEqual(<div key=".0:$keyFive" />);
643 });
644
645 it('should retain key across two mappings', () => {
@@ -812,27 +782,15 @@ describe('ReactChildren', () => {
782 var two = <div key="keyTwo" />;
783 var three = null;
784 var four = <div key="keyFour" />;
815 - var five = <div key="keyFiveInner" />;
816 - // five is placed into a JS object with a key that is joined to the
817 - // component key attribute.
818 - // Precedence is as follows:
819 - // 1. If grouped in an Object, the object key combined with `key` prop
820 - // 2. If grouped in an Array, the `key` prop, falling back to array index
785 + var five = <div key="keyFive" />;
786
787 var instance = (
788 <div>
824 - {[
825 - ReactFragment.create({
826 - firstHalfKey: [zero, one, two],
827 - secondHalfKey: [three, four],
828 - keyFive: five,
829 - }),
830 - null,
831 - ]}
789 + {[[[zero, one, two], [three, four], five], null]}
790 </div>
791 );
792 var numberOfChildren = React.Children.count(instance.props.children);
835 - expect(numberOfChildren).toBe(5);
793 + expect(numberOfChildren).toBe(7);
794 });
795
796 it('should flatten children to an array', () => {
@@ -878,8 +836,7 @@ describe('ReactChildren', () => {
836 }).toThrowError(
837 'Objects are not valid as a React child (found: object with keys ' +
838 '{a, b}). If you meant to render a collection of children, use an ' +
881 - 'array instead or wrap the object using createFragment(object) from ' +
882 - 'the React add-ons.',
839 + 'array instead.',
840 );
841 });
842
@@ -890,8 +847,7 @@ describe('ReactChildren', () => {
847 React.Children.forEach(/abc/, function() {}, null);
848 }).toThrowError(
849 'Objects are not valid as a React child (found: /abc/). If you meant ' +
893 - 'to render a collection of children, use an array instead or wrap the ' +
894 - 'object using createFragment(object) from the React add-ons.',
850 + 'to render a collection of children, use an array instead.',
851 );
852 });
853 });
src/isomorphic/children/__tests__/onlyChild-test.js
+1 -3
@@ -13,13 +13,11 @@
13
14 describe('onlyChild', () => {
15 var React;
16 - var ReactFragment;
16 var onlyChild;
17 var WrapComponent;
18
19 beforeEach(() => {
20 React = require('react');
22 - ReactFragment = require('ReactFragment');
21 onlyChild = require('onlyChild');
22 WrapComponent = class extends React.Component {
23 render() {
@@ -68,7 +66,7 @@ describe('onlyChild', () => {
66 expect(function() {
67 var instance = (
68 <WrapComponent>
71 - {ReactFragment.create({oneThing: <span />})}
69 + {[<span key="abc" />]}
70 </WrapComponent>
71 );
72 onlyChild(instance.props.children);
src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js
+2 -23
@@ -16,7 +16,6 @@ var checkPropTypes;
16 var checkReactTypeSpec;
17 var React;
18 var ReactDOM;
19 -var ReactFragment;
19
20 var Component;
21 var MyComponent;
@@ -115,7 +114,6 @@ describe('ReactPropTypes', () => {
114 PropTypes = require('ReactPropTypes');
115 React = require('react');
116 ReactDOM = require('react-dom');
118 - ReactFragment = require('ReactFragment');
117 resetWarningCache();
118 });
119
@@ -615,39 +613,20 @@ describe('ReactPropTypes', () => {
613 });
614
615 it('should not warn for valid values', () => {
618 - spyOn(console, 'error');
616 typeCheckPass(PropTypes.node, <div />);
617 typeCheckPass(PropTypes.node, false);
618 typeCheckPass(PropTypes.node, <MyComponent />);
619 typeCheckPass(PropTypes.node, 'Some string');
620 typeCheckPass(PropTypes.node, []);
624 -
621 typeCheckPass(PropTypes.node, [
622 123,
623 'Some string',
624 <div />,
625 ['Another string', [456], <span />, <MyComponent />],
626 <MyComponent />,
627 + null,
628 + undefined,
629 ]);
632 -
633 - // Object of renderable things
634 - var frag = ReactFragment.create;
635 - typeCheckPass(
636 - PropTypes.node,
637 - frag({
638 - k0: 123,
639 - k1: 'Some string',
640 - k2: <div />,
641 - k3: frag({
642 - k30: <MyComponent />,
643 - k31: frag({k310: <a />}),
644 - k32: 'Another string',
645 - }),
646 - k4: null,
647 - k5: undefined,
648 - }),
649 - );
650 - expectDev(console.error.calls.count()).toBe(0);
630 });
631
632 it('should not warn for iterables', () => {
src/renderers/__tests__/ReactIdentity-test.js
+3 -17
@@ -13,7 +13,6 @@
13
14 var React;
15 var ReactDOM;
16 -var ReactFragment;
16 var ReactTestUtils;
17
18 describe('ReactIdentity', () => {
@@ -21,14 +20,9 @@ describe('ReactIdentity', () => {
20 jest.resetModules();
21 React = require('react');
22 ReactDOM = require('react-dom');
24 - ReactFragment = require('ReactFragment');
23 ReactTestUtils = require('ReactTestUtils');
24 });
25
28 - function frag(obj) {
29 - return ReactFragment.create(obj);
30 - }
31 -
26 it('should allow key property to express identity', () => {
27 var node;
28 var Component = props => (
@@ -72,21 +66,13 @@ describe('ReactIdentity', () => {
66 function renderAComponentWithKeyIntoContainer(key, container) {
67 class Wrapper extends React.Component {
68 render() {
75 - var s1 = <span ref="span1" key={key} />;
76 - var s2 = <span ref="span2" />;
77 -
78 - var map = {};
79 - map[key] = s2;
80 - return <div>{[s1, frag(map)]}</div>;
69 + return <div><span ref="span" key={key} /></div>;
70 }
71 }
72
73 var instance = ReactDOM.render(<Wrapper />, container);
85 - var span1 = instance.refs.span1;
86 - var span2 = instance.refs.span2;
87 -
88 - expect(ReactDOM.findDOMNode(span1)).not.toBe(null);
89 - expect(ReactDOM.findDOMNode(span2)).not.toBe(null);
74 + var span = instance.refs.span;
75 + expect(ReactDOM.findDOMNode(span)).not.toBe(null);
76 }
77
78 it('should allow any character as a key, in a detached parent', () => {
src/renderers/shared/fiber/ReactChildFiber.js
+1 -2
@@ -127,8 +127,7 @@ function throwOnInvalidObjectType(returnFiber: Fiber, newChild: Object) {
127 let addendum = '';
128 if (__DEV__) {
129 addendum = ' If you meant to render a collection of children, use an array ' +
130 - 'instead or wrap the object using createFragment(object) from the ' +
131 - 'React add-ons.';
130 + 'instead.';
131 const owner = ReactCurrentOwner.owner || returnFiber._debugOwner;
132 if (owner && typeof owner.tag === 'number') {
133 const name = getComponentName((owner: any));
src/shared/utils/traverseAllChildren.js
+1 -2
@@ -151,8 +151,7 @@ function traverseAllChildrenImpl(
151 var addendum = '';
152 if (__DEV__) {
153 addendum = ' If you meant to render a collection of children, use an array ' +
154 - 'instead or wrap the object using createFragment(object) from the ' +
155 - 'React add-ons.';
154 + 'instead.';
155 if (ReactCurrentOwner.current) {
156 var name = ReactCurrentOwner.current.getName();
157 if (name) {
src/umd/ReactDOMUMDEntry.js
-7
@@ -11,7 +11,6 @@
11
12 'use strict';
13
14 -var React = require('react');
14 var ReactDOM = require('react-dom');
15
16 var ReactDOMUMDEntry = ReactDOM;
@@ -25,10 +24,4 @@ if (__DEV__) {
24 };
25 }
26
28 -// Inject ReactDOM into React for the addons UMD build that depends on ReactDOM (TransitionGroup).
29 -// We can remove this after we deprecate and remove the addons UMD build.
30 -if (React.addons) {
31 - React.__SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMUMDEntry;
32 -}
33 -
27 module.exports = ReactDOMUMDEntry;
src/umd/ReactWithAddonsUMDEntry.js deleted
-37
@@ -1,37 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @providesModule ReactWithAddonsUMDEntry
10 - */
11 -
12 -'use strict';
13 -
14 -var ReactWithAddons = require('ReactWithAddons');
15 -
16 -// `version` will be added here by the React module.
17 -var ReactWithAddonsUMDEntry = Object.assign(
18 - {
19 - __SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: null, // Will be injected by ReactDOM UMD build.
20 - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
21 - ReactCurrentOwner: require('react/lib/ReactCurrentOwner'),
22 - },
23 - },
24 - ReactWithAddons,
25 -);
26 -
27 -if (__DEV__) {
28 - Object.assign(
29 - ReactWithAddonsUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
30 - {
31 - // ReactComponentTreeHook should not be included in production.
32 - ReactComponentTreeHook: require('react/lib/ReactComponentTreeHook'),
33 - },
34 - );
35 -}
36 -
37 -module.exports = ReactWithAddonsUMDEntry;
src/umd/shims/ReactAddonsDOMDependenciesUMDShim.js deleted
-36
@@ -1,36 +0,0 @@
1 -/**
2 - * Copyright 2013-present, Facebook, Inc.
3 - * All rights reserved.
4 - *
5 - * This source code is licensed under the BSD-style license found in the
6 - * LICENSE file in the root directory of this source tree. An additional grant
7 - * of patent rights can be found in the PATENTS file in the same directory.
8 - *
9 - * @providesModule ReactAddonsDOMDependenciesUMDShim
10 - */
11 -
12 -'use strict';
13 -
14 -var ReactDOM;
15 -
16 -function getReactDOM() {
17 - if (!ReactDOM) {
18 - // This is safe to use because current module only exists in the addons build:
19 - var ReactWithAddonsUMDEntry = require('ReactWithAddonsUMDEntry');
20 - // This is injected by the ReactDOM UMD build:
21 - ReactDOM = ReactWithAddonsUMDEntry.__SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
22 - }
23 - return ReactDOM;
24 -}
25 -
26 -exports.getReactDOM = getReactDOM;
27 -
28 -if (__DEV__) {
29 - exports.getReactPerf = function() {
30 - return getReactDOM().__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactPerf;
31 - };
32 -
33 - exports.getReactTestUtils = function() {
34 - return getReactDOM().__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactTestUtils;
35 - };
36 -}