blob: 355fb0bdb4a2cb2159d0f95019c903d267d6904a [file] [log] [blame]
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +02001import DependenciesProviderSingleton, {
2 AutoRefreshDependency,
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +01003 ExtraInfoDependency,
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +02004 OptionsProviderDependency,
5 StartupDataStorageDependency,
Adrià Vilanova Martínez4e847f42024-11-09 23:03:32 +01006 ThreadPageDesignWarningDependency,
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +02007 WorkflowsImportDependency,
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +02008} from '../../../common/architecture/dependenciesProvider/DependenciesProvider';
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +02009import AutoRefreshSetUpScript from '../../../features/autoRefresh/presentation/scripts/setUp.script';
Adrià Vilanova Martínezfe694782024-11-09 20:40:43 +010010import CCDarkThemeInjectAutoDarkTheme from '../../../features/ccDarkTheme/presentation/scripts/injectAutoDarkTheme.script';
11import CCDarkThemeInjectForcedDarkTheme from '../../../features/ccDarkTheme/presentation/scripts/injectForcedDarkTheme.script';
Adrià Vilanova Martínez2d035552024-10-26 20:23:34 +020012import InteropThreadPageSetupScript from '../../../features/interopThreadPage/presentation/scripts/setup.script';
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020013import ScriptRunner from '../../../infrastructure/presentation/scripts/ScriptRunner';
14import ScriptSorterAdapter from '../../../infrastructure/presentation/scripts/ScriptSorter.adapter';
15import { SortedScriptsProviderAdapter } from '../../../infrastructure/presentation/scripts/SortedScriptsProvider.adapter';
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +020016import LoadDraftsSetupScript from '../../../features/loadDrafts/presentation/scripts/setup.script';
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +020017import WorkflowsImportSetUpScript from '../../../features/workflows/presentation/scripts/importSetUp.script';
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +010018import CCExtraInfoSetUpScript from '../../../features/extraInfo/presentation/scripts/ccExtraInfoSetUp.script';
Adrià Vilanova Martínez33a009c2024-11-09 22:41:56 +010019import MWI18nServerScript from '../../../presentation/standaloneScripts/mainWorldServers/MWI18nServerScript.script';
20import MWOptionsWatcherServerScript from '../../../presentation/standaloneScripts/mainWorldServers/MWOptionsWatcherServerScript.script';
21import ApplyStartupDataModificationsOnStartScript from '../../../presentation/standaloneScripts/startupDataStorage/applyStartupDataModificationsOnStart.script';
22import XHRInterceptorScript from '../../../presentation/standaloneScripts/xhrInterceptor/xhrInterceptor.script';
Adrià Vilanova Martínez4e847f42024-11-09 23:03:32 +010023import ThreadPageDesignWarningSetUpScript from '../../../features/threadPageDesignWarning/presentation/scripts/setUp.script';
Adrià Vilanova Martínez3c13a762024-11-09 23:03:32 +010024import FlattenThreadsSetUpReplyActionHandlerScript from '../../../features/flattenThreads/presentation/scripts/setUpReplyActionHandler.script';
25import FlattenThreadsReplyActionHandler from '../../../features/flattenThreads/core/replyActionHandler';
Adrià Vilanova Martínez80f6c9f2024-11-10 01:09:48 +010026import UiSpacingSharedStylesScript from '../../../features/uiSpacing/presentation/scripts/sharedStyles.script';
27import UiSpacingConsoleStylesScript from '../../../features/uiSpacing/presentation/scripts/consoleStyles.script';
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020028
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020029const scriptRunner = createScriptRunner();
30scriptRunner.run();
31
32function createScriptRunner() {
33 const dependenciesProvider = DependenciesProviderSingleton.getInstance();
34 const autoRefresh = dependenciesProvider.getDependency(AutoRefreshDependency);
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +010035 const extraInfo = dependenciesProvider.getDependency(ExtraInfoDependency);
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +020036 const optionsProvider = dependenciesProvider.getDependency(
37 OptionsProviderDependency,
38 );
39 const startupDataStorage = dependenciesProvider.getDependency(
40 StartupDataStorageDependency,
41 );
Adrià Vilanova Martínez4e847f42024-11-09 23:03:32 +010042 const threadPageDesignWarning = dependenciesProvider.getDependency(
43 ThreadPageDesignWarningDependency,
44 );
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +020045 const workflowsImport = dependenciesProvider.getDependency(
46 WorkflowsImportDependency,
47 );
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020048
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020049 return new ScriptRunner(
50 new SortedScriptsProviderAdapter(
51 [
52 // Individual feature scripts
53 new AutoRefreshSetUpScript(autoRefresh),
Adrià Vilanova Martínez6ecaa0d2024-10-26 17:04:32 +020054 new CCDarkThemeInjectAutoDarkTheme(),
55 new CCDarkThemeInjectForcedDarkTheme(),
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +010056 new CCExtraInfoSetUpScript(extraInfo),
Adrià Vilanova Martínez3c13a762024-11-09 23:03:32 +010057 new FlattenThreadsSetUpReplyActionHandlerScript(
58 new FlattenThreadsReplyActionHandler(optionsProvider),
Adrià Vilanova Martínez4e847f42024-11-09 23:03:32 +010059 ),
Adrià Vilanova Martínez3c13a762024-11-09 23:03:32 +010060 new InteropThreadPageSetupScript(),
61 new ThreadPageDesignWarningSetUpScript(threadPageDesignWarning),
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +020062 new LoadDraftsSetupScript(optionsProvider, startupDataStorage),
Adrià Vilanova Martínez80f6c9f2024-11-10 01:09:48 +010063 new UiSpacingConsoleStylesScript(),
64 new UiSpacingSharedStylesScript(),
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +020065 new WorkflowsImportSetUpScript(workflowsImport),
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020066
Adrià Vilanova Martínez33a009c2024-11-09 22:41:56 +010067 // Standalone scripts
68 new ApplyStartupDataModificationsOnStartScript(startupDataStorage),
69 new MWI18nServerScript(),
70 new MWOptionsWatcherServerScript(),
71 new XHRInterceptorScript(),
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020072 ],
73 new ScriptSorterAdapter(),
74 ).getScripts(),
75 );
76}