From 1410656ff5363e2aa5fa736d0b13452414b65f6e Mon Sep 17 00:00:00 2001 From: Pablo Palacios Date: Mon, 21 Jun 2021 19:29:00 +0200 Subject: [PATCH] refactor: remove debug dependency from all packages (#717) --- packages/dispatchr/lib/Action.js | 3 --- packages/dispatchr/lib/DispatcherContext.js | 5 +---- packages/dispatchr/package.json | 1 - packages/fluxible-plugin-devtools/package.json | 1 - .../fluxible-plugin-devtools/src/lib/devtools-plugin.js | 3 --- packages/fluxible-plugin-fetchr/package.json | 1 - packages/fluxible/lib/Fluxible.js | 6 ------ packages/fluxible/lib/FluxibleContext.js | 4 ---- packages/fluxible/package.json | 1 - 9 files changed, 1 insertion(+), 24 deletions(-) diff --git a/packages/dispatchr/lib/Action.js b/packages/dispatchr/lib/Action.js index b2361018..538dc3dc 100644 --- a/packages/dispatchr/lib/Action.js +++ b/packages/dispatchr/lib/Action.js @@ -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; @@ -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; }; @@ -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]) { diff --git a/packages/dispatchr/lib/DispatcherContext.js b/packages/dispatchr/lib/DispatcherContext.js index b43ab77d..bbe89568 100644 --- a/packages/dispatchr/lib/DispatcherContext.js +++ b/packages/dispatchr/lib/DispatcherContext.js @@ -6,7 +6,6 @@ var Action = require('./Action'); var DEFAULT = 'default'; -var debug = require('debug')('Dispatchr:DispatcherContext'); /** * @class Dispatcher @@ -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), @@ -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; } }; diff --git a/packages/dispatchr/package.json b/packages/dispatchr/package.json index 0c621021..7e3481e3 100644 --- a/packages/dispatchr/package.json +++ b/packages/dispatchr/package.json @@ -20,7 +20,6 @@ } ], "dependencies": { - "debug": "^2.0.0", "eventemitter3": "^2.0.0", "inherits": "^2.0.1" }, diff --git a/packages/fluxible-plugin-devtools/package.json b/packages/fluxible-plugin-devtools/package.json index cb6abb62..bcfe9673 100644 --- a/packages/fluxible-plugin-devtools/package.json +++ b/packages/fluxible-plugin-devtools/package.json @@ -17,7 +17,6 @@ "prepublish": "npm run dist" }, "dependencies": { - "debug": "^2.0.0", "prop-types": "^15.5.8" }, "peerDependencies": { diff --git a/packages/fluxible-plugin-devtools/src/lib/devtools-plugin.js b/packages/fluxible-plugin-devtools/src/lib/devtools-plugin.js index 1b9f98b8..1277b15e 100644 --- a/packages/fluxible-plugin-devtools/src/lib/devtools-plugin.js +++ b/packages/fluxible-plugin-devtools/src/lib/devtools-plugin.js @@ -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 @@ -60,7 +58,6 @@ export default function devToolsPlugin() { * @return {void} */ function overrideCtx() { - debug('devtools plugin %s', enableDebug ? 'enabled' : 'disabled') if (!enableDebug) { return; } diff --git a/packages/fluxible-plugin-fetchr/package.json b/packages/fluxible-plugin-fetchr/package.json index 1eeb8da5..5441e052 100644 --- a/packages/fluxible-plugin-fetchr/package.json +++ b/packages/fluxible-plugin-fetchr/package.json @@ -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 ", diff --git a/packages/fluxible/lib/Fluxible.js b/packages/fluxible/lib/Fluxible.js index 8c19cb61..a4dac5a6 100644 --- a/packages/fluxible/lib/Fluxible.js +++ b/packages/fluxible/lib/Fluxible.js @@ -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'); @@ -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(); @@ -39,7 +37,6 @@ function defaultComponentActionHandler(context, payload, done) { * }); */ function Fluxible(options) { - debug('Fluxible instance instantiated', options); options = options || {}; // Options @@ -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); }; @@ -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(), @@ -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') { diff --git a/packages/fluxible/lib/FluxibleContext.js b/packages/fluxible/lib/FluxibleContext.js index 3832f710..d4dbbb17 100644 --- a/packages/fluxible/lib/FluxibleContext.js +++ b/packages/fluxible/lib/FluxibleContext.js @@ -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'); @@ -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); } diff --git a/packages/fluxible/package.json b/packages/fluxible/package.json index f4914f80..8c5484e8 100644 --- a/packages/fluxible/package.json +++ b/packages/fluxible/package.json @@ -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"