Skip to content

Commit

Permalink
refactor: remove debug dependency from all packages (#717)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablopalacios authored Jun 21, 2021
1 parent fbcf06a commit 1410656
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 24 deletions.
3 changes: 0 additions & 3 deletions packages/dispatchr/lib/Action.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
'use strict';
var debug = require('debug')('Dispatchr:Action');

function Action(name, payload) {
this.name = name;
Expand Down Expand Up @@ -63,7 +62,6 @@ Action.prototype._callHandler = function callHandler(storeName) {
return;
}
self._isCompleted[storeName] = false;
debug('executing handler for ' + storeName);
handlerFn(self.payload, self.name);
self._isCompleted[storeName] = true;
};
Expand All @@ -85,7 +83,6 @@ Action.prototype.waitFor = function waitFor(stores, callback) {
stores = [stores];
}

debug('waiting on ' + stores.join(', '));
stores.forEach(function storesEach(storeName) {
storeName = self.getStoreName(storeName);
if (self._handlers[storeName]) {
Expand Down
5 changes: 1 addition & 4 deletions packages/dispatchr/lib/DispatcherContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

var Action = require('./Action');
var DEFAULT = 'default';
var debug = require('debug')('Dispatchr:DispatcherContext');

/**
* @class Dispatcher
Expand Down Expand Up @@ -79,10 +78,9 @@ DispatcherContext.prototype.dispatch = function dispatch(actionName, payload) {
var actionHandlers = this.dispatcher.handlers[actionName] || [],
defaultHandlers = this.dispatcher.handlers[DEFAULT] || [];
if (!actionHandlers.length && !defaultHandlers.length) {
debug(actionName + ' does not have any registered handlers');
return;
}
debug('dispatching ' + actionName, payload);

this.currentAction = new Action(actionName, payload);
var self = this,
allHandlers = actionHandlers.concat(defaultHandlers),
Expand Down Expand Up @@ -116,7 +114,6 @@ DispatcherContext.prototype.dispatch = function dispatch(actionName, payload) {
};
return this.dispatcher._throwOrCallErrorHandler(message, 'DISPATCH_EXCEPTION', this.context, meta);
} finally {
debug('finished ' + actionName);
this.currentAction = null;
}
};
Expand Down
1 change: 0 additions & 1 deletion packages/dispatchr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
}
],
"dependencies": {
"debug": "^2.0.0",
"eventemitter3": "^2.0.0",
"inherits": "^2.0.1"
},
Expand Down
1 change: 0 additions & 1 deletion packages/fluxible-plugin-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"prepublish": "npm run dist"
},
"dependencies": {
"debug": "^2.0.0",
"prop-types": "^15.5.8"
},
"peerDependencies": {
Expand Down
3 changes: 0 additions & 3 deletions packages/fluxible-plugin-devtools/src/lib/devtools-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
'use strict';
import debugLib from 'debug';
import { ACTION, DISPATCH } from './CONSTANTS';
const debug = debugLib('Fluxible:DevToolsPlugin');

/**
* Creates a new devtools plugin instance
Expand Down Expand Up @@ -60,7 +58,6 @@ export default function devToolsPlugin() {
* @return {void}
*/
function overrideCtx() {
debug('devtools plugin %s', enableDebug ? 'enabled' : 'disabled')
if (!enableDebug) {
return;
}
Expand Down
1 change: 0 additions & 1 deletion packages/fluxible-plugin-fetchr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"lint": "../../node_modules/.bin/eslint lib/ tests/ utils/ index.js"
},
"dependencies": {
"debug": "^2.0.0",
"fetchr": "^0.5.18"
},
"author": "Michael Ridgway <[email protected]>",
Expand Down
6 changes: 0 additions & 6 deletions packages/fluxible/lib/Fluxible.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
/*globals Promise */
'use strict';

var debug = require('debug')('Fluxible');
var isPromise = require('is-promise');
var FluxibleContext = require('./FluxibleContext');
var dispatchr = require('dispatchr');
Expand All @@ -18,7 +17,6 @@ var __DEV__ = process.env.NODE_ENV !== 'production';
*/
function defaultComponentActionHandler(context, payload, done) {
if (payload.err) {
debug('Action returned error', payload.actionName, payload.err);
throw payload.err;
}
done();
Expand All @@ -39,7 +37,6 @@ function defaultComponentActionHandler(context, payload, done) {
* });
*/
function Fluxible(options) {
debug('Fluxible instance instantiated', options);
options = options || {};

// Options
Expand Down Expand Up @@ -138,7 +135,6 @@ Fluxible.prototype.getComponent = function getComponent() {
* @method registerStore
*/
Fluxible.prototype.registerStore = function registerStore() {
debug(arguments[0].storeName + ' store registered');
this._dispatcher.registerStore.apply(this._dispatcher, arguments);
};

Expand All @@ -149,7 +145,6 @@ Fluxible.prototype.registerStore = function registerStore() {
* @returns {Object} Dehydrated state object
*/
Fluxible.prototype.dehydrate = function dehydrate(context) {
debug('dehydrate', context);
var self = this;
var state = {
context: context.dehydrate(),
Expand Down Expand Up @@ -177,7 +172,6 @@ Fluxible.prototype.dehydrate = function dehydrate(context) {
* @async Rehydration may require more asset loading or async IO calls
*/
Fluxible.prototype.rehydrate = function rehydrate(obj, callback) {
debug('rehydrate', obj);
var self = this;
if (__DEV__) {
if (typeof obj !== 'object') {
Expand Down
4 changes: 0 additions & 4 deletions packages/fluxible/lib/FluxibleContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/
'use strict';

var debug = require('debug')('Fluxible:Context');
var isPromise = require('is-promise');
var generateUUID = require('../utils/generateUUID');
var callAction = require('../utils/callAction');
Expand Down Expand Up @@ -144,9 +143,6 @@ function executeActionProxy(context, actionContext, action, payload, done) {
done = pluggedExecuteAction.done;
});

if (debug.enabled) {
debug('Executing action ' + actionContext.stack.join('.') + ' with payload', payload);
}
return callAction(actionContext, action, payload, done);
}

Expand Down
1 change: 0 additions & 1 deletion packages/fluxible/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"lint": "../../node_modules/.bin/eslint lib/ addons/"
},
"dependencies": {
"debug": "^2.0.0",
"dispatchr": "^1.0.0",
"is-promise": "^2.0.0",
"setimmediate": "^1.0.2"
Expand Down

0 comments on commit 1410656

Please sign in to comment.