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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/History.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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 = {

Expand Down
2 changes: 1 addition & 1 deletion modules/PathUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var invariant = require('react/lib/invariant');
var invariant = require('invariant');
var assign = require('object-assign');
var qs = require('qs');

Expand Down
4 changes: 2 additions & 2 deletions modules/Route.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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;
Expand Down
4 changes: 2 additions & 2 deletions modules/ScrollHistory.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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) {
Expand Down
2 changes: 1 addition & 1 deletion modules/components/Route.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var React = require('react');
var invariant = require('react/lib/invariant');
var invariant = require('invariant');
var PropTypes = require('../PropTypes');
var RouteHandler = require('./RouteHandler');

Expand Down
6 changes: 3 additions & 3 deletions modules/createRouter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* jshint -W058 */
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');
Expand Down
2 changes: 1 addition & 1 deletion modules/createRoutesFromReactChildren.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* jshint -W084 */
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');
Expand Down
4 changes: 2 additions & 2 deletions modules/getWindowScrollPosition.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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 }.
Expand Down
2 changes: 1 addition & 1 deletion modules/locations/StaticLocation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var invariant = require('react/lib/invariant');
var invariant = require('invariant');

function throwCannotModify() {
invariant(false, 'You cannot modify a static location');
Expand Down
2 changes: 1 addition & 1 deletion modules/locations/TestLocation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var invariant = require('react/lib/invariant');
var invariant = require('invariant');
var LocationActions = require('../actions/LocationActions');
var History = require('../History');

Expand Down
59 changes: 59 additions & 0 deletions modules/warning.js
Original file line number Diff line number Diff line change
@@ -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 () {};

if (__DEV__) {
warning = function(condition, format, ...args) {
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, () => 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;
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,18 @@
"marked": "0.3.3",
"mocha": "^2.0.1",
"pygmentize-bundled": "^2.3.0",
"react": "0.13.x",
"react": "0.14.x",
"rf-changelog": "^0.4.0",
"rx": "2.3.18",
"webpack": "^1.4.13",
"webpack-dev-server": "^1.6.6"
},
"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"
},
Expand Down