blob: 1d02a6b768ce3ffc29479a85bfaa48dd0290e8f4 [file] [log] [blame]
Adrià Vilanova Martínez2d035552024-10-26 20:23:34 +02001// Run legacy Javascript entry point
2import '../../../contentScripts/communityConsole/start';
3
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +02004import DependenciesProviderSingleton, {
5 AutoRefreshDependency,
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +01006 ExtraInfoDependency,
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +02007 OptionsProviderDependency,
8 StartupDataStorageDependency,
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +02009 WorkflowsImportDependency,
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020010} from '../../../common/architecture/dependenciesProvider/DependenciesProvider';
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020011import AutoRefreshSetUpScript from '../../../features/autoRefresh/presentation/scripts/setUp.script';
Adrià Vilanova Martínezfe694782024-11-09 20:40:43 +010012import CCDarkThemeInjectAutoDarkTheme from '../../../features/ccDarkTheme/presentation/scripts/injectAutoDarkTheme.script';
13import CCDarkThemeInjectForcedDarkTheme from '../../../features/ccDarkTheme/presentation/scripts/injectForcedDarkTheme.script';
Adrià Vilanova Martínez2d035552024-10-26 20:23:34 +020014import InteropThreadPageSetupScript from '../../../features/interopThreadPage/presentation/scripts/setup.script';
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020015import ScriptRunner from '../../../infrastructure/presentation/scripts/ScriptRunner';
16import ScriptSorterAdapter from '../../../infrastructure/presentation/scripts/ScriptSorter.adapter';
17import { SortedScriptsProviderAdapter } from '../../../infrastructure/presentation/scripts/SortedScriptsProvider.adapter';
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +020018import LoadDraftsSetupScript from '../../../features/loadDrafts/presentation/scripts/setup.script';
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +020019import WorkflowsImportSetUpScript from '../../../features/workflows/presentation/scripts/importSetUp.script';
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +010020import CCExtraInfoSetUpScript from '../../../features/extraInfo/presentation/scripts/ccExtraInfoSetUp.script';
Adrià Vilanova Martínez33a009c2024-11-09 22:41:56 +010021import MWI18nServerScript from '../../../presentation/standaloneScripts/mainWorldServers/MWI18nServerScript.script';
22import MWOptionsWatcherServerScript from '../../../presentation/standaloneScripts/mainWorldServers/MWOptionsWatcherServerScript.script';
23import ApplyStartupDataModificationsOnStartScript from '../../../presentation/standaloneScripts/startupDataStorage/applyStartupDataModificationsOnStart.script';
24import XHRInterceptorScript from '../../../presentation/standaloneScripts/xhrInterceptor/xhrInterceptor.script';
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020025
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020026const scriptRunner = createScriptRunner();
27scriptRunner.run();
28
29function createScriptRunner() {
30 const dependenciesProvider = DependenciesProviderSingleton.getInstance();
31 const autoRefresh = dependenciesProvider.getDependency(AutoRefreshDependency);
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +010032 const extraInfo = dependenciesProvider.getDependency(ExtraInfoDependency);
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +020033 const optionsProvider = dependenciesProvider.getDependency(
34 OptionsProviderDependency,
35 );
36 const startupDataStorage = dependenciesProvider.getDependency(
37 StartupDataStorageDependency,
38 );
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +020039 const workflowsImport = dependenciesProvider.getDependency(
40 WorkflowsImportDependency,
41 );
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020042
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020043 return new ScriptRunner(
44 new SortedScriptsProviderAdapter(
45 [
46 // Individual feature scripts
47 new AutoRefreshSetUpScript(autoRefresh),
Adrià Vilanova Martínez6ecaa0d2024-10-26 17:04:32 +020048 new CCDarkThemeInjectAutoDarkTheme(),
49 new CCDarkThemeInjectForcedDarkTheme(),
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +010050 new CCExtraInfoSetUpScript(extraInfo),
Adrià Vilanova Martínez2d035552024-10-26 20:23:34 +020051 new InteropThreadPageSetupScript(),
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +020052 new LoadDraftsSetupScript(optionsProvider, startupDataStorage),
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +020053 new WorkflowsImportSetUpScript(workflowsImport),
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020054
Adrià Vilanova Martínez33a009c2024-11-09 22:41:56 +010055 // Standalone scripts
56 new ApplyStartupDataModificationsOnStartScript(startupDataStorage),
57 new MWI18nServerScript(),
58 new MWOptionsWatcherServerScript(),
59 new XHRInterceptorScript(),
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020060 ],
61 new ScriptSorterAdapter(),
62 ).getScripts(),
63 );
64}