From 97efa34d79fb87a07b4c06591ab3a3f02a5ce130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerardo=20P=C3=A9rez=20P=C3=A9rez?= Date: Wed, 20 Sep 2017 11:00:01 -0500 Subject: [PATCH] perf: remove arguments of the removed 'requireSafe' --- src/middleware/router.js | 2 +- src/support/KoatonRouter.js | 2 +- src/support/configuration.js | 2 +- src/support/globals.js | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/middleware/router.js b/src/middleware/router.js index 761538f..a6b6bb7 100644 --- a/src/middleware/router.js +++ b/src/middleware/router.js @@ -54,7 +54,7 @@ export function initialize () { let routers = glob('koaton_modules/**/routes.js').concat(glob('routes.js')); for (const router of routers) { let location = path.dirname(router); - let PackageSubdomains = require(ProyPath(location, 'config', 'server.js'), {default: { subdomains: [] }}).default.subdomains; + let PackageSubdomains = require(ProyPath(location, 'config', 'server.js')).default.subdomains; for (const subdomain of PackageSubdomains) { if (!subdomainRouters[subdomain]) { subdomainRouters[subdomain] = new KoatonRouter(subdomain); diff --git a/src/support/KoatonRouter.js b/src/support/KoatonRouter.js index 4f191be..82632e9 100644 --- a/src/support/KoatonRouter.js +++ b/src/support/KoatonRouter.js @@ -200,7 +200,7 @@ export default class KoatonRouter { model = url; url = undefined; } - let controller = require(ProyPath(this.loc, 'controllers', model), {}).default; + let controller = require(ProyPath(this.loc, 'controllers', model)).default; controller = Object.assign({ Name: model, Namespace: '', diff --git a/src/support/configuration.js b/src/support/configuration.js index a746cc8..7229029 100644 --- a/src/support/configuration.js +++ b/src/support/configuration.js @@ -55,7 +55,7 @@ export default class Configuration { let modules = glob(ProyPath('config', '**', '*.js')); let moduleNames = []; for (const configFile of modules) { - let config = require(configFile, {default: {}}).default; + let config = require(configFile).default; const moduleName = basename(configFile).replace(extname(configFile), ''); moduleNames.push(moduleName); /** @ignore */ diff --git a/src/support/globals.js b/src/support/globals.js index ad61dc4..6684230 100644 --- a/src/support/globals.js +++ b/src/support/globals.js @@ -40,13 +40,13 @@ global.cleanString = (text) => { * @param {Object=} [defaults={}] - Object to return if require fails. * @returns {Object} The required library (always) fresh. */ -global.requireNoCache = function requireNoCache (lib, defaults) { +global.requireNoCache = function requireNoCache (lib) { let library = rawpath.normalize(rawpath.resolve(lib)); if (library.indexOf('.json') === -1) { library = library.replace('.js', ''); // + '.js'; } delete require.cache[library]; - return require(library, defaults); + return require(library); }; /**