vona-core 5.0.129 → 5.0.131
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 +40 -3
- 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/lib/utils/jsx-enhance.d.ts +1 -0
- 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';
|
|
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';
|
|
@@ -541,6 +541,7 @@ function copyMetadataOfClasses(target, sources, transform) {
|
|
|
541
541
|
const SymbolDecoratorBeanFullName = Symbol('SymbolDecoratorBeanFullName');
|
|
542
542
|
const SymbolDecoratorBeanInfo = Symbol('SymbolDecoratorBeanInfo');
|
|
543
543
|
const SymbolDecoratorProxyDisable = Symbol('SymbolDecoratorProxyDisable');
|
|
544
|
+
const SymbolDecoratorGlobal = Symbol('SymbolDecoratorGlobal');
|
|
544
545
|
const SymbolDecoratorVirtual = Symbol('SymbolDecoratorVirtual');
|
|
545
546
|
const SymbolDecoratorUse = Symbol('SymbolDecoratorUse');
|
|
546
547
|
class AppResource extends BeanSimple {
|
|
@@ -830,6 +831,13 @@ function createBeanDecorator(scene, options, optionsPrimitive, fn) {
|
|
|
830
831
|
};
|
|
831
832
|
}
|
|
832
833
|
|
|
834
|
+
function Global() {
|
|
835
|
+
return function (target) {
|
|
836
|
+
// set metadata
|
|
837
|
+
appMetadata.defineMetadata(SymbolDecoratorGlobal, true, target);
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
|
|
833
841
|
function ProxyDisable() {
|
|
834
842
|
return function (target) {
|
|
835
843
|
// set metadata
|
|
@@ -1742,7 +1750,7 @@ function isLocaleMagic(str) {
|
|
|
1742
1750
|
|
|
1743
1751
|
class AppLocale extends BeanSimple {
|
|
1744
1752
|
get current() {
|
|
1745
|
-
return this.ctx.locale;
|
|
1753
|
+
return this.ctx ? this.ctx.locale : 'en-us';
|
|
1746
1754
|
}
|
|
1747
1755
|
set current(value) {
|
|
1748
1756
|
this.ctx.locale = value;
|
|
@@ -2685,6 +2693,34 @@ function __formatLoggerFilterCheckInfo(info) {
|
|
|
2685
2693
|
return info;
|
|
2686
2694
|
}
|
|
2687
2695
|
|
|
2696
|
+
function jsxEnhance() {
|
|
2697
|
+
const createElementOriginal = React.createElement;
|
|
2698
|
+
React.createElement = function (...args) {
|
|
2699
|
+
const component = createElementOriginal(...args);
|
|
2700
|
+
return _translateJsxRender(component);
|
|
2701
|
+
};
|
|
2702
|
+
}
|
|
2703
|
+
function _translateJsxRender(component) {
|
|
2704
|
+
if (typeof component !== 'object' || !component.$$typeof) return component;
|
|
2705
|
+
const componentNew = {};
|
|
2706
|
+
const type = typeof component.type === 'function' ? component.type() : component.type;
|
|
2707
|
+
componentNew.$$typeof = type === 'action' ? 'zova-jsx:event' : 'zova-jsx:component';
|
|
2708
|
+
componentNew.type = type;
|
|
2709
|
+
componentNew.key = component.key;
|
|
2710
|
+
componentNew.props = {
|
|
2711
|
+
...component.props
|
|
2712
|
+
};
|
|
2713
|
+
const children = componentNew.props.children;
|
|
2714
|
+
if (children) {
|
|
2715
|
+
if (Array.isArray(children)) {
|
|
2716
|
+
componentNew.props.children = children.map(item => _translateJsxRender(item));
|
|
2717
|
+
} else if (typeof children === 'object' && !children.toJSON) {
|
|
2718
|
+
componentNew.props.children = _translateJsxRender(children);
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
return componentNew;
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2688
2724
|
async function loadConfig (app, modules) {
|
|
2689
2725
|
app.meta.hmrCacheConfigModules = deepExtend({}, app.config.modules);
|
|
2690
2726
|
// load configs
|
|
@@ -2985,6 +3021,7 @@ function __createApp({
|
|
|
2985
3021
|
}) {
|
|
2986
3022
|
// patch zod, should before config
|
|
2987
3023
|
zodEnhance();
|
|
3024
|
+
jsxEnhance();
|
|
2988
3025
|
// env
|
|
2989
3026
|
const env2 = prepareEnv(env);
|
|
2990
3027
|
// appInfo
|
|
@@ -3275,4 +3312,4 @@ function prepareNativeBinding(nativeBinding) {
|
|
|
3275
3312
|
|
|
3276
3313
|
zodExtendOpenApi();
|
|
3277
3314
|
|
|
3278
|
-
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, localeDefault, onionNameFromBeanFullName, pathToHref, polyfillDispose, prepareEnv, registerMappedClassMetadataKey, requireDynamic, retry, saveJSONFile, setMappedClassMetadataKeys, text, useApp, usePrepareArg, usePrepareArgs, uuidv4 };
|
|
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, localeDefault, 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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function jsxEnhance(): void;
|
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.131",
|
|
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.17",
|
|
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",
|