diff --git a/src/background/clients/AddonEnabledClient.ts b/src/background/clients/AddonEnabledClient.ts index 004d4654..ded836e5 100644 --- a/src/background/clients/AddonEnabledClient.ts +++ b/src/background/clients/AddonEnabledClient.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { newSender } from "./ContentMessageSender"; export interface AddonEnabledClient { @@ -9,7 +9,7 @@ export interface AddonEnabledClient { export const AddonEnabledClient = Symbol("AddonEnabledClient"); -@injectable() +@provide(AddonEnabledClient) export class AddonEnabledClientImpl implements AddonEnabledClient { async enable(tabId: number): Promise { const sender = newSender(tabId); diff --git a/src/background/clients/ConsoleClient.ts b/src/background/clients/ConsoleClient.ts index e0bb560f..f1b37592 100644 --- a/src/background/clients/ConsoleClient.ts +++ b/src/background/clients/ConsoleClient.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { newSender } from "./ConsoleMessageSender"; export interface ConsoleClient { @@ -15,7 +15,7 @@ export interface ConsoleClient { export const ConsoleClient = Symbol("ConsoleClient"); -@injectable() +@provide(ConsoleClient) export class ConsoleClientImpl implements ConsoleClient { async showCommand(tabId: number, command: string): Promise { const sender = newSender(tabId); diff --git a/src/background/clients/ConsoleFrameClient.ts b/src/background/clients/ConsoleFrameClient.ts index 3462c59b..64a10d9b 100644 --- a/src/background/clients/ConsoleFrameClient.ts +++ b/src/background/clients/ConsoleFrameClient.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { newSender } from "./ContentMessageSender"; export interface ConsoleFrameClient { @@ -7,7 +7,7 @@ export interface ConsoleFrameClient { export const ConsoleFrameClient = Symbol("ConsoleFrameClient"); -@injectable() +@provide(ConsoleFrameClient) export class ConsoleFrameClientImpl implements ConsoleFrameClient { async resize(tabId: number, width: number, height: number): Promise { const sender = newSender(tabId); diff --git a/src/background/clients/ContentMessageClient.ts b/src/background/clients/ContentMessageClient.ts index ae6f5c2a..3f2b539f 100644 --- a/src/background/clients/ContentMessageClient.ts +++ b/src/background/clients/ContentMessageClient.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { newSender } from "./ContentMessageSender"; export interface ContentMessageClient { @@ -42,7 +42,7 @@ export interface ContentMessageClient { export const ContentMessageClient = Symbol("ContentMessageClient"); -@injectable() +@provide(ContentMessageClient) export class ContentMessageClientImpl implements ContentMessageClient { async scrollTo( tabId: number, diff --git a/src/background/clients/FindClient.ts b/src/background/clients/FindClient.ts index 51b59d1c..f56dcce0 100644 --- a/src/background/clients/FindClient.ts +++ b/src/background/clients/FindClient.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { newSender } from "./ContentMessageSender"; import type { FindQuery } from "../../shared/findQuery"; @@ -12,7 +12,7 @@ export interface FindClient { export const FindClient = Symbol("FindClient"); -@injectable() +@provide(FindClient) export class FindClientImpl implements FindClient { async findNext( tabId: number, diff --git a/src/background/clients/FrameClient.ts b/src/background/clients/FrameClient.ts index 4897d989..61c2aa24 100644 --- a/src/background/clients/FrameClient.ts +++ b/src/background/clients/FrameClient.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { newSender } from "./ContentMessageSender"; export interface FrameClient { @@ -7,7 +7,7 @@ export interface FrameClient { export const FrameClient = Symbol("FrameClient"); -@injectable() +@provide(FrameClient) export class FrameClientImpl implements FrameClient { async notifyFrameId(tabId: number, frameId: number): Promise { const sender = newSender(tabId, frameId); diff --git a/src/background/clients/HintClient.ts b/src/background/clients/HintClient.ts index 238d677a..17a48f86 100644 --- a/src/background/clients/HintClient.ts +++ b/src/background/clients/HintClient.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { newSender } from "./ContentMessageSender"; import type { HTMLElementType } from "../../shared/HTMLElementType"; @@ -44,7 +44,7 @@ export interface HintClient { export const HintClient = Symbol("HintClient"); -@injectable() +@provide(HintClient) export class HintClientImpl implements HintClient { async lookupTargets( tabId: number, diff --git a/src/background/clients/ModeClient.ts b/src/background/clients/ModeClient.ts index 742851f0..f77e56ad 100644 --- a/src/background/clients/ModeClient.ts +++ b/src/background/clients/ModeClient.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { newSender } from "./ContentMessageSender"; import type { Mode } from "../../shared/mode"; @@ -8,7 +8,7 @@ export interface ModeClient { export const ModeClient = Symbol("ModeClient"); -@injectable() +@provide(ModeClient) export class ModeClientImpl implements ModeClient { async setMode(tabId: number, mode: Mode): Promise { const sender = newSender(tabId); diff --git a/src/background/clients/NavigateClient.ts b/src/background/clients/NavigateClient.ts index e76ae818..b471b007 100644 --- a/src/background/clients/NavigateClient.ts +++ b/src/background/clients/NavigateClient.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { newSender } from "./ContentMessageSender"; export interface NavigateClient { @@ -13,7 +13,7 @@ export interface NavigateClient { export const NavigateClient = Symbol("NavigateClient"); -@injectable() +@provide(NavigateClient) export class NavigateClientImpl implements NavigateClient { async historyNext(tabId: number): Promise { const sender = newSender(tabId); diff --git a/src/background/clients/TopFrameClient.ts b/src/background/clients/TopFrameClient.ts index 80161d54..266d36ca 100644 --- a/src/background/clients/TopFrameClient.ts +++ b/src/background/clients/TopFrameClient.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { newSender } from "./ContentMessageSender"; export type Rect = { @@ -19,7 +19,7 @@ export interface TopFrameClient { export const TopFrameClient = Symbol("TopFrameClient"); -@injectable() +@provide(TopFrameClient) export class TopFrameClientImpl implements TopFrameClient { getWindowViewport(tabId: number): Promise { const sender = newSender(tabId, 0); diff --git a/src/background/di.ts b/src/background/di.ts index 0ebd0030..54184407 100644 --- a/src/background/di.ts +++ b/src/background/di.ts @@ -1,116 +1,55 @@ /* eslint-disable max-len */ import { Container } from "inversify"; -import { - LastSelectedTabRepository, - LastSelectedTabRepositoryImpl, -} from "./repositories/LastSelectedTabRepository"; -import { Notifier, NotifierImpl } from "./presenters/Notifier"; -import { - ContentMessageClient, - ContentMessageClientImpl, -} from "./clients/ContentMessageClient"; -import { NavigateClient, NavigateClientImpl } from "./clients/NavigateClient"; -import { ConsoleClient, ConsoleClientImpl } from "./clients/ConsoleClient"; +import { buildProviderModule } from "inversify-binding-decorators"; import { BrowserSettingRepository, FirefoxBrowserSettingRepositoryImpl, ChromeBrowserSettingRepositoryImpl, } from "./repositories/BrowserSettingRepository"; -import { - RepeatRepository, - RepeatRepositoryImpl, -} from "./repositories/RepeatRepository"; -import { FindClient, FindClientImpl } from "./clients/FindClient"; -import { - ConsoleFrameClient, - ConsoleFrameClientImpl, -} from "./clients/ConsoleFrameClient"; -import { - FindRepository, - FindRepositoryImpl, -} from "./repositories/FindRepository"; -import { - FindHistoryRepository, - FindHistoryRepositoryImpl, -} from "./repositories/FindHistoryRepository"; -import { - ReadyFrameRepository, - ReadyFrameRepositoryImpl, -} from "./repositories/ReadyFrameRepository"; import { ClipboardRepository, FirefoxClipboardRepositoryImpl, ChromeClipboardRepositoryImpl, } from "./repositories/ClipboardRepository"; -import { - PropertySettings, - PropertySettingsImpl, -} from "./settings/PropertySettings"; -import { StyleSettings, StyleSettingsImpl } from "./settings/StyleSettings"; -import { - SearchEngineSettings, - SearchEngineSettingsImpl, -} from "./settings/SearchEngineSettings"; -import { - ModeRepository, - ModeRepositoryImpl, -} from "./repositories/ModeRepository"; -import { - SettingsRepository, - PermanentSettingsRepository, - TransientSettingsRepositoryImpl, - PermanentSettingsRepositoryImpl, -} from "./settings/SettingsRepository"; -import { ModeClient, ModeClientImpl } from "./clients/ModeClient"; -import { - MarkRepository, - MarkRepositoryImpl, -} from "./repositories/MarkRepository"; -import { HintClient, HintClientImpl } from "./clients/HintClient"; -import { - HintRepository, - HintRepositoryImpl, -} from "./repositories/HintRepository"; -import { FrameClient, FrameClientImpl } from "./clients/FrameClient"; -import { TopFrameClient, TopFrameClientImpl } from "./clients/TopFrameClient"; -import { - AddonEnabledRepository, - AddonEnabledRepositoryImpl, -} from "./repositories/AddonEnabledRepository"; -import { - AddonEnabledClient, - AddonEnabledClientImpl, -} from "./clients/AddonEnabledClient"; -import { - ToolbarPresenter, - ToolbarPresenterImpl, -} from "./presenters/ToolbarPresenter"; -import { TabPresenter, TabPresenterImpl } from "./presenters/TabPresenter"; import { createPropertyRegistry } from "./property"; -import { PropertyRegistry } from "./property/PropertyRegistry"; import { CommandRegistryFactory } from "./command"; import { CommandRegistry } from "./command/CommandRegistry"; import { OperatorRegistryFactory } from "./operators"; import { OperatorRegistry } from "./operators/OperatorRegistry"; -import { - HintActionFactory, - HintActionFactoryImpl, -} from "./hint/HintActionFactory"; +import { PropertyRegistry } from "./property/PropertyRegistry"; +import "./clients/AddonEnabledClient"; +import "./clients/ConsoleClient"; +import "./clients/ConsoleFrameClient"; +import "./clients/ContentMessageClient"; +import "./clients/FindClient"; +import "./clients/FrameClient"; +import "./clients/HintClient"; +import "./clients/ModeClient"; +import "./clients/NavigateClient"; +import "./clients/TopFrameClient"; +import "./hint/HintActionFactory"; +import "./presenters/Notifier"; +import "./presenters/TabPresenter"; +import "./presenters/ToolbarPresenter"; +import "./repositories/AddonEnabledRepository"; +import "./repositories/FindHistoryRepository"; +import "./repositories/FindRepository"; +import "./repositories/HintRepository"; +import "./repositories/LastSelectedTabRepository"; +import "./repositories/MarkRepository"; +import "./repositories/ModeRepository"; +import "./repositories/ReadyFrameRepository"; +import "./repositories/RepeatRepository"; +import "./settings/PropertySettings"; +import "./settings/SearchEngineSettings"; +import "./settings/SettingsRepository"; +import "./settings/StyleSettings"; const container = new Container({ autoBindInjectable: true }); -container.bind(LastSelectedTabRepository).to(LastSelectedTabRepositoryImpl); -container.bind(Notifier).to(NotifierImpl); -container.bind(RepeatRepository).to(RepeatRepositoryImpl); -container.bind(FindRepository).to(FindRepositoryImpl); -container.bind(FindHistoryRepository).to(FindHistoryRepositoryImpl); -container.bind(FindClient).to(FindClientImpl); -container.bind(ContentMessageClient).to(ContentMessageClientImpl); -container.bind(NavigateClient).to(NavigateClientImpl); -container.bind(ConsoleClient).to(ConsoleClientImpl); -container.bind(ConsoleFrameClient).to(ConsoleFrameClientImpl); -container.bind(ReadyFrameRepository).to(ReadyFrameRepositoryImpl); +container.load(buildProviderModule()); + if (process.env.BROWSER === "firefox") { container.bind(ClipboardRepository).to(FirefoxClipboardRepositoryImpl); container @@ -122,23 +61,6 @@ if (process.env.BROWSER === "firefox") { .bind(BrowserSettingRepository) .to(ChromeBrowserSettingRepositoryImpl); } -container.bind(PropertySettings).to(PropertySettingsImpl); -container.bind(StyleSettings).to(StyleSettingsImpl); -container.bind(SearchEngineSettings).to(SearchEngineSettingsImpl); -container.bind(ModeRepository).to(ModeRepositoryImpl); -container.bind(MarkRepository).to(MarkRepositoryImpl); -container.bind(ModeClient).to(ModeClientImpl); -container.bind(HintClient).to(HintClientImpl); -container.bind(HintRepository).to(HintRepositoryImpl); -container.bind(FrameClient).to(FrameClientImpl); -container.bind(TopFrameClient).to(TopFrameClientImpl); -container.bind(AddonEnabledRepository).to(AddonEnabledRepositoryImpl); -container.bind(AddonEnabledClient).to(AddonEnabledClientImpl); -container.bind(ToolbarPresenter).to(ToolbarPresenterImpl); -container.bind(TabPresenter).to(TabPresenterImpl); -container.bind(PermanentSettingsRepository).to(PermanentSettingsRepositoryImpl); -container.bind(SettingsRepository).to(TransientSettingsRepositoryImpl); -container.bind(HintActionFactory).to(HintActionFactoryImpl); container.bind(PropertyRegistry).toConstantValue(createPropertyRegistry()); container .bind(CommandRegistry) diff --git a/src/background/hint/HintActionFactory.ts b/src/background/hint/HintActionFactory.ts index fbc26650..7cc9103e 100644 --- a/src/background/hint/HintActionFactory.ts +++ b/src/background/hint/HintActionFactory.ts @@ -1,4 +1,5 @@ -import { injectable, inject } from "inversify"; +import { inject } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { QuickHintAction } from "./QuickHintAction"; import { OpenImageHintAction } from "./OpenImageHintAction"; import { YankURLHintAction } from "./YankURLHintAction"; @@ -18,7 +19,7 @@ export interface HintActionFactory { export const HintActionFactory = Symbol("HintActionFactory"); -@injectable() +@provide(HintActionFactory) export class HintActionFactoryImpl implements HintActionFactory { constructor( @inject(QuickHintAction) diff --git a/src/background/presenters/Notifier.ts b/src/background/presenters/Notifier.ts index aace42b7..6e31ab2d 100644 --- a/src/background/presenters/Notifier.ts +++ b/src/background/presenters/Notifier.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; const NOTIFICATION_ID_UPDATE = "vimmatic-update"; @@ -8,7 +8,7 @@ export interface Notifier { export const Notifier = Symbol("Notifier"); -@injectable() +@provide(Notifier) export class NotifierImpl implements NotifierImpl { async notifyUpdated(version: string, onclick: () => void): Promise { const title = `Vimmatic ${version} has been installed`; diff --git a/src/background/presenters/TabPresenter.ts b/src/background/presenters/TabPresenter.ts index fa071d80..2f2b78b3 100644 --- a/src/background/presenters/TabPresenter.ts +++ b/src/background/presenters/TabPresenter.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; export type Tab = chrome.tabs.Tab; @@ -14,7 +14,7 @@ export interface TabPresenter { export const TabPresenter = Symbol("TabPresenter"); -@injectable() +@provide(TabPresenter) export class TabPresenterImpl implements TabPresenter { async openToTab(url: string, tabId: number): Promise { await chrome.tabs.update(tabId, { url }); diff --git a/src/background/presenters/ToolbarPresenter.ts b/src/background/presenters/ToolbarPresenter.ts index 54a732ee..ca770d15 100644 --- a/src/background/presenters/ToolbarPresenter.ts +++ b/src/background/presenters/ToolbarPresenter.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; export interface ToolbarPresenter { setEnabled(enabled: boolean): Promise; @@ -8,7 +8,7 @@ export interface ToolbarPresenter { export const ToolbarPresenter = Symbol("ToolbarPresenter"); -@injectable() +@provide(ToolbarPresenter) export class ToolbarPresenterImpl { async setEnabled(enabled: boolean): Promise { const path = enabled diff --git a/src/background/repositories/AddonEnabledRepository.ts b/src/background/repositories/AddonEnabledRepository.ts index ed814556..14a1a857 100644 --- a/src/background/repositories/AddonEnabledRepository.ts +++ b/src/background/repositories/AddonEnabledRepository.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; export interface AddonEnabledRepository { @@ -21,7 +21,7 @@ const listeners: OnChangeListener[] = []; export const AddonEnabledRepository = Symbol("AddonEnabledRepository"); -@injectable() +@provide(AddonEnabledRepository) export class AddonEnabledRepositoryImpl implements AddonEnabledRepository { constructor( private readonly cache: LocalCache = new LocalCacheImpl( diff --git a/src/background/repositories/FindHistoryRepository.ts b/src/background/repositories/FindHistoryRepository.ts index 6dc6c23d..3104a1f5 100644 --- a/src/background/repositories/FindHistoryRepository.ts +++ b/src/background/repositories/FindHistoryRepository.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; type State = string[]; @@ -11,7 +11,7 @@ export interface FindHistoryRepository { export const FindHistoryRepository = Symbol("FindHistoryRepository"); -@injectable() +@provide(FindHistoryRepository) export class FindHistoryRepositoryImpl implements FindHistoryRepository { constructor( private readonly cache: LocalCache = new LocalCacheImpl( diff --git a/src/background/repositories/FindRepository.ts b/src/background/repositories/FindRepository.ts index fb1b4ab6..c55acb4d 100644 --- a/src/background/repositories/FindRepository.ts +++ b/src/background/repositories/FindRepository.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; export type FindState = { @@ -25,7 +25,7 @@ export interface FindRepository { export const FindRepository = Symbol("FindRepository"); -@injectable() +@provide(FindRepository) export class FindRepositoryImpl implements FindRepository { constructor( private readonly cache: LocalCache = new LocalCacheImpl( diff --git a/src/background/repositories/HintRepository.ts b/src/background/repositories/HintRepository.ts index 4750e7b4..42c63eaf 100644 --- a/src/background/repositories/HintRepository.ts +++ b/src/background/repositories/HintRepository.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; import type { HintTarget } from "../hint/types"; @@ -39,7 +39,7 @@ type State = { export const HintRepository = Symbol("HintRepository"); -@injectable() +@provide(HintRepository) export class HintRepositoryImpl implements HintRepository { constructor( private readonly cache: LocalCache = new LocalCacheImpl( diff --git a/src/background/repositories/LastSelectedTabRepository.ts b/src/background/repositories/LastSelectedTabRepository.ts index c443cc02..ab4e6cb9 100644 --- a/src/background/repositories/LastSelectedTabRepository.ts +++ b/src/background/repositories/LastSelectedTabRepository.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; export interface LastSelectedTabRepository { @@ -14,7 +14,7 @@ type State = { export const LastSelectedTabRepository = Symbol("LastSelectedTabRepository"); -@injectable() +@provide(LastSelectedTabRepository) export class LastSelectedTabRepositoryImpl implements LastSelectedTabRepository { diff --git a/src/background/repositories/MarkRepository.ts b/src/background/repositories/MarkRepository.ts index c391a371..fb616f1b 100644 --- a/src/background/repositories/MarkRepository.ts +++ b/src/background/repositories/MarkRepository.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; export type GlobalMark = { @@ -30,7 +30,7 @@ export interface MarkRepository { export const MarkRepository = Symbol("MarkRepository"); -@injectable() +@provide(MarkRepository) export class MarkRepositoryImpl implements MarkRepository { constructor( private readonly cache: LocalCache = new LocalCacheImpl( diff --git a/src/background/repositories/ModeRepository.ts b/src/background/repositories/ModeRepository.ts index 67dfbf6c..1fc616c7 100644 --- a/src/background/repositories/ModeRepository.ts +++ b/src/background/repositories/ModeRepository.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; import { Mode } from "../../shared/mode"; @@ -11,7 +11,7 @@ type State = Mode; export const ModeRepository = Symbol("ModeRepository"); -@injectable() +@provide(ModeRepository) export class ModeRepositoryImpl implements ModeRepository { constructor( private readonly localCache: LocalCache = new LocalCacheImpl( diff --git a/src/background/repositories/ReadyFrameRepository.ts b/src/background/repositories/ReadyFrameRepository.ts index 7d99643d..0e747156 100644 --- a/src/background/repositories/ReadyFrameRepository.ts +++ b/src/background/repositories/ReadyFrameRepository.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; type State = { [tabId: number]: number[] }; @@ -13,7 +13,7 @@ export interface ReadyFrameRepository { export const ReadyFrameRepository = Symbol("ReadyFrameRepository"); -@injectable() +@provide(ReadyFrameRepository) export class ReadyFrameRepositoryImpl implements ReadyFrameRepository { constructor( private readonly cache: LocalCache = new LocalCacheImpl( diff --git a/src/background/repositories/RepeatRepository.ts b/src/background/repositories/RepeatRepository.ts index 00b05b14..034acdc5 100644 --- a/src/background/repositories/RepeatRepository.ts +++ b/src/background/repositories/RepeatRepository.ts @@ -1,4 +1,4 @@ -import { injectable } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; import type { Operation } from "../../shared/operation"; @@ -10,7 +10,7 @@ export interface RepeatRepository { export const RepeatRepository = Symbol("RepeatRepository"); -@injectable() +@provide(RepeatRepository) export class RepeatRepositoryImpl implements RepeatRepository { constructor( private readonly cache: LocalCache = new LocalCacheImpl( diff --git a/src/background/settings/PropertySettings.ts b/src/background/settings/PropertySettings.ts index 1d463140..4778d092 100644 --- a/src/background/settings/PropertySettings.ts +++ b/src/background/settings/PropertySettings.ts @@ -1,4 +1,5 @@ -import { injectable, inject } from "inversify"; +import { inject } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { PropertyRegistry } from "../property/PropertyRegistry"; import { SettingsRepository } from "./SettingsRepository"; @@ -10,7 +11,7 @@ export interface PropertySettings { export const PropertySettings = Symbol("PropertySettings"); -@injectable() +@provide(PropertySettings) export class PropertySettingsImpl { constructor( @inject(SettingsRepository) diff --git a/src/background/settings/SearchEngineSettings.ts b/src/background/settings/SearchEngineSettings.ts index 396a4417..3e777d17 100644 --- a/src/background/settings/SearchEngineSettings.ts +++ b/src/background/settings/SearchEngineSettings.ts @@ -1,4 +1,5 @@ -import { injectable, inject } from "inversify"; +import { inject } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { SettingsRepository } from "./SettingsRepository"; import type { Search } from "../../shared/search"; import { defaultSettings } from "../../settings"; @@ -9,7 +10,7 @@ export interface SearchEngineSettings { export const SearchEngineSettings = Symbol("SearchEngineSettings"); -@injectable() +@provide(SearchEngineSettings) export class SearchEngineSettingsImpl { constructor( @inject(SettingsRepository) diff --git a/src/background/settings/SettingsRepository.ts b/src/background/settings/SettingsRepository.ts index f8b61b2b..4d220c57 100644 --- a/src/background/settings/SettingsRepository.ts +++ b/src/background/settings/SettingsRepository.ts @@ -1,4 +1,5 @@ -import { injectable, inject } from "inversify"; +import { inject } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; import type { Settings } from "../../shared/settings"; import { defaultSettings, serialize, deserialize } from "../../settings"; @@ -19,7 +20,7 @@ export const PermanentSettingsRepository = Symbol( "PermanentSettingsRepository", ); -@injectable() +@provide(PermanentSettingsRepository) export class PermanentSettingsRepositoryImpl implements SettingsRepository { async load(): Promise { const { settings } = await chrome.storage.sync.get("settings"); @@ -66,7 +67,7 @@ export class PermanentSettingsRepositoryImpl implements SettingsRepository { } } -@injectable() +@provide(SettingsRepository) export class TransientSettingsRepositoryImpl implements SettingsRepository { constructor( @inject(PermanentSettingsRepository) diff --git a/src/background/settings/StyleSettings.ts b/src/background/settings/StyleSettings.ts index 9eb4a756..6981d4c8 100644 --- a/src/background/settings/StyleSettings.ts +++ b/src/background/settings/StyleSettings.ts @@ -1,4 +1,5 @@ -import { injectable, inject } from "inversify"; +import { inject } from "inversify"; +import { provide } from "inversify-binding-decorators"; import { SettingsRepository } from "./SettingsRepository"; import type { ComponentName } from "../../shared/styles"; import { defaultSettings } from "../../settings"; @@ -9,7 +10,7 @@ export interface StyleSettings { export const StyleSettings = Symbol("StyleSettings"); -@injectable() +@provide(StyleSettings) export class StyleSettingsImpl { constructor( @inject(SettingsRepository)