vona-core 5.0.42 → 5.0.44

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.
@@ -22,4 +22,5 @@ export declare class VonaApplication extends KoaApplication {
22
22
  get ctx(): VonaContext;
23
23
  get name(): string;
24
24
  createAnonymousContext(req?: any, res?: any): VonaContext;
25
+ close(terminate?: boolean): Promise<void>;
25
26
  }
@@ -2,6 +2,7 @@ import http from 'node:http';
2
2
  import KoaApplication from 'koa';
3
3
  import { cast } from "../../types/utils/cast.js";
4
4
  import { BeanContainer } from "../bean/beanContainer.js";
5
+ import { closeApp } from "../framework/useApp.js";
5
6
  import { AppUtil } from "../utils/util.js";
6
7
  import { VonaAsyncLocalStorage } from "./asyncLocalStorage.js";
7
8
  import { contextBase } from "./context.js";
@@ -75,4 +76,7 @@ export class VonaApplication extends KoaApplication {
75
76
  const response = res ?? new http.ServerResponse(request);
76
77
  return this.createContext(request, response);
77
78
  }
79
+ async close(terminate) {
80
+ await closeApp(terminate);
81
+ }
78
82
  }
@@ -31,9 +31,16 @@ export async function closeApp(terminate) {
31
31
  }
32
32
  }
33
33
  export async function createGeneralApp(projectPath, envRuntime) {
34
- const testFile = path.join(projectPath, '.vona/app.ts');
35
- const testInstance = await import(__rewriteRelativeImportExtension(pathToHref(testFile)));
36
- return await testInstance.createSingleApp(envRuntime);
34
+ if (process.env.META_MODE === 'prod') {
35
+ const testFile = path.join(projectPath, `dist/${process.env.META_FLAVOR}/bootstrap.js`);
36
+ const testInstance = await import(__rewriteRelativeImportExtension(pathToHref(testFile)));
37
+ return await testInstance.appBootstrap;
38
+ }
39
+ else {
40
+ const testFile = path.join(projectPath, '.vona/app.ts');
41
+ const testInstance = await import(__rewriteRelativeImportExtension(pathToHref(testFile)));
42
+ return await testInstance.createSingleApp(envRuntime);
43
+ }
37
44
  }
38
45
  // export async function reloadApp() {
39
46
  // while (globalThis.__reloading__) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-core",
3
3
  "type": "module",
4
- "version": "5.0.42",
4
+ "version": "5.0.44",
5
5
  "description": "vona",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -30,10 +30,10 @@
30
30
  "@cabloy/extend": "^3.1.10",
31
31
  "@cabloy/json5": "^1.0.18",
32
32
  "@cabloy/localeutil": "^2.0.10",
33
- "@cabloy/module-info": "^1.3.25",
34
- "@cabloy/module-info-pro": "^1.0.33",
33
+ "@cabloy/module-info": "^1.3.26",
34
+ "@cabloy/module-info-pro": "^1.0.34",
35
35
  "@cabloy/set": "^1.0.17",
36
- "@cabloy/utils": "^1.0.38",
36
+ "@cabloy/utils": "^1.0.39",
37
37
  "@cabloy/word-utils": "^2.0.1",
38
38
  "chalk": "^5.3.0",
39
39
  "fs-extra": "^10.1.0",