From 5a0dc6844592b7f46b8cc91e981ad54c2fd3888a Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 19 May 2019 20:32:28 +0900 Subject: [PATCH 01/12] Install reflect-metadataa and tsyringe --- package-lock.json | 15 +++++++++++++++ package.json | 2 ++ 2 files changed, 17 insertions(+) diff --git a/package-lock.json b/package-lock.json index 372fac9..a9c2e9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9031,6 +9031,12 @@ "is-promise": "^2.1.0" } }, + "reflect-metadata": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==", + "dev": true + }, "regenerator-runtime": { "version": "0.11.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", @@ -10675,6 +10681,15 @@ "tslib": "^1.8.1" } }, + "tsyringe": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/tsyringe/-/tsyringe-3.2.0.tgz", + "integrity": "sha512-9Gh3605NgIv/ssBtx+L1vWv+Ep0aBc0bVRgLssPyW1VKau56cdBX4Gu1v5GWdo9YwWzB3Wr0iiPO6nRT08nVyA==", + "dev": true, + "requires": { + "tslib": "^1.9.3" + } + }, "tty-browserify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", diff --git a/package.json b/package.json index a799554..02b93e4 100644 --- a/package.json +++ b/package.json @@ -60,9 +60,11 @@ "react-test-renderer": "^16.8.6", "redux": "^4.0.1", "redux-promise": "^0.6.0", + "reflect-metadata": "^0.1.13", "sass-loader": "^7.1.0", "sinon-chrome": "^3.0.1", "style-loader": "^0.23.1", + "tsyringe": "^3.2.0", "typescript": "^3.4.5", "web-ext-types": "^3.1.0", "webextensions-api-fake": "^0.7.4", From a58a18b3614f5bfeabd371bb81d290e53f870a68 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 19 May 2019 21:08:32 +0900 Subject: [PATCH 02/12] Update eslint --- .eslintrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index 48826fa..a80a79c 100644 --- a/.eslintrc +++ b/.eslintrc @@ -36,7 +36,7 @@ "jsx-quotes": ["error", "prefer-single"], "max-classes-per-file": "off", "max-lines": "off", - "max-params": ["error", 5], + "max-params": ["error", 10], "max-statements": ["error", 15], "multiline-comment-style": "off", "multiline-ternary": "off", @@ -57,6 +57,7 @@ "no-undef-init": "off", "no-unused-vars": "off", "no-use-before-define": "off", + "no-useless-constructor": "off", "no-warning-comments": "off", "object-curly-newline": ["error", { "consistent": true }], "object-curly-spacing": ["error", "always", { "arraysInObjects": false, "objectsInObjects": false }], From ffb740b3abac4f7db6d87572a316f56ca9e4effc Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 19 May 2019 21:09:06 +0900 Subject: [PATCH 03/12] Update tsconfig --- tsconfig.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index b61ee23..2f26430 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -28,7 +28,10 @@ "moduleResolution": "node", "esModuleInterop": true, - "typeRoots": ["node_modules/@types", "node_modules/web-ext-types"] + "typeRoots": ["node_modules/@types", "node_modules/web-ext-types"], + + "experimentalDecorators": true, + "emitDecoratorMetadata": true }, "include": [ "src" From 54d274e9fd2855664048eedb805a6762d6acf9fa Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 19 May 2019 21:33:04 +0900 Subject: [PATCH 04/12] Install @babel/plugin-proposal-decorators --- package-lock.json | 20 ++++++++++++++++++++ package.json | 1 + 2 files changed, 21 insertions(+) diff --git a/package-lock.json b/package-lock.json index a9c2e9f..d2e5c3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -535,6 +535,26 @@ "@babel/helper-plugin-utils": "^7.0.0" } }, + "@babel/plugin-proposal-decorators": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.4.4.tgz", + "integrity": "sha512-z7MpQz3XC/iQJWXH9y+MaWcLPNSMY9RQSthrLzak8R8hCj0fuyNk+Dzi9kfNe/JxxlWQ2g7wkABbgWjW36MTcw==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.4.4", + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-decorators": "^7.2.0" + } + }, + "@babel/plugin-syntax-decorators": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.2.0.tgz", + "integrity": "sha512-38QdqVoXdHUQfTpZo3rQwqQdWtCn5tMv4uV6r2RMfTqNBuv4ZBhz79SfaQWKTVmxHjeFv/DnXVC/+agHCklYWA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, "@babel/plugin-syntax-jsx": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.2.0.tgz", diff --git a/package.json b/package.json index 02b93e4..abe9d3a 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "@babel/cli": "^7.4.4", "@babel/core": "^7.4.4", "@babel/plugin-proposal-class-properties": "^7.4.4", + "@babel/plugin-proposal-decorators": "^7.4.4", "@babel/preset-react": "^7.0.0", "@babel/preset-typescript": "^7.3.3", "@types/chai": "^4.1.7", From c7803e7c2911f63e43611290b996f526c0f8aaf2 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 19 May 2019 21:33:42 +0900 Subject: [PATCH 05/12] Configure @babel/plugin-proposal-decorators --- webpack.config.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index a845375..540418d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -25,7 +25,12 @@ config = { loader: 'babel-loader', options: { presets: [ - { plugins: ['@babel/plugin-proposal-class-properties'] }, + { + plugins: [ + ["@babel/plugin-proposal-decorators", { "legacy": true }], + '@babel/plugin-proposal-class-properties' + ] + }, '@babel/react', '@babel/preset-typescript' ] From cdfd54ed99087dc4a7a3fd13865849ff9ce9e8ba Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 19 May 2019 21:34:08 +0900 Subject: [PATCH 06/12] Use TSyringe on background script --- src/background/Application.ts | 35 +++++++++++++++++++ .../controllers/AddonEnabledController.ts | 8 +++-- .../controllers/CommandController.ts | 13 ++++--- src/background/controllers/FindController.ts | 9 ++--- src/background/controllers/LinkController.ts | 9 ++--- src/background/controllers/MarkController.ts | 9 ++--- .../controllers/OperationController.ts | 25 +++++-------- .../controllers/SettingController.ts | 13 ++++--- .../controllers/VersionController.ts | 9 ++--- src/background/index.ts | 27 +++----------- .../infrastructures/ConsoleClient.ts | 2 ++ .../infrastructures/ContentMessageClient.ts | 2 ++ .../infrastructures/ContentMessageListener.ts | 34 ++++++------------ .../presenters/IndicatorPresenter.ts | 3 ++ src/background/presenters/NotifyPresenter.ts | 3 ++ src/background/presenters/TabPresenter.ts | 2 ++ src/background/presenters/WindowPresenter.ts | 3 ++ .../repositories/BookmarkRepository.ts | 3 ++ .../repositories/BrowserSettingRepository.ts | 2 ++ .../repositories/CompletionsRepository.ts | 3 ++ src/background/repositories/FindRepository.ts | 2 ++ src/background/repositories/MarkRepository.ts | 2 ++ .../PersistentSettingRepository.ts | 2 ++ .../repositories/SettingRepository.ts | 2 ++ .../usecases/AddonEnabledUseCase.ts | 20 ++++------- src/background/usecases/CommandUseCase.ts | 30 ++++++---------- src/background/usecases/CompletionsUseCase.ts | 17 ++++----- src/background/usecases/ConsoleUseCase.ts | 12 +++---- src/background/usecases/FindUseCase.ts | 17 ++++----- src/background/usecases/LinkUseCase.ts | 9 ++--- src/background/usecases/MarkUseCase.ts | 21 +++++------ src/background/usecases/SettingUseCase.ts | 16 ++++----- src/background/usecases/TabSelectUseCase.ts | 9 ++--- src/background/usecases/TabUseCase.ts | 13 ++++--- src/background/usecases/VersionUseCase.ts | 13 ++++--- src/background/usecases/ZoomUseCase.ts | 9 ++--- test/main.ts | 6 ++-- 37 files changed, 212 insertions(+), 202 deletions(-) create mode 100644 src/background/Application.ts diff --git a/src/background/Application.ts b/src/background/Application.ts new file mode 100644 index 0000000..08013cd --- /dev/null +++ b/src/background/Application.ts @@ -0,0 +1,35 @@ +import { injectable } from 'tsyringe'; +import ContentMessageListener from './infrastructures/ContentMessageListener'; +import SettingController from './controllers/SettingController'; +import VersionController from './controllers/VersionController'; + +@injectable() +export default class Application { + constructor( + private contentMessageListener: ContentMessageListener, + private settingController: SettingController, + private versionController: VersionController, + ) { + } + + run() { + this.settingController.reload(); + + browser.runtime.onInstalled.addListener((details) => { + if (details.reason !== 'install' && details.reason !== 'update') { + return; + } + this.versionController.notify(); + }); + + this.contentMessageListener.run(); + browser.storage.onChanged.addListener((changes, area) => { + if (area !== 'local') { + return; + } + if (changes.settings) { + this.settingController.reload(); + } + }); + } +} diff --git a/src/background/controllers/AddonEnabledController.ts b/src/background/controllers/AddonEnabledController.ts index 251af25..903df40 100644 --- a/src/background/controllers/AddonEnabledController.ts +++ b/src/background/controllers/AddonEnabledController.ts @@ -1,10 +1,12 @@ +import { injectable } from 'tsyringe'; import AddonEnabledUseCase from '../usecases/AddonEnabledUseCase'; +@injectable() export default class AddonEnabledController { - private addonEnabledUseCase: AddonEnabledUseCase; - constructor() { - this.addonEnabledUseCase = new AddonEnabledUseCase(); + constructor( + private addonEnabledUseCase: AddonEnabledUseCase, + ) { } indicate(enabled: boolean): Promise { diff --git a/src/background/controllers/CommandController.ts b/src/background/controllers/CommandController.ts index f3a6b7f..2ad1683 100644 --- a/src/background/controllers/CommandController.ts +++ b/src/background/controllers/CommandController.ts @@ -1,3 +1,4 @@ +import { injectable } from 'tsyringe'; import CompletionsUseCase from '../usecases/CompletionsUseCase'; import CommandUseCase from '../usecases/CommandUseCase'; import CompletionGroup from '../domains/CompletionGroup'; @@ -7,14 +8,12 @@ const trimStart = (str: string): string => { return str.replace(/^\s+/, ''); }; +@injectable() export default class CommandController { - private completionsUseCase: CompletionsUseCase; - - private commandIndicator: CommandUseCase; - - constructor() { - this.completionsUseCase = new CompletionsUseCase(); - this.commandIndicator = new CommandUseCase(); + constructor( + private completionsUseCase: CompletionsUseCase, + private commandIndicator: CommandUseCase, + ) { } getCompletions(line: string): Promise { diff --git a/src/background/controllers/FindController.ts b/src/background/controllers/FindController.ts index 28959e2..1cec962 100644 --- a/src/background/controllers/FindController.ts +++ b/src/background/controllers/FindController.ts @@ -1,10 +1,11 @@ +import { injectable } from 'tsyringe'; import FindUseCase from '../usecases/FindUseCase'; +@injectable() export default class FindController { - private findUseCase: FindUseCase; - - constructor() { - this.findUseCase = new FindUseCase(); + constructor( + private findUseCase: FindUseCase, + ) { } getKeyword(): Promise { diff --git a/src/background/controllers/LinkController.ts b/src/background/controllers/LinkController.ts index 707b28a..af6148e 100644 --- a/src/background/controllers/LinkController.ts +++ b/src/background/controllers/LinkController.ts @@ -1,10 +1,11 @@ +import { injectable } from 'tsyringe'; import LinkUseCase from '../usecases/LinkUseCase'; +@injectable() export default class LinkController { - private linkUseCase: LinkUseCase; - - constructor() { - this.linkUseCase = new LinkUseCase(); + constructor( + private linkUseCase: LinkUseCase, + ) { } openToTab(url: string, tabId: number): Promise { diff --git a/src/background/controllers/MarkController.ts b/src/background/controllers/MarkController.ts index 419a08b..4726fbc 100644 --- a/src/background/controllers/MarkController.ts +++ b/src/background/controllers/MarkController.ts @@ -1,10 +1,11 @@ +import { injectable } from 'tsyringe'; import MarkUseCase from '../usecases/MarkUseCase'; +@injectable() export default class MarkController { - private markUseCase: MarkUseCase; - - constructor() { - this.markUseCase = new MarkUseCase(); + constructor( + private markUseCase: MarkUseCase, + ) { } setGlobal(key: string, x: number, y: number): Promise { diff --git a/src/background/controllers/OperationController.ts b/src/background/controllers/OperationController.ts index fa09512..de6f8cb 100644 --- a/src/background/controllers/OperationController.ts +++ b/src/background/controllers/OperationController.ts @@ -1,3 +1,4 @@ +import { injectable } from 'tsyringe'; import * as operations from '../../shared/operations'; import FindUseCase from '../usecases/FindUseCase'; import ConsoleUseCase from '../usecases/ConsoleUseCase'; @@ -5,23 +6,15 @@ import TabUseCase from '../usecases/TabUseCase'; import TabSelectUseCase from '../usecases/TabSelectUseCase'; import ZoomUseCase from '../usecases/ZoomUseCase'; +@injectable() export default class OperationController { - private findUseCase: FindUseCase; - - private consoleUseCase: ConsoleUseCase; - - private tabUseCase: TabUseCase; - - private tabSelectUseCase: TabSelectUseCase; - - private zoomUseCase: ZoomUseCase; - - constructor() { - this.findUseCase = new FindUseCase(); - this.consoleUseCase = new ConsoleUseCase(); - this.tabUseCase = new TabUseCase(); - this.tabSelectUseCase = new TabSelectUseCase(); - this.zoomUseCase = new ZoomUseCase(); + constructor( + private findUseCase: FindUseCase, + private consoleUseCase: ConsoleUseCase, + private tabUseCase: TabUseCase, + private tabSelectUseCase: TabSelectUseCase, + private zoomUseCase: ZoomUseCase, + ) { } // eslint-disable-next-line complexity, max-lines-per-function diff --git a/src/background/controllers/SettingController.ts b/src/background/controllers/SettingController.ts index dfd2817..34951ff 100644 --- a/src/background/controllers/SettingController.ts +++ b/src/background/controllers/SettingController.ts @@ -1,15 +1,14 @@ +import { injectable } from 'tsyringe'; import SettingUseCase from '../usecases/SettingUseCase'; import ContentMessageClient from '../infrastructures/ContentMessageClient'; import Settings from '../../shared/Settings'; +@injectable() export default class SettingController { - private settingUseCase: SettingUseCase; - - private contentMessageClient: ContentMessageClient; - - constructor() { - this.settingUseCase = new SettingUseCase(); - this.contentMessageClient = new ContentMessageClient(); + constructor( + private settingUseCase: SettingUseCase, + private contentMessageClient: ContentMessageClient, + ) { } getSetting(): Promise { diff --git a/src/background/controllers/VersionController.ts b/src/background/controllers/VersionController.ts index 2e2a197..b00185a 100644 --- a/src/background/controllers/VersionController.ts +++ b/src/background/controllers/VersionController.ts @@ -1,10 +1,11 @@ +import { injectable } from 'tsyringe'; import VersionUseCase from '../usecases/VersionUseCase'; +@injectable() export default class VersionController { - private versionUseCase: VersionUseCase; - - constructor() { - this.versionUseCase = new VersionUseCase(); + constructor( + private versionUseCase: VersionUseCase, + ) { } notify(): Promise { diff --git a/src/background/index.ts b/src/background/index.ts index f9efd4d..26b0f6b 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -1,23 +1,6 @@ -import ContentMessageListener from './infrastructures/ContentMessageListener'; -import SettingController from './controllers/SettingController'; -import VersionController from './controllers/VersionController'; +import 'reflect-metadata'; +import { container } from 'tsyringe'; +import Application from './Application'; -let settingController = new SettingController(); -settingController.reload(); - -browser.runtime.onInstalled.addListener((details) => { - if (details.reason !== 'install' && details.reason !== 'update') { - return; - } - new VersionController().notify(); -}); - -new ContentMessageListener().run(); -browser.storage.onChanged.addListener((changes, area) => { - if (area !== 'local') { - return; - } - if (changes.settings) { - settingController.reload(); - } -}); +let app = container.resolve(Application); +app.run(); diff --git a/src/background/infrastructures/ConsoleClient.ts b/src/background/infrastructures/ConsoleClient.ts index c162634..1385fe7 100644 --- a/src/background/infrastructures/ConsoleClient.ts +++ b/src/background/infrastructures/ConsoleClient.ts @@ -1,5 +1,7 @@ +import { injectable } from 'tsyringe'; import * as messages from '../../shared/messages'; +@injectable() export default class ConsoleClient { showCommand(tabId: number, command: string): Promise { return browser.tabs.sendMessage(tabId, { diff --git a/src/background/infrastructures/ContentMessageClient.ts b/src/background/infrastructures/ContentMessageClient.ts index 2215330..2983409 100644 --- a/src/background/infrastructures/ContentMessageClient.ts +++ b/src/background/infrastructures/ContentMessageClient.ts @@ -1,5 +1,7 @@ +import { injectable } from 'tsyringe'; import * as messages from '../../shared/messages'; +@injectable() export default class ContentMessageClient { async broadcastSettingsChanged(): Promise { let tabs = await browser.tabs.query({}); diff --git a/src/background/infrastructures/ContentMessageListener.ts b/src/background/infrastructures/ContentMessageListener.ts index 1cc2696..3d24741 100644 --- a/src/background/infrastructures/ContentMessageListener.ts +++ b/src/background/infrastructures/ContentMessageListener.ts @@ -1,3 +1,4 @@ +import { injectable } from 'tsyringe'; import * as messages from '../../shared/messages'; import CompletionGroup from '../domains/CompletionGroup'; import CommandController from '../controllers/CommandController'; @@ -8,32 +9,19 @@ import LinkController from '../controllers/LinkController'; import OperationController from '../controllers/OperationController'; import MarkController from '../controllers/MarkController'; +@injectable() export default class ContentMessageListener { - private settingController: SettingController; - - private commandController: CommandController; - - private findController: FindController; - - private addonEnabledController: AddonEnabledController; - - private linkController: LinkController; - - private backgroundOperationController: OperationController; - - private markController: MarkController; - private consolePorts: {[tabId: number]: browser.runtime.Port}; - constructor() { - this.settingController = new SettingController(); - this.commandController = new CommandController(); - this.findController = new FindController(); - this.addonEnabledController = new AddonEnabledController(); - this.linkController = new LinkController(); - this.backgroundOperationController = new OperationController(); - this.markController = new MarkController(); - + constructor( + private settingController: SettingController, + private commandController: CommandController, + private findController: FindController, + private addonEnabledController: AddonEnabledController, + private linkController: LinkController, + private backgroundOperationController: OperationController, + private markController: MarkController, + ) { this.consolePorts = {}; } diff --git a/src/background/presenters/IndicatorPresenter.ts b/src/background/presenters/IndicatorPresenter.ts index 1c81cf5..99f92b5 100644 --- a/src/background/presenters/IndicatorPresenter.ts +++ b/src/background/presenters/IndicatorPresenter.ts @@ -1,3 +1,6 @@ +import { injectable } from 'tsyringe'; + +@injectable() export default class IndicatorPresenter { indicate(enabled: boolean): Promise { let path = enabled diff --git a/src/background/presenters/NotifyPresenter.ts b/src/background/presenters/NotifyPresenter.ts index 23932f7..8fa4acb 100644 --- a/src/background/presenters/NotifyPresenter.ts +++ b/src/background/presenters/NotifyPresenter.ts @@ -1,5 +1,8 @@ +import { injectable } from 'tsyringe'; + const NOTIFICATION_ID = 'vimvixen-update'; +@injectable() export default class NotifyPresenter { async notify( title: string, diff --git a/src/background/presenters/TabPresenter.ts b/src/background/presenters/TabPresenter.ts index 33c6513..5665bf0 100644 --- a/src/background/presenters/TabPresenter.ts +++ b/src/background/presenters/TabPresenter.ts @@ -1,3 +1,4 @@ +import { injectable } from 'tsyringe'; import MemoryStorage from '../infrastructures/MemoryStorage'; const CURRENT_SELECTED_KEY = 'tabs.current.selected'; @@ -5,6 +6,7 @@ const LAST_SELECTED_KEY = 'tabs.last.selected'; type Tab = browser.tabs.Tab; +@injectable() export default class TabPresenter { open(url: string, tabId?: number): Promise { return browser.tabs.update(tabId, { url }); diff --git a/src/background/presenters/WindowPresenter.ts b/src/background/presenters/WindowPresenter.ts index e04f258..150a48b 100644 --- a/src/background/presenters/WindowPresenter.ts +++ b/src/background/presenters/WindowPresenter.ts @@ -1,3 +1,6 @@ +import { injectable } from 'tsyringe'; + +@injectable() export default class WindowPresenter { create(url: string): Promise { return browser.windows.create({ url }); diff --git a/src/background/repositories/BookmarkRepository.ts b/src/background/repositories/BookmarkRepository.ts index b4da509..d266ae6 100644 --- a/src/background/repositories/BookmarkRepository.ts +++ b/src/background/repositories/BookmarkRepository.ts @@ -1,3 +1,6 @@ +import { injectable } from 'tsyringe'; + +@injectable() export default class BookmarkRepository { async create( title: string, url: string diff --git a/src/background/repositories/BrowserSettingRepository.ts b/src/background/repositories/BrowserSettingRepository.ts index 33b35dd..9cfb35e 100644 --- a/src/background/repositories/BrowserSettingRepository.ts +++ b/src/background/repositories/BrowserSettingRepository.ts @@ -1,3 +1,4 @@ +import { injectable } from 'tsyringe'; import * as urls from '../../shared/urls'; declare namespace browser.browserSettings.homepageOverride { @@ -16,6 +17,7 @@ declare namespace browser.browserSettings.homepageOverride { function get(param: object): Promise; } +@injectable() export default class BrowserSettingRepository { async getHomepageUrls(): Promise { let { value } = await browser.browserSettings.homepageOverride.get({}); diff --git a/src/background/repositories/CompletionsRepository.ts b/src/background/repositories/CompletionsRepository.ts index 18af587..dfdbc27 100644 --- a/src/background/repositories/CompletionsRepository.ts +++ b/src/background/repositories/CompletionsRepository.ts @@ -1,6 +1,9 @@ +import { injectable } from 'tsyringe'; + type Tab = browser.tabs.Tab; type BookmarkTreeNode = browser.bookmarks.BookmarkTreeNode; +@injectable() export default class CompletionsRepository { async queryBookmarks(keywords: string): Promise { let items = await browser.bookmarks.search({ query: keywords }); diff --git a/src/background/repositories/FindRepository.ts b/src/background/repositories/FindRepository.ts index bf286e6..6a087f5 100644 --- a/src/background/repositories/FindRepository.ts +++ b/src/background/repositories/FindRepository.ts @@ -1,7 +1,9 @@ +import { injectable } from 'tsyringe'; import MemoryStorage from '../infrastructures/MemoryStorage'; const FIND_KEYWORD_KEY = 'find-keyword'; +@injectable() export default class FindRepository { private cache: MemoryStorage; diff --git a/src/background/repositories/MarkRepository.ts b/src/background/repositories/MarkRepository.ts index 69c85f6..c106fff 100644 --- a/src/background/repositories/MarkRepository.ts +++ b/src/background/repositories/MarkRepository.ts @@ -1,8 +1,10 @@ +import { injectable } from 'tsyringe'; import MemoryStorage from '../infrastructures/MemoryStorage'; import GlobalMark from '../domains/GlobalMark'; const MARK_KEY = 'mark'; +@injectable() export default class MarkRepository { private cache: MemoryStorage; diff --git a/src/background/repositories/PersistentSettingRepository.ts b/src/background/repositories/PersistentSettingRepository.ts index ff882a5..927bce9 100644 --- a/src/background/repositories/PersistentSettingRepository.ts +++ b/src/background/repositories/PersistentSettingRepository.ts @@ -1,5 +1,7 @@ +import { injectable } from 'tsyringe'; import SettingData from '../../shared/SettingData'; +@injectable() export default class SettingRepository { async load(): Promise { let { settings } = await browser.storage.local.get('settings'); diff --git a/src/background/repositories/SettingRepository.ts b/src/background/repositories/SettingRepository.ts index eb83a2c..2f159e5 100644 --- a/src/background/repositories/SettingRepository.ts +++ b/src/background/repositories/SettingRepository.ts @@ -1,9 +1,11 @@ +import { injectable } from 'tsyringe'; import MemoryStorage from '../infrastructures/MemoryStorage'; import Settings from '../../shared/Settings'; import * as PropertyDefs from '../../shared/property-defs'; const CACHED_SETTING_KEY = 'setting'; +@injectable() export default class SettingRepository { private cache: MemoryStorage; diff --git a/src/background/usecases/AddonEnabledUseCase.ts b/src/background/usecases/AddonEnabledUseCase.ts index 0a6fb03..bb5cd90 100644 --- a/src/background/usecases/AddonEnabledUseCase.ts +++ b/src/background/usecases/AddonEnabledUseCase.ts @@ -1,27 +1,21 @@ +import { injectable } from 'tsyringe'; import IndicatorPresenter from '../presenters/IndicatorPresenter'; import TabPresenter from '../presenters/TabPresenter'; import ContentMessageClient from '../infrastructures/ContentMessageClient'; +@injectable() export default class AddonEnabledUseCase { - private indicatorPresentor: IndicatorPresenter; - - private tabPresenter: TabPresenter; - - private contentMessageClient: ContentMessageClient; - - constructor() { - this.indicatorPresentor = new IndicatorPresenter(); - + constructor( + private indicatorPresentor: IndicatorPresenter, + private tabPresenter: TabPresenter, + private contentMessageClient: ContentMessageClient, + ) { this.indicatorPresentor.onClick((tab) => { if (tab.id) { this.onIndicatorClick(tab.id); } }); - - this.tabPresenter = new TabPresenter(); this.tabPresenter.onSelected(info => this.onTabSelected(info.tabId)); - - this.contentMessageClient = new ContentMessageClient(); } indicate(enabled: boolean): Promise { diff --git a/src/background/usecases/CommandUseCase.ts b/src/background/usecases/CommandUseCase.ts index 2247d7b..921a779 100644 --- a/src/background/usecases/CommandUseCase.ts +++ b/src/background/usecases/CommandUseCase.ts @@ -1,3 +1,4 @@ +import { injectable } from 'tsyringe'; import * as parsers from './parsers'; import * as urls from '../../shared/urls'; import TabPresenter from '../presenters/TabPresenter'; @@ -7,27 +8,16 @@ import BookmarkRepository from '../repositories/BookmarkRepository'; import ConsoleClient from '../infrastructures/ConsoleClient'; import ContentMessageClient from '../infrastructures/ContentMessageClient'; +@injectable() export default class CommandIndicator { - private tabPresenter: TabPresenter; - - private windowPresenter: WindowPresenter; - - private settingRepository: SettingRepository; - - private bookmarkRepository: BookmarkRepository; - - private consoleClient: ConsoleClient; - - private contentMessageClient: ContentMessageClient; - - constructor() { - this.tabPresenter = new TabPresenter(); - this.windowPresenter = new WindowPresenter(); - this.settingRepository = new SettingRepository(); - this.bookmarkRepository = new BookmarkRepository(); - this.consoleClient = new ConsoleClient(); - - this.contentMessageClient = new ContentMessageClient(); + constructor( + private tabPresenter: TabPresenter, + private windowPresenter: WindowPresenter, + private settingRepository: SettingRepository, + private bookmarkRepository: BookmarkRepository, + private consoleClient: ConsoleClient, + private contentMessageClient: ContentMessageClient, + ) { } async open(keywords: string): Promise { diff --git a/src/background/usecases/CompletionsUseCase.ts b/src/background/usecases/CompletionsUseCase.ts index da36e3c..705555b 100644 --- a/src/background/usecases/CompletionsUseCase.ts +++ b/src/background/usecases/CompletionsUseCase.ts @@ -1,3 +1,4 @@ +import { injectable } from 'tsyringe'; import CompletionGroup from '../domains/CompletionGroup'; import CommandDocs from '../domains/CommandDocs'; import CompletionsRepository from '../repositories/CompletionsRepository'; @@ -11,17 +12,13 @@ const COMPLETION_ITEM_LIMIT = 10; type Tab = browser.tabs.Tab; type HistoryItem = browser.history.HistoryItem; +@injectable() export default class CompletionsUseCase { - private tabPresenter: TabPresenter; - - private completionsRepository: CompletionsRepository; - - private settingRepository: SettingRepository; - - constructor() { - this.tabPresenter = new TabPresenter(); - this.completionsRepository = new CompletionsRepository(); - this.settingRepository = new SettingRepository(); + constructor( + private tabPresenter: TabPresenter, + private completionsRepository: CompletionsRepository, + private settingRepository: SettingRepository, + ) { } queryConsoleCommand(prefix: string): Promise { diff --git a/src/background/usecases/ConsoleUseCase.ts b/src/background/usecases/ConsoleUseCase.ts index 60c0439..d0bd7bb 100644 --- a/src/background/usecases/ConsoleUseCase.ts +++ b/src/background/usecases/ConsoleUseCase.ts @@ -1,14 +1,14 @@ +import { injectable } from 'tsyringe'; import TabPresenter from '../presenters/TabPresenter'; import ConsoleClient from '../infrastructures/ConsoleClient'; +@injectable() export default class ConsoleUseCase { - private tabPresenter: TabPresenter; - private consoleClient: ConsoleClient; - - constructor() { - this.tabPresenter = new TabPresenter(); - this.consoleClient = new ConsoleClient(); + constructor( + private tabPresenter: TabPresenter, + private consoleClient: ConsoleClient, + ) { } async showCommand(): Promise { diff --git a/src/background/usecases/FindUseCase.ts b/src/background/usecases/FindUseCase.ts index d567800..41b9cbd 100644 --- a/src/background/usecases/FindUseCase.ts +++ b/src/background/usecases/FindUseCase.ts @@ -1,18 +1,15 @@ +import { injectable } from 'tsyringe'; import FindRepository from '../repositories/FindRepository'; import TabPresenter from '../presenters/TabPresenter'; import ConsoleClient from '../infrastructures/ConsoleClient'; +@injectable() export default class FindUseCase { - private tabPresenter: TabPresenter; - - private findRepository: FindRepository; - - private consoleClient: ConsoleClient; - - constructor() { - this.tabPresenter = new TabPresenter(); - this.findRepository = new FindRepository(); - this.consoleClient = new ConsoleClient(); + constructor( + private tabPresenter: TabPresenter, + private findRepository: FindRepository, + private consoleClient: ConsoleClient, + ) { } getKeyword(): Promise { diff --git a/src/background/usecases/LinkUseCase.ts b/src/background/usecases/LinkUseCase.ts index 480f6b5..e87867d 100644 --- a/src/background/usecases/LinkUseCase.ts +++ b/src/background/usecases/LinkUseCase.ts @@ -1,10 +1,11 @@ +import { injectable } from 'tsyringe'; import TabPresenter from '../presenters/TabPresenter'; +@injectable() export default class LinkUseCase { - private tabPresenter: TabPresenter; - - constructor() { - this.tabPresenter = new TabPresenter(); + constructor( + private tabPresenter: TabPresenter, + ) { } openToTab(url: string, tabId: number): Promise { diff --git a/src/background/usecases/MarkUseCase.ts b/src/background/usecases/MarkUseCase.ts index e376c55..8cb96da 100644 --- a/src/background/usecases/MarkUseCase.ts +++ b/src/background/usecases/MarkUseCase.ts @@ -1,22 +1,17 @@ +import { injectable } from 'tsyringe'; import TabPresenter from '../presenters/TabPresenter'; import MarkRepository from '../repositories/MarkRepository'; import ConsoleClient from '../infrastructures/ConsoleClient'; import ContentMessageClient from '../infrastructures/ContentMessageClient'; +@injectable() export default class MarkUseCase { - private tabPresenter: TabPresenter; - - private markRepository: MarkRepository; - - private consoleClient: ConsoleClient; - - private contentMessageClient: ContentMessageClient; - - constructor() { - this.tabPresenter = new TabPresenter(); - this.markRepository = new MarkRepository(); - this.consoleClient = new ConsoleClient(); - this.contentMessageClient = new ContentMessageClient(); + constructor( + private tabPresenter: TabPresenter, + private markRepository: MarkRepository, + private consoleClient: ConsoleClient, + private contentMessageClient: ContentMessageClient, + ) { } async setGlobal(key: string, x: number, y: number): Promise { diff --git a/src/background/usecases/SettingUseCase.ts b/src/background/usecases/SettingUseCase.ts index aa3b534..fd00f80 100644 --- a/src/background/usecases/SettingUseCase.ts +++ b/src/background/usecases/SettingUseCase.ts @@ -1,17 +1,17 @@ -// eslint-disable-next-line max-len -import PersistentSettingRepository from '../repositories/PersistentSettingRepository'; +import { injectable } from 'tsyringe'; +import PersistentSettingRepository + from '../repositories/PersistentSettingRepository'; import SettingRepository from '../repositories/SettingRepository'; import { DefaultSettingData } from '../../shared/SettingData'; import Settings from '../../shared/Settings'; +@injectable() export default class SettingUseCase { - private persistentSettingRepository: PersistentSettingRepository; - private settingRepository: SettingRepository; - - constructor() { - this.persistentSettingRepository = new PersistentSettingRepository(); - this.settingRepository = new SettingRepository(); + constructor( + private persistentSettingRepository: PersistentSettingRepository, + private settingRepository: SettingRepository, + ) { } get(): Promise { diff --git a/src/background/usecases/TabSelectUseCase.ts b/src/background/usecases/TabSelectUseCase.ts index a0b52f0..df3db94 100644 --- a/src/background/usecases/TabSelectUseCase.ts +++ b/src/background/usecases/TabSelectUseCase.ts @@ -1,10 +1,11 @@ +import { injectable } from 'tsyringe'; import TabPresenter from '../presenters/TabPresenter'; +@injectable() export default class TabSelectUseCase { - private tabPresenter: TabPresenter; - - constructor() { - this.tabPresenter = new TabPresenter(); + constructor( + private tabPresenter: TabPresenter, + ) { } async selectPrev(count: number): Promise { diff --git a/src/background/usecases/TabUseCase.ts b/src/background/usecases/TabUseCase.ts index 1615333..0239a87 100644 --- a/src/background/usecases/TabUseCase.ts +++ b/src/background/usecases/TabUseCase.ts @@ -1,14 +1,13 @@ +import { injectable } from 'tsyringe'; import TabPresenter from '../presenters/TabPresenter'; import BrowserSettingRepository from '../repositories/BrowserSettingRepository'; +@injectable() export default class TabUseCase { - private tabPresenter: TabPresenter; - - private browserSettingRepository: BrowserSettingRepository; - - constructor() { - this.tabPresenter = new TabPresenter(); - this.browserSettingRepository = new BrowserSettingRepository(); + constructor( + private tabPresenter: TabPresenter, + private browserSettingRepository: BrowserSettingRepository, + ) { } async close(force: boolean): Promise { diff --git a/src/background/usecases/VersionUseCase.ts b/src/background/usecases/VersionUseCase.ts index 8154eba..1d9ef8b 100644 --- a/src/background/usecases/VersionUseCase.ts +++ b/src/background/usecases/VersionUseCase.ts @@ -1,14 +1,13 @@ +import { injectable } from 'tsyringe'; import TabPresenter from '../presenters/TabPresenter'; import NotifyPresenter from '../presenters/NotifyPresenter'; +@injectable() export default class VersionUseCase { - private tabPresenter: TabPresenter; - - private notifyPresenter: NotifyPresenter; - - constructor() { - this.tabPresenter = new TabPresenter(); - this.notifyPresenter = new NotifyPresenter(); + constructor( + private tabPresenter: TabPresenter, + private notifyPresenter: NotifyPresenter, + ) { } notify(): Promise { diff --git a/src/background/usecases/ZoomUseCase.ts b/src/background/usecases/ZoomUseCase.ts index 661c3cd..32ba897 100644 --- a/src/background/usecases/ZoomUseCase.ts +++ b/src/background/usecases/ZoomUseCase.ts @@ -1,3 +1,4 @@ +import { injectable } from 'tsyringe'; import TabPresenter from '../presenters/TabPresenter'; const ZOOM_SETTINGS: number[] = [ @@ -5,11 +6,11 @@ const ZOOM_SETTINGS: number[] = [ 1.10, 1.25, 1.50, 1.75, 2.00, 2.50, 3.00 ]; +@injectable() export default class ZoomUseCase { - private tabPresenter: TabPresenter; - - constructor() { - this.tabPresenter = new TabPresenter(); + constructor( + private tabPresenter: TabPresenter, + ) { } async zoomIn(): Promise { diff --git a/test/main.ts b/test/main.ts index 3aeae69..433b531 100644 --- a/test/main.ts +++ b/test/main.ts @@ -1,6 +1,8 @@ -import chai from 'chai'; +import 'reflect-metadata'; +import { expect } from 'chai'; + const browserFake = require('webextensions-api-fake'); const browser = browserFake(); -global.expect = chai.expect; +global.expect = expect; global.browser = browser; From 914b6500db8b0cd40c8738bd5ffb155ad0376dff Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 20 May 2019 20:38:21 +0900 Subject: [PATCH 07/12] Install ts-loader --- package-lock.json | 99 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 100 insertions(+) diff --git a/package-lock.json b/package-lock.json index d2e5c3e..7a8b5f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8342,6 +8342,12 @@ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "dev": true }, + "picomatch": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.0.7.tgz", + "integrity": "sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA==", + "dev": true + }, "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", @@ -10686,6 +10692,99 @@ "glob": "^7.1.2" } }, + "ts-loader": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-6.0.1.tgz", + "integrity": "sha512-9H5ErTIw5t73sdSoFE0hX0RO45B7cdDA4pW1VIQ2wNFAhxSpZcAlv2fwMcfv6SAYLoI7uGwHuzC5dECzmzqtzA==", + "dev": true, + "requires": { + "chalk": "^2.3.0", + "enhanced-resolve": "^4.0.0", + "loader-utils": "^1.0.2", + "micromatch": "^4.0.0", + "semver": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "semver": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.0.0.tgz", + "integrity": "sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + } + } + }, "tslib": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", diff --git a/package.json b/package.json index abe9d3a..f33eaf7 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "sass-loader": "^7.1.0", "sinon-chrome": "^3.0.1", "style-loader": "^0.23.1", + "ts-loader": "^6.0.1", "tsyringe": "^3.2.0", "typescript": "^3.4.5", "web-ext-types": "^3.1.0", From fa0325bb8a453c607fd7d8f35d6c881cbdf0b8e7 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 20 May 2019 20:43:58 +0900 Subject: [PATCH 08/12] Goodble babel --- package-lock.json | 1182 +-------------------------------------------- package.json | 9 - 2 files changed, 9 insertions(+), 1182 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7a8b5f3..fad8e5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3,32 +3,6 @@ "requires": true, "lockfileVersion": 1, "dependencies": { - "@babel/cli": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.4.4.tgz", - "integrity": "sha512-XGr5YjQSjgTa6OzQZY57FAJsdeVSAKR/u/KA5exWIz66IKtv/zXtHy+fIZcMry/EgYegwuHE7vzGnrFhjdIAsQ==", - "dev": true, - "requires": { - "chokidar": "^2.0.4", - "commander": "^2.8.1", - "convert-source-map": "^1.1.0", - "fs-readdir-recursive": "^1.1.0", - "glob": "^7.0.0", - "lodash": "^4.17.11", - "mkdirp": "^0.5.1", - "output-file-sync": "^2.0.0", - "slash": "^2.0.0", - "source-map": "^0.5.0" - }, - "dependencies": { - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - } - } - }, "@babel/code-frame": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", @@ -38,439 +12,6 @@ "@babel/highlight": "^7.0.0" } }, - "@babel/core": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.4.4.tgz", - "integrity": "sha512-lQgGX3FPRgbz2SKmhMtYgJvVzGZrmjaF4apZ2bLwofAKiSjxU0drPh4S/VasyYXwaTs+A1gvQ45BN8SQJzHsQQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.4.4", - "@babel/helpers": "^7.4.4", - "@babel/parser": "^7.4.4", - "@babel/template": "^7.4.4", - "@babel/traverse": "^7.4.4", - "@babel/types": "^7.4.4", - "convert-source-map": "^1.1.0", - "debug": "^4.1.0", - "json5": "^2.1.0", - "lodash": "^4.17.11", - "resolve": "^1.3.2", - "semver": "^5.4.1", - "source-map": "^0.5.0" - }, - "dependencies": { - "@babel/generator": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.4.4.tgz", - "integrity": "sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ==", - "dev": true, - "requires": { - "@babel/types": "^7.4.4", - "jsesc": "^2.5.1", - "lodash": "^4.17.11", - "source-map": "^0.5.0", - "trim-right": "^1.0.1" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz", - "integrity": "sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q==", - "dev": true, - "requires": { - "@babel/types": "^7.4.4" - } - }, - "@babel/parser": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.4.4.tgz", - "integrity": "sha512-5pCS4mOsL+ANsFZGdvNLybx4wtqAZJ0MJjMHxvzI3bvIsz6sQvzW8XX92EYIkiPtIvcfG3Aj+Ir5VNyjnZhP7w==", - "dev": true - }, - "@babel/template": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.4.tgz", - "integrity": "sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.4.4", - "@babel/types": "^7.4.4" - } - }, - "@babel/traverse": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.4.4.tgz", - "integrity": "sha512-Gw6qqkw/e6AGzlyj9KnkabJX7VcubqPtkUQVAwkc0wUMldr3A/hezNB3Rc5eIvId95iSGkGIOe5hh1kMKf951A==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.4.4", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/parser": "^7.4.4", - "@babel/types": "^7.4.4", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.11" - } - }, - "@babel/types": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.4.4.tgz", - "integrity": "sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ==", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "lodash": "^4.17.11", - "to-fast-properties": "^2.0.0" - } - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "json5": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", - "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==", - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - } - } - }, - "@babel/generator": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.3.0.tgz", - "integrity": "sha512-dZTwMvTgWfhmibq4V9X+LMf6Bgl7zAodRn9PvcPdhlzFMbvUutx74dbEv7Atz3ToeEpevYEJtAwfxq/bDCzHWg==", - "dev": true, - "requires": { - "@babel/types": "^7.3.0", - "jsesc": "^2.5.1", - "lodash": "^4.17.10", - "source-map": "^0.5.0", - "trim-right": "^1.0.1" - }, - "dependencies": { - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true - } - } - }, - "@babel/helper-builder-react-jsx": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.3.0.tgz", - "integrity": "sha512-MjA9KgwCuPEkQd9ncSXvSyJ5y+j2sICHyrI0M3L+6fnS4wMSNDc1ARXsbTfbb2cXHn17VisSnU/sHFTCxVxSMw==", - "dev": true, - "requires": { - "@babel/types": "^7.3.0", - "esutils": "^2.0.0" - } - }, - "@babel/helper-create-class-features-plugin": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.4.4.tgz", - "integrity": "sha512-UbBHIa2qeAGgyiNR9RszVF7bUHEdgS4JAUNT8SiqrAN6YJVxlOxeLr5pBzb5kan302dejJ9nla4RyKcR1XT6XA==", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-member-expression-to-functions": "^7.0.0", - "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-replace-supers": "^7.4.4", - "@babel/helper-split-export-declaration": "^7.4.4" - }, - "dependencies": { - "@babel/helper-split-export-declaration": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz", - "integrity": "sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q==", - "dev": true, - "requires": { - "@babel/types": "^7.4.4" - } - }, - "@babel/types": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.4.4.tgz", - "integrity": "sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ==", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "lodash": "^4.17.11", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/helper-function-name": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz", - "integrity": "sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw==", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.0.0", - "@babel/template": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz", - "integrity": "sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==", - "dev": true, - "requires": { - "@babel/types": "^7.0.0" - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0.tgz", - "integrity": "sha512-avo+lm/QmZlv27Zsi0xEor2fKcqWG56D5ae9dzklpIaY7cQMK5N8VSpaNVPPagiqmy7LrEjK1IWdGMOqPu5csg==", - "dev": true, - "requires": { - "@babel/types": "^7.0.0" - } - }, - "@babel/helper-optimise-call-expression": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz", - "integrity": "sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g==", - "dev": true, - "requires": { - "@babel/types": "^7.0.0" - } - }, - "@babel/helper-plugin-utils": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz", - "integrity": "sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==", - "dev": true - }, - "@babel/helper-replace-supers": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.4.4.tgz", - "integrity": "sha512-04xGEnd+s01nY1l15EuMS1rfKktNF+1CkKmHoErDppjAAZL+IUBZpzT748x262HF7fibaQPhbvWUl5HeSt1EXg==", - "dev": true, - "requires": { - "@babel/helper-member-expression-to-functions": "^7.0.0", - "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/traverse": "^7.4.4", - "@babel/types": "^7.4.4" - }, - "dependencies": { - "@babel/generator": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.4.4.tgz", - "integrity": "sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ==", - "dev": true, - "requires": { - "@babel/types": "^7.4.4", - "jsesc": "^2.5.1", - "lodash": "^4.17.11", - "source-map": "^0.5.0", - "trim-right": "^1.0.1" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz", - "integrity": "sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q==", - "dev": true, - "requires": { - "@babel/types": "^7.4.4" - } - }, - "@babel/parser": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.4.4.tgz", - "integrity": "sha512-5pCS4mOsL+ANsFZGdvNLybx4wtqAZJ0MJjMHxvzI3bvIsz6sQvzW8XX92EYIkiPtIvcfG3Aj+Ir5VNyjnZhP7w==", - "dev": true - }, - "@babel/traverse": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.4.4.tgz", - "integrity": "sha512-Gw6qqkw/e6AGzlyj9KnkabJX7VcubqPtkUQVAwkc0wUMldr3A/hezNB3Rc5eIvId95iSGkGIOe5hh1kMKf951A==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.4.4", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/parser": "^7.4.4", - "@babel/types": "^7.4.4", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.11" - } - }, - "@babel/types": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.4.4.tgz", - "integrity": "sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ==", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "lodash": "^4.17.11", - "to-fast-properties": "^2.0.0" - } - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - } - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz", - "integrity": "sha512-MXkOJqva62dfC0w85mEf/LucPPS/1+04nmmRMPEBUB++hiiThQ2zPtX/mEWQ3mtzCEjIJvPY8nuwxXtQeQwUag==", - "dev": true, - "requires": { - "@babel/types": "^7.0.0" - } - }, - "@babel/helpers": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.4.4.tgz", - "integrity": "sha512-igczbR/0SeuPR8RFfC7tGrbdTbFL3QTvH6D+Z6zNxnTe//GyqmtHmDkzrqDmyZ3eSwPqB/LhyKoU5DXsp+Vp2A==", - "dev": true, - "requires": { - "@babel/template": "^7.4.4", - "@babel/traverse": "^7.4.4", - "@babel/types": "^7.4.4" - }, - "dependencies": { - "@babel/generator": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.4.4.tgz", - "integrity": "sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ==", - "dev": true, - "requires": { - "@babel/types": "^7.4.4", - "jsesc": "^2.5.1", - "lodash": "^4.17.11", - "source-map": "^0.5.0", - "trim-right": "^1.0.1" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz", - "integrity": "sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q==", - "dev": true, - "requires": { - "@babel/types": "^7.4.4" - } - }, - "@babel/parser": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.4.4.tgz", - "integrity": "sha512-5pCS4mOsL+ANsFZGdvNLybx4wtqAZJ0MJjMHxvzI3bvIsz6sQvzW8XX92EYIkiPtIvcfG3Aj+Ir5VNyjnZhP7w==", - "dev": true - }, - "@babel/template": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.4.tgz", - "integrity": "sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.4.4", - "@babel/types": "^7.4.4" - } - }, - "@babel/traverse": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.4.4.tgz", - "integrity": "sha512-Gw6qqkw/e6AGzlyj9KnkabJX7VcubqPtkUQVAwkc0wUMldr3A/hezNB3Rc5eIvId95iSGkGIOe5hh1kMKf951A==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.4.4", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/parser": "^7.4.4", - "@babel/types": "^7.4.4", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.11" - } - }, - "@babel/types": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.4.4.tgz", - "integrity": "sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ==", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "lodash": "^4.17.11", - "to-fast-properties": "^2.0.0" - } - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - } - } - }, "@babel/highlight": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", @@ -519,133 +60,6 @@ } } }, - "@babel/parser": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.3.1.tgz", - "integrity": "sha512-ATz6yX/L8LEnC3dtLQnIx4ydcPxhLcoy9Vl6re00zb2w5lG6itY6Vhnr1KFRPq/FHNsgl/gh2mjNN20f9iJTTA==", - "dev": true - }, - "@babel/plugin-proposal-class-properties": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.4.4.tgz", - "integrity": "sha512-WjKTI8g8d5w1Bc9zgwSz2nfrsNQsXcCf9J9cdCvrJV6RF56yztwm4TmJC0MgJ9tvwO9gUA/mcYe89bLdGfiXFg==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.4.4", - "@babel/helper-plugin-utils": "^7.0.0" - } - }, - "@babel/plugin-proposal-decorators": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.4.4.tgz", - "integrity": "sha512-z7MpQz3XC/iQJWXH9y+MaWcLPNSMY9RQSthrLzak8R8hCj0fuyNk+Dzi9kfNe/JxxlWQ2g7wkABbgWjW36MTcw==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.4.4", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-decorators": "^7.2.0" - } - }, - "@babel/plugin-syntax-decorators": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.2.0.tgz", - "integrity": "sha512-38QdqVoXdHUQfTpZo3rQwqQdWtCn5tMv4uV6r2RMfTqNBuv4ZBhz79SfaQWKTVmxHjeFv/DnXVC/+agHCklYWA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0" - } - }, - "@babel/plugin-syntax-jsx": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.2.0.tgz", - "integrity": "sha512-VyN4QANJkRW6lDBmENzRszvZf3/4AXaj9YR7GwrWeeN9tEBPuXbmDYVU9bYBN0D70zCWVwUy0HWq2553VCb6Hw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0" - } - }, - "@babel/plugin-syntax-typescript": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.3.3.tgz", - "integrity": "sha512-dGwbSMA1YhVS8+31CnPR7LB4pcbrzcV99wQzby4uAfrkZPYZlQ7ImwdpzLqi6Z6IL02b8IAL379CaMwo0x5Lag==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0" - } - }, - "@babel/plugin-transform-react-display-name": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.2.0.tgz", - "integrity": "sha512-Htf/tPa5haZvRMiNSQSFifK12gtr/8vwfr+A9y69uF0QcU77AVu4K7MiHEkTxF7lQoHOL0F9ErqgfNEAKgXj7A==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0" - } - }, - "@babel/plugin-transform-react-jsx": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.3.0.tgz", - "integrity": "sha512-a/+aRb7R06WcKvQLOu4/TpjKOdvVEKRLWFpKcNuHhiREPgGRB4TQJxq07+EZLS8LFVYpfq1a5lDUnuMdcCpBKg==", - "dev": true, - "requires": { - "@babel/helper-builder-react-jsx": "^7.3.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-jsx": "^7.2.0" - } - }, - "@babel/plugin-transform-react-jsx-self": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.2.0.tgz", - "integrity": "sha512-v6S5L/myicZEy+jr6ielB0OR8h+EH/1QFx/YJ7c7Ua+7lqsjj/vW6fD5FR9hB/6y7mGbfT4vAURn3xqBxsUcdg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-jsx": "^7.2.0" - } - }, - "@babel/plugin-transform-react-jsx-source": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.2.0.tgz", - "integrity": "sha512-A32OkKTp4i5U6aE88GwwcuV4HAprUgHcTq0sSafLxjr6AW0QahrCRCjxogkbbcdtpbXkuTOlgpjophCxb6sh5g==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-jsx": "^7.2.0" - } - }, - "@babel/plugin-transform-typescript": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.4.4.tgz", - "integrity": "sha512-rwDvjaMTx09WC0rXGBRlYSSkEHOKRrecY6hEr3SVIPKII8DVWXtapNAfAyMC0dovuO+zYArcAuKeu3q9DNRfzA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-typescript": "^7.2.0" - } - }, - "@babel/preset-react": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.0.0.tgz", - "integrity": "sha512-oayxyPS4Zj+hF6Et11BwuBkmpgT/zMxyuZgFrMeZID6Hdh3dGlk4sHCAhdBCpuCKW2ppBfl2uCCetlrUIJRY3w==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-transform-react-display-name": "^7.0.0", - "@babel/plugin-transform-react-jsx": "^7.0.0", - "@babel/plugin-transform-react-jsx-self": "^7.0.0", - "@babel/plugin-transform-react-jsx-source": "^7.0.0" - } - }, - "@babel/preset-typescript": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.3.3.tgz", - "integrity": "sha512-mzMVuIP4lqtn4du2ynEfdO0+RYcslwrZiJHXu4MGaC1ctJiW2fyaeDrtjJGs7R/KebZ1sgowcIoWf4uRpEfKEg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.3.2" - } - }, "@babel/runtime": { "version": "7.4.4", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.4.tgz", @@ -663,76 +77,6 @@ } } }, - "@babel/template": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.2.2.tgz", - "integrity": "sha512-zRL0IMM02AUDwghf5LMSSDEz7sBCO2YnNmpg3uWTZj/v1rcG2BmQUvaGU8GhU8BvfMh1k2KIAYZ7Ji9KXPUg7g==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.2.2", - "@babel/types": "^7.2.2" - } - }, - "@babel/traverse": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.2.3.tgz", - "integrity": "sha512-Z31oUD/fJvEWVR0lNZtfgvVt512ForCTNKYcJBGbPb1QZfve4WGH8Wsy7+Mev33/45fhP/hwQtvgusNdcCMgSw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.2.2", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.0.0", - "@babel/parser": "^7.2.3", - "@babel/types": "^7.2.2", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.10" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "globals": { - "version": "11.10.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.10.0.tgz", - "integrity": "sha512-0GZF1RiPKU97IHUO5TORo9w1PwrH/NBPl+fS7oMLdaTRiYmYbwK4NWoZWrAdd0/abG9R2BU+OiwyQpTpE6pdfQ==", - "dev": true - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - } - } - }, - "@babel/types": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.0.tgz", - "integrity": "sha512-QkFPw68QqWU1/RVPyBe8SO7lXbPfjtqAxRYQKpFpaB8yMq7X2qAqfwK5LKoQufEkSmO5NQ70O6Kc3Afk03RwXw==", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "lodash": "^4.17.10", - "to-fast-properties": "^2.0.0" - }, - "dependencies": { - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true - } - } - }, "@sinonjs/commons": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.4.0.tgz", @@ -1195,29 +539,6 @@ "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", "dev": true }, - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "optional": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - }, - "dependencies": { - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "optional": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - } - } - }, "aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", @@ -1243,12 +564,6 @@ "sprintf-js": "~1.0.2" } }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", @@ -1289,12 +604,6 @@ "es-abstract": "^1.7.0" } }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, "arraybuffer.slice": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", @@ -1422,32 +731,6 @@ "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "dev": true }, - "babel-eslint": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.0.1.tgz", - "integrity": "sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.0.0", - "@babel/traverse": "^7.0.0", - "@babel/types": "^7.0.0", - "eslint-scope": "3.7.1", - "eslint-visitor-keys": "^1.0.0" - } - }, - "babel-loader": { - "version": "8.0.5", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.5.tgz", - "integrity": "sha512-NTnHnVRd2JnRqPC0vW+iOQWU5pchDbYXsG2E6DMXEpMfUcQKclF9gmf3G3ZMhzG7IG9ji4coL0cm+FxeWxDpnw==", - "dev": true, - "requires": { - "find-cache-dir": "^2.0.0", - "loader-utils": "^1.0.2", - "mkdirp": "^0.5.1", - "util.promisify": "^1.0.0" - } - }, "babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", @@ -1646,24 +929,6 @@ "concat-map": "0.0.1" } }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - } - }, "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", @@ -1983,27 +1248,6 @@ "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, - "chokidar": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.5.tgz", - "integrity": "sha512-i0TprVWp+Kj4WRPtInjexJ8Q+BqTE909VpH8xVhXrJkoc5QC8VO9TryGOqTr+2hljzc1sC62t22h5tZePodM/A==", - "dev": true, - "optional": true, - "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "fsevents": "^1.2.7", - "glob-parent": "^3.1.0", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - } - }, "chownr": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", @@ -2274,15 +1518,6 @@ "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", "dev": true }, - "convert-source-map": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", - "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, "cookie": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", @@ -3283,16 +2518,6 @@ } } }, - "eslint-scope": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", - "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", - "dev": true, - "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - } - }, "eslint-utils": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", @@ -3410,21 +2635,6 @@ } } }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - } - }, "expand-tilde": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", @@ -3521,82 +2731,20 @@ "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", "dev": true, - "requires": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - }, - "dependencies": { - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - } - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" }, "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" + "safer-buffer": ">= 2.1.2 < 3" } - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true } } }, @@ -3648,18 +2796,6 @@ "flat-cache": "^2.0.1" } }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - } - }, "finalhandler": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.0.tgz", @@ -3683,26 +2819,6 @@ } } }, - "find-cache-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", - "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^2.0.0", - "pkg-dir": "^3.0.0" - } - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, "findup-sync": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz", @@ -4223,12 +3339,6 @@ "universalify": "^0.1.0" } }, - "fs-readdir-recursive": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", - "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==", - "dev": true - }, "fs-write-stream-atomic": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", @@ -4910,29 +4020,6 @@ "path-is-absolute": "^1.0.0" } }, - "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "dev": true, - "optional": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "optional": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - }, "global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", @@ -4957,12 +4044,6 @@ "which": "^1.2.14" } }, - "globals": { - "version": "11.11.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.11.0.tgz", - "integrity": "sha512-WHq43gS+6ufNOEqlrDBxVEbb8ntfXrfAUU2ZOpCxrBdGKW3gyv8mCxAfIBD0DroPKGrJ2eSsXsLtY9MPntsyTw==", - "dev": true - }, "globule": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/globule/-/globule-1.2.1.tgz", @@ -5733,12 +4814,6 @@ "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", "dev": true }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, "is-finite": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", @@ -5754,31 +4829,6 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "optional": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", - "dev": true - }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -5862,12 +4912,6 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -5902,12 +4946,6 @@ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", "dev": true }, - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true - }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -6413,12 +5451,6 @@ } } }, - "karma-babel-preprocessor": { - "version": "8.0.0-beta.0", - "resolved": "https://registry.npmjs.org/karma-babel-preprocessor/-/karma-babel-preprocessor-8.0.0-beta.0.tgz", - "integrity": "sha512-nv3GbDAKdonWuTJc+Kg4jEdRXzoP7uKKQ6HfTJb5PNTY+OJYKzrtUBUSez/wrutUFtztVT+MQxJHamd7MNCmBQ==", - "dev": true - }, "karma-firefox-launcher": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-1.1.0.tgz", @@ -6734,16 +5766,6 @@ "json5": "^0.5.0" } }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, "lodash": { "version": "4.17.11", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", @@ -6889,24 +5911,6 @@ "yallist": "^2.1.2" } }, - "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", - "dev": true, - "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" - }, - "dependencies": { - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true - } - } - }, "mamacro": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/mamacro/-/mamacro-0.0.3.tgz", @@ -7027,93 +6031,6 @@ "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", "dev": true }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "dependencies": { - "define-property": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", - "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - } - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, "miller-rabin": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", @@ -7850,13 +6767,6 @@ "validate-npm-package-license": "^3.0.1" } }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "optional": true - }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -8092,17 +7002,6 @@ "os-tmpdir": "^1.0.0" } }, - "output-file-sync": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/output-file-sync/-/output-file-sync-2.0.1.tgz", - "integrity": "sha512-mDho4qm7WgIXIGf4eYU1RHN2UU5tPfVYVSRwDJw0uTmj35DQUt/eNp19N7v6T3SrR0ESTEf2up2CGO73qI35zQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "is-plain-obj": "^1.1.0", - "mkdirp": "^0.5.1" - } - }, "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", @@ -8121,30 +7020,6 @@ "integrity": "sha512-pzQPhYMCAgLAKPWD2jC3Se9fEfrD9npNos0y150EeqZll7akhEgGhTW/slB6lHku8AvYGiJ+YJ5hfHKePPgFWg==", "dev": true }, - "p-limit": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", - "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, "pako": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", @@ -8369,15 +7244,6 @@ "pinkie": "^2.0.0" } }, - "pkg-dir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", - "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", - "dev": true, - "requires": { - "find-up": "^3.0.0" - } - }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -9004,18 +7870,6 @@ "util-deprecate": "~1.0.1" } }, - "readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", - "dev": true, - "optional": true, - "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - } - }, "redent": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", @@ -9684,12 +8538,6 @@ "urijs": "^1.18.2" } }, - "slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", - "dev": true - }, "slice-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", @@ -10536,12 +9384,6 @@ "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", "dev": true }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true - }, "to-object-path": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", @@ -10677,12 +9519,6 @@ "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", "dev": true }, - "trim-right": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", - "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", - "dev": true - }, "true-case-path": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.3.tgz", diff --git a/package.json b/package.json index f33eaf7..ac6fa75 100644 --- a/package.json +++ b/package.json @@ -21,12 +21,6 @@ }, "homepage": "https://github.com/ueokande/vim-vixen", "devDependencies": { - "@babel/cli": "^7.4.4", - "@babel/core": "^7.4.4", - "@babel/plugin-proposal-class-properties": "^7.4.4", - "@babel/plugin-proposal-decorators": "^7.4.4", - "@babel/preset-react": "^7.0.0", - "@babel/preset-typescript": "^7.3.3", "@types/chai": "^4.1.7", "@types/mocha": "^5.2.6", "@types/prop-types": "^15.7.1", @@ -35,8 +29,6 @@ "@types/react-redux": "^7.0.8", "@types/redux-promise": "^0.5.28", "@typescript-eslint/eslint-plugin": "^1.7.0", - "babel-eslint": "^10.0.1", - "babel-loader": "^8.0.5", "chai": "^4.2.0", "css-loader": "^2.1.1", "eslint": "^5.16.0", @@ -44,7 +36,6 @@ "html-webpack-plugin": "^3.2.0", "jszip": "^3.2.1", "karma": "^4.1.0", - "karma-babel-preprocessor": "^8.0.0-beta.0", "karma-firefox-launcher": "^1.1.0", "karma-html2js-preprocessor": "^1.1.0", "karma-mocha": "^1.3.0", From 71f3a1ea2d3d648db9f628bb1deddc41263ab438 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 20 May 2019 20:44:18 +0900 Subject: [PATCH 09/12] Configure webpack and tsconfig --- package.json | 2 +- tsconfig.json | 1 - webpack.config.js | 16 ++-------------- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index ac6fa75..d12779d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "build": "NODE_ENV=production webpack --mode production --progress --display-error-details", "package": "npm run build && script/package", "lint": "eslint --ext .js,.jsx,.ts,.tsx src", - "type-checks": "tsc", + "type-checks": "tsc --noEmit", "test": "karma start", "test:e2e": "mocha --timeout 8000 e2e" }, diff --git a/tsconfig.json b/tsconfig.json index 2f26430..9f90223 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,6 @@ "lib": ["es6", "dom", "es2017"], "allowJs": true, "checkJs": true, - "noEmit": true, "jsx": "react", "sourceMap": true, "outDir": "./build", diff --git a/webpack.config.js b/webpack.config.js index 540418d..cb56835 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -20,21 +20,9 @@ config = { module: { rules: [ { - test: [ /\.js$/, /\.jsx$/, /\.ts$/, /\.tsx$/], + test: [ /\.ts$/, /\.tsx$/], exclude: /node_modules/, - loader: 'babel-loader', - options: { - presets: [ - { - plugins: [ - ["@babel/plugin-proposal-decorators", { "legacy": true }], - '@babel/plugin-proposal-class-properties' - ] - }, - '@babel/react', - '@babel/preset-typescript' - ] - }, + loader: 'ts-loader' }, { test: /\.css$/, From 1666e626b0d90a53399bf2e79e47b486dbca795c Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 20 May 2019 22:21:31 +0900 Subject: [PATCH 10/12] Use TSyringe on content script --- src/content/Application.ts | 111 ++++++++++++++++++ src/content/MessageListener.ts | 2 + src/content/client/BackgroundClient.ts | 2 + .../controllers/AddonEnabledController.ts | 11 +- .../controllers/ConsoleFrameController.ts | 11 +- src/content/controllers/FindController.ts | 11 +- .../controllers/FollowKeyController.ts | 11 +- .../controllers/FollowMasterController.ts | 11 +- .../controllers/FollowSlaveController.ts | 11 +- src/content/controllers/KeymapController.ts | 59 +++------- src/content/controllers/MarkController.ts | 11 +- src/content/controllers/MarkKeyController.ts | 16 +-- src/content/controllers/SettingController.ts | 15 +-- src/content/di.ts | 52 ++++++++ src/content/index.ts | 16 ++- src/content/routes.ts | 97 --------------- src/content/usecases/AddonEnabledUseCase.ts | 22 ++-- src/content/usecases/ClipboardUseCase.ts | 37 ++---- src/content/usecases/ConsoleFrameUseCase.ts | 15 ++- src/content/usecases/FindSlaveUseCase.ts | 14 +-- src/content/usecases/FindUseCase.ts | 35 ++---- src/content/usecases/FocusUseCase.ts | 14 +-- src/content/usecases/FollowMasterUseCase.ts | 35 +++--- src/content/usecases/FollowSlaveUseCase.ts | 38 +++--- src/content/usecases/KeymapUseCase.ts | 33 ++---- src/content/usecases/MarkKeyUseCase.ts | 14 +-- src/content/usecases/MarkUseCase.ts | 46 +++----- src/content/usecases/NavigateUseCase.ts | 15 ++- src/content/usecases/ScrollUseCase.ts | 22 ++-- src/content/usecases/SettingUseCase.ts | 21 ++-- .../usecases/AddonEnabledUseCase.test.ts | 2 +- .../content/usecases/ClipboardUseCase.test.ts | 8 +- test/content/usecases/FindUseCase.test.ts | 2 +- test/content/usecases/MarkUseCase.test.ts | 11 +- test/content/usecases/SettingUseCaase.test.ts | 2 +- 35 files changed, 399 insertions(+), 434 deletions(-) create mode 100644 src/content/Application.ts create mode 100644 src/content/di.ts delete mode 100644 src/content/routes.ts diff --git a/src/content/Application.ts b/src/content/Application.ts new file mode 100644 index 0000000..470bf53 --- /dev/null +++ b/src/content/Application.ts @@ -0,0 +1,111 @@ +import { injectable } from 'tsyringe'; +import MessageListener from './MessageListener'; +import FindController from './controllers/FindController'; +import MarkController from './controllers/MarkController'; +import FollowMasterController from './controllers/FollowMasterController'; +import FollowSlaveController from './controllers/FollowSlaveController'; +import FollowKeyController from './controllers/FollowKeyController'; +import InputDriver from './InputDriver'; +import KeymapController from './controllers/KeymapController'; +import AddonEnabledUseCase from './usecases/AddonEnabledUseCase'; +import MarkKeyController from './controllers/MarkKeyController'; +import AddonEnabledController from './controllers/AddonEnabledController'; +import SettingController from './controllers/SettingController'; +import ConsoleFrameController from './controllers/ConsoleFrameController'; +import * as messages from '../shared/messages'; + +type Message = messages.Message; + +@injectable() +export default class Application { + + // eslint-disable-next-line max-params + constructor( + private messageListener: MessageListener, + private findController: FindController, + private markController: MarkController, + private followMasterController: FollowMasterController, + private followSlaveController: FollowSlaveController, + private followKeyController: FollowKeyController, + private keymapController: KeymapController, + private addonEnabledUseCase: AddonEnabledUseCase, + private markKeyController: MarkKeyController, + private addonEnabledController: AddonEnabledController, + private settingController: SettingController, + private consoleFrameController: ConsoleFrameController, + ) { + } + + run() { + this.routeCommonComponents(); + if (window.self === window.top) { + this.routeMasterComponents(); + } + } + + private routeMasterComponents() { + this.messageListener.onWebMessage((msg: Message, sender: Window) => { + switch (msg.type) { + case messages.CONSOLE_ENTER_FIND: + return this.findController.start(msg); + case messages.FIND_NEXT: + return this.findController.next(msg); + case messages.FIND_PREV: + return this.findController.prev(msg); + case messages.CONSOLE_UNFOCUS: + return this.consoleFrameController.unfocus(msg); + case messages.FOLLOW_START: + return this.followMasterController.followStart(msg); + case messages.FOLLOW_RESPONSE_COUNT_TARGETS: + return this.followMasterController.responseCountTargets(msg, sender); + case messages.FOLLOW_KEY_PRESS: + return this.followMasterController.keyPress(msg); + } + return undefined; + }); + + this.messageListener.onBackgroundMessage((msg: Message) => { + switch (msg.type) { + case messages.ADDON_ENABLED_QUERY: + return this.addonEnabledController.getAddonEnabled(msg); + case messages.TAB_SCROLL_TO: + return this.markController.scrollTo(msg); + } + return undefined; + }); + } + + private routeCommonComponents() { + this.messageListener.onWebMessage((msg: Message) => { + switch (msg.type) { + case messages.FOLLOW_REQUEST_COUNT_TARGETS: + return this.followSlaveController.countTargets(msg); + case messages.FOLLOW_CREATE_HINTS: + return this.followSlaveController.createHints(msg); + case messages.FOLLOW_SHOW_HINTS: + return this.followSlaveController.showHints(msg); + case messages.FOLLOW_ACTIVATE: + return this.followSlaveController.activate(msg); + case messages.FOLLOW_REMOVE_HINTS: + return this.followSlaveController.clear(msg); + } + return undefined; + }); + + this.messageListener.onBackgroundMessage((msg: Message): any => { + switch (msg.type) { + case messages.SETTINGS_CHANGED: + return this.settingController.reloadSettings(msg); + case messages.ADDON_TOGGLE_ENABLED: + return this.addonEnabledUseCase.toggle(); + } + }); + + let inputDriver = new InputDriver(window.document.body); + inputDriver.onKey(key => this.followKeyController.press(key)); + inputDriver.onKey(key => this.markKeyController.press(key)); + inputDriver.onKey(key => this.keymapController.press(key)); + + this.settingController.initSettings(); + } +} diff --git a/src/content/MessageListener.ts b/src/content/MessageListener.ts index e545cab..d035825 100644 --- a/src/content/MessageListener.ts +++ b/src/content/MessageListener.ts @@ -1,7 +1,9 @@ +import { injectable } from 'tsyringe'; import { Message, valueOf } from '../shared/messages'; export type WebExtMessageSender = browser.runtime.MessageSender; +@injectable() export default class MessageListener { onWebMessage( listener: (msg: Message, sender: Window) => void, diff --git a/src/content/client/BackgroundClient.ts b/src/content/client/BackgroundClient.ts index 2fe8d01..4a41184 100644 --- a/src/content/client/BackgroundClient.ts +++ b/src/content/client/BackgroundClient.ts @@ -1,6 +1,8 @@ +import { injectable } from 'tsyringe'; import * as operations from '../../shared/operations'; import * as messages from '../../shared/messages'; +@injectable() export default class BackgroundClient { execBackgroundOp(op: operations.Operation): Promise { return browser.runtime.sendMessage({ diff --git a/src/content/controllers/AddonEnabledController.ts b/src/content/controllers/AddonEnabledController.ts index 4e19b6a..bae95bf 100644 --- a/src/content/controllers/AddonEnabledController.ts +++ b/src/content/controllers/AddonEnabledController.ts @@ -1,13 +1,12 @@ +import { injectable } from 'tsyringe'; import * as messages from '../../shared/messages'; import AddonEnabledUseCase from '../usecases/AddonEnabledUseCase'; +@injectable() export default class AddonEnabledController { - private addonEnabledUseCase: AddonEnabledUseCase; - - constructor({ - addonEnabledUseCase = new AddonEnabledUseCase(), - } = {}) { - this.addonEnabledUseCase = addonEnabledUseCase; + constructor( + private addonEnabledUseCase: AddonEnabledUseCase, + ) { } getAddonEnabled( diff --git a/src/content/controllers/ConsoleFrameController.ts b/src/content/controllers/ConsoleFrameController.ts index fafadf4..ae26b7c 100644 --- a/src/content/controllers/ConsoleFrameController.ts +++ b/src/content/controllers/ConsoleFrameController.ts @@ -1,13 +1,12 @@ +import { injectable } from 'tsyringe'; import ConsoleFrameUseCase from '../usecases/ConsoleFrameUseCase'; import * as messages from '../../shared/messages'; +@injectable() export default class ConsoleFrameController { - private consoleFrameUseCase: ConsoleFrameUseCase; - - constructor({ - consoleFrameUseCase = new ConsoleFrameUseCase(), - } = {}) { - this.consoleFrameUseCase = consoleFrameUseCase; + constructor( + private consoleFrameUseCase: ConsoleFrameUseCase, + ) { } unfocus(_message: messages.Message) { diff --git a/src/content/controllers/FindController.ts b/src/content/controllers/FindController.ts index cf27a8d..7735176 100644 --- a/src/content/controllers/FindController.ts +++ b/src/content/controllers/FindController.ts @@ -1,13 +1,12 @@ +import { injectable } from 'tsyringe'; import * as messages from '../../shared/messages'; import FindUseCase from '../usecases/FindUseCase'; +@injectable() export default class FindController { - private findUseCase: FindUseCase; - - constructor({ - findUseCase = new FindUseCase(), - } = {}) { - this.findUseCase = findUseCase; + constructor( + private findUseCase: FindUseCase, + ) { } async start(m: messages.ConsoleEnterFindMessage): Promise { diff --git a/src/content/controllers/FollowKeyController.ts b/src/content/controllers/FollowKeyController.ts index eb45e01..59d2271 100644 --- a/src/content/controllers/FollowKeyController.ts +++ b/src/content/controllers/FollowKeyController.ts @@ -1,13 +1,12 @@ +import { injectable } from 'tsyringe'; import FollowSlaveUseCase from '../usecases/FollowSlaveUseCase'; import Key from '../domains/Key'; +@injectable() export default class FollowKeyController { - private followSlaveUseCase: FollowSlaveUseCase; - - constructor({ - followSlaveUseCase = new FollowSlaveUseCase(), - } = {}) { - this.followSlaveUseCase = followSlaveUseCase; + constructor( + private followSlaveUseCase: FollowSlaveUseCase, + ) { } press(key: Key): boolean { diff --git a/src/content/controllers/FollowMasterController.ts b/src/content/controllers/FollowMasterController.ts index 89294ff..fa99820 100644 --- a/src/content/controllers/FollowMasterController.ts +++ b/src/content/controllers/FollowMasterController.ts @@ -1,13 +1,12 @@ +import { injectable } from 'tsyringe'; import FollowMasterUseCase from '../usecases/FollowMasterUseCase'; import * as messages from '../../shared/messages'; +@injectable() export default class FollowMasterController { - private followMasterUseCase: FollowMasterUseCase; - - constructor({ - followMasterUseCase = new FollowMasterUseCase(), - } = {}) { - this.followMasterUseCase = followMasterUseCase; + constructor( + private followMasterUseCase: FollowMasterUseCase, + ) { } followStart(m: messages.FollowStartMessage): void { diff --git a/src/content/controllers/FollowSlaveController.ts b/src/content/controllers/FollowSlaveController.ts index 88dccf3..65ce477 100644 --- a/src/content/controllers/FollowSlaveController.ts +++ b/src/content/controllers/FollowSlaveController.ts @@ -1,13 +1,12 @@ +import { injectable } from 'tsyringe'; import * as messages from '../../shared/messages'; import FollowSlaveUseCase from '../usecases/FollowSlaveUseCase'; +@injectable() export default class FollowSlaveController { - private usecase: FollowSlaveUseCase; - - constructor({ - usecase = new FollowSlaveUseCase(), - } = {}) { - this.usecase = usecase; + constructor( + private usecase: FollowSlaveUseCase, + ) { } countTargets(m: messages.FollowRequestCountTargetsMessage): void { diff --git a/src/content/controllers/KeymapController.ts b/src/content/controllers/KeymapController.ts index 20c24c0..1835546 100644 --- a/src/content/controllers/KeymapController.ts +++ b/src/content/controllers/KeymapController.ts @@ -1,3 +1,4 @@ +import { injectable, inject } from 'tsyringe'; import * as operations from '../../shared/operations'; import KeymapUseCase from '../usecases/KeymapUseCase'; import AddonEnabledUseCase from '../usecases/AddonEnabledUseCase'; @@ -8,53 +9,25 @@ import FocusUseCase from '../usecases/FocusUseCase'; import ClipboardUseCase from '../usecases/ClipboardUseCase'; import BackgroundClient from '../client/BackgroundClient'; import MarkKeyyUseCase from '../usecases/MarkKeyUseCase'; -import FollowMasterClient, { FollowMasterClientImpl } - from '../client/FollowMasterClient'; +import FollowMasterClient from '../client/FollowMasterClient'; import Key from '../domains/Key'; +@injectable() export default class KeymapController { - private keymapUseCase: KeymapUseCase; + constructor( + private keymapUseCase: KeymapUseCase, + private addonEnabledUseCase: AddonEnabledUseCase, + private findSlaveUseCase: FindSlaveUseCase, + private scrollUseCase: ScrollUseCase, + private navigateUseCase: NavigateUseCase, + private focusUseCase: FocusUseCase, + private clipbaordUseCase: ClipboardUseCase, + private backgroundClient: BackgroundClient, + private markKeyUseCase: MarkKeyyUseCase, - private addonEnabledUseCase: AddonEnabledUseCase; - - private findSlaveUseCase: FindSlaveUseCase; - - private scrollUseCase: ScrollUseCase; - - private navigateUseCase: NavigateUseCase; - - private focusUseCase: FocusUseCase; - - private clipbaordUseCase: ClipboardUseCase; - - private backgroundClient: BackgroundClient; - - private markKeyUseCase: MarkKeyyUseCase; - - private followMasterClient: FollowMasterClient; - - constructor({ - keymapUseCase = new KeymapUseCase(), - addonEnabledUseCase = new AddonEnabledUseCase(), - findSlaveUseCase = new FindSlaveUseCase(), - scrollUseCase = new ScrollUseCase(), - navigateUseCase = new NavigateUseCase(), - focusUseCase = new FocusUseCase(), - clipbaordUseCase = new ClipboardUseCase(), - backgroundClient = new BackgroundClient(), - markKeyUseCase = new MarkKeyyUseCase(), - followMasterClient = new FollowMasterClientImpl(window.top), - } = {}) { - this.keymapUseCase = keymapUseCase; - this.addonEnabledUseCase = addonEnabledUseCase; - this.findSlaveUseCase = findSlaveUseCase; - this.scrollUseCase = scrollUseCase; - this.navigateUseCase = navigateUseCase; - this.focusUseCase = focusUseCase; - this.clipbaordUseCase = clipbaordUseCase; - this.backgroundClient = backgroundClient; - this.markKeyUseCase = markKeyUseCase; - this.followMasterClient = followMasterClient; + @inject('FollowMasterClient') + private followMasterClient: FollowMasterClient, + ) { } // eslint-disable-next-line complexity, max-lines-per-function diff --git a/src/content/controllers/MarkController.ts b/src/content/controllers/MarkController.ts index 365794c..5eb898a 100644 --- a/src/content/controllers/MarkController.ts +++ b/src/content/controllers/MarkController.ts @@ -1,13 +1,12 @@ +import { injectable } from 'tsyringe'; import * as messages from '../../shared/messages'; import MarkUseCase from '../usecases/MarkUseCase'; +@injectable() export default class MarkController { - private markUseCase: MarkUseCase; - - constructor({ - markUseCase = new MarkUseCase(), - } = {}) { - this.markUseCase = markUseCase; + constructor( + private markUseCase: MarkUseCase, + ) { } scrollTo(message: messages.TabScrollToMessage) { diff --git a/src/content/controllers/MarkKeyController.ts b/src/content/controllers/MarkKeyController.ts index 395dee3..886e5ff 100644 --- a/src/content/controllers/MarkKeyController.ts +++ b/src/content/controllers/MarkKeyController.ts @@ -1,18 +1,14 @@ +import { injectable } from 'tsyringe'; import MarkUseCase from '../usecases/MarkUseCase'; import MarkKeyyUseCase from '../usecases/MarkKeyUseCase'; import Key from '../domains/Key'; +@injectable() export default class MarkKeyController { - private markUseCase: MarkUseCase; - - private markKeyUseCase: MarkKeyyUseCase; - - constructor({ - markUseCase = new MarkUseCase(), - markKeyUseCase = new MarkKeyyUseCase(), - } = {}) { - this.markUseCase = markUseCase; - this.markKeyUseCase = markKeyUseCase; + constructor( + private markUseCase: MarkUseCase, + private markKeyUseCase: MarkKeyyUseCase, + ) { } press(key: Key): boolean { diff --git a/src/content/controllers/SettingController.ts b/src/content/controllers/SettingController.ts index f0e770b..7fb045b 100644 --- a/src/content/controllers/SettingController.ts +++ b/src/content/controllers/SettingController.ts @@ -1,20 +1,17 @@ +import { injectable } from 'tsyringe'; import AddonEnabledUseCase from '../usecases/AddonEnabledUseCase'; import SettingUseCase from '../usecases/SettingUseCase'; import * as blacklists from '../../shared/blacklists'; import * as messages from '../../shared/messages'; +@injectable() export default class SettingController { - private addonEnabledUseCase: AddonEnabledUseCase; - private settingUseCase: SettingUseCase; - - constructor({ - addonEnabledUseCase = new AddonEnabledUseCase(), - settingUseCase = new SettingUseCase(), - } = {}) { - this.addonEnabledUseCase = addonEnabledUseCase; - this.settingUseCase = settingUseCase; + constructor( + private addonEnabledUseCase: AddonEnabledUseCase, + private settingUseCase: SettingUseCase, + ) { } async initSettings(): Promise { diff --git a/src/content/di.ts b/src/content/di.ts new file mode 100644 index 0000000..a890666 --- /dev/null +++ b/src/content/di.ts @@ -0,0 +1,52 @@ +/* eslint-disable max-len */ + +import { FollowMasterClientImpl } from './client/FollowMasterClient'; +import { AddonIndicatorClientImpl } from './client/AddonIndicatorClient'; +import { AddonEnabledRepositoryImpl } from './repositories/AddonEnabledRepository'; +import { ClipboardRepositoryImpl } from './repositories/ClipboardRepository'; +import { SettingRepositoryImpl } from './repositories/SettingRepository'; +import { TabsClientImpl } from './client/TabsClient'; +import { ConsoleClientImpl } from './client/ConsoleClient'; +import { ConsoleFramePresenterImpl } from './presenters/ConsoleFramePresenter'; +import { FindMasterClientImpl } from './client/FindMasterClient'; +import { FindPresenterImpl } from './presenters/FindPresenter'; +import { FindRepositoryImpl } from './repositories/FindRepository'; +import { FindClientImpl } from './client/FindClient'; +import { FocusPresenterImpl } from './presenters/FocusPresenter'; +import { FollowKeyRepositoryImpl } from './repositories/FollowKeyRepository'; +import { FollowMasterRepositoryImpl } from './repositories/FollowMasterRepository'; +import { FollowSlaveRepositoryImpl } from './repositories/FollowSlaveRepository'; +import { FollowPresenterImpl } from './presenters/FollowPresenter'; +import { KeymapRepositoryImpl } from './repositories/KeymapRepository'; +import { MarkKeyRepositoryImpl } from './repositories/MarkKeyRepository'; +import { ScrollPresenterImpl } from './presenters/ScrollPresenter'; +import { MarkClientImpl } from './client/MarkClient'; +import { MarkRepositoryImpl } from './repositories/MarkRepository'; +import { NavigationPresenterImpl } from './presenters/NavigationPresenter'; +import { SettingClientImpl } from './client/SettingClient'; +import { container } from 'tsyringe'; + +container.register('FollowMasterClient', { useValue: new FollowMasterClientImpl(window.top) }); +container.register('AddonIndicatorClient', { useClass: AddonIndicatorClientImpl }); +container.register('AddonEnabledRepository', { useClass: AddonEnabledRepositoryImpl }); +container.register('ClipboardRepository', { useClass: ClipboardRepositoryImpl }); +container.register('SettingRepository', { useClass: SettingRepositoryImpl }); +container.register('TabsClient', { useClass: TabsClientImpl }); +container.register('ConsoleClient', { useClass: ConsoleClientImpl }); +container.register('ConsoleFramePresenter', { useClass: ConsoleFramePresenterImpl }); +container.register('FindMasterClient', { useClass: FindMasterClientImpl }); +container.register('FindPresenter', { useClass: FindPresenterImpl }); +container.register('FindRepository', { useClass: FindRepositoryImpl }); +container.register('FindClient', { useClass: FindClientImpl }); +container.register('FocusPresenter', { useClass: FocusPresenterImpl }); +container.register('FollowKeyRepository', { useClass: FollowKeyRepositoryImpl }); +container.register('FollowMasterRepository', { useClass: FollowMasterRepositoryImpl }); +container.register('FollowSlaveRepository', { useClass: FollowSlaveRepositoryImpl }); +container.register('FollowPresenter', { useClass: FollowPresenterImpl }); +container.register('KeymapRepository', { useClass: KeymapRepositoryImpl }); +container.register('MarkKeyRepository', { useClass: MarkKeyRepositoryImpl }); +container.register('ScrollPresenter', { useClass: ScrollPresenterImpl }); +container.register('MarkClient', { useClass: MarkClientImpl }); +container.register('MarkRepository', { useClass: MarkRepositoryImpl }); +container.register('NavigationPresenter', { useClass: NavigationPresenterImpl }); +container.register('SettingClient', { useClass: SettingClientImpl }); diff --git a/src/content/index.ts b/src/content/index.ts index 660ebf5..5b9b92c 100644 --- a/src/content/index.ts +++ b/src/content/index.ts @@ -1,15 +1,19 @@ -import { ConsoleFramePresenterImpl } from './presenters/ConsoleFramePresenter'; +import 'reflect-metadata'; + +import Application from './Application'; import consoleFrameStyle from './site-style'; -import * as routes from './routes'; +import { ConsoleFramePresenterImpl } from './presenters/ConsoleFramePresenter'; +import { container } from 'tsyringe'; +import './di'; if (window.self === window.top) { - routes.routeMasterComponents(); - new ConsoleFramePresenterImpl().initialize(); } -routes.routeComponents(); - +try { + let app = container.resolve(Application); + app.run(); +} catch (e) { console.error(e); } let style = window.document.createElement('style'); style.textContent = consoleFrameStyle; diff --git a/src/content/routes.ts b/src/content/routes.ts deleted file mode 100644 index 0bce4f5..0000000 --- a/src/content/routes.ts +++ /dev/null @@ -1,97 +0,0 @@ -import MessageListener from './MessageListener'; -import FindController from './controllers/FindController'; -import MarkController from './controllers/MarkController'; -import FollowMasterController from './controllers/FollowMasterController'; -import FollowSlaveController from './controllers/FollowSlaveController'; -import FollowKeyController from './controllers/FollowKeyController'; -import InputDriver from './InputDriver'; -import KeymapController from './controllers/KeymapController'; -import AddonEnabledUseCase from './usecases/AddonEnabledUseCase'; -import MarkKeyController from './controllers/MarkKeyController'; -import AddonEnabledController from './controllers/AddonEnabledController'; -import SettingController from './controllers/SettingController'; -import ConsoleFrameController from './controllers/ConsoleFrameController'; -import * as messages from '../shared/messages'; - -export const routeComponents = () => { - let listener = new MessageListener(); - - let followSlaveController = new FollowSlaveController(); - listener.onWebMessage((message: messages.Message) => { - switch (message.type) { - case messages.FOLLOW_REQUEST_COUNT_TARGETS: - return followSlaveController.countTargets(message); - case messages.FOLLOW_CREATE_HINTS: - return followSlaveController.createHints(message); - case messages.FOLLOW_SHOW_HINTS: - return followSlaveController.showHints(message); - case messages.FOLLOW_ACTIVATE: - return followSlaveController.activate(message); - case messages.FOLLOW_REMOVE_HINTS: - return followSlaveController.clear(message); - } - return undefined; - }); - - let keymapController = new KeymapController(); - let markKeyController = new MarkKeyController(); - let followKeyController = new FollowKeyController(); - let inputDriver = new InputDriver(document.body); - inputDriver.onKey(key => followKeyController.press(key)); - inputDriver.onKey(key => markKeyController.press(key)); - inputDriver.onKey(key => keymapController.press(key)); - - let settingController = new SettingController(); - settingController.initSettings(); - - listener.onBackgroundMessage((message: messages.Message): any => { - let addonEnabledUseCase = new AddonEnabledUseCase(); - - switch (message.type) { - case messages.SETTINGS_CHANGED: - return settingController.reloadSettings(message); - case messages.ADDON_TOGGLE_ENABLED: - return addonEnabledUseCase.toggle(); - } - }); -}; - -export const routeMasterComponents = () => { - let listener = new MessageListener(); - - let findController = new FindController(); - let followMasterController = new FollowMasterController(); - let markController = new MarkController(); - let addonEnabledController = new AddonEnabledController(); - let consoleFrameController = new ConsoleFrameController(); - - listener.onWebMessage((message: messages.Message, sender: Window) => { - switch (message.type) { - case messages.CONSOLE_ENTER_FIND: - return findController.start(message); - case messages.FIND_NEXT: - return findController.next(message); - case messages.FIND_PREV: - return findController.prev(message); - case messages.CONSOLE_UNFOCUS: - return consoleFrameController.unfocus(message); - case messages.FOLLOW_START: - return followMasterController.followStart(message); - case messages.FOLLOW_RESPONSE_COUNT_TARGETS: - return followMasterController.responseCountTargets(message, sender); - case messages.FOLLOW_KEY_PRESS: - return followMasterController.keyPress(message); - } - return undefined; - }); - - listener.onBackgroundMessage((message: messages.Message) => { - switch (message.type) { - case messages.ADDON_ENABLED_QUERY: - return addonEnabledController.getAddonEnabled(message); - case messages.TAB_SCROLL_TO: - return markController.scrollTo(message); - } - return undefined; - }); -}; diff --git a/src/content/usecases/AddonEnabledUseCase.ts b/src/content/usecases/AddonEnabledUseCase.ts index e9ce0a6..2d6fa11 100644 --- a/src/content/usecases/AddonEnabledUseCase.ts +++ b/src/content/usecases/AddonEnabledUseCase.ts @@ -1,19 +1,17 @@ -import AddonIndicatorClient, { AddonIndicatorClientImpl } - from '../client/AddonIndicatorClient'; -import AddonEnabledRepository, { AddonEnabledRepositoryImpl } - from '../repositories/AddonEnabledRepository'; +import { injectable, inject } from 'tsyringe'; +import AddonIndicatorClient from '../client/AddonIndicatorClient'; +import AddonEnabledRepository from '../repositories/AddonEnabledRepository'; +@injectable() export default class AddonEnabledUseCase { - private indicator: AddonIndicatorClient; - private repository: AddonEnabledRepository; + constructor( + @inject('AddonIndicatorClient') + private indicator: AddonIndicatorClient, - constructor({ - indicator = new AddonIndicatorClientImpl(), - repository = new AddonEnabledRepositoryImpl(), - } = {}) { - this.indicator = indicator; - this.repository = repository; + @inject('AddonEnabledRepository') + private repository: AddonEnabledRepository, + ) { } async enable(): Promise { diff --git a/src/content/usecases/ClipboardUseCase.ts b/src/content/usecases/ClipboardUseCase.ts index b2ece2f..8c4d621 100644 --- a/src/content/usecases/ClipboardUseCase.ts +++ b/src/content/usecases/ClipboardUseCase.ts @@ -1,31 +1,18 @@ +import { injectable, inject } from 'tsyringe'; import * as urls from '../../shared/urls'; -import ClipboardRepository, { ClipboardRepositoryImpl } - from '../repositories/ClipboardRepository'; -import SettingRepository, { SettingRepositoryImpl } - from '../repositories/SettingRepository'; -import TabsClient, { TabsClientImpl } - from '../client/TabsClient'; -import ConsoleClient, { ConsoleClientImpl } from '../client/ConsoleClient'; +import ClipboardRepository from '../repositories/ClipboardRepository'; +import SettingRepository from '../repositories/SettingRepository'; +import TabsClient from '../client/TabsClient'; +import ConsoleClient from '../client/ConsoleClient'; +@injectable() export default class ClipboardUseCase { - private repository: ClipboardRepository; - - private settingRepository: SettingRepository; - - private client: TabsClient; - - private consoleClient: ConsoleClient; - - constructor({ - repository = new ClipboardRepositoryImpl(), - settingRepository = new SettingRepositoryImpl(), - client = new TabsClientImpl(), - consoleClient = new ConsoleClientImpl(), - } = {}) { - this.repository = repository; - this.settingRepository = settingRepository; - this.client = client; - this.consoleClient = consoleClient; + constructor( + @inject('ClipboardRepository') private repository: ClipboardRepository, + @inject('SettingRepository') private settingRepository: SettingRepository, + @inject('TabsClient') private client: TabsClient, + @inject('ConsoleClient') private consoleClient: ConsoleClient, + ) { } async yankCurrentURL(): Promise { diff --git a/src/content/usecases/ConsoleFrameUseCase.ts b/src/content/usecases/ConsoleFrameUseCase.ts index b4c756c..3c4b0a1 100644 --- a/src/content/usecases/ConsoleFrameUseCase.ts +++ b/src/content/usecases/ConsoleFrameUseCase.ts @@ -1,13 +1,12 @@ -import ConsoleFramePresenter, { ConsoleFramePresenterImpl } - from '../presenters/ConsoleFramePresenter'; +import { injectable, inject } from 'tsyringe'; +import ConsoleFramePresenter from '../presenters/ConsoleFramePresenter'; +@injectable() export default class ConsoleFrameUseCase { - private consoleFramePresenter: ConsoleFramePresenter; - - constructor({ - consoleFramePresenter = new ConsoleFramePresenterImpl(), - } = {}) { - this.consoleFramePresenter = consoleFramePresenter; + constructor( + @inject('ConsoleFramePresenter') + private consoleFramePresenter: ConsoleFramePresenter, + ) { } unfocus() { diff --git a/src/content/usecases/FindSlaveUseCase.ts b/src/content/usecases/FindSlaveUseCase.ts index b733cbd..0a5c2ce 100644 --- a/src/content/usecases/FindSlaveUseCase.ts +++ b/src/content/usecases/FindSlaveUseCase.ts @@ -1,13 +1,11 @@ -import FindMasterClient, { FindMasterClientImpl } - from '../client/FindMasterClient'; +import { injectable, inject } from 'tsyringe'; +import FindMasterClient from '../client/FindMasterClient'; +@injectable() export default class FindSlaveUseCase { - private findMasterClient: FindMasterClient; - - constructor({ - findMasterClient = new FindMasterClientImpl(), - } = {}) { - this.findMasterClient = findMasterClient; + constructor( + @inject('FindMasterClient') private findMasterClient: FindMasterClient, + ) { } findNext() { diff --git a/src/content/usecases/FindUseCase.ts b/src/content/usecases/FindUseCase.ts index 74cbc97..88b516c 100644 --- a/src/content/usecases/FindUseCase.ts +++ b/src/content/usecases/FindUseCase.ts @@ -1,28 +1,17 @@ -import FindPresenter, { FindPresenterImpl } from '../presenters/FindPresenter'; -import FindRepository, { FindRepositoryImpl } - from '../repositories/FindRepository'; -import FindClient, { FindClientImpl } from '../client/FindClient'; -import ConsoleClient, { ConsoleClientImpl } from '../client/ConsoleClient'; +import { injectable, inject } from 'tsyringe'; +import FindPresenter from '../presenters/FindPresenter'; +import FindRepository from '../repositories/FindRepository'; +import FindClient from '../client/FindClient'; +import ConsoleClient from '../client/ConsoleClient'; +@injectable() export default class FindUseCase { - private presenter: FindPresenter; - - private repository: FindRepository; - - private client: FindClient; - - private consoleClient: ConsoleClient; - - constructor({ - presenter = new FindPresenterImpl() as FindPresenter, - repository = new FindRepositoryImpl(), - client = new FindClientImpl(), - consoleClient = new ConsoleClientImpl(), - } = {}) { - this.presenter = presenter; - this.repository = repository; - this.client = client; - this.consoleClient = consoleClient; + constructor( + @inject('FindPresenter') private presenter: FindPresenter, + @inject('FindRepository') private repository: FindRepository, + @inject('FindClient') private client: FindClient, + @inject('ConsoleClient') private consoleClient: ConsoleClient, + ) { } async startFind(keyword?: string): Promise { diff --git a/src/content/usecases/FocusUseCase.ts b/src/content/usecases/FocusUseCase.ts index 0ad4021..0158672 100644 --- a/src/content/usecases/FocusUseCase.ts +++ b/src/content/usecases/FocusUseCase.ts @@ -1,13 +1,11 @@ -import FocusPresenter, { FocusPresenterImpl } - from '../presenters/FocusPresenter'; +import { injectable, inject } from 'tsyringe'; +import FocusPresenter from '../presenters/FocusPresenter'; +@injectable() export default class FocusUseCases { - private presenter: FocusPresenter; - - constructor({ - presenter = new FocusPresenterImpl(), - } = {}) { - this.presenter = presenter; + constructor( + @inject('FocusPresenter') private presenter: FocusPresenter, + ) { } focusFirstInput() { diff --git a/src/content/usecases/FollowMasterUseCase.ts b/src/content/usecases/FollowMasterUseCase.ts index 9cbb790..38c41b7 100644 --- a/src/content/usecases/FollowMasterUseCase.ts +++ b/src/content/usecases/FollowMasterUseCase.ts @@ -1,31 +1,26 @@ -import FollowKeyRepository, { FollowKeyRepositoryImpl } - from '../repositories/FollowKeyRepository'; -import FollowMasterRepository, { FollowMasterRepositoryImpl } - from '../repositories/FollowMasterRepository'; +import { injectable, inject } from 'tsyringe'; +import FollowKeyRepository from '../repositories/FollowKeyRepository'; +import FollowMasterRepository from '../repositories/FollowMasterRepository'; import FollowSlaveClient, { FollowSlaveClientImpl } from '../client/FollowSlaveClient'; +import SettingRepository from '../repositories/SettingRepository'; import HintKeyProducer from './HintKeyProducer'; -import SettingRepository, { SettingRepositoryImpl } - from '../repositories/SettingRepository'; +@injectable() export default class FollowMasterUseCase { - private followKeyRepository: FollowKeyRepository; - - private followMasterRepository: FollowMasterRepository; - - private settingRepository: SettingRepository; - // TODO Make repository private producer: HintKeyProducer | null; - constructor({ - followKeyRepository = new FollowKeyRepositoryImpl(), - followMasterRepository = new FollowMasterRepositoryImpl(), - settingRepository = new SettingRepositoryImpl(), - } = {}) { - this.followKeyRepository = followKeyRepository; - this.followMasterRepository = followMasterRepository; - this.settingRepository = settingRepository; + constructor( + @inject('FollowKeyRepository') + private followKeyRepository: FollowKeyRepository, + + @inject('FollowMasterRepository') + private followMasterRepository: FollowMasterRepository, + + @inject('SettingRepository') + private settingRepository: SettingRepository, + ) { this.producer = null; } diff --git a/src/content/usecases/FollowSlaveUseCase.ts b/src/content/usecases/FollowSlaveUseCase.ts index eb011de..a2cc80e 100644 --- a/src/content/usecases/FollowSlaveUseCase.ts +++ b/src/content/usecases/FollowSlaveUseCase.ts @@ -1,11 +1,9 @@ -import FollowSlaveRepository, { FollowSlaveRepositoryImpl } - from '../repositories/FollowSlaveRepository'; -import FollowPresenter, { FollowPresenterImpl } - from '../presenters/FollowPresenter'; -import TabsClient, { TabsClientImpl } from '../client/TabsClient'; +import { injectable, inject } from 'tsyringe'; +import FollowSlaveRepository from '../repositories/FollowSlaveRepository'; +import FollowPresenter from '../presenters/FollowPresenter'; +import TabsClient from '../client/TabsClient'; +import FollowMasterClient from '../client/FollowMasterClient'; import { LinkHint, InputHint } from '../presenters/Hint'; -import FollowMasterClient, { FollowMasterClientImpl } - from '../client/FollowMasterClient'; import Key from '../domains/Key'; interface Size { @@ -18,25 +16,21 @@ interface Point { y: number; } +@injectable() export default class FollowSlaveUseCase { - private presenter: FollowPresenter; + constructor( + @inject('FollowPresenter') + private presenter: FollowPresenter, - private tabsClient: TabsClient; + @inject('TabsClient') + private tabsClient: TabsClient, - private followMasterClient: FollowMasterClient; + @inject('FollowMasterClient') + private followMasterClient: FollowMasterClient, - private followSlaveRepository: FollowSlaveRepository; - - constructor({ - presenter = new FollowPresenterImpl(), - tabsClient = new TabsClientImpl(), - followMasterClient = new FollowMasterClientImpl(window.top), - followSlaveRepository = new FollowSlaveRepositoryImpl(), - } = {}) { - this.presenter = presenter; - this.tabsClient = tabsClient; - this.followMasterClient = followMasterClient; - this.followSlaveRepository = followSlaveRepository; + @inject('FollowSlaveRepository') + private followSlaveRepository: FollowSlaveRepository, + ) { } countTargets(viewSize: Size, framePosition: Point): void { diff --git a/src/content/usecases/KeymapUseCase.ts b/src/content/usecases/KeymapUseCase.ts index af0ad77..d0d039a 100644 --- a/src/content/usecases/KeymapUseCase.ts +++ b/src/content/usecases/KeymapUseCase.ts @@ -1,10 +1,7 @@ -import KeymapRepository, { KeymapRepositoryImpl } - from '../repositories/KeymapRepository'; -import SettingRepository, { SettingRepositoryImpl } - from '../repositories/SettingRepository'; -import AddonEnabledRepository, { AddonEnabledRepositoryImpl } - from '../repositories/AddonEnabledRepository'; - +import { injectable, inject } from 'tsyringe'; +import KeymapRepository from '../repositories/KeymapRepository'; +import SettingRepository from '../repositories/SettingRepository'; +import AddonEnabledRepository from '../repositories/AddonEnabledRepository'; import * as operations from '../../shared/operations'; import { Keymaps } from '../../shared/Settings'; import Key from '../domains/Key'; @@ -17,22 +14,18 @@ const reservedKeymaps: Keymaps = { '': { type: operations.CANCEL }, }; - +@injectable() export default class KeymapUseCase { - private repository: KeymapRepository; - - private settingRepository: SettingRepository; + constructor( + @inject('KeymapRepository') + private repository: KeymapRepository, - private addonEnabledRepository: AddonEnabledRepository; + @inject('SettingRepository') + private settingRepository: SettingRepository, - constructor({ - repository = new KeymapRepositoryImpl(), - settingRepository = new SettingRepositoryImpl(), - addonEnabledRepository = new AddonEnabledRepositoryImpl(), - } = {}) { - this.repository = repository; - this.settingRepository = settingRepository; - this.addonEnabledRepository = addonEnabledRepository; + @inject('AddonEnabledRepository') + private addonEnabledRepository: AddonEnabledRepository, + ) { } nextOp(key: Key): operations.Operation | null { diff --git a/src/content/usecases/MarkKeyUseCase.ts b/src/content/usecases/MarkKeyUseCase.ts index c0aa655..6cef6f2 100644 --- a/src/content/usecases/MarkKeyUseCase.ts +++ b/src/content/usecases/MarkKeyUseCase.ts @@ -1,13 +1,11 @@ -import MarkKeyRepository, { MarkKeyRepositoryImpl } - from '../repositories/MarkKeyRepository'; +import { injectable, inject } from 'tsyringe'; +import MarkKeyRepository from '../repositories/MarkKeyRepository'; +@injectable() export default class MarkKeyUseCase { - private repository: MarkKeyRepository; - - constructor({ - repository = new MarkKeyRepositoryImpl() - } = {}) { - this.repository = repository; + constructor( + @inject('MarkKeyRepository') private repository: MarkKeyRepository, + ) { } isSetMode(): boolean { diff --git a/src/content/usecases/MarkUseCase.ts b/src/content/usecases/MarkUseCase.ts index 530f141..a7d5ad8 100644 --- a/src/content/usecases/MarkUseCase.ts +++ b/src/content/usecases/MarkUseCase.ts @@ -1,35 +1,19 @@ -import ScrollPresenter, { ScrollPresenterImpl } - from '../presenters/ScrollPresenter'; -import MarkClient, { MarkClientImpl } from '../client/MarkClient'; -import MarkRepository, { MarkRepositoryImpl } - from '../repositories/MarkRepository'; -import SettingRepository, { SettingRepositoryImpl } - from '../repositories/SettingRepository'; -import ConsoleClient, { ConsoleClientImpl } from '../client/ConsoleClient'; - +import { injectable, inject } from 'tsyringe'; +import ScrollPresenter from '../presenters/ScrollPresenter'; +import MarkClient from '../client/MarkClient'; +import MarkRepository from '../repositories/MarkRepository'; +import SettingRepository from '../repositories/SettingRepository'; +import ConsoleClient from '../client/ConsoleClient'; + +@injectable() export default class MarkUseCase { - private scrollPresenter: ScrollPresenter; - - private client: MarkClient; - - private repository: MarkRepository; - - private settingRepository: SettingRepository; - - private consoleClient: ConsoleClient; - - constructor({ - scrollPresenter = new ScrollPresenterImpl(), - client = new MarkClientImpl(), - repository = new MarkRepositoryImpl(), - settingRepository = new SettingRepositoryImpl(), - consoleClient = new ConsoleClientImpl(), - } = {}) { - this.scrollPresenter = scrollPresenter; - this.client = client; - this.repository = repository; - this.settingRepository = settingRepository; - this.consoleClient = consoleClient; + constructor( + @inject('ScrollPresenter') private scrollPresenter: ScrollPresenter, + @inject('MarkClient') private client: MarkClient, + @inject('MarkRepository') private repository: MarkRepository, + @inject('SettingRepository') private settingRepository: SettingRepository, + @inject('ConsoleClient') private consoleClient: ConsoleClient, + ) { } async set(key: string): Promise { diff --git a/src/content/usecases/NavigateUseCase.ts b/src/content/usecases/NavigateUseCase.ts index 6f82d3f..4711c5e 100644 --- a/src/content/usecases/NavigateUseCase.ts +++ b/src/content/usecases/NavigateUseCase.ts @@ -1,13 +1,12 @@ -import NavigationPresenter, { NavigationPresenterImpl } - from '../presenters/NavigationPresenter'; +import { injectable, inject } from 'tsyringe'; +import NavigationPresenter from '../presenters/NavigationPresenter'; +@injectable() export default class NavigateUseCase { - private navigationPresenter: NavigationPresenter; - - constructor({ - navigationPresenter = new NavigationPresenterImpl(), - } = {}) { - this.navigationPresenter = navigationPresenter; + constructor( + @inject('NavigationPresenter') + private navigationPresenter: NavigationPresenter, + ) { } openHistoryPrev(): void { diff --git a/src/content/usecases/ScrollUseCase.ts b/src/content/usecases/ScrollUseCase.ts index 6a1f801..32cbef1 100644 --- a/src/content/usecases/ScrollUseCase.ts +++ b/src/content/usecases/ScrollUseCase.ts @@ -1,19 +1,13 @@ -import ScrollPresenter, { ScrollPresenterImpl } - from '../presenters/ScrollPresenter'; -import SettingRepository, { SettingRepositoryImpl } - from '../repositories/SettingRepository'; +import { injectable, inject } from 'tsyringe'; +import ScrollPresenter from '../presenters/ScrollPresenter'; +import SettingRepository from '../repositories/SettingRepository'; +@injectable() export default class ScrollUseCase { - private presenter: ScrollPresenter; - - private settingRepository: SettingRepository; - - constructor({ - presenter = new ScrollPresenterImpl(), - settingRepository = new SettingRepositoryImpl(), - } = {}) { - this.presenter = presenter; - this.settingRepository = settingRepository; + constructor( + @inject('ScrollPresenter') private presenter: ScrollPresenter, + @inject('SettingRepository') private settingRepository: SettingRepository, + ) { } scrollVertically(count: number): void { diff --git a/src/content/usecases/SettingUseCase.ts b/src/content/usecases/SettingUseCase.ts index 765cb45..d5f66c6 100644 --- a/src/content/usecases/SettingUseCase.ts +++ b/src/content/usecases/SettingUseCase.ts @@ -1,19 +1,14 @@ -import SettingRepository, { SettingRepositoryImpl } - from '../repositories/SettingRepository'; -import SettingClient, { SettingClientImpl } from '../client/SettingClient'; +import { injectable, inject } from 'tsyringe'; +import SettingRepository from '../repositories/SettingRepository'; +import SettingClient from '../client/SettingClient'; import Settings from '../../shared/Settings'; +@injectable() export default class SettingUseCase { - private repository: SettingRepository; - - private client: SettingClient; - - constructor({ - repository = new SettingRepositoryImpl(), - client = new SettingClientImpl(), - } = {}) { - this.repository = repository; - this.client = client; + constructor( + @inject('SettingRepository') private repository: SettingRepository, + @inject('SettingClient') private client: SettingClient, + ) { } async reload(): Promise { diff --git a/test/content/usecases/AddonEnabledUseCase.test.ts b/test/content/usecases/AddonEnabledUseCase.test.ts index 912bddf..8c15099 100644 --- a/test/content/usecases/AddonEnabledUseCase.test.ts +++ b/test/content/usecases/AddonEnabledUseCase.test.ts @@ -40,7 +40,7 @@ describe('AddonEnabledUseCase', () => { beforeEach(() => { repository = new MockAddonEnabledRepository(true); indicator = new MockAddonIndicatorClient(false); - sut = new AddonEnabledUseCase({ repository, indicator }); + sut = new AddonEnabledUseCase(indicator, repository); }); describe('#enable', () => { diff --git a/test/content/usecases/ClipboardUseCase.test.ts b/test/content/usecases/ClipboardUseCase.test.ts index 862ee8a..551c3f7 100644 --- a/test/content/usecases/ClipboardUseCase.test.ts +++ b/test/content/usecases/ClipboardUseCase.test.ts @@ -1,4 +1,5 @@ import ClipboardRepository from '../../../src/content/repositories/ClipboardRepository'; +import { SettingRepositoryImpl } from '../../../src/content/repositories/SettingRepository'; import TabsClient from '../../../src/content/client/TabsClient'; import MockConsoleClient from '../mock/MockConsoleClient'; import ClipboardUseCase from '../../../src/content/usecases/ClipboardUseCase'; @@ -43,7 +44,12 @@ describe('ClipboardUseCase', () => { repository = new MockClipboardRepository(); client = new MockTabsClient(); consoleClient = new MockConsoleClient(); - sut = new ClipboardUseCase({ repository, client: client, consoleClient }); + sut = new ClipboardUseCase( + repository, + new SettingRepositoryImpl(), + client, + consoleClient + ); }); describe('#yankCurrentURL', () => { diff --git a/test/content/usecases/FindUseCase.test.ts b/test/content/usecases/FindUseCase.test.ts index c7bfd39..ddd4cd4 100644 --- a/test/content/usecases/FindUseCase.test.ts +++ b/test/content/usecases/FindUseCase.test.ts @@ -71,7 +71,7 @@ describe('FindUseCase', () => { presenter = new MockFindPresenter(); client = new MockFindClient(); consoleClient = new MockConsoleClient(); - sut = new FindUseCase({ repository, presenter, client, consoleClient }); + sut = new FindUseCase(presenter, repository, client, consoleClient); }); describe('#startFind', () => { diff --git a/test/content/usecases/MarkUseCase.test.ts b/test/content/usecases/MarkUseCase.test.ts index 4f2dee4..494497a 100644 --- a/test/content/usecases/MarkUseCase.test.ts +++ b/test/content/usecases/MarkUseCase.test.ts @@ -1,4 +1,5 @@ import MarkRepository from '../../../src/content/repositories/MarkRepository'; +import { SettingRepositoryImpl } from '../../../src/content/repositories/SettingRepository'; import MarkUseCase from '../../../src/content/usecases/MarkUseCase'; import MarkClient from '../../../src/content/client/MarkClient'; import MockConsoleClient from '../mock/MockConsoleClient'; @@ -54,9 +55,13 @@ describe('MarkUseCase', () => { client = new MockMarkClient(); consoleClient = new MockConsoleClient(); scrollPresenter = new MockScrollPresenter(); - sut = new MarkUseCase({ - repository, client, consoleClient, scrollPresenter, - }); + sut = new MarkUseCase( + scrollPresenter, + client, + repository, + new SettingRepositoryImpl(), + consoleClient, + ); }); describe('#set', () => { diff --git a/test/content/usecases/SettingUseCaase.test.ts b/test/content/usecases/SettingUseCaase.test.ts index 02cef78..e9633f4 100644 --- a/test/content/usecases/SettingUseCaase.test.ts +++ b/test/content/usecases/SettingUseCaase.test.ts @@ -56,7 +56,7 @@ describe('AddonEnabledUseCase', () => { repository = new MockSettingRepository(); client = new MockSettingClient(testSettings); - sut = new SettingUseCase({ repository, client }); + sut = new SettingUseCase(repository, client); }); describe('#reload', () => { From b60a085a2c1e000772e3a62f187196db21137db5 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Tue, 21 May 2019 21:12:11 +0900 Subject: [PATCH 11/12] FollowSlaveClient as a factory pattern --- .../client/FollowSlaveClientFactory.ts | 13 ++++++++ src/content/di.ts | 32 ++++++++++--------- src/content/usecases/FollowMasterUseCase.ts | 17 ++++++---- 3 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 src/content/client/FollowSlaveClientFactory.ts diff --git a/src/content/client/FollowSlaveClientFactory.ts b/src/content/client/FollowSlaveClientFactory.ts new file mode 100644 index 0000000..cd331d4 --- /dev/null +++ b/src/content/client/FollowSlaveClientFactory.ts @@ -0,0 +1,13 @@ +import FollowSlaveClient, { FollowSlaveClientImpl } from './FollowSlaveClient'; + +export default interface FollowSlaveClientFactory { + create(window: Window): FollowSlaveClient; + + // eslint-disable-next-line semi +} + +export class FollowSlaveClientFactoryImpl implements FollowSlaveClientFactory { + create(window: Window): FollowSlaveClient { + return new FollowSlaveClientImpl(window); + } +} diff --git a/src/content/di.ts b/src/content/di.ts index a890666..23be027 100644 --- a/src/content/di.ts +++ b/src/content/di.ts @@ -1,52 +1,54 @@ /* eslint-disable max-len */ -import { FollowMasterClientImpl } from './client/FollowMasterClient'; -import { AddonIndicatorClientImpl } from './client/AddonIndicatorClient'; import { AddonEnabledRepositoryImpl } from './repositories/AddonEnabledRepository'; +import { AddonIndicatorClientImpl } from './client/AddonIndicatorClient'; import { ClipboardRepositoryImpl } from './repositories/ClipboardRepository'; -import { SettingRepositoryImpl } from './repositories/SettingRepository'; -import { TabsClientImpl } from './client/TabsClient'; import { ConsoleClientImpl } from './client/ConsoleClient'; import { ConsoleFramePresenterImpl } from './presenters/ConsoleFramePresenter'; +import { FindClientImpl } from './client/FindClient'; import { FindMasterClientImpl } from './client/FindMasterClient'; import { FindPresenterImpl } from './presenters/FindPresenter'; import { FindRepositoryImpl } from './repositories/FindRepository'; -import { FindClientImpl } from './client/FindClient'; import { FocusPresenterImpl } from './presenters/FocusPresenter'; import { FollowKeyRepositoryImpl } from './repositories/FollowKeyRepository'; +import { FollowMasterClientImpl } from './client/FollowMasterClient'; import { FollowMasterRepositoryImpl } from './repositories/FollowMasterRepository'; -import { FollowSlaveRepositoryImpl } from './repositories/FollowSlaveRepository'; import { FollowPresenterImpl } from './presenters/FollowPresenter'; +import { FollowSlaveClientFactoryImpl } from './client/FollowSlaveClientFactory'; +import { FollowSlaveRepositoryImpl } from './repositories/FollowSlaveRepository'; import { KeymapRepositoryImpl } from './repositories/KeymapRepository'; -import { MarkKeyRepositoryImpl } from './repositories/MarkKeyRepository'; -import { ScrollPresenterImpl } from './presenters/ScrollPresenter'; import { MarkClientImpl } from './client/MarkClient'; +import { MarkKeyRepositoryImpl } from './repositories/MarkKeyRepository'; import { MarkRepositoryImpl } from './repositories/MarkRepository'; import { NavigationPresenterImpl } from './presenters/NavigationPresenter'; +import { ScrollPresenterImpl } from './presenters/ScrollPresenter'; import { SettingClientImpl } from './client/SettingClient'; +import { SettingRepositoryImpl } from './repositories/SettingRepository'; +import { TabsClientImpl } from './client/TabsClient'; import { container } from 'tsyringe'; container.register('FollowMasterClient', { useValue: new FollowMasterClientImpl(window.top) }); -container.register('AddonIndicatorClient', { useClass: AddonIndicatorClientImpl }); container.register('AddonEnabledRepository', { useClass: AddonEnabledRepositoryImpl }); +container.register('AddonIndicatorClient', { useClass: AddonIndicatorClientImpl }); container.register('ClipboardRepository', { useClass: ClipboardRepositoryImpl }); -container.register('SettingRepository', { useClass: SettingRepositoryImpl }); -container.register('TabsClient', { useClass: TabsClientImpl }); container.register('ConsoleClient', { useClass: ConsoleClientImpl }); container.register('ConsoleFramePresenter', { useClass: ConsoleFramePresenterImpl }); +container.register('FindClient', { useClass: FindClientImpl }); container.register('FindMasterClient', { useClass: FindMasterClientImpl }); container.register('FindPresenter', { useClass: FindPresenterImpl }); container.register('FindRepository', { useClass: FindRepositoryImpl }); -container.register('FindClient', { useClass: FindClientImpl }); container.register('FocusPresenter', { useClass: FocusPresenterImpl }); container.register('FollowKeyRepository', { useClass: FollowKeyRepositoryImpl }); container.register('FollowMasterRepository', { useClass: FollowMasterRepositoryImpl }); -container.register('FollowSlaveRepository', { useClass: FollowSlaveRepositoryImpl }); container.register('FollowPresenter', { useClass: FollowPresenterImpl }); +container.register('FollowSlaveClientFactory', { useClass: FollowSlaveClientFactoryImpl }); +container.register('FollowSlaveRepository', { useClass: FollowSlaveRepositoryImpl }); container.register('KeymapRepository', { useClass: KeymapRepositoryImpl }); -container.register('MarkKeyRepository', { useClass: MarkKeyRepositoryImpl }); -container.register('ScrollPresenter', { useClass: ScrollPresenterImpl }); container.register('MarkClient', { useClass: MarkClientImpl }); +container.register('MarkKeyRepository', { useClass: MarkKeyRepositoryImpl }); container.register('MarkRepository', { useClass: MarkRepositoryImpl }); container.register('NavigationPresenter', { useClass: NavigationPresenterImpl }); +container.register('ScrollPresenter', { useClass: ScrollPresenterImpl }); container.register('SettingClient', { useClass: SettingClientImpl }); +container.register('SettingRepository', { useClass: SettingRepositoryImpl }); +container.register('TabsClient', { useClass: TabsClientImpl }); diff --git a/src/content/usecases/FollowMasterUseCase.ts b/src/content/usecases/FollowMasterUseCase.ts index 38c41b7..7d7e875 100644 --- a/src/content/usecases/FollowMasterUseCase.ts +++ b/src/content/usecases/FollowMasterUseCase.ts @@ -1,8 +1,8 @@ import { injectable, inject } from 'tsyringe'; import FollowKeyRepository from '../repositories/FollowKeyRepository'; import FollowMasterRepository from '../repositories/FollowMasterRepository'; -import FollowSlaveClient, { FollowSlaveClientImpl } - from '../client/FollowSlaveClient'; +import FollowSlaveClient from '../client/FollowSlaveClient'; +import FollowSlaveClientFactory from '../client/FollowSlaveClientFactory'; import SettingRepository from '../repositories/SettingRepository'; import HintKeyProducer from './HintKeyProducer'; @@ -20,6 +20,9 @@ export default class FollowMasterUseCase { @inject('SettingRepository') private settingRepository: SettingRepository, + + @inject('FollowSlaveClientFactory') + private followSlaveClientFactory: FollowSlaveClientFactory, ) { this.producer = null; } @@ -33,7 +36,7 @@ export default class FollowMasterUseCase { let viewWidth = window.top.innerWidth; let viewHeight = window.top.innerHeight; - new FollowSlaveClientImpl(window.top).requestHintCount( + this.followSlaveClientFactory.create(window.top).requestHintCount( { width: viewWidth, height: viewHeight }, { x: 0, y: 0 }, ); @@ -42,7 +45,8 @@ export default class FollowMasterUseCase { for (let i = 0; i < frameElements.length; ++i) { let ele = frameElements[i] as HTMLFrameElement | HTMLIFrameElement; let { left: frameX, top: frameY } = ele.getBoundingClientRect(); - new FollowSlaveClientImpl(ele.contentWindow!!).requestHintCount( + let client = this.followSlaveClientFactory.create(ele.contentWindow!!); + client.requestHintCount( { width: viewWidth, height: viewHeight }, { x: frameX, y: frameY }, ); @@ -72,7 +76,8 @@ export default class FollowMasterUseCase { let { left: frameX, top: frameY } = ele.getBoundingClientRect(); pos = { x: frameX, y: frameY }; } - new FollowSlaveClientImpl(sender).createHints( + let client = this.followSlaveClientFactory.create(sender); + client.createHints( { width: viewWidth, height: viewHeight }, pos, produced, @@ -133,7 +138,7 @@ export default class FollowMasterUseCase { private broadcastToSlaves(handler: (client: FollowSlaveClient) => void) { let allFrames = [window.self].concat(Array.from(window.frames as any)); - let clients = allFrames.map(frame => new FollowSlaveClientImpl(frame)); + let clients = allFrames.map(w => this.followSlaveClientFactory.create(w)); for (let client of clients) { handler(client); } From 7be8bc71784b8dedd0fee03dd72dd8936e2f3929 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Tue, 21 May 2019 21:52:03 +0900 Subject: [PATCH 12/12] Disable minify --- webpack.config.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index cb56835..1cd05df 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -17,6 +17,14 @@ config = { filename: '[name].js' }, + optimization: { + minimize: false + }, + + performance: { + hints: false + }, + module: { rules: [ {