rename to with associated warnings
petehunt committed
Dec 3, 2013 at 16:50 UTC
6269cbf482fefcfbc0bec1e6a8b0f027f43f060a
4 files changed
+45
-1
npm-react-core/ReactJSErrors.js
new
+38
@@ -0,0 +1,38 @@
1
+var copyProperties = require('./lib/copyProperties');
2
+
3
+var WARNING_MESSAGE = (
4
+ 'It looks like you\'re trying to use jeffbski\'s React.js project.\n' +
5
+ 'The `react` npm package now points to the React JavaScript library for ' +
6
+ 'building user interfaces, not the React.js project for managing asynchronous ' +
7
+ 'control flow. If you\'re looking for that library, please npm install reactjs.'
8
+);
9
+
10
+function error() {
11
+ throw new Error(WARNING_MESSAGE);
12
+}
13
+
14
+// Model the React.js project's public interface exactly.
15
+
16
+function ReactJSShim() {
17
+ error();
18
+};
19
+
20
+ReactJSShim.logEvents = error;
21
+ReactJSShim.resolvePromises = error;
22
+ReactJSShim.trackTasks = error;
23
+ReactJSShim.createEventCollector = error;
24
+
25
+// These could throw using defineProperty() but supporting older browsers will
26
+// be painful. Additionally any error messages around this will contain the string
27
+// so I think this is sufficient.
28
+ReactJSShim.options = WARNING_MESSAGE;
29
+ReactJSShim.events = WARNING_MESSAGE;
30
+
31
+var ReactJSErrors = {
32
+ wrap: function(module) {
33
+ copyProperties(ReactJSShim, module);
34
+ return ReactJSShim;
35
+ }
36
+};
37
+
38
+module.exports = ReactJSErrors;
\ No newline at end of file
npm-react-core/addons.js
+3
@@ -1 +1,4 @@
1
module.exports = require('./lib/ReactWithAddons');
2
+if ('production' !== process.env.NODE_ENV) {
3
+ module.exports = require('./ReactJSErrors').wrap(module.exports);
4
+}
npm-react-core/package.json
+1
-1
@@ -1,5 +1,5 @@
1
{
2
- "name": "react-core",
2
+ "name": "react",
3
"version": "0.6.0-alpha",
4
"keywords": [
5
"react"
npm-react-core/react.js
+3
@@ -1 +1,4 @@
1
module.exports = require('./lib/React');
2
+if ('production' !== process.env.NODE_ENV) {
3
+ module.exports = require('./ReactJSErrors').wrap(module.exports);
4
+}