Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 34 additions & 36 deletions package.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
var meteorVersion = '1.0.3.1';
var reactVersion = '0.12.2';
var reactAddonsVersion = '0.9.0';
var meteorVersion = '1.1.0.2',
reactVersion = '0.13.2'

Package.describe({
name: 'hipertracker:reactjs',
summary: 'ReactJS + addons + JSX (--harmony) for Meteor',
version: '0.0.8',
git: 'https://github.com/hipertracker/meteor-reactjs.git'
});
name: 'rkstar:reactjs',
summary: 'ReactJS + addons + JSX (--harmony) for Meteor',
version: '0.0.9',
git: 'https://github.com/rkstar/meteor-reactjs'
})

Package._transitional_registerBuildPlugin({
name: 'compileJSX',
use: [],
sources: [
'plugin/compile-jsx.js'
],
npmDependencies: {
'react': reactVersion,
'react-tools': reactVersion
}
});
name: 'compileJSX',
use: [],
sources: [
'plugin/compile-jsx.js'
],
npmDependencies: {
'react': reactVersion,
'react-tools': reactVersion
}
})


Package.onTest(function (api) {
api.use('tinytest');
api.use('hipertracker:reactjs');
api.addFiles('hipertracker:reactjs-tests.js');
});
api.use('tinytest')
api.use('rkstar:reactjs')
api.addFiles('rkstar:reactjs-tests.js')
})


Package.on_use(function (api) {
api.versionsFrom(meteorVersion);
api.versionsFrom(meteorVersion)

// Standard distribution of React, same version as react-tools.
api.add_files('vendor/react-' + reactVersion + '.js', 'client');
// Standard distribution of React, same version as react-tools.
api.add_files('vendor/react-' + reactVersion + '.js', 'client')

// On the server, we use the modules that ship with react.
api.add_files('src/require-packages.js', 'server');
api.export('React', 'server');
// On the server, we use the modules that ship with react.
api.add_files('src/require-packages.js', 'server')
api.export('React', 'server')

// Meteor-enabled components should include this mixin via
// React.createClass({ mixins: [ReactMeteor.Mixin], ... }).
api.add_files('src/ReactMeteor.js', ['server', 'client']);
api.export('ReactMeteor', ['server', 'client']);
});
// Meteor-enabled components should include this mixin via
// React.createClass({ mixins: [ReactMeteor.Mixin], ... }).
api.add_files('src/ReactMeteor.js', ['server', 'client'])
api.export('ReactMeteor', ['server', 'client'])
})


Npm.depends({
'react': reactVersion,
'react-addons': reactAddonsVersion
});
'react': reactVersion
})
15 changes: 7 additions & 8 deletions plugin/compile-jsx.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
var reactTools = Npm.require('react-tools');
var reactTools = Npm.require('react-tools')

var handler = function (compileStep) {
var source = compileStep.read().toString('utf8');
var outputFile = compileStep.inputPath + '.js';
var handler = function( compileStep ){
var source = compileStep.read().toString('utf8')
var outputFile = compileStep.inputPath + '.js'

compileStep.addJavaScript({
path: outputFile,
sourcePath: compileStep.inputPath,
data: reactTools.transform(source, {harmony: true, sourceMap: true})
});
};

Plugin.registerSourceHandler('jsx', handler);
})
}

Plugin.registerSourceHandler('jsx', handler)
File renamed without changes.
File renamed without changes.
41 changes: 21 additions & 20 deletions src/ReactMeteor.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
var ReactMeteorMixin = {
_handleMeteorChange: function () {
this.setState(this.getMeteorState());
if( this.getMeteorState !== undefined ){
this.setState(this.getMeteorState())
}
},

_cancelComputation: function () {
if (this._meteorComputation) {
this._meteorComputation.stop();
this._meteorComputation = null;
_cancelComputation: function(){
if( this._meteorComputation ){
this._meteorComputation.stop()
this._meteorComputation = null
}
},

componentWillMount: function () {
this._meteorComputation = Tracker.autorun(this._handleMeteorChange);
componentWillMount: function(){
this._meteorComputation = Tracker.autorun(this._handleMeteorChange)
},

componentWillReceiveProps: function (nextProps) {
var oldProps = this.props;
this.props = nextProps;
this._handleMeteorChange();
this.props = oldProps;
componentWillReceiveProps: function( nextProps ){
var oldProps = this.props
this.props = nextProps
this._handleMeteorChange()
this.props = oldProps
},

componentWillUnmount: function () {
this._cancelComputation();
componentWillUnmount: function(){
this._cancelComputation()
}
};
}


if (typeof exports === "object") {
ReactMeteor = exports;
if( typeof exports === "object" ){
ReactMeteor = exports
} else {
ReactMeteor = {};
ReactMeteor = {}
}

ReactMeteor.Mixin = ReactMeteorMixin;

ReactMeteor.Mixin = ReactMeteorMixin
3 changes: 1 addition & 2 deletions src/require-packages.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
React = Npm.require('react');
React.addons = Npm.require('react-addons');
React = Npm.require('react')
Loading