@midwayjs/faas 3.11.6 → 3.11.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/starter.d.ts +1 -0
- package/dist/starter.js +29 -1
- package/package.json +4 -4
package/dist/starter.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare abstract class AbstractBootstrapStarter {
|
|
|
9
9
|
private startedExports;
|
|
10
10
|
getApplicationContext(): any;
|
|
11
11
|
close(): Promise<void>;
|
|
12
|
+
protected getBaseDir(): string;
|
|
12
13
|
start(options?: ServerlessStarterOptions): Record<string, any>;
|
|
13
14
|
initFramework(bootstrapOptions?: IMidwayBootstrapOptions): Promise<void>;
|
|
14
15
|
protected createDefaultMockHttpEvent(): void;
|
package/dist/starter.js
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AbstractBootstrapStarter = void 0;
|
|
4
4
|
const core_1 = require("@midwayjs/core");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
function isTypeScriptEnvironment() {
|
|
7
|
+
const TS_MODE_PROCESS_FLAG = process.env.MIDWAY_TS_MODE;
|
|
8
|
+
if ('false' === TS_MODE_PROCESS_FLAG) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
// eslint-disable-next-line node/no-deprecated-api
|
|
12
|
+
return TS_MODE_PROCESS_FLAG === 'true' || !!require.extensions['.ts'];
|
|
13
|
+
}
|
|
5
14
|
class AbstractBootstrapStarter {
|
|
6
15
|
constructor(options = {}) {
|
|
7
16
|
this.options = options;
|
|
@@ -12,12 +21,31 @@ class AbstractBootstrapStarter {
|
|
|
12
21
|
async close() {
|
|
13
22
|
await this.onClose();
|
|
14
23
|
}
|
|
24
|
+
getBaseDir() {
|
|
25
|
+
if (this.options.baseDir) {
|
|
26
|
+
return this.options.baseDir;
|
|
27
|
+
}
|
|
28
|
+
if (isTypeScriptEnvironment()) {
|
|
29
|
+
return (0, path_1.join)(this.options.appDir, 'src');
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return (0, path_1.join)(this.options.appDir, 'dist');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
15
35
|
start(options) {
|
|
16
36
|
if (!this.startedExports) {
|
|
17
37
|
this.options = Object.assign(this.options, options);
|
|
38
|
+
if (this.options.appDir && !this.options.baseDir) {
|
|
39
|
+
this.options.baseDir = this.getBaseDir();
|
|
40
|
+
}
|
|
18
41
|
this.startedExports = this.onStart();
|
|
19
42
|
}
|
|
20
|
-
|
|
43
|
+
if (this.startedExports) {
|
|
44
|
+
this.startedExports['getStarter'] = () => {
|
|
45
|
+
return this;
|
|
46
|
+
};
|
|
47
|
+
return this.startedExports;
|
|
48
|
+
}
|
|
21
49
|
}
|
|
22
50
|
async initFramework(bootstrapOptions = {}) {
|
|
23
51
|
// init midway
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/faas",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.9",
|
|
4
4
|
"main": "dist/index",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"@midwayjs/simple-lock": "^1.1.4"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@midwayjs/mock": "^3.11.
|
|
14
|
+
"@midwayjs/mock": "^3.11.9",
|
|
15
15
|
"@midwayjs/serverless-fc-starter": "^3.11.6",
|
|
16
16
|
"@midwayjs/serverless-scf-starter": "^3.10.14",
|
|
17
|
-
"mm": "3.
|
|
17
|
+
"mm": "3.3.0"
|
|
18
18
|
},
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=12"
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"url": "git@github.com:midwayjs/midway.git"
|
|
46
46
|
},
|
|
47
47
|
"license": "MIT",
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "4899f4087aa822370a303c7d076daa6b8a59055b"
|
|
49
49
|
}
|