vona-core 5.0.129 → 5.0.130
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 +29 -1
- package/dist/lib/utils/jsx-enhance.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ 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';
|
|
12
|
+
import React from 'react';
|
|
13
13
|
import { setLocaleErrors, setLocaleAdapter, translateError } from '@cabloy/zod-errors-custom';
|
|
14
14
|
import { ZodMetadata } from '@cabloy/zod-openapi';
|
|
15
15
|
import { setParseAdapter } from '@cabloy/zod-query';
|
|
@@ -2685,6 +2685,33 @@ function __formatLoggerFilterCheckInfo(info) {
|
|
|
2685
2685
|
return info;
|
|
2686
2686
|
}
|
|
2687
2687
|
|
|
2688
|
+
function jsxEnhance() {
|
|
2689
|
+
const createElementOriginal = React.createElement;
|
|
2690
|
+
React.createElement = function (...args) {
|
|
2691
|
+
const component = createElementOriginal(...args);
|
|
2692
|
+
return _translateJsxRender(component);
|
|
2693
|
+
};
|
|
2694
|
+
}
|
|
2695
|
+
function _translateJsxRender(component) {
|
|
2696
|
+
if (typeof component !== 'object' || !component.$$typeof) return component;
|
|
2697
|
+
const componentNew = {};
|
|
2698
|
+
componentNew.$$typeof = 'zova-jsx';
|
|
2699
|
+
componentNew.type = typeof component.type === 'function' ? component.type() : component.type;
|
|
2700
|
+
componentNew.key = component.key;
|
|
2701
|
+
componentNew.props = {
|
|
2702
|
+
...component.props
|
|
2703
|
+
};
|
|
2704
|
+
const children = componentNew.props.children;
|
|
2705
|
+
if (children) {
|
|
2706
|
+
if (Array.isArray(children)) {
|
|
2707
|
+
componentNew.props.children = children.map(item => _translateJsxRender(item));
|
|
2708
|
+
} else if (typeof children === 'object' && !children.toJSON) {
|
|
2709
|
+
componentNew.props.children = _translateJsxRender(children);
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
return componentNew;
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2688
2715
|
async function loadConfig (app, modules) {
|
|
2689
2716
|
app.meta.hmrCacheConfigModules = deepExtend({}, app.config.modules);
|
|
2690
2717
|
// load configs
|
|
@@ -2985,6 +3012,7 @@ function __createApp({
|
|
|
2985
3012
|
}) {
|
|
2986
3013
|
// patch zod, should before config
|
|
2987
3014
|
zodEnhance();
|
|
3015
|
+
jsxEnhance();
|
|
2988
3016
|
// env
|
|
2989
3017
|
const env2 = prepareEnv(env);
|
|
2990
3018
|
// appInfo
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function jsxEnhance(): void;
|