UNPKG

@midwayjs/faas

Version:

![](https://img.alicdn.com/tfs/TB1HdniCSf2gK0jSZFPXXXsopXa-1000-353.png)

54 lines 1.86 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AbstractBootstrapStarter = void 0; const core_1 = require("@midwayjs/core"); const path_1 = require("path"); const core_2 = require("@midwayjs/core"); class AbstractBootstrapStarter { constructor(options = {}) { this.options = options; } getApplicationContext() { return this.applicationContext; } async close() { await this.onClose(); } getBaseDir() { if (this.options.baseDir) { return this.options.baseDir; } if ((0, core_2.isTypeScriptEnvironment)()) { return (0, path_1.join)(this.options.appDir, 'src'); } else { return (0, path_1.join)(this.options.appDir, 'dist'); } } start(options) { if (!this.startedExports) { this.options = Object.assign(this.options, options); if (this.options.appDir && !this.options.baseDir) { this.options.baseDir = this.getBaseDir(); } this.startedExports = this.onStart(); } if (this.startedExports) { this.startedExports['getStarter'] = () => { return this; }; return this.startedExports; } } async initFramework(bootstrapOptions = {}) { // init midway this.applicationContext = await (0, core_1.initializeGlobalApplicationContext)(bootstrapOptions); const midwayFrameworkService = this.applicationContext.get(core_1.MidwayFrameworkService); this.framework = midwayFrameworkService.getMainFramework(); } createDefaultMockHttpEvent() { } createDefaultMockEvent() { } createDefaultMockContext() { } } exports.AbstractBootstrapStarter = AbstractBootstrapStarter; //# sourceMappingURL=starter.js.map