"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExtensionContribution = exports.ExtensionModule = void 0;
const tslib_1 = require("tslib");
const di_1 = require("@opensumi/di");
const ide_core_node_1 = require("@opensumi/ide-core-node");
const common_1 = require("../common");
const extension_host_manager_1 = require("./extension.host.manager");
const extension_profiler_service_1 = require("./extension.profiler.service");
const extension_service_1 = require("./extension.service");
const extension_service_client_1 = require("./extension.service.client");
let ExtensionModule = class ExtensionModule extends ide_core_node_1.NodeModule {
    constructor() {
        super(...arguments);
        this.providers = [
            {
                token: common_1.IExtensionNodeService,
                useClass: extension_service_1.ExtensionNodeServiceImpl,
            },
            {
                token: common_1.IExtensionNodeClientService,
                useClass: extension_service_client_1.ExtensionServiceClientImpl,
            },
            {
                token: common_1.ExtensionHostProfilerServiceToken,
                useClass: extension_profiler_service_1.ExtensionProfilerService,
            },
            {
                token: common_1.IExtensionHostManager,
                useClass: extension_host_manager_1.ExtensionHostManager,
            },
            ExtensionContribution,
        ];
        this.backServices = [
            {
                servicePath: common_1.ExtensionNodeServiceServerPath,
                token: common_1.IExtensionNodeClientService,
            },
            {
                servicePath: common_1.ExtensionHostProfilerServicePath,
                token: common_1.ExtensionHostProfilerServiceToken,
            },
        ];
    }
};
exports.ExtensionModule = ExtensionModule;
exports.ExtensionModule = ExtensionModule = tslib_1.__decorate([
    (0, di_1.Injectable)()
], ExtensionModule);
let ExtensionContribution = class ExtensionContribution {
    async initialize() {
        await this.extensionNodeService.initialize();
        this.logger.verbose('Extension server initialized');
    }
    async onStop() {
        await this.extensionNodeService.disposeAllClientExtProcess();
        this.logger.warn('All extension process exit by server stop');
    }
};
exports.ExtensionContribution = ExtensionContribution;
tslib_1.__decorate([
    (0, di_1.Autowired)(common_1.IExtensionNodeService),
    tslib_1.__metadata("design:type", Object)
], ExtensionContribution.prototype, "extensionNodeService", void 0);
tslib_1.__decorate([
    (0, di_1.Autowired)(ide_core_node_1.INodeLogger),
    tslib_1.__metadata("design:type", Object)
], ExtensionContribution.prototype, "logger", void 0);
exports.ExtensionContribution = ExtensionContribution = tslib_1.__decorate([
    (0, ide_core_node_1.Domain)(ide_core_node_1.ServerAppContribution)
], ExtensionContribution);
//# sourceMappingURL=index.js.map