vona-core 5.0.130 → 5.0.132
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/index.js +22 -13
- package/dist/lib/core/resource.d.ts +1 -0
- package/dist/lib/decorator/class/global.d.ts +1 -0
- package/dist/lib/decorator/class/index.d.ts +1 -0
- package/dist/types/application/app.d.ts +5 -3
- package/dist/types/config/locale.d.ts +2 -5
- package/dist/types/interface/index.d.ts +0 -1
- package/package.json +5 -5
- package/dist/types/interface/react.d.ts +0 -7
package/dist/index.js
CHANGED
|
@@ -9,7 +9,6 @@ import { compose as compose$1 } from '@cabloy/compose';
|
|
|
9
9
|
import { extend } from '@cabloy/extend';
|
|
10
10
|
import fse from 'fs-extra';
|
|
11
11
|
import * as uuid from 'uuid';
|
|
12
|
-
import React from 'react';
|
|
13
12
|
import { setLocaleErrors, setLocaleAdapter, translateError } from '@cabloy/zod-errors-custom';
|
|
14
13
|
import { ZodMetadata } from '@cabloy/zod-openapi';
|
|
15
14
|
import { setParseAdapter } from '@cabloy/zod-query';
|
|
@@ -25,6 +24,7 @@ import DailyRotateFile from 'winston-daily-rotate-file';
|
|
|
25
24
|
import os from 'node:os';
|
|
26
25
|
import { MESSAGE, LEVEL } from 'triple-beam';
|
|
27
26
|
import cluster from 'node:cluster';
|
|
27
|
+
import React from 'react';
|
|
28
28
|
import { extendZodWithOpenApi } from '@cabloy/zod-to-openapi';
|
|
29
29
|
import { z } from 'zod';
|
|
30
30
|
import * as Retry from 'retry';
|
|
@@ -46,10 +46,6 @@ class BeanSimple {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const localeDefault = {
|
|
50
|
-
modules: {}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
49
|
const EnumAppEvent = {
|
|
54
50
|
AppStarted: 'eb:event:appStarted',
|
|
55
51
|
AppStartError: 'eb:event:appStartError'
|
|
@@ -541,6 +537,7 @@ function copyMetadataOfClasses(target, sources, transform) {
|
|
|
541
537
|
const SymbolDecoratorBeanFullName = Symbol('SymbolDecoratorBeanFullName');
|
|
542
538
|
const SymbolDecoratorBeanInfo = Symbol('SymbolDecoratorBeanInfo');
|
|
543
539
|
const SymbolDecoratorProxyDisable = Symbol('SymbolDecoratorProxyDisable');
|
|
540
|
+
const SymbolDecoratorGlobal = Symbol('SymbolDecoratorGlobal');
|
|
544
541
|
const SymbolDecoratorVirtual = Symbol('SymbolDecoratorVirtual');
|
|
545
542
|
const SymbolDecoratorUse = Symbol('SymbolDecoratorUse');
|
|
546
543
|
class AppResource extends BeanSimple {
|
|
@@ -830,6 +827,13 @@ function createBeanDecorator(scene, options, optionsPrimitive, fn) {
|
|
|
830
827
|
};
|
|
831
828
|
}
|
|
832
829
|
|
|
830
|
+
function Global() {
|
|
831
|
+
return function (target) {
|
|
832
|
+
// set metadata
|
|
833
|
+
appMetadata.defineMetadata(SymbolDecoratorGlobal, true, target);
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
|
|
833
837
|
function ProxyDisable() {
|
|
834
838
|
return function (target) {
|
|
835
839
|
// set metadata
|
|
@@ -1742,7 +1746,7 @@ function isLocaleMagic(str) {
|
|
|
1742
1746
|
|
|
1743
1747
|
class AppLocale extends BeanSimple {
|
|
1744
1748
|
get current() {
|
|
1745
|
-
return this.ctx.locale;
|
|
1749
|
+
return this.ctx ? this.ctx.locale : 'en-us';
|
|
1746
1750
|
}
|
|
1747
1751
|
set current(value) {
|
|
1748
1752
|
this.ctx.locale = value;
|
|
@@ -2695,8 +2699,9 @@ function jsxEnhance() {
|
|
|
2695
2699
|
function _translateJsxRender(component) {
|
|
2696
2700
|
if (typeof component !== 'object' || !component.$$typeof) return component;
|
|
2697
2701
|
const componentNew = {};
|
|
2698
|
-
|
|
2699
|
-
componentNew
|
|
2702
|
+
const type = typeof component.type === 'function' ? component.type() : component.type;
|
|
2703
|
+
componentNew.$$typeof = type === 'action' ? 'zova-jsx:event' : 'zova-jsx:component';
|
|
2704
|
+
componentNew.type = type;
|
|
2700
2705
|
componentNew.key = component.key;
|
|
2701
2706
|
componentNew.props = {
|
|
2702
2707
|
...component.props
|
|
@@ -2786,10 +2791,14 @@ async function loadLocales (app, modules) {
|
|
|
2786
2791
|
// load locales
|
|
2787
2792
|
await loadLocales();
|
|
2788
2793
|
async function loadLocales() {
|
|
2789
|
-
const
|
|
2790
|
-
// project locales
|
|
2791
|
-
for (const locale in
|
|
2792
|
-
_initLocales(locale,
|
|
2794
|
+
const localesAll = await app.options.locales();
|
|
2795
|
+
// project locales default
|
|
2796
|
+
for (const locale in localesAll.localesDefault) {
|
|
2797
|
+
_initLocales(locale, localesAll.localesDefault[locale]);
|
|
2798
|
+
}
|
|
2799
|
+
// project locales modules
|
|
2800
|
+
for (const locale in localesAll.localesModules) {
|
|
2801
|
+
_initLocales(locale, localesAll.localesModules[locale]);
|
|
2793
2802
|
}
|
|
2794
2803
|
// app cache
|
|
2795
2804
|
app.meta.hmrCacheLocaleModules = deepExtend({}, app.meta.localeModules);
|
|
@@ -3303,4 +3312,4 @@ function prepareNativeBinding(nativeBinding) {
|
|
|
3303
3312
|
|
|
3304
3313
|
zodExtendOpenApi();
|
|
3305
3314
|
|
|
3306
|
-
export { $Class, $customKey, $localeScope, $makeLocaleMagic, AppHmr, AppHmrDeps, AppLocale, AppLogger, AppMeta, AppMetadata, AppResource, AppUtil, BeanAopBase, BeanAopMethodBase, BeanBase, BeanBaseSimple, BeanContainer, BeanInfo, BeanScopeBase, BeanScopeContainer, BeanScopeError, BeanScopeErrorImpl, BeanScopeLocale, BeanScopeScene, BeanScopeUtil, BeanSimple, EnumAppEvent, ErrorClass, LocaleModuleNameSeparator, PickClassInner, ProxyDisable, SymbolBeanContainerInstances, SymbolBeanFullName, SymbolBeanInstanceKey, SymbolBeanInstancePropsLazy, SymbolCacheAopChains, SymbolCacheAopChainsKey, SymbolDecoratorBeanFullName, SymbolDecoratorBeanInfo, SymbolDecoratorProxyDisable, SymbolDecoratorUse, SymbolDecoratorVirtual, SymbolHmrStateLoad, SymbolHmrStateSave, SymbolMappedClassMetadataKeys, SymbolModuleBelong, SymbolModuleName, Use, Virtual, VonaApplication, __prepareInjectSelectorInfo, appHmrDeps, appMetadata, appResource, beanFullNameFromOnionName, bootstrap, cast, closeApp, combineConfigDefault, combineFilePathSafe, compose, copyMetadataOfClasses, copyProperties, copyPropertiesOfClasses, copySqlite3NativeBinding, createApp, createAppMaster, createBeanDecorator, createGeneralApp, createHash, deepExtend, disposeInstance, errorsInternal, filterHeaders, formatLoggerAxiosError, formatLoggerConsole, formatLoggerCtx, formatLoggerDummy, formatLoggerFilter, functionNoop, getLoggerPathPhysicalRoot, getMappedClassMetadataKeys, getPublicPathPhysicalRoot, getRuntimePathPhysicalRoot, getSqlite3DatabaseNameDefault, getSqlite3NativeBinding, instanceDesp, isLocaleMagic, loadJSONFile,
|
|
3315
|
+
export { $Class, $customKey, $localeScope, $makeLocaleMagic, AppHmr, AppHmrDeps, AppLocale, AppLogger, AppMeta, AppMetadata, AppResource, AppUtil, BeanAopBase, BeanAopMethodBase, BeanBase, BeanBaseSimple, BeanContainer, BeanInfo, BeanScopeBase, BeanScopeContainer, BeanScopeError, BeanScopeErrorImpl, BeanScopeLocale, BeanScopeScene, BeanScopeUtil, BeanSimple, EnumAppEvent, ErrorClass, Global, LocaleModuleNameSeparator, PickClassInner, ProxyDisable, SymbolBeanContainerInstances, SymbolBeanFullName, SymbolBeanInstanceKey, SymbolBeanInstancePropsLazy, SymbolCacheAopChains, SymbolCacheAopChainsKey, SymbolDecoratorBeanFullName, SymbolDecoratorBeanInfo, SymbolDecoratorGlobal, SymbolDecoratorProxyDisable, SymbolDecoratorUse, SymbolDecoratorVirtual, SymbolHmrStateLoad, SymbolHmrStateSave, SymbolMappedClassMetadataKeys, SymbolModuleBelong, SymbolModuleName, Use, Virtual, VonaApplication, __prepareInjectSelectorInfo, appHmrDeps, appMetadata, appResource, beanFullNameFromOnionName, bootstrap, cast, closeApp, combineConfigDefault, combineFilePathSafe, compose, copyMetadataOfClasses, copyProperties, copyPropertiesOfClasses, copySqlite3NativeBinding, createApp, createAppMaster, createBeanDecorator, createGeneralApp, createHash, deepExtend, disposeInstance, errorsInternal, filterHeaders, formatLoggerAxiosError, formatLoggerConsole, formatLoggerCtx, formatLoggerDummy, formatLoggerFilter, functionNoop, getLoggerPathPhysicalRoot, getMappedClassMetadataKeys, getPublicPathPhysicalRoot, getRuntimePathPhysicalRoot, getSqlite3DatabaseNameDefault, getSqlite3NativeBinding, instanceDesp, isLocaleMagic, loadJSONFile, onionNameFromBeanFullName, pathToHref, polyfillDispose, prepareEnv, registerMappedClassMetadataKey, requireDynamic, retry, saveJSONFile, setMappedClassMetadataKeys, text, useApp, usePrepareArg, usePrepareArgs, uuidv4 };
|
|
@@ -5,6 +5,7 @@ import { BeanSimple } from '../bean/beanSimple.ts';
|
|
|
5
5
|
export declare const SymbolDecoratorBeanFullName: unique symbol;
|
|
6
6
|
export declare const SymbolDecoratorBeanInfo: unique symbol;
|
|
7
7
|
export declare const SymbolDecoratorProxyDisable: unique symbol;
|
|
8
|
+
export declare const SymbolDecoratorGlobal: unique symbol;
|
|
8
9
|
export declare const SymbolDecoratorVirtual: unique symbol;
|
|
9
10
|
export declare const SymbolDecoratorUse: unique symbol;
|
|
10
11
|
export type IAppResourceRecord = Record<string, IDecoratorBeanOptionsBase>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Global(): ClassDecorator;
|
|
@@ -8,15 +8,17 @@ export interface VonaModulesMeta {
|
|
|
8
8
|
modules: Record<string, IModule>;
|
|
9
9
|
moduleNames: string[];
|
|
10
10
|
}
|
|
11
|
+
export interface IBootstrapOptionsLocales {
|
|
12
|
+
localesDefault: {};
|
|
13
|
+
localesModules: VonaLocaleOptionalMap;
|
|
14
|
+
}
|
|
11
15
|
export type TypeBootstrapOptionsModulesMeta = () => Promise<{
|
|
12
16
|
modulesMeta: VonaModulesMeta;
|
|
13
17
|
}>;
|
|
14
18
|
export type TypeBootstrapOptionsConfig = () => Promise<{
|
|
15
19
|
default: TypeAppInfoConfig[];
|
|
16
20
|
}>;
|
|
17
|
-
export type TypeBootstrapOptionsLocales = () => Promise<
|
|
18
|
-
locales: VonaLocaleOptionalMap;
|
|
19
|
-
}>;
|
|
21
|
+
export type TypeBootstrapOptionsLocales = () => Promise<IBootstrapOptionsLocales>;
|
|
20
22
|
export interface KoaApplicationOptions {
|
|
21
23
|
env?: string | undefined;
|
|
22
24
|
keys?: string[] | undefined;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { ILocaleRecord } from '../../lib/bean/resource/locale/type.ts';
|
|
2
2
|
import type { IBeanScopeLocale } from '../../lib/bean/type.ts';
|
|
3
3
|
import type { PowerPartial } from '../utils/powerPartial.ts';
|
|
4
|
-
export
|
|
5
|
-
modules: {};
|
|
6
|
-
};
|
|
7
|
-
export type VonaLocale = {
|
|
4
|
+
export interface VonaLocale {
|
|
8
5
|
modules: IBeanScopeLocale;
|
|
9
|
-
}
|
|
6
|
+
}
|
|
10
7
|
export type VonaLocaleOptional = PowerPartial<VonaLocale>;
|
|
11
8
|
export type VonaLocaleOptionalMap = Record<keyof ILocaleRecord, VonaLocaleOptional>;
|
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.132",
|
|
5
5
|
"description": "vona",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@cabloy/compose": "^2.0.15",
|
|
29
|
-
"@cabloy/extend": "^3.1.
|
|
29
|
+
"@cabloy/extend": "^3.1.13",
|
|
30
30
|
"@cabloy/json5": "^1.0.19",
|
|
31
31
|
"@cabloy/localeutil": "^2.0.11",
|
|
32
|
-
"@cabloy/module-info": "^1.3.
|
|
33
|
-
"@cabloy/module-info-pro": "^1.0.
|
|
32
|
+
"@cabloy/module-info": "^1.3.41",
|
|
33
|
+
"@cabloy/module-info-pro": "^1.0.45",
|
|
34
34
|
"@cabloy/type-fest": "^5.3.1",
|
|
35
|
-
"@cabloy/utils": "^2.0.
|
|
35
|
+
"@cabloy/utils": "^2.0.18",
|
|
36
36
|
"@cabloy/word-utils": "^2.0.2",
|
|
37
37
|
"@cabloy/zod-errors-custom": "^2.0.6",
|
|
38
38
|
"@cabloy/zod-openapi": "^1.0.8",
|