vona-core 5.0.41 → 5.0.43

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
  }
@@ -13,7 +13,7 @@ export declare class AppMeta extends BeanSimple {
13
13
  ctxCounter: CtxCounter;
14
14
  isProd: boolean;
15
15
  isTest: boolean;
16
- isLocal: boolean;
16
+ isDev: boolean;
17
17
  error: ErrorClass;
18
18
  logger: AppLogger;
19
19
  locale: AppLocale;
@@ -12,7 +12,7 @@ export class AppMeta extends BeanSimple {
12
12
  ctxCounter;
13
13
  isProd;
14
14
  isTest;
15
- isLocal;
15
+ isDev;
16
16
  error;
17
17
  logger;
18
18
  locale;
@@ -65,7 +65,7 @@ export class AppMeta extends BeanSimple {
65
65
  const mode = this.app.config.meta.mode;
66
66
  this.isProd = mode === 'prod';
67
67
  this.isTest = mode === 'test';
68
- this.isLocal = mode === 'dev';
68
+ this.isDev = mode === 'dev';
69
69
  }
70
70
  async waitAppStarted() {
71
71
  return new Promise((resolve, reject) => {
@@ -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__) {
@@ -3,7 +3,7 @@ export interface IInstanceRecord {
3
3
  '': never;
4
4
  }
5
5
  export interface ConfigInstanceBase {
6
- instanceName: keyof IInstanceRecord;
6
+ name: keyof IInstanceRecord;
7
7
  password?: string;
8
8
  title?: string;
9
9
  config?: VonaConfigOptional;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-core",
3
3
  "type": "module",
4
- "version": "5.0.41",
4
+ "version": "5.0.43",
5
5
  "description": "vona",
6
6
  "publishConfig": {
7
7
  "access": "public"