blob: e8391682826bf1cd309708faa8b619010c306bd1 [file] [log] [blame]
Adrià Vilanova Martínez104f8ef2024-05-04 17:22:11 +02001import Features from '../../../features/Features';
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +02002import StandaloneScripts from '../../../scripts/Scripts';
3import ScriptProvider from '../scripts/ScriptProvider';
Adrià Vilanova Martínez8b591d92024-10-19 15:55:15 +02004import LegacyScriptRunner from '../scripts/LegacyScriptRunner';
Adrià Vilanova Martínez104f8ef2024-05-04 17:22:11 +02005import { Context } from './Context';
6
Adrià Vilanova Martínez8b591d92024-10-19 15:55:15 +02007/**
8 * @deprecated
9 */
Adrià Vilanova Martínez104f8ef2024-05-04 17:22:11 +020010export default class EntrypointScriptRunner {
Adrià Vilanova Martínez8b591d92024-10-19 15:55:15 +020011 private scriptRunner: LegacyScriptRunner;
Adrià Vilanova Martínez104f8ef2024-05-04 17:22:11 +020012
13 constructor(public context: Context) {
Adrià Vilanova Martínez8b591d92024-10-19 15:55:15 +020014 this.scriptRunner = new LegacyScriptRunner();
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020015 this.addScriptProvider(new Features());
16 this.addScriptProvider(new StandaloneScripts());
17 }
18
19 addScriptProvider(scriptProvider: ScriptProvider): EntrypointScriptRunner {
20 const scripts = scriptProvider.getScripts(this.context);
21 this.scriptRunner.add(...scripts);
22 return this;
Adrià Vilanova Martínez104f8ef2024-05-04 17:22:11 +020023 }
24
25 run() {
Adrià Vilanova Martínez104f8ef2024-05-04 17:22:11 +020026 this.scriptRunner.run();
27 }
28}