(parent: Container)
| 155 | * shared/global services. |
| 156 | */ |
| 157 | export const createTopLevelSessionContainer = (parent: Container) => { |
| 158 | const container = new Container(); |
| 159 | container.parent = parent; |
| 160 | container.bind(IContainer).toConstantValue(container); |
| 161 | |
| 162 | // Core services: |
| 163 | container.bind(ILogger).to(Logger).inSingletonScope().onActivation(trackDispose); |
| 164 | container.bind(ResourceProviderState).toSelf().inSingletonScope(); |
| 165 | container.bind(IResourceProvider).to(StatefulResourceProvider).inSingletonScope(); |
| 166 | container |
| 167 | .bind(ITelemetryReporter) |
| 168 | .to(process.env.DA_TEST_DISABLE_TELEMETRY ? NullTelemetryReporter : DapTelemetryReporter) |
| 169 | .inSingletonScope() |
| 170 | .onActivation(trackDispose); |
| 171 | |
| 172 | // Source handling: |
| 173 | container |
| 174 | .bind(ISourceMapFactory) |
| 175 | .to(CachingSourceMapFactory) |
| 176 | .inSingletonScope() |
| 177 | .onActivation(trackDispose); |
| 178 | |
| 179 | container.bind(IBreakpointsPredictor).to(BreakpointsPredictor).inSingletonScope(); |
| 180 | container.bind(OutFiles).to(OutFiles).inSingletonScope(); |
| 181 | container.bind(VueComponentPaths).to(VueComponentPaths).inSingletonScope(); |
| 182 | container.bind(IVueFileMapper).to(VueFileMapper).inSingletonScope(); |
| 183 | container |
| 184 | .bind(ISearchStrategy) |
| 185 | .toDynamicValue(ctx => CodeSearchStrategy.createOrFallback(ctx.container.get<ILogger>(ILogger))) |
| 186 | .inSingletonScope(); |
| 187 | |
| 188 | container.bind(INodeBinaryProvider).to(NodeBinaryProvider); |
| 189 | |
| 190 | // Launcher logic: |
| 191 | container.bind(RestartPolicyFactory).toSelf(); |
| 192 | container.bind(ILauncher).to(ExtensionHostAttacher).onActivation(trackDispose); |
| 193 | container.bind(ILauncher).to(ExtensionHostLauncher).onActivation(trackDispose); |
| 194 | container.bind(ILauncher).to(NodeLauncher).onActivation(trackDispose); |
| 195 | container.bind(IProgramLauncher).to(SubprocessProgramLauncher); |
| 196 | container.bind(IProgramLauncher).to(TerminalProgramLauncher); |
| 197 | |
| 198 | if (parent.get(IsVSCode)) { |
| 199 | // dynamic require to not break the debug server |
| 200 | container |
| 201 | .bind(ILauncher) |
| 202 | .to(require('./targets/node/terminalNodeLauncher').TerminalNodeLauncher) |
| 203 | .onActivation(trackDispose); |
| 204 | } |
| 205 | |
| 206 | container.bind(ILauncher).to(NodeAttacher).onActivation(trackDispose); |
| 207 | container.bind(ILauncher).to(ValdiAttacher).onActivation(trackDispose); |
| 208 | |
| 209 | container.bind(ChromeLauncher).toSelf().inSingletonScope().onActivation(trackDispose); |
| 210 | container.bind(ILauncher).toService(ChromeLauncher); |
| 211 | container.bind(ILauncher).to(EdgeLauncher).inSingletonScope().onActivation(trackDispose); |
| 212 | container.bind(ILauncher).to(RemoteBrowserLauncher).inSingletonScope().onActivation(trackDispose); |
| 213 | |
| 214 | container.bind(ILauncher).to(BrowserAttacher).onActivation(trackDispose); |
no test coverage detected