-
Notifications
You must be signed in to change notification settings - Fork 48.5k
react-core npm module #627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+222
−36
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f4f024a
first work: __DEV__
petehunt a167bfd
muffinification
petehunt 2b951b2
react-core npm module
zpao 5ce788d
update npm-react-core package.json
petehunt 44aa918
response to code review
petehunt 8ebdd27
revert muffinize :(
petehunt bd2a593
rename to with associated warnings
petehunt 7e3855a
rename to with associated warnings
petehunt 932ef47
version bump to 0.8 to get on top of react.js
petehunt e51a1c6
update README
petehunt aef0ee8
Version bump, make tests work
petehunt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
|
||
var grunt = require('grunt'); | ||
|
||
var src = 'npm-react-core/'; | ||
var dest = 'build/react-core/'; | ||
var modSrc = 'build/modules/'; | ||
var lib = dest + 'lib/'; | ||
|
||
function buildRelease() { | ||
// delete build/react-core for fresh start | ||
grunt.file.exists(dest) && grunt.file.delete(dest); | ||
|
||
// mkdir -p build/react-core/lib | ||
grunt.file.mkdir(lib); | ||
|
||
// Copy everything over | ||
// console.log(grunt.file.expandMapping(src + '**/*', dest, {flatten: true})); | ||
grunt.file.expandMapping(src + '**/*', dest, {flatten: true}).forEach(function(mapping) { | ||
var src = mapping.src[0]; | ||
var dest = mapping.dest; | ||
if (grunt.file.isDir(src)) { | ||
grunt.file.mkdir(dest); | ||
} else { | ||
grunt.file.copy(src, dest); | ||
} | ||
}); | ||
|
||
// copy build/modules/*.js to build/react-core/lib | ||
grunt.file.expandMapping(modSrc + '*.js', lib, { flatten: true }).forEach(function(mapping) { | ||
grunt.file.copy(mapping.src[0], mapping.dest); | ||
}); | ||
|
||
// modify build/react-core/package.json to set version ## | ||
var pkg = grunt.file.readJSON(dest + 'package.json'); | ||
pkg.version = grunt.config.data.pkg.version; | ||
grunt.file.write(dest + 'package.json', JSON.stringify(pkg, null, 2)); | ||
} | ||
|
||
function buildDev() { | ||
// TODO: same as above except different destination | ||
} | ||
|
||
module.exports = { | ||
buildRelease: buildRelease, | ||
buildDev: buildDev | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# react-core | ||
|
||
An npm package to get you immediate access to [React](http://facebook.github.io/react/), | ||
without also requiring the JSX transformer. This is especially useful for cases where you | ||
want to [`browserify`](https://github.com/substack/node-browserify) your module using | ||
`React`. | ||
|
||
## Example Usage | ||
|
||
```js | ||
|
||
// Previously, you might access React with react-tools. | ||
var React = require('react-tools').React; | ||
|
||
// Now you can access React directly with react-core. | ||
var React = require('react-core'); | ||
|
||
// You can also access ReactWithAddons. | ||
var React = require('react-core/addons'); | ||
``` | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var copyProperties = require('./lib/copyProperties'); | ||
|
||
var WARNING_MESSAGE = ( | ||
'It looks like you\'re trying to use jeffbski\'s React.js project.\n' + | ||
'The `react` npm package now points to the React JavaScript library for ' + | ||
'building user interfaces, not the React.js project for managing asynchronous ' + | ||
'control flow. If you\'re looking for that library, please npm install reactjs.' | ||
); | ||
|
||
function error() { | ||
throw new Error(WARNING_MESSAGE); | ||
} | ||
|
||
// Model the React.js project's public interface exactly. | ||
|
||
function ReactJSShim() { | ||
error(); | ||
}; | ||
|
||
ReactJSShim.logEvents = error; | ||
ReactJSShim.resolvePromises = error; | ||
ReactJSShim.trackTasks = error; | ||
ReactJSShim.createEventCollector = error; | ||
|
||
// These could throw using defineProperty() but supporting older browsers will | ||
// be painful. Additionally any error messages around this will contain the string | ||
// so I think this is sufficient. | ||
ReactJSShim.options = WARNING_MESSAGE; | ||
ReactJSShim.events = WARNING_MESSAGE; | ||
|
||
var ReactJSErrors = { | ||
wrap: function(module) { | ||
copyProperties(ReactJSShim, module); | ||
return ReactJSShim; | ||
} | ||
}; | ||
|
||
module.exports = ReactJSErrors; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = require('./lib/ReactWithAddons'); | ||
if ('production' !== process.env.NODE_ENV) { | ||
module.exports = require('./ReactJSErrors').wrap(module.exports); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "react", | ||
"version": "0.8.0-alpha", | ||
"keywords": [ | ||
"react" | ||
], | ||
"homepage": "https://github.com/facebook/react/tree/master/npm-react-core", | ||
"bugs": "https://github.com/facebook/react/issues?labels=react-core", | ||
"licenses": [ | ||
{ | ||
"type": "Apache-2.0", | ||
"url": "http://www.apache.org/licenses/LICENSE-2.0" | ||
} | ||
], | ||
"files": [ | ||
"README.md", | ||
"addons.js", | ||
"react.js", | ||
"ReactJSErrors.js", | ||
"lib/" | ||
], | ||
"main": "react.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/facebook/react" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"peerDependencies": { | ||
"envify": "~0.2.0" | ||
}, | ||
"browserify": { | ||
"transform": ["envify"] | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = require('./lib/React'); | ||
if ('production' !== process.env.NODE_ENV) { | ||
module.exports = require('./ReactJSErrors').wrap(module.exports); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe
_lib
orinternal
is a better name for now? /me shrugs.