mirror of
https://github.com/twisterarmy/twister-react.git
synced 2025-01-11 15:38:00 +00:00
better account handling
This commit is contained in:
parent
bd1f8c3ed2
commit
63096c0ddf
1340
build/app-bundle.js
1340
build/app-bundle.js
File diff suppressed because it is too large
Load Diff
@ -29652,6 +29652,18 @@ TwisterAccount.prototype.trim = function (timestamp) {
|
||||
|
||||
TwisterAccount.prototype.getUsername = function () {return this._name}
|
||||
|
||||
TwisterAccount.prototype.verifyKey = function (cbfunc,querySettings) {
|
||||
|
||||
this._privkey.verifyKey(cbfunc,querySettings);
|
||||
|
||||
}
|
||||
|
||||
TwisterAccount.prototype.getKeyStatus = function () {
|
||||
|
||||
this._privkey.getStatus();
|
||||
|
||||
}
|
||||
|
||||
TwisterAccount.prototype.activateTorrents = function (cbfunc,querySettings) {
|
||||
|
||||
var Twister = this._scope;
|
||||
@ -30749,7 +30761,6 @@ var twister_network = Bitcoin.networks.bitcoin;
|
||||
|
||||
twister_network.messagePrefix= '\x18twister Signed Message:\n';
|
||||
|
||||
|
||||
/**
|
||||
* Describes the public key of a user.
|
||||
* @class
|
||||
@ -30764,18 +30775,33 @@ var TwisterPrivKey = function (name,scope) {
|
||||
|
||||
this._verified = true;
|
||||
|
||||
|
||||
this._status = "unchecked";
|
||||
|
||||
this._createdAt = Date.now()/1000;
|
||||
|
||||
}
|
||||
|
||||
inherits(TwisterPrivKey,TwisterResource);
|
||||
|
||||
module.exports = TwisterPrivKey;
|
||||
|
||||
TwisterPrivKey.prototype.flatten = function () {
|
||||
|
||||
var flatData = TwisterResource.prototype.flatten.call(this);
|
||||
|
||||
flatData.status = this._status;
|
||||
flatData.createdAt = this._createdAt;
|
||||
|
||||
return flatData;
|
||||
|
||||
}
|
||||
|
||||
TwisterPrivKey.prototype.inflate = function (flatData) {
|
||||
|
||||
TwisterResource.prototype.inflate.call(this,flatData);
|
||||
|
||||
console.log("inflating privkey",flatData);
|
||||
this._status = flatData.status;
|
||||
this._createdAt = flatData.createdAt;
|
||||
|
||||
if (this._data) {
|
||||
|
||||
@ -30789,6 +30815,18 @@ TwisterPrivKey.prototype.trim = function (timestamp) {
|
||||
|
||||
}
|
||||
|
||||
TwisterPrivKey.prototype.getStatus = function () {
|
||||
|
||||
return this._status || "unchecked";
|
||||
|
||||
}
|
||||
|
||||
TwisterPrivKey.prototype.getCreatedAt = function () {
|
||||
|
||||
return this._createdAt;
|
||||
|
||||
}
|
||||
|
||||
TwisterPrivKey.prototype.getKey = function () {
|
||||
|
||||
return this._data;
|
||||
@ -30807,30 +30845,43 @@ TwisterPrivKey.prototype.setKey = function (key) {
|
||||
|
||||
}
|
||||
|
||||
TwisterPrivKey.prototype.verifyKey = function (cbfunc) {
|
||||
TwisterPrivKey.prototype.makeRandomKey = function (key) {
|
||||
|
||||
this._btcKey = Bitcoin.ECPair.makeRandom(twister_network);
|
||||
|
||||
this._data = this._btcKey.toWIF();
|
||||
|
||||
}
|
||||
|
||||
TwisterPrivKey.prototype.verifyKey = function (cbfunc,querySettings) {
|
||||
|
||||
var Twister = this._scope;
|
||||
|
||||
var thisResource = this;
|
||||
|
||||
Twister.getUser(this._name)._doPubKey(function(pubkey){
|
||||
Twister.getUser(this._name)._doPubKey(function(pubkey,querySettings){
|
||||
|
||||
if(pubkey._data){
|
||||
|
||||
if(pubkey._data!=thisResource.getPubKey()){
|
||||
if(pubkey._data==thisResource.getPubKey()){
|
||||
|
||||
thisResource._status = "confirmed";
|
||||
|
||||
}else{
|
||||
|
||||
thisResource._status = "conflicting";
|
||||
|
||||
}
|
||||
|
||||
this._data = null;
|
||||
this._btcKey = null;
|
||||
|
||||
thisResource._handleError({
|
||||
message: "Private key is in conflict with public key.",
|
||||
code: 32064
|
||||
})
|
||||
|
||||
}else{
|
||||
if(cbfunc){
|
||||
cbfunc(thisResource);
|
||||
}
|
||||
|
||||
thisResource._status = "unconfirmed";
|
||||
|
||||
}
|
||||
|
||||
if(cbfunc) cbfunc(thisResource);
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
@ -32344,6 +32395,7 @@ TwisterTorrent.prototype.fillPostsCache = function (id,cbfunc) {
|
||||
|
||||
}
|
||||
},{"../TwisterResource.js":157,"inherits":52}],147:[function(require,module,exports){
|
||||
(function (Buffer){
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
@ -32496,7 +32548,7 @@ Twister.getAccounts = function () {
|
||||
var res = [];
|
||||
|
||||
for (var acc in Twister._wallet) {
|
||||
res.push(acc);
|
||||
res.push(Twister._wallet[acc]);
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -32543,11 +32595,9 @@ Twister.loadServerAccounts = function (cbfunc) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @function
|
||||
* @name loadAccounts
|
||||
* @description loads available account into the wallet.
|
||||
* @name importClientSideAccount
|
||||
* @description imports an account into client side wallet. The private key is not send to any server.
|
||||
*/
|
||||
Twister.importClientSideAccount = function (name,key,cbfunc) {
|
||||
|
||||
@ -32556,9 +32606,68 @@ Twister.importClientSideAccount = function (name,key,cbfunc) {
|
||||
Twister._wallet[name] = new TwisterAccount(name,Twister);
|
||||
|
||||
Twister._wallet[name]._privkey.setKey(key)
|
||||
Twister._wallet[name]._privkey.verifyKey(function(){
|
||||
Twister._wallet[name]._privkey.verifyKey(function(key){
|
||||
|
||||
if(cbfunc) cbfunc(Twister._wallet[name])
|
||||
if(key.getStatus()=="confirmed"){
|
||||
|
||||
if(cbfunc) cbfunc(Twister._wallet[name])
|
||||
|
||||
}else{
|
||||
|
||||
Twister._handleError({
|
||||
message: "Private key is in conflict with public key.",
|
||||
code: 32064
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/** @function
|
||||
* @name generateClientSideAccount
|
||||
* @description generate an account in the client side wallet. The private key is not send to any server.
|
||||
*/
|
||||
Twister.generateClientSideAccount = function (name,cbfunc) {
|
||||
|
||||
var TwisterAccount = require('./ClientWallet/TwisterAccount.js');
|
||||
|
||||
Twister._wallet[name] = new TwisterAccount(name,Twister);
|
||||
|
||||
var newAccount = Twister._wallet[name];
|
||||
|
||||
newAccount._privkey.makeRandomKey()
|
||||
newAccount._privkey.verifyKey(function(){
|
||||
|
||||
var pubkey = newAccount._privkey.getPubKey();
|
||||
|
||||
Twister.RPC("createrawtransaction",[name,pubkey],function(raw){
|
||||
|
||||
console.log("raw transaction: ",raw);
|
||||
|
||||
Twister.RPC("sendrawtransaction",raw,function(res){
|
||||
|
||||
console.log("sent transaction",res);
|
||||
|
||||
var twisterPubKey = Twister.getUser(username)._pubkey
|
||||
|
||||
twisterPubKey._lastUpdate = Date.now()/1000;
|
||||
|
||||
twisterPubKey._data = res;
|
||||
|
||||
twisterPubKey._btcKey = Bitcoin.ECPair.fromPublicKeyBuffer(new Buffer(res,"hex"),twister_network);
|
||||
|
||||
if(cbfunc) cbfunc(newAccount)
|
||||
|
||||
},function(err){
|
||||
console.log("error",err);
|
||||
})
|
||||
},function(err){
|
||||
console.log("error",err);
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
@ -32726,7 +32835,8 @@ Twister.onQueryComplete = function (id, cbfunc){
|
||||
|
||||
module.exports = Twister;
|
||||
|
||||
},{"./ClientWallet/TwisterAccount.js":139,"./ServerWallet/TwisterAccount.js":144,"./TwisterHashtag.js":150,"./TwisterPromotedPosts.js":154,"./TwisterResource.js":157,"./TwisterUser.js":160}],148:[function(require,module,exports){
|
||||
}).call(this,require("buffer").Buffer)
|
||||
},{"./ClientWallet/TwisterAccount.js":139,"./ServerWallet/TwisterAccount.js":144,"./TwisterHashtag.js":150,"./TwisterPromotedPosts.js":154,"./TwisterResource.js":157,"./TwisterUser.js":160,"buffer":177}],148:[function(require,module,exports){
|
||||
var inherits = require('inherits');
|
||||
|
||||
var TwisterResource = require('./TwisterResource.js');
|
||||
|
87
jsx/App.js
87
jsx/App.js
@ -38,6 +38,7 @@ var Mentions = require('./profile/Mentions.js');
|
||||
var Conversation = require('./other/Conversation.js');
|
||||
var Hashtag = require('./other/Hashtag.js');
|
||||
var Settings = require('./other/Settings.js');
|
||||
var Accounts = require('./other/Accounts.js');
|
||||
var AppSettingsMixin = require('./common/AppSettingsMixin.js');
|
||||
|
||||
App = React.createClass({
|
||||
@ -66,6 +67,33 @@ App = React.createClass({
|
||||
} else {return "none"}
|
||||
},
|
||||
|
||||
getInitialState: function () {
|
||||
|
||||
var state={};
|
||||
|
||||
state.activeAccount = localStorage.getItem("twister-react-activeAccount")
|
||||
|
||||
state.accounts = Twister.getAccounts().map(function(acc){
|
||||
return {
|
||||
name: acc.getUsername(),
|
||||
status: acc.getKeyStatus()
|
||||
}
|
||||
});
|
||||
|
||||
//console.log(state);
|
||||
|
||||
return state;
|
||||
|
||||
},
|
||||
|
||||
componentDidMount: function () {
|
||||
|
||||
this.setInterval(this.saveCache,300000);
|
||||
|
||||
this.setInterval(this.checkAccounts,60000);
|
||||
|
||||
},
|
||||
|
||||
clearCache: function () {
|
||||
localStorage.setItem("twister-cache", null);
|
||||
},
|
||||
@ -76,6 +104,24 @@ App = React.createClass({
|
||||
localStorage.setItem("twister-cache", JSON.stringify(Twister.serializeCache()))
|
||||
},
|
||||
|
||||
checkAccounts: function() {
|
||||
|
||||
this.state.accounts.map(function(acc){
|
||||
|
||||
Twister.getAccount(newaccoutname).verifyKey(function(key){
|
||||
thisComponent.setState(function(oldstate,props){
|
||||
|
||||
oldstate.accounts[acc].status = key.getStatus();
|
||||
|
||||
return oldstate;
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
switchAccount: function (newaccoutname) {
|
||||
|
||||
//console.log(newaccoutname);
|
||||
@ -100,28 +146,14 @@ App = React.createClass({
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
getInitialState: function () {
|
||||
this.setState(function(oldstate,props){
|
||||
oldstate.accounts.push({
|
||||
name: event.detail.getUsername(),
|
||||
status: event.detail.getKeyStatus()
|
||||
})
|
||||
return oldstate;
|
||||
})
|
||||
|
||||
var state={};
|
||||
|
||||
state.activeAccount = localStorage.getItem("twister-react-activeAccount")
|
||||
|
||||
state.accounts = Twister.getAccounts();
|
||||
|
||||
if (!state.activeAccount) { state.activeAccount=state.accounts[0]; }
|
||||
|
||||
//console.log(state);
|
||||
|
||||
return state;
|
||||
|
||||
},
|
||||
|
||||
componentDidMount: function () {
|
||||
|
||||
this.setInterval(this.saveCache,300000);
|
||||
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@ -134,11 +166,11 @@ App = React.createClass({
|
||||
for (var i in this.state.accounts) {
|
||||
userbuttons.push(
|
||||
<MenuItem
|
||||
key={this.state.accounts[i]}
|
||||
bsStyle={this.state.accounts[i]==this.state.activeAccount ? 'primary' : 'default'}
|
||||
onClick={this.switchAccount.bind(this,this.state.accounts[i])}
|
||||
key={this.state.accounts[i].name}
|
||||
bsStyle={this.state.accounts[i].name==this.state.activeAccount ? 'primary' : 'default'}
|
||||
onClick={this.switchAccount.bind(this,this.state.accounts[i].name)}
|
||||
href="javascript:void(0);"
|
||||
>{this.state.accounts[i]}</MenuItem>
|
||||
>{this.state.accounts[i].name}</MenuItem>
|
||||
);
|
||||
}
|
||||
|
||||
@ -166,12 +198,14 @@ App = React.createClass({
|
||||
>Clear Cache</MenuItem>
|
||||
<MenuItem href="#/search" >Search</MenuItem>
|
||||
<MenuItem href="#/settings" >Settings</MenuItem>
|
||||
<MenuItem href="#/accounts" >Accounts</MenuItem>
|
||||
<MenuItem href="#/howtofollow" >How to Follow</MenuItem>
|
||||
<MenuItem href="#/trendinghashtags" >Trending Hashtags</MenuItem>
|
||||
</DropdownButton>
|
||||
</ButtonGroup>
|
||||
<br/>
|
||||
<RouteHandler
|
||||
accounts={this.state.accounts}
|
||||
activeAccount={this.state.activeAccount}
|
||||
key={this.getHandlerKey()}
|
||||
/>
|
||||
@ -200,6 +234,7 @@ var routes = (
|
||||
<Route name="conversation" path="/conversation/:username/:postid" handler={Conversation}/>
|
||||
<Route name="hashtag" path="/hashtag/:hashtag" handler={Hashtag}/>
|
||||
<Route name="settings" path="/settings" handler={Settings}/>
|
||||
<Route name="accounts" path="/accounts" handler={Accounts}/>
|
||||
<DefaultRoute name="home" handler={Home} />
|
||||
</Route>
|
||||
);
|
||||
@ -228,7 +263,7 @@ if (accounts.length==0) {
|
||||
pollInterval:60,
|
||||
pollIntervalProfile: 3600,
|
||||
ignoredUsers: "nobody",
|
||||
host: "http://tschaul.com:8080"
|
||||
host: window.location.protocol+"//"+window.location.host+"/"
|
||||
|
||||
};
|
||||
|
||||
|
@ -49,15 +49,19 @@ module.exports = FollowButton = React.createClass({
|
||||
|
||||
thisComponent = this;
|
||||
|
||||
Twister.getUser(thisComponent.props.activeAccount).doFollowings(function(followings){
|
||||
if(followings.map(function(fol){
|
||||
return fol.getUsername();
|
||||
}).indexOf(thisComponent.props.username)<0){
|
||||
thisComponent.setStateSafe({isCurrentlyFollowing: false, hasLoaded: true});
|
||||
}else{
|
||||
thisComponent.setStateSafe({isCurrentlyFollowing: true, hasLoaded: true});
|
||||
}
|
||||
})
|
||||
if(thisComponent.props.activeAccount){
|
||||
Twister.getUser(thisComponent.props.activeAccount).doFollowings(function(followings){
|
||||
if(followings.map(function(fol){
|
||||
return fol.getUsername();
|
||||
}).indexOf(thisComponent.props.username)<0){
|
||||
thisComponent.setStateSafe({isCurrentlyFollowing: false, hasLoaded: true});
|
||||
}else{
|
||||
thisComponent.setStateSafe({isCurrentlyFollowing: true, hasLoaded: true});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
render: function() {
|
||||
|
||||
|
@ -121,6 +121,11 @@ module.exports = Post = React.createClass({
|
||||
render: function() {
|
||||
|
||||
var post = Twister.getUser(this.props.post.username).getPost(this.props.post.id);
|
||||
if(!post){
|
||||
return (
|
||||
<span/>
|
||||
)
|
||||
}
|
||||
var retwist = false;
|
||||
var retwistWithComment = false;
|
||||
var comment = "";
|
||||
|
@ -152,7 +152,7 @@ module.exports = Home = React.createClass({
|
||||
this.setInterval(this.updatePosts, this.state.appSettings.pollInterval*1000);
|
||||
|
||||
} else {
|
||||
window.location.hash="#/settings";
|
||||
window.location.hash="#/accounts";
|
||||
console.log("active account is null")
|
||||
}
|
||||
|
||||
|
47
jsx/other/Accounts.js
Normal file
47
jsx/other/Accounts.js
Normal file
@ -0,0 +1,47 @@
|
||||
var React = require('react');
|
||||
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
|
||||
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
|
||||
var EventListenerMixin = require('../common/EventListenerMixin.js');
|
||||
var AppSettingsMixin = require('../common/AppSettingsMixin.js');
|
||||
|
||||
var ImportAccountModalButton = require('../other/ImportAccountModalButton.js');
|
||||
|
||||
var ReactBootstrap = require('react-bootstrap')
|
||||
, NavItem = ReactBootstrap.NavItem
|
||||
, Nav = ReactBootstrap.Nav
|
||||
, ListGroup = ReactBootstrap.ListGroup
|
||||
, ListGroupItem = ReactBootstrap.ListGroupItem
|
||||
, Panel = ReactBootstrap.Panel
|
||||
, Glyphicon = ReactBootstrap.Glyphicon
|
||||
, Button = ReactBootstrap.Button
|
||||
, Input = ReactBootstrap.Input
|
||||
|
||||
module.exports = Accounts = React.createClass({
|
||||
|
||||
mixins: [
|
||||
SetIntervalMixin,
|
||||
SafeStateChangeMixin,
|
||||
AppSettingsMixin
|
||||
],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.func
|
||||
},
|
||||
render: function() {
|
||||
return (
|
||||
<ListGroup>
|
||||
<ListGroupItem>Settings</ListGroupItem>
|
||||
<ListGroupItem>
|
||||
<ul>
|
||||
{this.props.accounts.map(function(acc,index) {
|
||||
//console.log(acc,index)
|
||||
return (
|
||||
<li>{acc.name} - {acc.status}</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
<ImportAccountModalButton/>
|
||||
</ListGroupItem>
|
||||
</ListGroup>
|
||||
);
|
||||
}
|
||||
});
|
@ -16,7 +16,7 @@ var ReactBootstrap = require('react-bootstrap')
|
||||
, Button = ReactBootstrap.Button
|
||||
, Input = ReactBootstrap.Input
|
||||
|
||||
module.exports = Home = React.createClass({
|
||||
module.exports = Settings = React.createClass({
|
||||
|
||||
mixins: [
|
||||
SetIntervalMixin,
|
||||
@ -66,7 +66,6 @@ module.exports = Home = React.createClass({
|
||||
wrapperClassName='col-xs-8' className="settings-host"/>
|
||||
<Input type='submit' value='Save' wrapperClassName='col-xs-offset-10 col-xs-2'/>
|
||||
</form>
|
||||
<ImportAccountModalButton/>
|
||||
</ListGroupItem>
|
||||
</ListGroup>
|
||||
);
|
||||
|
14
node_modules/react-router/README.md
generated
vendored
Executable file → Normal file
14
node_modules/react-router/README.md
generated
vendored
Executable file → Normal file
@ -1,18 +1,14 @@
|
||||
[![build status](https://img.shields.io/travis/rackt/react-router/0.13.x.svg?style=flat-square)](https://travis-ci.org/rackt/react-router)
|
||||
[![npm package](https://img.shields.io/npm/v/react-router.svg?style=flat-square)](https://www.npmjs.org/package/react-router)
|
||||
[![build status](https://img.shields.io/travis/rackt/react-router/master.svg?style=flat-square)](https://travis-ci.org/rackt/react-router)
|
||||
[![dependency status](https://img.shields.io/david/rackt/react-router.svg?style=flat-square)](https://david-dm.org/rackt/react-router)
|
||||
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/rackt/react-router?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
[![react-router channel on slack](https://img.shields.io/badge/slack-react--router@reactiflux-61DAFB.svg?style=flat-square)](http://www.reactiflux.com)
|
||||
|
||||
React Router
|
||||
============
|
||||
|
||||
A complete routing library for React.
|
||||
|
||||
Docs
|
||||
----
|
||||
|
||||
- [Guide: Overview](/docs/guides/overview.md)
|
||||
- [API](/docs/api/)
|
||||
* [Guides](/docs/guides)
|
||||
* [Docs](/doc)
|
||||
|
||||
Important Notes
|
||||
---------------
|
||||
@ -124,7 +120,7 @@ Related Modules
|
||||
|
||||
- [rnr-constrained-route](https://github.com/bjyoungblood/rnr-constrained-route) - validate paths
|
||||
and parameters on route handlers.
|
||||
- [react-router-bootstrap](https://github.com/mtscout6/react-router-bootstrap) - Integration with [react-bootstrap](https://github.com/react-bootstrap/react-bootstrap) components.
|
||||
- [react-router-bootstrap](https://github.com/react-bootstrap/react-router-bootstrap) - Integration with [react-bootstrap](https://github.com/react-bootstrap/react-bootstrap) components.
|
||||
- [react-router-proxy-loader](https://github.com/odysseyscience/react-router-proxy-loader) - A Webpack loader to dynamically load react-router components on-demand
|
||||
|
||||
Contributing
|
||||
|
0
node_modules/react-router/lib/Cancellation.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/Cancellation.js
generated
vendored
Executable file → Normal file
4
node_modules/react-router/lib/History.js
generated
vendored
Executable file → Normal file
4
node_modules/react-router/lib/History.js
generated
vendored
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var invariant = require('react/lib/invariant');
|
||||
var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM;
|
||||
var invariant = require('invariant');
|
||||
var canUseDOM = require('can-use-dom');
|
||||
|
||||
var History = {
|
||||
|
||||
|
42
node_modules/react-router/lib/Match.js
generated
vendored
Executable file → Normal file
42
node_modules/react-router/lib/Match.js
generated
vendored
Executable file → Normal file
@ -1,10 +1,10 @@
|
||||
/* jshint -W084 */
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
/* jshint -W084 */
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
var PathUtils = require('./PathUtils');
|
||||
|
||||
function deepSearch(route, pathname, query) {
|
||||
@ -27,29 +27,20 @@ function deepSearch(route, pathname, query) {
|
||||
|
||||
// No child routes matched; try the default route.
|
||||
var defaultRoute = route.defaultRoute;
|
||||
if (defaultRoute && (params = PathUtils.extractParams(defaultRoute.path, pathname))) {
|
||||
return new Match(pathname, params, query, [route, defaultRoute]);
|
||||
} // Does the "not found" route match?
|
||||
if (defaultRoute && (params = PathUtils.extractParams(defaultRoute.path, pathname))) return new Match(pathname, params, query, [route, defaultRoute]);
|
||||
|
||||
// Does the "not found" route match?
|
||||
var notFoundRoute = route.notFoundRoute;
|
||||
if (notFoundRoute && (params = PathUtils.extractParams(notFoundRoute.path, pathname))) {
|
||||
return new Match(pathname, params, query, [route, notFoundRoute]);
|
||||
} // Last attempt: check this route.
|
||||
if (notFoundRoute && (params = PathUtils.extractParams(notFoundRoute.path, pathname))) return new Match(pathname, params, query, [route, notFoundRoute]);
|
||||
|
||||
// Last attempt: check this route.
|
||||
var params = PathUtils.extractParams(route.path, pathname);
|
||||
if (params) {
|
||||
return new Match(pathname, params, query, [route]);
|
||||
}return null;
|
||||
if (params) return new Match(pathname, params, query, [route]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var Match = (function () {
|
||||
function Match(pathname, params, query, routes) {
|
||||
_classCallCheck(this, Match);
|
||||
|
||||
this.pathname = pathname;
|
||||
this.params = params;
|
||||
this.query = query;
|
||||
this.routes = routes;
|
||||
}
|
||||
|
||||
_createClass(Match, null, [{
|
||||
key: 'findMatch',
|
||||
|
||||
@ -69,6 +60,15 @@ var Match = (function () {
|
||||
}
|
||||
}]);
|
||||
|
||||
function Match(pathname, params, query, routes) {
|
||||
_classCallCheck(this, Match);
|
||||
|
||||
this.pathname = pathname;
|
||||
this.params = params;
|
||||
this.query = query;
|
||||
this.routes = routes;
|
||||
}
|
||||
|
||||
return Match;
|
||||
})();
|
||||
|
||||
|
0
node_modules/react-router/lib/Navigation.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/Navigation.js
generated
vendored
Executable file → Normal file
16
node_modules/react-router/lib/PathUtils.js
generated
vendored
Executable file → Normal file
16
node_modules/react-router/lib/PathUtils.js
generated
vendored
Executable file → Normal file
@ -1,12 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var invariant = require('react/lib/invariant');
|
||||
var invariant = require('invariant');
|
||||
var assign = require('object-assign');
|
||||
var qs = require('qs');
|
||||
|
||||
var paramCompileMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g;
|
||||
var paramInjectMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$?]*[?]?)|[*]/g;
|
||||
var paramInjectTrailingSlashMatcher = /\/\/\?|\/\?\/|\/\?/g;
|
||||
var paramInjectTrailingSlashMatcher = /\/\/\?|\/\?\/|\/\?(?![^\/=]+=.*$)/g;
|
||||
var queryMatcher = /\?(.*)$/;
|
||||
|
||||
var _compiledPatterns = {};
|
||||
@ -71,9 +71,9 @@ var PathUtils = {
|
||||
|
||||
var match = path.match(matcher);
|
||||
|
||||
if (!match) {
|
||||
return null;
|
||||
}var params = {};
|
||||
if (!match) return null;
|
||||
|
||||
var params = {};
|
||||
|
||||
paramNames.forEach(function (paramName, index) {
|
||||
params[paramName] = match[index + 1];
|
||||
@ -143,9 +143,9 @@ var PathUtils = {
|
||||
|
||||
var queryString = qs.stringify(query, { arrayFormat: 'brackets' });
|
||||
|
||||
if (queryString) {
|
||||
return PathUtils.withoutQuery(path) + '?' + queryString;
|
||||
}return PathUtils.withoutQuery(path);
|
||||
if (queryString) return PathUtils.withoutQuery(path) + '?' + queryString;
|
||||
|
||||
return PathUtils.withoutQuery(path);
|
||||
}
|
||||
|
||||
};
|
||||
|
4
node_modules/react-router/lib/PropTypes.js
generated
vendored
Executable file → Normal file
4
node_modules/react-router/lib/PropTypes.js
generated
vendored
Executable file → Normal file
@ -10,9 +10,7 @@ var PropTypes = assign({}, ReactPropTypes, {
|
||||
* Indicates that a prop should be falsy.
|
||||
*/
|
||||
falsy: function falsy(props, propName, componentName) {
|
||||
if (props[propName]) {
|
||||
return new Error('<' + componentName + '> should not have a "' + propName + '" prop');
|
||||
}
|
||||
if (props[propName]) return new Error('<' + componentName + '> should not have a "' + propName + '" prop');
|
||||
},
|
||||
|
||||
/**
|
||||
|
0
node_modules/react-router/lib/Redirect.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/Redirect.js
generated
vendored
Executable file → Normal file
100
node_modules/react-router/lib/Route.js
generated
vendored
Executable file → Normal file
100
node_modules/react-router/lib/Route.js
generated
vendored
Executable file → Normal file
@ -1,56 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
var assign = require('react/lib/Object.assign');
|
||||
var invariant = require('react/lib/invariant');
|
||||
var warning = require('react/lib/warning');
|
||||
var invariant = require('invariant');
|
||||
var warning = require('./warning');
|
||||
var PathUtils = require('./PathUtils');
|
||||
|
||||
var _currentRoute;
|
||||
|
||||
var Route = (function () {
|
||||
function Route(name, path, ignoreScrollBehavior, isDefault, isNotFound, onEnter, onLeave, handler) {
|
||||
_classCallCheck(this, Route);
|
||||
|
||||
this.name = name;
|
||||
this.path = path;
|
||||
this.paramNames = PathUtils.extractParamNames(this.path);
|
||||
this.ignoreScrollBehavior = !!ignoreScrollBehavior;
|
||||
this.isDefault = !!isDefault;
|
||||
this.isNotFound = !!isNotFound;
|
||||
this.onEnter = onEnter;
|
||||
this.onLeave = onLeave;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
_createClass(Route, [{
|
||||
key: 'appendChild',
|
||||
|
||||
/**
|
||||
* Appends the given route to this route's child routes.
|
||||
*/
|
||||
value: function appendChild(route) {
|
||||
invariant(route instanceof Route, 'route.appendChild must use a valid Route');
|
||||
|
||||
if (!this.childRoutes) this.childRoutes = [];
|
||||
|
||||
this.childRoutes.push(route);
|
||||
}
|
||||
}, {
|
||||
key: 'toString',
|
||||
value: function toString() {
|
||||
var string = '<Route';
|
||||
|
||||
if (this.name) string += ' name="' + this.name + '"';
|
||||
|
||||
string += ' path="' + this.path + '">';
|
||||
|
||||
return string;
|
||||
}
|
||||
}], [{
|
||||
_createClass(Route, null, [{
|
||||
key: 'createRoute',
|
||||
|
||||
/**
|
||||
@ -149,28 +111,26 @@ var Route = (function () {
|
||||
|
||||
return route;
|
||||
}
|
||||
}, {
|
||||
key: 'createDefaultRoute',
|
||||
|
||||
/**
|
||||
* Creates and returns a route that is rendered when its parent matches
|
||||
* the current URL.
|
||||
*/
|
||||
}, {
|
||||
key: 'createDefaultRoute',
|
||||
value: function createDefaultRoute(options) {
|
||||
return Route.createRoute(assign({}, options, { isDefault: true }));
|
||||
}
|
||||
}, {
|
||||
key: 'createNotFoundRoute',
|
||||
|
||||
/**
|
||||
* Creates and returns a route that is rendered when its parent matches
|
||||
* the current URL but none of its siblings do.
|
||||
*/
|
||||
}, {
|
||||
key: 'createNotFoundRoute',
|
||||
value: function createNotFoundRoute(options) {
|
||||
return Route.createRoute(assign({}, options, { isNotFound: true }));
|
||||
}
|
||||
}, {
|
||||
key: 'createRedirect',
|
||||
|
||||
/**
|
||||
* Creates and returns a route that automatically redirects the transition
|
||||
@ -184,6 +144,8 @@ var Route = (function () {
|
||||
* - query The query to use in the redirect URL. Defaults
|
||||
* to using the current query
|
||||
*/
|
||||
}, {
|
||||
key: 'createRedirect',
|
||||
value: function createRedirect(options) {
|
||||
return Route.createRoute(assign({}, options, {
|
||||
path: options.path || options.from || '*',
|
||||
@ -194,6 +156,46 @@ var Route = (function () {
|
||||
}
|
||||
}]);
|
||||
|
||||
function Route(name, path, ignoreScrollBehavior, isDefault, isNotFound, onEnter, onLeave, handler) {
|
||||
_classCallCheck(this, Route);
|
||||
|
||||
this.name = name;
|
||||
this.path = path;
|
||||
this.paramNames = PathUtils.extractParamNames(this.path);
|
||||
this.ignoreScrollBehavior = !!ignoreScrollBehavior;
|
||||
this.isDefault = !!isDefault;
|
||||
this.isNotFound = !!isNotFound;
|
||||
this.onEnter = onEnter;
|
||||
this.onLeave = onLeave;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the given route to this route's child routes.
|
||||
*/
|
||||
|
||||
_createClass(Route, [{
|
||||
key: 'appendChild',
|
||||
value: function appendChild(route) {
|
||||
invariant(route instanceof Route, 'route.appendChild must use a valid Route');
|
||||
|
||||
if (!this.childRoutes) this.childRoutes = [];
|
||||
|
||||
this.childRoutes.push(route);
|
||||
}
|
||||
}, {
|
||||
key: 'toString',
|
||||
value: function toString() {
|
||||
var string = '<Route';
|
||||
|
||||
if (this.name) string += ' name="' + this.name + '"';
|
||||
|
||||
string += ' path="' + this.path + '">';
|
||||
|
||||
return string;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Route;
|
||||
})();
|
||||
|
||||
|
22
node_modules/react-router/lib/ScrollHistory.js
generated
vendored
Executable file → Normal file
22
node_modules/react-router/lib/ScrollHistory.js
generated
vendored
Executable file → Normal file
@ -1,16 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var invariant = require('react/lib/invariant');
|
||||
var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM;
|
||||
var invariant = require('invariant');
|
||||
var canUseDOM = require('can-use-dom');
|
||||
var getWindowScrollPosition = require('./getWindowScrollPosition');
|
||||
|
||||
function shouldUpdateScroll(state, prevState) {
|
||||
if (!prevState) {
|
||||
return true;
|
||||
} // Don't update scroll position when only the query has changed.
|
||||
if (state.pathname === prevState.pathname) {
|
||||
return false;
|
||||
}var routes = state.routes;
|
||||
if (!prevState) return true;
|
||||
|
||||
// Don't update scroll position when only the query has changed.
|
||||
if (state.pathname === prevState.pathname) return false;
|
||||
|
||||
var routes = state.routes;
|
||||
var prevRoutes = prevState.routes;
|
||||
|
||||
var sharedAncestorRoutes = routes.filter(function (route) {
|
||||
@ -63,9 +63,9 @@ var ScrollHistory = {
|
||||
},
|
||||
|
||||
_updateScroll: function _updateScroll(prevState) {
|
||||
if (!shouldUpdateScroll(this.state, prevState)) {
|
||||
return;
|
||||
}var scrollBehavior = this.constructor.getScrollBehavior();
|
||||
if (!shouldUpdateScroll(this.state, prevState)) return;
|
||||
|
||||
var scrollBehavior = this.constructor.getScrollBehavior();
|
||||
|
||||
if (scrollBehavior) scrollBehavior.updateScrollPosition(this.constructor.getScrollPosition(this.state.path), this.state.action);
|
||||
}
|
||||
|
0
node_modules/react-router/lib/State.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/State.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/TestUtils.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/TestUtils.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/Transition.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/Transition.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/actions/LocationActions.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/actions/LocationActions.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/behaviors/ImitateBrowserBehavior.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/behaviors/ImitateBrowserBehavior.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/behaviors/ScrollToTopBehavior.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/behaviors/ScrollToTopBehavior.js
generated
vendored
Executable file → Normal file
28
node_modules/react-router/lib/components/ActiveHandler.js
generated
vendored
Executable file → Normal file
28
node_modules/react-router/lib/components/ActiveHandler.js
generated
vendored
Executable file → Normal file
@ -1,10 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
|
||||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var React = require('react');
|
||||
var ContextWrapper = require('./ContextWrapper');
|
||||
@ -19,15 +21,17 @@ var REF_NAME = '__routeHandler__';
|
||||
*/
|
||||
|
||||
var RouteHandler = (function (_React$Component) {
|
||||
_inherits(RouteHandler, _React$Component);
|
||||
|
||||
function RouteHandler() {
|
||||
_classCallCheck(this, RouteHandler);
|
||||
|
||||
if (_React$Component != null) {
|
||||
_React$Component.apply(this, arguments);
|
||||
}
|
||||
_get(Object.getPrototypeOf(RouteHandler.prototype), 'constructor', this).apply(this, arguments);
|
||||
}
|
||||
|
||||
_inherits(RouteHandler, _React$Component);
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
_createClass(RouteHandler, [{
|
||||
key: 'getChildContext',
|
||||
@ -66,9 +70,9 @@ var RouteHandler = (function (_React$Component) {
|
||||
value: function createChildRouteHandler(props) {
|
||||
var route = this.context.router.getRouteAtDepth(this.getRouteDepth());
|
||||
|
||||
if (route == null) {
|
||||
return null;
|
||||
}var childProps = assign({}, props || this.props, {
|
||||
if (route == null) return null;
|
||||
|
||||
var childProps = assign({}, props || this.props, {
|
||||
ref: REF_NAME,
|
||||
params: this.context.router.getCurrentParams(),
|
||||
query: this.context.router.getCurrentQuery()
|
||||
@ -92,10 +96,6 @@ var RouteHandler = (function (_React$Component) {
|
||||
return RouteHandler;
|
||||
})(React.Component);
|
||||
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
RouteHandler.contextTypes = {
|
||||
routeDepth: PropTypes.number.isRequired,
|
||||
router: PropTypes.router.isRequired
|
||||
|
26
node_modules/react-router/lib/components/ContextWrapper.js
generated
vendored
Executable file → Normal file
26
node_modules/react-router/lib/components/ContextWrapper.js
generated
vendored
Executable file → Normal file
@ -1,30 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
|
||||
|
||||
/**
|
||||
* This component is necessary to get around a context warning
|
||||
* present in React 0.13.0. It sovles this by providing a separation
|
||||
* between the "owner" and "parent" contexts.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var React = require('react');
|
||||
|
||||
var ContextWrapper = (function (_React$Component) {
|
||||
_inherits(ContextWrapper, _React$Component);
|
||||
|
||||
function ContextWrapper() {
|
||||
_classCallCheck(this, ContextWrapper);
|
||||
|
||||
if (_React$Component != null) {
|
||||
_React$Component.apply(this, arguments);
|
||||
}
|
||||
_get(Object.getPrototypeOf(ContextWrapper.prototype), 'constructor', this).apply(this, arguments);
|
||||
}
|
||||
|
||||
_inherits(ContextWrapper, _React$Component);
|
||||
|
||||
_createClass(ContextWrapper, [{
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
|
20
node_modules/react-router/lib/components/DefaultRoute.js
generated
vendored
Executable file → Normal file
20
node_modules/react-router/lib/components/DefaultRoute.js
generated
vendored
Executable file → Normal file
@ -1,8 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
||||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
||||
|
||||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var PropTypes = require('../PropTypes');
|
||||
var RouteHandler = require('./RouteHandler');
|
||||
@ -16,23 +18,21 @@ var Route = require('./Route');
|
||||
*/
|
||||
|
||||
var DefaultRoute = (function (_Route) {
|
||||
_inherits(DefaultRoute, _Route);
|
||||
|
||||
function DefaultRoute() {
|
||||
_classCallCheck(this, DefaultRoute);
|
||||
|
||||
if (_Route != null) {
|
||||
_Route.apply(this, arguments);
|
||||
}
|
||||
_get(Object.getPrototypeOf(DefaultRoute.prototype), 'constructor', this).apply(this, arguments);
|
||||
}
|
||||
|
||||
_inherits(DefaultRoute, _Route);
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
return DefaultRoute;
|
||||
})(Route);
|
||||
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
DefaultRoute.propTypes = {
|
||||
name: PropTypes.string,
|
||||
path: PropTypes.falsy,
|
||||
|
36
node_modules/react-router/lib/components/Link.js
generated
vendored
Executable file → Normal file
36
node_modules/react-router/lib/components/Link.js
generated
vendored
Executable file → Normal file
@ -1,10 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
|
||||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var React = require('react');
|
||||
var assign = require('react/lib/Object.assign');
|
||||
@ -38,15 +40,17 @@ function isModifiedEvent(event) {
|
||||
*/
|
||||
|
||||
var Link = (function (_React$Component) {
|
||||
_inherits(Link, _React$Component);
|
||||
|
||||
function Link() {
|
||||
_classCallCheck(this, Link);
|
||||
|
||||
if (_React$Component != null) {
|
||||
_React$Component.apply(this, arguments);
|
||||
}
|
||||
_get(Object.getPrototypeOf(Link.prototype), 'constructor', this).apply(this, arguments);
|
||||
}
|
||||
|
||||
_inherits(Link, _React$Component);
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
_createClass(Link, [{
|
||||
key: 'handleClick',
|
||||
@ -56,30 +60,30 @@ var Link = (function (_React$Component) {
|
||||
|
||||
if (this.props.onClick) clickResult = this.props.onClick(event);
|
||||
|
||||
if (isModifiedEvent(event) || !isLeftClickEvent(event)) {
|
||||
return;
|
||||
}if (clickResult === false || event.defaultPrevented === true) allowTransition = false;
|
||||
if (isModifiedEvent(event) || !isLeftClickEvent(event)) return;
|
||||
|
||||
if (clickResult === false || event.defaultPrevented === true) allowTransition = false;
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if (allowTransition) this.context.router.transitionTo(this.props.to, this.props.params, this.props.query);
|
||||
}
|
||||
}, {
|
||||
key: 'getHref',
|
||||
|
||||
/**
|
||||
* Returns the value of the "href" attribute to use on the DOM element.
|
||||
*/
|
||||
}, {
|
||||
key: 'getHref',
|
||||
value: function getHref() {
|
||||
return this.context.router.makeHref(this.props.to, this.props.params, this.props.query);
|
||||
}
|
||||
}, {
|
||||
key: 'getClassName',
|
||||
|
||||
/**
|
||||
* Returns the value of the "class" attribute to use on the DOM element, which contains
|
||||
* the value of the activeClassName property when this <Link> is active.
|
||||
*/
|
||||
}, {
|
||||
key: 'getClassName',
|
||||
value: function getClassName() {
|
||||
var className = this.props.className;
|
||||
|
||||
@ -110,10 +114,6 @@ var Link = (function (_React$Component) {
|
||||
return Link;
|
||||
})(React.Component);
|
||||
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
Link.contextTypes = {
|
||||
router: PropTypes.router.isRequired
|
||||
};
|
||||
|
20
node_modules/react-router/lib/components/NotFoundRoute.js
generated
vendored
Executable file → Normal file
20
node_modules/react-router/lib/components/NotFoundRoute.js
generated
vendored
Executable file → Normal file
@ -1,8 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
||||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
||||
|
||||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var PropTypes = require('../PropTypes');
|
||||
var RouteHandler = require('./RouteHandler');
|
||||
@ -17,23 +19,21 @@ var Route = require('./Route');
|
||||
*/
|
||||
|
||||
var NotFoundRoute = (function (_Route) {
|
||||
_inherits(NotFoundRoute, _Route);
|
||||
|
||||
function NotFoundRoute() {
|
||||
_classCallCheck(this, NotFoundRoute);
|
||||
|
||||
if (_Route != null) {
|
||||
_Route.apply(this, arguments);
|
||||
}
|
||||
_get(Object.getPrototypeOf(NotFoundRoute.prototype), 'constructor', this).apply(this, arguments);
|
||||
}
|
||||
|
||||
_inherits(NotFoundRoute, _Route);
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
return NotFoundRoute;
|
||||
})(Route);
|
||||
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
NotFoundRoute.propTypes = {
|
||||
name: PropTypes.string,
|
||||
path: PropTypes.falsy,
|
||||
|
20
node_modules/react-router/lib/components/Redirect.js
generated
vendored
Executable file → Normal file
20
node_modules/react-router/lib/components/Redirect.js
generated
vendored
Executable file → Normal file
@ -1,8 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
||||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
||||
|
||||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var PropTypes = require('../PropTypes');
|
||||
var Route = require('./Route');
|
||||
@ -13,23 +15,21 @@ var Route = require('./Route');
|
||||
*/
|
||||
|
||||
var Redirect = (function (_Route) {
|
||||
_inherits(Redirect, _Route);
|
||||
|
||||
function Redirect() {
|
||||
_classCallCheck(this, Redirect);
|
||||
|
||||
if (_Route != null) {
|
||||
_Route.apply(this, arguments);
|
||||
}
|
||||
_get(Object.getPrototypeOf(Redirect.prototype), 'constructor', this).apply(this, arguments);
|
||||
}
|
||||
|
||||
_inherits(Redirect, _Route);
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
return Redirect;
|
||||
})(Route);
|
||||
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
Redirect.propTypes = {
|
||||
path: PropTypes.string,
|
||||
from: PropTypes.string, // Alias for path.
|
||||
|
26
node_modules/react-router/lib/components/Route.js
generated
vendored
Executable file → Normal file
26
node_modules/react-router/lib/components/Route.js
generated
vendored
Executable file → Normal file
@ -1,13 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
|
||||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var React = require('react');
|
||||
var invariant = require('react/lib/invariant');
|
||||
var invariant = require('invariant');
|
||||
var PropTypes = require('../PropTypes');
|
||||
var RouteHandler = require('./RouteHandler');
|
||||
|
||||
@ -42,7 +44,7 @@ var RouteHandler = require('./RouteHandler');
|
||||
* var App = React.createClass({
|
||||
* render: function () {
|
||||
* return (
|
||||
* <div class="application">
|
||||
* <div className="application">
|
||||
* <RouteHandler/>
|
||||
* </div>
|
||||
* );
|
||||
@ -53,15 +55,17 @@ var RouteHandler = require('./RouteHandler');
|
||||
*/
|
||||
|
||||
var Route = (function (_React$Component) {
|
||||
_inherits(Route, _React$Component);
|
||||
|
||||
function Route() {
|
||||
_classCallCheck(this, Route);
|
||||
|
||||
if (_React$Component != null) {
|
||||
_React$Component.apply(this, arguments);
|
||||
}
|
||||
_get(Object.getPrototypeOf(Route.prototype), 'constructor', this).apply(this, arguments);
|
||||
}
|
||||
|
||||
_inherits(Route, _React$Component);
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
_createClass(Route, [{
|
||||
key: 'render',
|
||||
@ -73,10 +77,6 @@ var Route = (function (_React$Component) {
|
||||
return Route;
|
||||
})(React.Component);
|
||||
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
Route.propTypes = {
|
||||
name: PropTypes.string,
|
||||
path: PropTypes.string,
|
||||
|
28
node_modules/react-router/lib/components/RouteHandler.js
generated
vendored
Executable file → Normal file
28
node_modules/react-router/lib/components/RouteHandler.js
generated
vendored
Executable file → Normal file
@ -1,10 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
|
||||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var React = require('react');
|
||||
var ContextWrapper = require('./ContextWrapper');
|
||||
@ -19,15 +21,17 @@ var REF_NAME = '__routeHandler__';
|
||||
*/
|
||||
|
||||
var RouteHandler = (function (_React$Component) {
|
||||
_inherits(RouteHandler, _React$Component);
|
||||
|
||||
function RouteHandler() {
|
||||
_classCallCheck(this, RouteHandler);
|
||||
|
||||
if (_React$Component != null) {
|
||||
_React$Component.apply(this, arguments);
|
||||
}
|
||||
_get(Object.getPrototypeOf(RouteHandler.prototype), 'constructor', this).apply(this, arguments);
|
||||
}
|
||||
|
||||
_inherits(RouteHandler, _React$Component);
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
_createClass(RouteHandler, [{
|
||||
key: 'getChildContext',
|
||||
@ -66,9 +70,9 @@ var RouteHandler = (function (_React$Component) {
|
||||
value: function createChildRouteHandler(props) {
|
||||
var route = this.context.router.getRouteAtDepth(this.getRouteDepth());
|
||||
|
||||
if (route == null) {
|
||||
return null;
|
||||
}var childProps = assign({}, props || this.props, {
|
||||
if (route == null) return null;
|
||||
|
||||
var childProps = assign({}, props || this.props, {
|
||||
ref: REF_NAME,
|
||||
params: this.context.router.getCurrentParams(),
|
||||
query: this.context.router.getCurrentQuery()
|
||||
@ -92,10 +96,6 @@ var RouteHandler = (function (_React$Component) {
|
||||
return RouteHandler;
|
||||
})(React.Component);
|
||||
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
RouteHandler.contextTypes = {
|
||||
routeDepth: PropTypes.number.isRequired,
|
||||
router: PropTypes.router.isRequired
|
||||
|
34
node_modules/react-router/lib/createRouter.js
generated
vendored
Executable file → Normal file
34
node_modules/react-router/lib/createRouter.js
generated
vendored
Executable file → Normal file
@ -2,9 +2,9 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var warning = require('react/lib/warning');
|
||||
var invariant = require('react/lib/invariant');
|
||||
var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM;
|
||||
var warning = require('./warning');
|
||||
var invariant = require('invariant');
|
||||
var canUseDOM = require('can-use-dom');
|
||||
var LocationActions = require('./actions/LocationActions');
|
||||
var ImitateBrowserBehavior = require('./behaviors/ImitateBrowserBehavior');
|
||||
var HashLocation = require('./locations/HashLocation');
|
||||
@ -35,9 +35,9 @@ var DEFAULT_LOCATION = canUseDOM ? HashLocation : '/';
|
||||
var DEFAULT_SCROLL_BEHAVIOR = canUseDOM ? ImitateBrowserBehavior : null;
|
||||
|
||||
function hasProperties(object, properties) {
|
||||
for (var propertyName in properties) if (properties.hasOwnProperty(propertyName) && object[propertyName] !== properties[propertyName]) {
|
||||
return false;
|
||||
}return true;
|
||||
for (var propertyName in properties) if (properties.hasOwnProperty(propertyName) && object[propertyName] !== properties[propertyName]) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function hasMatch(routes, route, prevParams, nextParams, prevQuery, nextQuery) {
|
||||
@ -81,15 +81,15 @@ function routeIsActive(activeRoutes, routeName) {
|
||||
}
|
||||
|
||||
function paramsAreActive(activeParams, params) {
|
||||
for (var property in params) if (String(activeParams[property]) !== String(params[property])) {
|
||||
return false;
|
||||
}return true;
|
||||
for (var property in params) if (String(activeParams[property]) !== String(params[property])) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function queryIsActive(activeQuery, query) {
|
||||
for (var property in query) if (String(activeQuery[property]) !== String(query[property])) {
|
||||
return false;
|
||||
}return true;
|
||||
for (var property in query) if (String(activeQuery[property]) !== String(query[property])) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -301,9 +301,7 @@ function createRouter(options) {
|
||||
var prevPath = state.path;
|
||||
var isRefreshing = action == null;
|
||||
|
||||
if (prevPath === path && !isRefreshing) {
|
||||
return;
|
||||
} // Nothing to do!
|
||||
if (prevPath === path && !isRefreshing) return; // Nothing to do!
|
||||
|
||||
// Record the scroll position as early as possible to
|
||||
// get it before browsers try update it automatically.
|
||||
@ -460,9 +458,9 @@ function createRouter(options) {
|
||||
* Returns true if the given route, params, and query are active.
|
||||
*/
|
||||
isActive: function isActive(to, params, query) {
|
||||
if (PathUtils.isAbsolute(to)) {
|
||||
return to === state.path;
|
||||
}return routeIsActive(state.routes, to) && paramsAreActive(state.params, params) && (query == null || queryIsActive(state.query, query));
|
||||
if (PathUtils.isAbsolute(to)) return to === state.path;
|
||||
|
||||
return routeIsActive(state.routes, to) && paramsAreActive(state.params, params) && (query == null || queryIsActive(state.query, query));
|
||||
}
|
||||
|
||||
},
|
||||
|
22
node_modules/react-router/lib/createRoutesFromReactChildren.js
generated
vendored
Executable file → Normal file
22
node_modules/react-router/lib/createRoutesFromReactChildren.js
generated
vendored
Executable file → Normal file
@ -3,7 +3,7 @@
|
||||
|
||||
var React = require('react');
|
||||
var assign = require('react/lib/Object.assign');
|
||||
var warning = require('react/lib/warning');
|
||||
var warning = require('./warning');
|
||||
var DefaultRoute = require('./components/DefaultRoute');
|
||||
var NotFoundRoute = require('./components/NotFoundRoute');
|
||||
var Redirect = require('./components/Redirect');
|
||||
@ -34,20 +34,20 @@ function createRouteOptions(props) {
|
||||
}
|
||||
|
||||
function createRouteFromReactElement(element) {
|
||||
if (!React.isValidElement(element)) {
|
||||
return;
|
||||
}var type = element.type;
|
||||
if (!React.isValidElement(element)) return;
|
||||
|
||||
var type = element.type;
|
||||
var props = assign({}, type.defaultProps, element.props);
|
||||
|
||||
if (type.propTypes) checkPropTypes(type.displayName, type.propTypes, props);
|
||||
|
||||
if (type === DefaultRoute) {
|
||||
return Route.createDefaultRoute(createRouteOptions(props));
|
||||
}if (type === NotFoundRoute) {
|
||||
return Route.createNotFoundRoute(createRouteOptions(props));
|
||||
}if (type === Redirect) {
|
||||
return Route.createRedirect(createRouteOptions(props));
|
||||
}return Route.createRoute(createRouteOptions(props), function () {
|
||||
if (type === DefaultRoute) return Route.createDefaultRoute(createRouteOptions(props));
|
||||
|
||||
if (type === NotFoundRoute) return Route.createNotFoundRoute(createRouteOptions(props));
|
||||
|
||||
if (type === Redirect) return Route.createRedirect(createRouteOptions(props));
|
||||
|
||||
return Route.createRoute(createRouteOptions(props), function () {
|
||||
if (props.children) createRoutesFromReactChildren(props.children);
|
||||
});
|
||||
}
|
||||
|
4
node_modules/react-router/lib/getWindowScrollPosition.js
generated
vendored
Executable file → Normal file
4
node_modules/react-router/lib/getWindowScrollPosition.js
generated
vendored
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var invariant = require('react/lib/invariant');
|
||||
var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM;
|
||||
var invariant = require('invariant');
|
||||
var canUseDOM = require('can-use-dom');
|
||||
|
||||
/**
|
||||
* Returns the current scroll position of the window as { x, y }.
|
||||
|
0
node_modules/react-router/lib/index.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/index.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/isReactChildren.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/isReactChildren.js
generated
vendored
Executable file → Normal file
6
node_modules/react-router/lib/locations/HashLocation.js
generated
vendored
Executable file → Normal file
6
node_modules/react-router/lib/locations/HashLocation.js
generated
vendored
Executable file → Normal file
@ -23,9 +23,9 @@ function notifyChange(type) {
|
||||
function ensureSlash() {
|
||||
var path = HashLocation.getCurrentPath();
|
||||
|
||||
if (path.charAt(0) === '/') {
|
||||
return true;
|
||||
}HashLocation.replace('/' + path);
|
||||
if (path.charAt(0) === '/') return true;
|
||||
|
||||
HashLocation.replace('/' + path);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
4
node_modules/react-router/lib/locations/HistoryLocation.js
generated
vendored
Executable file → Normal file
4
node_modules/react-router/lib/locations/HistoryLocation.js
generated
vendored
Executable file → Normal file
@ -18,9 +18,7 @@ function notifyChange(type) {
|
||||
}
|
||||
|
||||
function onPopState(event) {
|
||||
if (event.state === undefined) {
|
||||
return;
|
||||
} // Ignore extraneous popstate events in WebKit.
|
||||
if (event.state === undefined) return; // Ignore extraneous popstate events in WebKit.
|
||||
|
||||
notifyChange(LocationActions.POP);
|
||||
}
|
||||
|
0
node_modules/react-router/lib/locations/RefreshLocation.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/locations/RefreshLocation.js
generated
vendored
Executable file → Normal file
14
node_modules/react-router/lib/locations/StaticLocation.js
generated
vendored
Executable file → Normal file
14
node_modules/react-router/lib/locations/StaticLocation.js
generated
vendored
Executable file → Normal file
@ -1,10 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
var invariant = require('react/lib/invariant');
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
var invariant = require('invariant');
|
||||
|
||||
function throwCannotModify() {
|
||||
invariant(false, 'You cannot modify a static location');
|
||||
@ -23,6 +23,10 @@ var StaticLocation = (function () {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
_createClass(StaticLocation, [{
|
||||
key: 'getCurrentPath',
|
||||
value: function getCurrentPath() {
|
||||
@ -38,10 +42,6 @@ var StaticLocation = (function () {
|
||||
return StaticLocation;
|
||||
})();
|
||||
|
||||
// TODO: Include these in the above class definition
|
||||
// once we can use ES7 property initializers.
|
||||
// https://github.com/babel/babel/issues/619
|
||||
|
||||
StaticLocation.prototype.push = throwCannotModify;
|
||||
StaticLocation.prototype.replace = throwCannotModify;
|
||||
StaticLocation.prototype.pop = throwCannotModify;
|
||||
|
12
node_modules/react-router/lib/locations/TestLocation.js
generated
vendored
Executable file → Normal file
12
node_modules/react-router/lib/locations/TestLocation.js
generated
vendored
Executable file → Normal file
@ -1,10 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
var invariant = require('react/lib/invariant');
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
var invariant = require('invariant');
|
||||
var LocationActions = require('../actions/LocationActions');
|
||||
var History = require('../History');
|
||||
|
||||
@ -18,15 +18,11 @@ var TestLocation = (function () {
|
||||
|
||||
this.history = history || [];
|
||||
this.listeners = [];
|
||||
this.needsDOM = false;
|
||||
this._updateHistoryLength();
|
||||
}
|
||||
|
||||
_createClass(TestLocation, [{
|
||||
key: 'needsDOM',
|
||||
get: function () {
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: '_updateHistoryLength',
|
||||
value: function _updateHistoryLength() {
|
||||
History.length = this.history.length;
|
||||
|
0
node_modules/react-router/lib/runRouter.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/runRouter.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/supportsHistory.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/lib/supportsHistory.js
generated
vendored
Executable file → Normal file
59
node_modules/react-router/lib/warning.js
generated
vendored
Normal file
59
node_modules/react-router/lib/warning.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Copyright 2014-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of https://github.com/facebook/react/tree/0.13-stable.
|
||||
* An additional grant of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule warning
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Similar to invariant but only logs a warning if the condition is not met.
|
||||
* This can be used to log issues in development environments in critical
|
||||
* paths. Removing the logging code for production environments will keep the
|
||||
* same logic and follow the same code paths.
|
||||
*/
|
||||
|
||||
var __DEV__ = process.env.NODE_ENV !== 'production';
|
||||
|
||||
var warning = function warning() {};
|
||||
|
||||
if (__DEV__) {
|
||||
warning = function (condition, format) {
|
||||
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||||
args[_key - 2] = arguments[_key];
|
||||
}
|
||||
|
||||
if (format === undefined) {
|
||||
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
||||
}
|
||||
|
||||
if (format.length < 10 || /^[s\W]*$/.test(format)) {
|
||||
throw new Error('The warning format should be able to uniquely identify this ' + 'warning. Please, use a more descriptive format than: ' + format);
|
||||
}
|
||||
|
||||
if (format.indexOf('Failed Composite propType: ') === 0) {
|
||||
return; // Ignore CompositeComponent proptype check.
|
||||
}
|
||||
|
||||
if (!condition) {
|
||||
var argIndex = 0;
|
||||
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
||||
return args[argIndex++];
|
||||
});
|
||||
console.warn(message);
|
||||
try {
|
||||
// --- Welcome to debugging React ---
|
||||
// This error was thrown as a convenience so that you can use this stack
|
||||
// to find the callsite that caused this warning to fire.
|
||||
throw new Error(message);
|
||||
} catch (x) {}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = warning;
|
28
node_modules/react-router/node_modules/can-use-dom/.npmignore
generated
vendored
Normal file
28
node_modules/react-router/node_modules/can-use-dom/.npmignore
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# Commenting this out is preferred by some people, see
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
|
||||
node_modules
|
||||
|
||||
# Users Environment Variables
|
||||
.lock-wscript
|
22
node_modules/react-router/node_modules/can-use-dom/LICENSE
generated
vendored
Normal file
22
node_modules/react-router/node_modules/can-use-dom/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Kiran Abburi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
7
node_modules/react-router/node_modules/can-use-dom/index.js
generated
vendored
Normal file
7
node_modules/react-router/node_modules/can-use-dom/index.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
var canUseDOM = !!(
|
||||
typeof window !== 'undefined' &&
|
||||
window.document &&
|
||||
window.document.createElement
|
||||
);
|
||||
|
||||
module.exports = canUseDOM;
|
51
node_modules/react-router/node_modules/can-use-dom/package.json
generated
vendored
Normal file
51
node_modules/react-router/node_modules/can-use-dom/package.json
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "can-use-dom",
|
||||
"version": "0.1.0",
|
||||
"description": "Test if you can use dom in the current environment",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "mocha test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/akiran/can-use-dom.git"
|
||||
},
|
||||
"keywords": [
|
||||
"isomorphic"
|
||||
],
|
||||
"author": {
|
||||
"name": "Kiran Abburi"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/akiran/can-use-dom/issues"
|
||||
},
|
||||
"homepage": "https://github.com/akiran/can-use-dom",
|
||||
"devDependencies": {
|
||||
"jsdom": "^3.1.0",
|
||||
"mocha": "^2.1.0",
|
||||
"should": "^4.6.3"
|
||||
},
|
||||
"gitHead": "0d49ab2adaacdd6c0160c6aafd474be4904a2e52",
|
||||
"_id": "can-use-dom@0.1.0",
|
||||
"_shasum": "22cc4a34a0abc43950f42c6411024a3f6366b45a",
|
||||
"_from": "can-use-dom@0.1.0",
|
||||
"_npmVersion": "2.1.3",
|
||||
"_nodeVersion": "0.10.26",
|
||||
"_npmUser": {
|
||||
"name": "akiran",
|
||||
"email": "kiran.coder0@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "akiran",
|
||||
"email": "kiran.coder0@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "22cc4a34a0abc43950f42c6411024a3f6366b45a",
|
||||
"tarball": "http://registry.npmjs.org/can-use-dom/-/can-use-dom-0.1.0.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/can-use-dom/-/can-use-dom-0.1.0.tgz"
|
||||
}
|
20
node_modules/react-router/node_modules/can-use-dom/test.js
generated
vendored
Normal file
20
node_modules/react-router/node_modules/can-use-dom/test.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
var should = require('should');
|
||||
// var jsdom = require('jsdom');
|
||||
|
||||
describe('canUseDOM', function () {
|
||||
it('should return false in nodejs environment', function (done) {
|
||||
var canUseDOM = require('./index');
|
||||
canUseDOM.should.be.false;
|
||||
done();
|
||||
});
|
||||
|
||||
// it('should return true in browser', function (done) {
|
||||
// jsdom.env('<div></div>', function (err, window) {
|
||||
// global.document = jsdom.jsdom('');
|
||||
// global.window = document.defaultView;
|
||||
// var canUseDOM = require('./index');
|
||||
// canUseDOM.should.be.true;
|
||||
// done();
|
||||
// });
|
||||
// });
|
||||
});
|
33
node_modules/react-router/node_modules/invariant/CHANGELOG.md
generated
vendored
Normal file
33
node_modules/react-router/node_modules/invariant/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
2.1.1 / 2015-09-20
|
||||
==================
|
||||
|
||||
* Use correct SPDX license.
|
||||
* Test "browser.js" using browserify.
|
||||
* Switch from "envify" to "loose-envify".
|
||||
|
||||
2.1.0 / 2015-06-03
|
||||
==================
|
||||
|
||||
* Add "envify" as a dependency.
|
||||
* Fixed license field in "package.json".
|
||||
|
||||
2.0.0 / 2015-02-21
|
||||
==================
|
||||
|
||||
* Switch to using the "browser" field. There are now browser and server versions that respect the "format" in production.
|
||||
|
||||
1.0.2 / 2014-09-24
|
||||
==================
|
||||
|
||||
* Added tests, npmignore and gitignore.
|
||||
* Clarifications in README.
|
||||
|
||||
1.0.1 / 2014-09-24
|
||||
==================
|
||||
|
||||
* Actually include 'invariant.js'.
|
||||
|
||||
1.0.0 / 2014-09-24
|
||||
==================
|
||||
|
||||
* Initial release.
|
35
node_modules/react-router/node_modules/invariant/README.md
generated
vendored
Normal file
35
node_modules/react-router/node_modules/invariant/README.md
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
# invariant
|
||||
|
||||
[![Build Status](https://travis-ci.org/zertosh/invariant.svg?branch=master)](https://travis-ci.org/zertosh/invariant)
|
||||
|
||||
A mirror of Facebook's `invariant` (e.g. [React](https://github.com/facebook/react/blob/v0.13.3/src/vendor/core/invariant.js), [flux](https://github.com/facebook/flux/blob/2.0.2/src/invariant.js)).
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](http://npmjs.org) do:
|
||||
|
||||
```sh
|
||||
npm install invariant
|
||||
```
|
||||
|
||||
## `invariant(condition, message)`
|
||||
|
||||
```js
|
||||
var invariant = require('invariant');
|
||||
|
||||
invariant(someTruthyVal, 'This will not throw');
|
||||
// No errors
|
||||
|
||||
invariant(someFalseyVal, 'This will throw an error with this message');
|
||||
// Error: Invariant Violation: This will throw an error with this message
|
||||
```
|
||||
|
||||
**Note:** When `process.env.NODE_ENV` is not `production`, the message is required. If omitted, `invariant` will throw regardless of the truthiness of the condition. When `process.env.NODE_ENV` is `production`, the message is optional – so they can be minified away.
|
||||
|
||||
### Browser
|
||||
|
||||
When used with [browserify](https://github.com/substack/node-browserify), it'll use `browser.js` (instead of `invariant.js`) and the [envify](https://github.com/hughsk/envify) transform will inline the value of `process.env.NODE_ENV`.
|
||||
|
||||
### Node
|
||||
|
||||
The node version is optimized around the performance implications of accessing `process.env`. The value of `process.env.NODE_ENV` is cached, and repeatedly used instead of reading `proces.env`. See [Server rendering is slower with npm react #812](https://github.com/facebook/react/issues/812)
|
51
node_modules/react-router/node_modules/invariant/browser.js
generated
vendored
Normal file
51
node_modules/react-router/node_modules/invariant/browser.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Use invariant() to assert state which your program assumes to be true.
|
||||
*
|
||||
* Provide sprintf-style format (only %s is supported) and arguments
|
||||
* to provide information about what broke and what you were
|
||||
* expecting.
|
||||
*
|
||||
* The invariant message will be stripped in production, but the invariant
|
||||
* will remain to ensure logic does not differ in production.
|
||||
*/
|
||||
|
||||
var invariant = function(condition, format, a, b, c, d, e, f) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (format === undefined) {
|
||||
throw new Error('invariant requires an error message argument');
|
||||
}
|
||||
}
|
||||
|
||||
if (!condition) {
|
||||
var error;
|
||||
if (format === undefined) {
|
||||
error = new Error(
|
||||
'Minified exception occurred; use the non-minified dev environment ' +
|
||||
'for the full error message and additional helpful warnings.'
|
||||
);
|
||||
} else {
|
||||
var args = [a, b, c, d, e, f];
|
||||
var argIndex = 0;
|
||||
error = new Error(
|
||||
format.replace(/%s/g, function() { return args[argIndex++]; })
|
||||
);
|
||||
error.name = 'Invariant Violation';
|
||||
}
|
||||
|
||||
error.framesToPop = 1; // we don't care about invariant's own frame
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = invariant;
|
53
node_modules/react-router/node_modules/invariant/invariant.js
generated
vendored
Normal file
53
node_modules/react-router/node_modules/invariant/invariant.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Use invariant() to assert state which your program assumes to be true.
|
||||
*
|
||||
* Provide sprintf-style format (only %s is supported) and arguments
|
||||
* to provide information about what broke and what you were
|
||||
* expecting.
|
||||
*
|
||||
* The invariant message will be stripped in production, but the invariant
|
||||
* will remain to ensure logic does not differ in production.
|
||||
*/
|
||||
|
||||
var __DEV__ = process.env.NODE_ENV !== 'production';
|
||||
|
||||
var invariant = function(condition, format, a, b, c, d, e, f) {
|
||||
if (__DEV__) {
|
||||
if (format === undefined) {
|
||||
throw new Error('invariant requires an error message argument');
|
||||
}
|
||||
}
|
||||
|
||||
if (!condition) {
|
||||
var error;
|
||||
if (format === undefined) {
|
||||
error = new Error(
|
||||
'Minified exception occurred; use the non-minified dev environment ' +
|
||||
'for the full error message and additional helpful warnings.'
|
||||
);
|
||||
} else {
|
||||
var args = [a, b, c, d, e, f];
|
||||
var argIndex = 0;
|
||||
error = new Error(
|
||||
format.replace(/%s/g, function() { return args[argIndex++]; })
|
||||
);
|
||||
error.name = 'Invariant Violation';
|
||||
}
|
||||
|
||||
error.framesToPop = 1; // we don't care about invariant's own frame
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = invariant;
|
3
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/.npmignore
generated
vendored
Normal file
3
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/.npmignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
bench/
|
||||
test/
|
||||
.travis.yml
|
45
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/README.md
generated
vendored
Normal file
45
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/README.md
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
# loose-envify
|
||||
|
||||
[![Build Status](https://travis-ci.org/zertosh/loose-envify.svg?branch=master)](https://travis-ci.org/zertosh/loose-envify)
|
||||
|
||||
Fast (and loose) selective `process.env` replacer using [js-tokens](https://github.com/lydell/js-tokens) instead of an AST. Works just like [envify](https://github.com/hughsk/envify) but much faster.
|
||||
|
||||
## Gotchas
|
||||
|
||||
* Doesn't handle broken syntax.
|
||||
* Doesn't look inside embedded expressions in template strings.
|
||||
- **this won't work:**
|
||||
```js
|
||||
console.log(`the current env is ${process.env.NODE_ENV}`);
|
||||
```
|
||||
* Doesn't replace oddly-spaced or oddly-commented expressions.
|
||||
- **this won't work:**
|
||||
```js
|
||||
console.log(process./*won't*/env./*work*/NODE_ENV);
|
||||
```
|
||||
|
||||
## Usage/Options
|
||||
|
||||
loose-envify has the exact same interface as [envify](https://github.com/hughsk/envify).
|
||||
|
||||
## Benchmark
|
||||
|
||||
```
|
||||
envify:
|
||||
|
||||
$ for i in {1..5}; do node bench/bench.js 'envify'; done
|
||||
708ms
|
||||
727ms
|
||||
791ms
|
||||
719ms
|
||||
720ms
|
||||
|
||||
loose-envify:
|
||||
|
||||
$ for i in {1..5}; do node bench/bench.js '../'; done
|
||||
51ms
|
||||
52ms
|
||||
52ms
|
||||
52ms
|
||||
52ms
|
||||
```
|
2
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/custom.js
generated
vendored
Normal file
2
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/custom.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
// envify compatibility
|
||||
module.exports = require('./loose-envify');
|
1
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/index.js
generated
vendored
Normal file
1
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require('./loose-envify')(process.env);
|
36
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/loose-envify.js
generated
vendored
Normal file
36
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/loose-envify.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
var stream = require('stream');
|
||||
var util = require('util');
|
||||
var replace = require('./replace');
|
||||
|
||||
var jsonExtRe = /\.json$/;
|
||||
|
||||
module.exports = function(rootEnv) {
|
||||
rootEnv = rootEnv || process.env;
|
||||
return function (file, trOpts) {
|
||||
if (jsonExtRe.test(file)) {
|
||||
return stream.PassThrough();
|
||||
}
|
||||
var envs = trOpts ? [rootEnv, trOpts] : [rootEnv];
|
||||
return new LooseEnvify(envs);
|
||||
};
|
||||
};
|
||||
|
||||
function LooseEnvify(envs) {
|
||||
stream.Transform.call(this);
|
||||
this._data = '';
|
||||
this._envs = envs;
|
||||
}
|
||||
util.inherits(LooseEnvify, stream.Transform);
|
||||
|
||||
LooseEnvify.prototype._transform = function(buf, enc, cb) {
|
||||
this._data += buf;
|
||||
cb();
|
||||
};
|
||||
|
||||
LooseEnvify.prototype._flush = function(cb) {
|
||||
var replaced = replace(this._data, this._envs);
|
||||
this.push(replaced);
|
||||
cb();
|
||||
};
|
21
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/node_modules/js-tokens/LICENSE
generated
vendored
Normal file
21
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/node_modules/js-tokens/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014, 2015 Simon Lydell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
65
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/node_modules/js-tokens/changelog.md
generated
vendored
Normal file
65
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/node_modules/js-tokens/changelog.md
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
### Version 1.0.2 (2015-10-18) ###
|
||||
|
||||
- Improved: Limited npm package contents for a smaller download. Thanks to
|
||||
@zertosh!
|
||||
|
||||
|
||||
### Version 1.0.1 (2015-06-20) ###
|
||||
|
||||
- Fixed: Declared an undeclared variable.
|
||||
|
||||
|
||||
### Version 1.0.0 (2015-02-26) ###
|
||||
|
||||
- Changed: Merged the 'operator' and 'punctuation' types into 'punctuator'. That
|
||||
type is now equivalent to the Punctuator token in the ECMAScript
|
||||
specification. (Backwards-incompatible change.)
|
||||
- Fixed: A `-` followed by a number is now correctly matched as a punctuator
|
||||
followed by a number. It used to be matched as just a number, but there is no
|
||||
such thing as negative number literals. (Possibly backwards-incompatible
|
||||
change.)
|
||||
|
||||
|
||||
### Version 0.4.1 (2015-02-21) ###
|
||||
|
||||
- Added: Support for the regex `u` flag.
|
||||
|
||||
|
||||
### Version 0.4.0 (2015-02-21) ###
|
||||
|
||||
- Improved: `jsTokens.matchToToken` performance.
|
||||
- Added: Support for octal and binary number literals.
|
||||
- Added: Support for template strings.
|
||||
|
||||
|
||||
### Version 0.3.1 (2015-01-06) ###
|
||||
|
||||
- Fixed: Support for unicode spaces. They used to be allowed in names (which is
|
||||
very confusing), and some unicode newlines were wrongly allowed in strings and
|
||||
regexes.
|
||||
|
||||
|
||||
### Version 0.3.0 (2014-12-19) ###
|
||||
|
||||
- Changed: The `jsTokens.names` array has been replaced with the
|
||||
`jsTokens.matchToToken` function. The capturing groups of `jsTokens` are no
|
||||
longer part of the public API; instead use said function. See this [gist] for
|
||||
an example. (Backwards-incompatible change.)
|
||||
- Changed: The empty string is now considered an “invalid” token, instead an
|
||||
“empty” token (its own group). (Backwards-incompatible change.)
|
||||
- Removed: component support. (Backwards-incompatible change.)
|
||||
|
||||
[gist]: https://gist.github.com/lydell/be49dbf80c382c473004
|
||||
|
||||
|
||||
### Version 0.2.0 (2014-06-19) ###
|
||||
|
||||
- Changed: Match ES6 function arrows (`=>`) as an operator, instead of its own
|
||||
category (“functionArrow”), for simplicity. (Backwards-incompatible change.)
|
||||
- Added: ES6 splats (`...`) are now matched as an operator (instead of three
|
||||
punctuations). (Backwards-incompatible change.)
|
||||
|
||||
|
||||
### Version 0.1.0 (2014-03-08) ###
|
||||
|
||||
- Initial release.
|
19
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/node_modules/js-tokens/index.js
generated
vendored
Normal file
19
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/node_modules/js-tokens/index.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2014, 2015 Simon Lydell
|
||||
// X11 (“MIT”) Licensed. (See LICENSE.)
|
||||
|
||||
// This regex comes from regex.coffee, and is inserted here by generate-index.js
|
||||
// (run `npm run build`).
|
||||
module.exports = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|((?:0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?))|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]{1,6}\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-*\/%&|^]|<{1,2}|>{1,3}|!=?|={1,2})=?|[?:~]|[;,.[\](){}])|(\s+)|(^$|[\s\S])/g
|
||||
|
||||
module.exports.matchToToken = function(match) {
|
||||
var token = {type: "invalid", value: match[0]}
|
||||
if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4])
|
||||
else if (match[ 5]) token.type = "comment"
|
||||
else if (match[ 6]) token.type = "comment", token.closed = !!match[7]
|
||||
else if (match[ 8]) token.type = "regex"
|
||||
else if (match[ 9]) token.type = "number"
|
||||
else if (match[10]) token.type = "name"
|
||||
else if (match[11]) token.type = "punctuator"
|
||||
else if (match[12]) token.type = "whitespace"
|
||||
return token
|
||||
}
|
61
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/node_modules/js-tokens/package.json
generated
vendored
Normal file
61
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/node_modules/js-tokens/package.json
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "js-tokens",
|
||||
"version": "1.0.2",
|
||||
"author": {
|
||||
"name": "Simon Lydell"
|
||||
},
|
||||
"license": "MIT",
|
||||
"description": "A regex that tokenizes JavaScript.",
|
||||
"keywords": [
|
||||
"JavaScript",
|
||||
"js",
|
||||
"token",
|
||||
"tokenize",
|
||||
"regex"
|
||||
],
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lydell/js-tokens.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --ui tdd",
|
||||
"esprima-compare": "node esprima-compare ./index.js everything.js/es5.js",
|
||||
"build": "node generate-index.js",
|
||||
"dev": "npm run build && npm test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coffee-script": "~1.9.3",
|
||||
"esprima": "^2.3.0",
|
||||
"everything.js": "^1.0.3",
|
||||
"mocha": "^2.2.5"
|
||||
},
|
||||
"gitHead": "90f0f0a217984625180414763234c923aeee4af5",
|
||||
"bugs": {
|
||||
"url": "https://github.com/lydell/js-tokens/issues"
|
||||
},
|
||||
"homepage": "https://github.com/lydell/js-tokens#readme",
|
||||
"_id": "js-tokens@1.0.2",
|
||||
"_shasum": "8647f7e13f64ac15d9357a59a346c804d53b3efe",
|
||||
"_from": "js-tokens@^1.0.1",
|
||||
"_npmVersion": "2.14.7",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_npmUser": {
|
||||
"name": "lydell",
|
||||
"email": "simon.lydell@gmail.com"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "8647f7e13f64ac15d9357a59a346c804d53b3efe",
|
||||
"tarball": "http://registry.npmjs.org/js-tokens/-/js-tokens-1.0.2.tgz"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "lydell",
|
||||
"email": "simon.lydell@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-1.0.2.tgz"
|
||||
}
|
204
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/node_modules/js-tokens/readme.md
generated
vendored
Normal file
204
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/node_modules/js-tokens/readme.md
generated
vendored
Normal file
@ -0,0 +1,204 @@
|
||||
Overview [![Build Status](https://travis-ci.org/lydell/js-tokens.png?branch=master)](https://travis-ci.org/lydell/js-tokens)
|
||||
========
|
||||
|
||||
A regex that tokenizes JavaScript.
|
||||
|
||||
```js
|
||||
var jsTokens = require("js-tokens")
|
||||
|
||||
var jsString = "var foo=opts.foo;\n..."
|
||||
|
||||
jsString.match(jsTokens)
|
||||
// ["var", " ", "foo", "=", "opts", ".", "foo", ";", "\n", ...]
|
||||
```
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
- `npm install js-tokens`
|
||||
|
||||
```js
|
||||
var jsTokens = require("js-tokens")
|
||||
```
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
### `jsTokens` ###
|
||||
|
||||
A regex with the `g` flag that matches JavaScript tokens.
|
||||
|
||||
The regex _always_ matches, even invalid JavaScript and the empty string.
|
||||
|
||||
The next match is always directly after the previous.
|
||||
|
||||
### `var token = jsTokens.matchToToken(match)` ###
|
||||
|
||||
Takes a `match` returned by `jsTokens.exec(string)`, and returns a `{type:
|
||||
String, value: String}` object. The following types are available:
|
||||
|
||||
- string
|
||||
- comment
|
||||
- regex
|
||||
- number
|
||||
- name
|
||||
- punctuator
|
||||
- whitespace
|
||||
- invalid
|
||||
|
||||
Multi-line comments and strings also have a `closed` property indicating if the
|
||||
token was closed or not (see below).
|
||||
|
||||
Comments and strings both come in several flavors. To distinguish them, check if
|
||||
the token starts with `//`, `/*`, `'`, `"` or `` ` ``.
|
||||
|
||||
Names are ECMAScript IdentifierNames, that is, including both identifiers and
|
||||
keywords. You may use [is-keyword-js] to tell them apart.
|
||||
|
||||
Whitespace includes both line terminators and other whitespace.
|
||||
|
||||
For example usage, please see this [gist].
|
||||
|
||||
[is-keyword-js]: https://github.com/crissdev/is-keyword-js
|
||||
[gist]: https://gist.github.com/lydell/be49dbf80c382c473004
|
||||
|
||||
|
||||
Invalid code handling
|
||||
=====================
|
||||
|
||||
Unterminated strings are still matched as strings. JavaScript strings cannot
|
||||
contain (unescaped) newlines, so unterminated strings simply end at the end of
|
||||
the line. Unterminated template strings can contain unescaped newlines, though,
|
||||
so they go on to the end of input.
|
||||
|
||||
Unterminated multi-line comments are also still matched as comments. They
|
||||
simply go on to the end of the input.
|
||||
|
||||
Unterminated regex literals are likely matched as division and whatever is
|
||||
inside the regex.
|
||||
|
||||
Invalid ASCII characters have their own capturing group.
|
||||
|
||||
Invalid non-ASCII characters are treated as names, to simplify the matching of
|
||||
names (except unicode spaces which are treated as whitespace).
|
||||
|
||||
Regex literals may contain invalid regex syntax. They are still matched as
|
||||
regex literals. They may also contain repeated regex flags, to keep the regex
|
||||
simple.
|
||||
|
||||
Strings may contain invalid escape sequences.
|
||||
|
||||
|
||||
Limitations
|
||||
===========
|
||||
|
||||
Tokenizing JavaScript using regexes—in fact, _one single regex_—won’t be
|
||||
perfect. But that’s not the point either.
|
||||
|
||||
You may compare jsTokens with [esprima] by using `esprima-compare.js`.
|
||||
See `npm run esprima-compare`!
|
||||
|
||||
[esprima]: http://esprima.org/
|
||||
|
||||
### Template string interpolation ###
|
||||
|
||||
Template strings are matched as single tokens, from the starting `` ` `` to the
|
||||
ending `` ` ``, including interpolations (whose tokens are not matched
|
||||
individually).
|
||||
|
||||
Matching template string interpolations requires recursive balancing of `{` and
|
||||
`}`—something that JavaScript regexes cannot do. Only one level of nesting is
|
||||
supported.
|
||||
|
||||
### Division and regex literals collision ###
|
||||
|
||||
Consider this example:
|
||||
|
||||
```js
|
||||
var g = 9.82
|
||||
var number = bar / 2/g
|
||||
|
||||
var regex = / 2/g
|
||||
```
|
||||
|
||||
A human can easily understand that in the `number` line we’re dealing with
|
||||
division, and in the `regex` line we’re dealing with a regex literal. How come?
|
||||
Because humans can look at the whole code to put the `/` characters in context.
|
||||
A JavaScript regex cannot. It only sees forwards.
|
||||
|
||||
When the `jsTokens` regex scans throught the above, it will see the following
|
||||
at the end of both the `number` and `regex` rows:
|
||||
|
||||
```js
|
||||
/ 2/g
|
||||
```
|
||||
|
||||
It is then impossible to know if that is a regex literal, or part of an
|
||||
expression dealing with division.
|
||||
|
||||
Here is a similar case:
|
||||
|
||||
```js
|
||||
foo /= 2/g
|
||||
foo(/= 2/g)
|
||||
```
|
||||
|
||||
The first line divides the `foo` variable with `2/g`. The second line calls the
|
||||
`foo` function with the regex literal `/= 2/g`. Again, since `jsTokens` only
|
||||
sees forwards, it cannot tell the two cases apart.
|
||||
|
||||
There are some cases where we _can_ tell division and regex literals apart,
|
||||
though.
|
||||
|
||||
First off, we have the simple cases where there’s only one slash in the line:
|
||||
|
||||
```js
|
||||
var foo = 2/g
|
||||
foo /= 2
|
||||
```
|
||||
|
||||
Regex literals cannot contain newlines, so the above cases are correctly
|
||||
identified as division. Things are only problematic when there are more than
|
||||
one non-comment slash in a single line.
|
||||
|
||||
Secondly, not every character is a valid regex flag.
|
||||
|
||||
```js
|
||||
var number = bar / 2/e
|
||||
```
|
||||
|
||||
The above example is also correctly identified as division, because `e` is not a
|
||||
valid regex flag. I initially wanted to future-proof by allowing `[a-zA-Z]*`
|
||||
(any letter) as flags, but it is not worth it since it increases the amount of
|
||||
ambigous cases. So only the standard `g`, `m`, `i`, `y` and `u` flags are
|
||||
allowed. This means that the above example will be identified as division as
|
||||
long as you don’t rename the `e` variable to some permutation of `gmiyu` 1 to 5
|
||||
characters long.
|
||||
|
||||
Lastly, we can look _forward_ for information.
|
||||
|
||||
- If the token following what looks like a regex literal is not valid after a
|
||||
regex literal, but is valid in a division expression, then the regex literal
|
||||
is treated as division instead. For example, a flagless regex cannot be
|
||||
followed by a string, number or name, but all of those three can be the
|
||||
denominator of a division.
|
||||
- Generally, if what looks like a regex literal is followed by an operator, the
|
||||
regex literal is treated as division instead. This is because regexes are
|
||||
seldomly used with operators (such as `+`, `*`, `&&` and `==`), but division
|
||||
could likely be part of such an expression.
|
||||
|
||||
Please consult the regex source and the test cases for precise information on
|
||||
when regex or division is matched (should you need to know). In short, you
|
||||
could sum it up as:
|
||||
|
||||
If the end of a statement looks like a regex literal (even if it isn’t), it
|
||||
will be treated as one. Otherwise it should work as expected (if you write sane
|
||||
code).
|
||||
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
[The X11 (“MIT”) License](LICENSE).
|
60
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/package.json
generated
vendored
Normal file
60
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/package.json
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "loose-envify",
|
||||
"version": "1.1.0",
|
||||
"description": "Fast (and loose) selective `process.env` replacer using js-tokens instead of an AST",
|
||||
"keywords": [
|
||||
"environment",
|
||||
"variables",
|
||||
"browserify",
|
||||
"browserify-transform",
|
||||
"transform",
|
||||
"source",
|
||||
"configuration"
|
||||
],
|
||||
"homepage": "https://github.com/zertosh/loose-envify",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Andres Suarez",
|
||||
"email": "zertosh@gmail.com"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/zertosh/loose-envify.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"js-tokens": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^11.0.1",
|
||||
"envify": "^3.4.0",
|
||||
"tap": "^1.4.0"
|
||||
},
|
||||
"gitHead": "f536f4fdbde317d77827ac8655c6c8473928b9e1",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zertosh/loose-envify/issues"
|
||||
},
|
||||
"_id": "loose-envify@1.1.0",
|
||||
"_shasum": "527582d62cff4e04da3f9976c7110d3392ec7e0c",
|
||||
"_from": "loose-envify@^1.0.0",
|
||||
"_npmVersion": "2.14.4",
|
||||
"_nodeVersion": "4.1.2",
|
||||
"_npmUser": {
|
||||
"name": "zertosh",
|
||||
"email": "zertosh@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "zertosh",
|
||||
"email": "zertosh@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "527582d62cff4e04da3f9976c7110d3392ec7e0c",
|
||||
"tarball": "http://registry.npmjs.org/loose-envify/-/loose-envify-1.1.0.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.1.0.tgz"
|
||||
}
|
65
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/replace.js
generated
vendored
Normal file
65
node_modules/react-router/node_modules/invariant/node_modules/loose-envify/replace.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
'use strict';
|
||||
|
||||
var jsTokens = require('js-tokens');
|
||||
|
||||
var processEnvRe = /\bprocess\.env\.[_$a-zA-Z][$\w]+\b/;
|
||||
var spaceOrCommentRe = /^(?:\s|\/[/*])/;
|
||||
|
||||
function replace(src, envs) {
|
||||
if (!processEnvRe.test(src)) {
|
||||
return src;
|
||||
}
|
||||
|
||||
var out = '';
|
||||
var purge = envs.some(function(env) {
|
||||
return env._ && env._.indexOf('purge') !== -1;
|
||||
});
|
||||
|
||||
jsTokens.lastIndex = 0
|
||||
var parts = src.match(jsTokens);
|
||||
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
if (parts[i ] === 'process' &&
|
||||
parts[i + 1] === '.' &&
|
||||
parts[i + 2] === 'env' &&
|
||||
parts[i + 3] === '.') {
|
||||
var prevCodeToken = getAdjacentCodeToken(-1, parts, i);
|
||||
var nextCodeToken = getAdjacentCodeToken(1, parts, i + 4);
|
||||
var replacement = getReplacementString(envs, parts[i + 4], purge);
|
||||
if (prevCodeToken !== '.' &&
|
||||
nextCodeToken !== '.' &&
|
||||
nextCodeToken !== '=' &&
|
||||
typeof replacement === 'string') {
|
||||
out += replacement;
|
||||
i += 4;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
out += parts[i];
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
function getAdjacentCodeToken(dir, parts, i) {
|
||||
while (true) {
|
||||
var part = parts[i += dir];
|
||||
if (!spaceOrCommentRe.test(part)) {
|
||||
return part;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getReplacementString(envs, name, purge) {
|
||||
for (var j = 0; j < envs.length; j++) {
|
||||
var env = envs[j];
|
||||
if (typeof env[name] !== 'undefined') {
|
||||
return JSON.stringify(env[name]);
|
||||
}
|
||||
}
|
||||
if (purge) {
|
||||
return 'undefined';
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = replace;
|
64
node_modules/react-router/node_modules/invariant/package.json
generated
vendored
Normal file
64
node_modules/react-router/node_modules/invariant/package.json
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "invariant",
|
||||
"version": "2.2.0",
|
||||
"description": "invariant",
|
||||
"keywords": [
|
||||
"test"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"author": {
|
||||
"name": "Andres Suarez",
|
||||
"email": "zertosh@gmail.com"
|
||||
},
|
||||
"files": [
|
||||
"invariant.js",
|
||||
"browser.js"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zertosh/invariant.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "NODE_ENV=production tap test/*.js && NODE_ENV=development tap test/*.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^11.0.1",
|
||||
"tap": "^1.4.0"
|
||||
},
|
||||
"main": "invariant.js",
|
||||
"browser": "browser.js",
|
||||
"browserify": {
|
||||
"transform": [
|
||||
"loose-envify"
|
||||
]
|
||||
},
|
||||
"gitHead": "1660eab9f183183e71ef57a7765bb1121680fff9",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zertosh/invariant/issues"
|
||||
},
|
||||
"homepage": "https://github.com/zertosh/invariant#readme",
|
||||
"_id": "invariant@2.2.0",
|
||||
"_shasum": "c8d7e847366a49cc18b622f058a689d481e895f2",
|
||||
"_from": "invariant@^2.0.0",
|
||||
"_npmVersion": "2.14.7",
|
||||
"_nodeVersion": "4.2.2",
|
||||
"_npmUser": {
|
||||
"name": "zertosh",
|
||||
"email": "zertosh@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "zertosh",
|
||||
"email": "zertosh@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "c8d7e847366a49cc18b622f058a689d481e895f2",
|
||||
"tarball": "http://registry.npmjs.org/invariant/-/invariant-2.2.0.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.0.tgz"
|
||||
}
|
0
node_modules/react-router/node_modules/object-assign/index.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/object-assign/index.js
generated
vendored
Executable file → Normal file
21
node_modules/react-router/node_modules/object-assign/license
generated
vendored
Normal file
21
node_modules/react-router/node_modules/object-assign/license
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
25
node_modules/react-router/node_modules/object-assign/package.json
generated
vendored
Executable file → Normal file
25
node_modules/react-router/node_modules/object-assign/package.json
generated
vendored
Executable file → Normal file
@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "object-assign",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.1",
|
||||
"description": "ES6 Object.assign() ponyfill",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/object-assign.git"
|
||||
"url": "https://github.com/sindresorhus/object-assign"
|
||||
},
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
@ -43,26 +43,25 @@
|
||||
"url": "https://github.com/sindresorhus/object-assign/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/object-assign",
|
||||
"_id": "object-assign@2.0.0",
|
||||
"_shasum": "f8309b09083b01261ece3ef7373f2b57b8dd7042",
|
||||
"_from": "object-assign@>=2.0.0 <3.0.0",
|
||||
"_npmVersion": "2.1.5",
|
||||
"_nodeVersion": "0.10.32",
|
||||
"_id": "object-assign@2.1.1",
|
||||
"_shasum": "43c36e5d569ff8e4816c4efa8be02d26967c18aa",
|
||||
"_from": "object-assign@^2.0.0",
|
||||
"_npmVersion": "2.10.1",
|
||||
"_nodeVersion": "0.12.4",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "43c36e5d569ff8e4816c4efa8be02d26967c18aa",
|
||||
"tarball": "http://registry.npmjs.org/object-assign/-/object-assign-2.1.1.tgz"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "f8309b09083b01261ece3ef7373f2b57b8dd7042",
|
||||
"tarball": "http://registry.npmjs.org/object-assign/-/object-assign-2.0.0.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/object-assign/-/object-assign-2.0.0.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
"_resolved": "https://registry.npmjs.org/object-assign/-/object-assign-2.1.1.tgz"
|
||||
}
|
||||
|
0
node_modules/react-router/node_modules/object-assign/readme.md
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/object-assign/readme.md
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/.jshintignore
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/.jshintignore
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/.jshintrc
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/.jshintrc
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/.npmignore
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/.npmignore
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/.travis.yml
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/.travis.yml
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/CHANGELOG.md
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/CHANGELOG.md
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/CONTRIBUTING.md
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/CONTRIBUTING.md
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/Makefile
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/Makefile
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/index.js
generated
vendored
Executable file → Normal file
0
node_modules/react-router/node_modules/qs/index.js
generated
vendored
Executable file → Normal file
5
node_modules/react-router/node_modules/qs/package.json
generated
vendored
Executable file → Normal file
5
node_modules/react-router/node_modules/qs/package.json
generated
vendored
Executable file → Normal file
@ -14,7 +14,7 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/hapijs/qs.git"
|
||||
"url": "https://github.com/hapijs/qs.git"
|
||||
},
|
||||
"keywords": [
|
||||
"querystring",
|
||||
@ -54,6 +54,5 @@
|
||||
"tarball": "http://registry.npmjs.org/qs/-/qs-2.4.1.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/qs/-/qs-2.4.1.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
"_resolved": "https://registry.npmjs.org/qs/-/qs-2.4.1.tgz"
|
||||
}
|
||||
|
24
node_modules/react-router/package.json
generated
vendored
Executable file → Normal file
24
node_modules/react-router/package.json
generated
vendored
Executable file → Normal file
@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "react-router",
|
||||
"version": "0.13.3",
|
||||
"version": "0.13.5",
|
||||
"description": "A complete routing library for React.js",
|
||||
"main": "lib",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rackt/react-router.git"
|
||||
"url": "git+https://github.com/rackt/react-router.git"
|
||||
},
|
||||
"homepage": "https://github.com/rackt/react-router/blob/latest/README.md",
|
||||
"bugs": {
|
||||
@ -17,9 +17,11 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"react": "0.13.x"
|
||||
"react": "0.13.x||0.14.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"can-use-dom": "0.1.0",
|
||||
"invariant": "^2.0.0",
|
||||
"object-assign": "^2.0.0",
|
||||
"qs": "2.4.1"
|
||||
},
|
||||
@ -35,13 +37,13 @@
|
||||
"routes",
|
||||
"router"
|
||||
],
|
||||
"_id": "react-router@0.13.3",
|
||||
"_id": "react-router@0.13.5",
|
||||
"scripts": {},
|
||||
"_shasum": "95455dd19d2c04c7b2957ff7fccda76031ac29b1",
|
||||
"_from": "react-router@>=0.13.2 <0.14.0",
|
||||
"_resolved": "https://registry.npmjs.org/react-router/-/react-router-0.13.3.tgz",
|
||||
"_npmVersion": "2.5.1",
|
||||
"_nodeVersion": "0.12.0",
|
||||
"_shasum": "02e3e2821c1a38d0573733ab1abfb1c388516733",
|
||||
"_from": "react-router@0.13.5",
|
||||
"_resolved": "https://registry.npmjs.org/react-router/-/react-router-0.13.5.tgz",
|
||||
"_npmVersion": "3.3.10",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_npmUser": {
|
||||
"name": "ryanflorence",
|
||||
"email": "rpflorence@gmail.com"
|
||||
@ -57,8 +59,8 @@
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "95455dd19d2c04c7b2957ff7fccda76031ac29b1",
|
||||
"tarball": "http://registry.npmjs.org/react-router/-/react-router-0.13.3.tgz"
|
||||
"shasum": "02e3e2821c1a38d0573733ab1abfb1c388516733",
|
||||
"tarball": "http://registry.npmjs.org/react-router/-/react-router-0.13.5.tgz"
|
||||
},
|
||||
"directories": {}
|
||||
}
|
||||
|
4508
node_modules/react-router/umd/ReactRouter.js
generated
vendored
Executable file → Normal file
4508
node_modules/react-router/umd/ReactRouter.js
generated
vendored
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
5
node_modules/react-router/umd/ReactRouter.min.js
generated
vendored
Executable file → Normal file
5
node_modules/react-router/umd/ReactRouter.min.js
generated
vendored
Executable file → Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user