From 689e087aefd4fd66ad89507f57e5a59f87cc832c Mon Sep 17 00:00:00 2001 From: Sebastian Seedorf Date: Mon, 16 Nov 2020 00:00:29 +0100 Subject: [PATCH] Optimize Imports --- src/utils/auth-proxy.ts | 4 +--- src/utils/auto-reload.ts | 3 +-- src/utils/config.ts | 3 +-- src/utils/helpers/urlJoin.ts | 1 + src/utils/index.ts | 1 + src/utils/logging.ts | 2 +- src/utils/polyfill.ts | 3 +-- src/utils/session.ts | 7 +++---- 8 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/utils/auth-proxy.ts b/src/utils/auth-proxy.ts index 771999d..8fe6272 100644 --- a/src/utils/auth-proxy.ts +++ b/src/utils/auth-proxy.ts @@ -1,8 +1,6 @@ import {Request, RequestHandler} from 'express'; -import {DefaultConfig, Logger} from '.'; -import {Resolvable} from './helpers/resolvable'; +import {DefaultConfig, Logger, Resolvable, urlJoin} from '.'; import fetch from 'node-fetch'; -import {urlJoin} from './helpers/urlJoin'; const router: RequestHandler = (req: Request, res, next) => { const resolvable = new Resolvable(async () => { diff --git a/src/utils/auto-reload.ts b/src/utils/auto-reload.ts index 47b8192..c3d014e 100644 --- a/src/utils/auto-reload.ts +++ b/src/utils/auto-reload.ts @@ -1,6 +1,5 @@ import {Router} from 'express'; -import {DefaultConfig, Logger} from '.'; -import {urlJoin} from './helpers/urlJoin'; +import {DefaultConfig, Logger, urlJoin} from '.'; import {v4} from 'uuid'; import Timeout = NodeJS.Timeout; diff --git a/src/utils/config.ts b/src/utils/config.ts index e772704..13db449 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -1,6 +1,5 @@ import * as env from 'env-var'; -import * as properUrlJoin from 'proper-url-join'; -const urlJoin = properUrlJoin as unknown as properUrlJoin.default; +import {urlJoin} from '.'; const NODE_ENV = env.get('NODE_ENV').default("development").asString(); const isProduction = NODE_ENV === 'production'; diff --git a/src/utils/helpers/urlJoin.ts b/src/utils/helpers/urlJoin.ts index 0fc1991..457fc35 100644 --- a/src/utils/helpers/urlJoin.ts +++ b/src/utils/helpers/urlJoin.ts @@ -1,2 +1,3 @@ import * as properUrlJoin from 'proper-url-join'; + export const urlJoin = properUrlJoin as unknown as properUrlJoin.default; diff --git a/src/utils/index.ts b/src/utils/index.ts index 5ef6823..2867882 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -3,6 +3,7 @@ export {Redis} from './redis'; export {Logger, HttpLogger} from './logging'; export {AuthProxy} from './auth-proxy'; export {Resolvable, WaitForSync} from './helpers/resolvable'; +export {urlJoin} from './helpers/urlJoin'; export {AutoReloader} from './auto-reload'; export {Polyfill} from './polyfill'; export {Session} from './session'; diff --git a/src/utils/logging.ts b/src/utils/logging.ts index c646f3b..1225d69 100644 --- a/src/utils/logging.ts +++ b/src/utils/logging.ts @@ -1,9 +1,9 @@ import * as winston from 'winston'; import {LeveledLogMethod} from 'winston'; -import prune = require('json-prune'); import {RequestHandler} from 'express'; import * as colors from 'colors'; import {DefaultConfig} from '.'; +import prune = require('json-prune'); const logger = winston.createLogger({ diff --git a/src/utils/polyfill.ts b/src/utils/polyfill.ts index 38f192c..2a68457 100644 --- a/src/utils/polyfill.ts +++ b/src/utils/polyfill.ts @@ -1,8 +1,7 @@ import {RequestHandler} from 'express'; import * as polyfillLibrary from 'polyfill-library'; -import {DefaultConfig, Logger} from '.'; import {PolyfillFeatureList} from 'polyfill-library'; -import {WaitForSync} from './helpers/resolvable'; +import {DefaultConfig, Logger, WaitForSync} from '.'; import {spawn, Thread, Worker} from 'threads'; import {WorkerFunction} from 'threads/dist/types/worker'; diff --git a/src/utils/session.ts b/src/utils/session.ts index 565e805..7e93aee 100644 --- a/src/utils/session.ts +++ b/src/utils/session.ts @@ -1,11 +1,10 @@ -import {Store} from 'express-session'; -import {Redis, DefaultConfig} from '.'; -import * as redisStore from "connect-redis"; import * as session from 'express-session'; +import {Store} from 'express-session'; +import {DefaultConfig, Redis} from '.'; +import * as redisStore from "connect-redis"; import {RequestHandler} from 'express'; - let sessionStore: Store|undefined = undefined; function getRouter(options?: Partial): RequestHandler {