vona-core 5.0.128 → 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 CHANGED
@@ -9,6 +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 from 'react';
12
13
  import { setLocaleErrors, setLocaleAdapter, translateError } from '@cabloy/zod-errors-custom';
13
14
  import { ZodMetadata } from '@cabloy/zod-openapi';
14
15
  import { setParseAdapter } from '@cabloy/zod-query';
@@ -1705,6 +1706,8 @@ function $makeLocaleMagic(str, ...args) {
1705
1706
  }
1706
1707
  };
1707
1708
  }
1709
+
1710
+ // not use : ILocaleMagic
1708
1711
  function text(strings, ...expressions) {
1709
1712
  return {
1710
1713
  toString() {
@@ -2682,6 +2685,33 @@ function __formatLoggerFilterCheckInfo(info) {
2682
2685
  return info;
2683
2686
  }
2684
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
+
2685
2715
  async function loadConfig (app, modules) {
2686
2716
  app.meta.hmrCacheConfigModules = deepExtend({}, app.config.modules);
2687
2717
  // load configs
@@ -2982,6 +3012,7 @@ function __createApp({
2982
3012
  }) {
2983
3013
  // patch zod, should before config
2984
3014
  zodEnhance();
3015
+ jsxEnhance();
2985
3016
  // env
2986
3017
  const env2 = prepareEnv(env);
2987
3018
  // appInfo
@@ -3199,19 +3230,23 @@ function zodExtendOpenApi() {
3199
3230
  z.ZodType.prototype.openapi = function (...args) {
3200
3231
  // refId
3201
3232
  if (typeof args[0] === 'string') return openapiOriginal.call(this, ...args);
3202
- const refId = ZodMetadata.getRefId(this);
3203
- if (!refId) return openapiOriginal.call(this, ...args);
3204
- // metadata
3233
+ // metadata/options
3205
3234
  const metadata = args[0];
3235
+ const options = args[1];
3236
+ // metadata
3206
3237
  if (isEmptyObject(metadata)) {
3207
3238
  return this;
3208
3239
  // return openapiOriginal.call(this, ...args);
3209
3240
  }
3210
- const options = args[1];
3211
- // refId: update
3212
- const refIdNew = `${refId}_${hashkey(metadata)}`;
3213
3241
  const metadataOld = ZodMetadata.getOpenapiMetadata(this);
3214
3242
  const metadataNew = deepExtend({}, metadataOld, metadata);
3243
+ // refId
3244
+ const refId = ZodMetadata.getRefId(this);
3245
+ if (!refId) {
3246
+ return openapiOriginal.call(this, metadataNew, options);
3247
+ }
3248
+ // refId: update
3249
+ const refIdNew = `${refId}_${hashkey(metadata)}`;
3215
3250
  return openapiOriginal.call(this, refIdNew, metadataNew, options);
3216
3251
  };
3217
3252
  }
@@ -2,5 +2,5 @@ import type { IBeanScopeLocale } from '../../type.ts';
2
2
  import type { ILocaleMagic } from './type.ts';
3
3
  export declare function $localeScope<M extends keyof IBeanScopeLocale, K extends keyof IBeanScopeLocale[M]>(moduleName: M, key: K, ...args: any[]): ILocaleMagic<`${M}::${K extends string ? K : never}`>;
4
4
  export declare function $makeLocaleMagic<T extends string>(str: T, ...args: any[]): ILocaleMagic<T>;
5
- export declare function text(strings: any, ...expressions: any): ILocaleMagic;
5
+ export declare function text(strings: any, ...expressions: any): any;
6
6
  export declare function isLocaleMagic(str: string | object): any;
@@ -0,0 +1 @@
1
+ export declare function jsxEnhance(): void;
@@ -2,3 +2,4 @@ export * from './bootstrap.ts';
2
2
  export * from './logger.ts';
3
3
  export * from './module.ts';
4
4
  export * from './monkey.ts';
5
+ export * from './react.ts';
@@ -0,0 +1,7 @@
1
+ import 'react';
2
+ declare module 'react' {
3
+ interface HTMLAttributes<T> {
4
+ name?: string;
5
+ value?: string;
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-core",
3
3
  "type": "module",
4
- "version": "5.0.128",
4
+ "version": "5.0.130",
5
5
  "description": "vona",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -32,15 +32,17 @@
32
32
  "@cabloy/module-info": "^1.3.37",
33
33
  "@cabloy/module-info-pro": "^1.0.44",
34
34
  "@cabloy/type-fest": "^5.3.1",
35
- "@cabloy/utils": "^2.0.15",
35
+ "@cabloy/utils": "^2.0.16",
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",
39
39
  "@cabloy/zod-query": "^2.0.4",
40
40
  "@cabloy/zod-to-openapi": "^8.1.5",
41
+ "@types/react": "^19.2.7",
41
42
  "chalk": "^5.3.0",
42
43
  "fs-extra": "^10.1.0",
43
44
  "koa": "^3.0.0",
45
+ "react": "^19.2.3",
44
46
  "reflect-metadata": "^0.2.2",
45
47
  "retry": "^0.13.1",
46
48
  "triple-beam": "^1.4.1",