@midwayjs/mock 3.11.5 → 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/creator.d.ts CHANGED
@@ -26,6 +26,6 @@ declare class BootstrapAppStarter {
26
26
  * @param options
27
27
  */
28
28
  export declare function createLightApp(baseDir?: string, options?: MockAppConfigurationOptions): Promise<IMidwayApplication>;
29
- export declare function createBootstrap(entryFile: string): Promise<BootstrapAppStarter>;
29
+ export declare function createBootstrap(entryFile: string, options?: MockAppConfigurationOptions): Promise<BootstrapAppStarter>;
30
30
  export {};
31
31
  //# sourceMappingURL=creator.d.ts.map
package/dist/creator.js CHANGED
@@ -183,7 +183,13 @@ async function createFunctionApp(baseDir, options = {}, customFrameworkModule) {
183
183
  options = baseDir;
184
184
  baseDir = options.appDir || '';
185
185
  }
186
+ // v3 新的处理 bootstrap 过来的 faas 入口
187
+ if (options.entryFile) {
188
+ const exportModules = require((0, path_1.join)(baseDir, options.entryFile));
189
+ options.starter = exportModules.getStarter();
190
+ }
186
191
  let starterName;
192
+ // 老的 f.yml 逻辑
187
193
  if (!options.starter) {
188
194
  if (!baseDir) {
189
195
  baseDir = process.cwd();
@@ -422,11 +428,17 @@ async function createLightApp(baseDir = '', options = {}) {
422
428
  });
423
429
  }
424
430
  exports.createLightApp = createLightApp;
425
- async function createBootstrap(entryFile) {
426
- await create(undefined, {
427
- entryFile,
428
- });
429
- return new BootstrapAppStarter();
431
+ async function createBootstrap(entryFile, options = {}) {
432
+ if ((0, core_1.safeRequire)('@midwayjs/faas')) {
433
+ options.entryFile = entryFile;
434
+ return createFunctionApp(process.cwd(), options);
435
+ }
436
+ else {
437
+ await create(undefined, {
438
+ entryFile,
439
+ });
440
+ return new BootstrapAppStarter();
441
+ }
430
442
  }
431
443
  exports.createBootstrap = createBootstrap;
432
444
  //# sourceMappingURL=creator.js.map
@@ -3,6 +3,7 @@ export interface MockAppConfigurationOptions extends IMidwayBootstrapOptions {
3
3
  cleanLogsDir?: boolean;
4
4
  cleanTempDir?: boolean;
5
5
  ssl?: boolean;
6
+ entryFile?: string;
6
7
  }
7
8
  export type ComponentModule = {
8
9
  Configuration: new () => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/mock",
3
- "version": "3.11.5",
3
+ "version": "3.11.9",
4
4
  "description": "create your test app from midway framework",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@midwayjs/core": "^3.11.4",
30
+ "@midwayjs/core": "^3.11.6",
31
31
  "@midwayjs/logger": "^2.15.0",
32
32
  "@types/amqplib": "0.10.1",
33
33
  "amqplib": "0.10.3",
@@ -37,7 +37,7 @@
37
37
  "ws": "8.13.0"
38
38
  },
39
39
  "dependencies": {
40
- "@midwayjs/async-hooks-context-manager": "^3.11.4",
40
+ "@midwayjs/async-hooks-context-manager": "^3.11.6",
41
41
  "@types/superagent": "4.1.14",
42
42
  "@types/supertest": "2.0.12",
43
43
  "js-yaml": "4.1.0",
@@ -49,5 +49,5 @@
49
49
  "type": "git",
50
50
  "url": "https://github.com/midwayjs/midway.git"
51
51
  },
52
- "gitHead": "a2c3b25f840a2e9dc01bfb7ef4bef82c3a4b0dcf"
52
+ "gitHead": "4899f4087aa822370a303c7d076daa6b8a59055b"
53
53
  }