vona-core 5.0.43 → 5.0.45
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.
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import cluster from 'node:cluster';
|
|
2
|
-
import { createApp } from "./createApp.js";
|
|
2
|
+
import { createApp, createAppMaster } from "./createApp.js";
|
|
3
3
|
import { handleProcessMaster, handleProcessWork } from "./process.js";
|
|
4
4
|
export async function startCluster(workers, bootstrapOptions) {
|
|
5
5
|
if (cluster.isPrimary) {
|
|
6
6
|
handleProcessMaster();
|
|
7
|
+
createAppMaster(bootstrapOptions);
|
|
7
8
|
// console.log(`Primary ${process.pid} is running`);
|
|
8
9
|
// Fork workers.
|
|
9
10
|
for (let i = 0; i < workers; i++) {
|
|
@@ -4,6 +4,17 @@ import { VonaApplication } from "../core/application.js";
|
|
|
4
4
|
import { combineAppConfigDefault } from "../core/config.js";
|
|
5
5
|
import { deepExtend, prepareEnv } from "../utils/util.js";
|
|
6
6
|
import { Start } from "./start.js";
|
|
7
|
+
export async function createAppMaster(bootstrapOptions) {
|
|
8
|
+
globalThis.__bootstrapOptions__ = bootstrapOptions;
|
|
9
|
+
const { modulesMeta, locales, config, env, AppMonkey } = bootstrapOptions;
|
|
10
|
+
globalThis.__app__ = __createApp({
|
|
11
|
+
modulesMeta,
|
|
12
|
+
locales,
|
|
13
|
+
config,
|
|
14
|
+
env,
|
|
15
|
+
AppMonkey,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
7
18
|
export async function createApp(bootstrapOptions) {
|
|
8
19
|
while (globalThis.__creating__) {
|
|
9
20
|
await sleep(100);
|
package/dist/lib/utils/util.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type * as ModuleInfo from '@cabloy/module-info';
|
|
|
2
2
|
import type { IModule } from '@cabloy/module-info';
|
|
3
3
|
import type { BinaryToTextEncoding, HashOptions } from 'node:crypto';
|
|
4
4
|
import type { IInstanceRecord, TypeMonkeyName, VonaConfigEnv, VonaContext } from '../../types/index.ts';
|
|
5
|
+
import type { IBeanScopeRecord, TypeBeanScopeRecordKeys } from '../bean/type.ts';
|
|
5
6
|
import type { IBeanSceneRecord } from '../decorator/interface/beanOptions.ts';
|
|
6
7
|
import { BeanSimple } from '../bean/beanSimple.ts';
|
|
7
8
|
export interface IExecuteBeanCallbackParams {
|
|
@@ -40,6 +41,9 @@ export declare class AppUtil extends BeanSimple {
|
|
|
40
41
|
detectErrorMessage(err: Error): string;
|
|
41
42
|
detectStatus(err: Error): number;
|
|
42
43
|
accepts(): "json" | "html";
|
|
44
|
+
getModuleConfigRaw<K extends TypeBeanScopeRecordKeys>(moduleName: K): IBeanScopeRecord[K] extends {
|
|
45
|
+
config?: infer CONFIG;
|
|
46
|
+
} ? CONFIG | undefined : undefined;
|
|
43
47
|
}
|
|
44
48
|
export declare function compose(chains: any, adapter?: any): (context: any, next?: any) => any;
|
|
45
49
|
export declare function instanceDesp(instanceName: keyof IInstanceRecord | null | undefined): string;
|
package/dist/lib/utils/util.js
CHANGED
|
@@ -205,6 +205,9 @@ export class AppUtil extends BeanSimple {
|
|
|
205
205
|
return 'json';
|
|
206
206
|
return 'html';
|
|
207
207
|
}
|
|
208
|
+
getModuleConfigRaw(moduleName) {
|
|
209
|
+
return this.app.config.modules[moduleName];
|
|
210
|
+
}
|
|
208
211
|
}
|
|
209
212
|
export function compose(chains, adapter) {
|
|
210
213
|
return _compose(chains, adapter);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.45",
|
|
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.
|
|
34
|
-
"@cabloy/module-info-pro": "^1.0.
|
|
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.
|
|
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",
|