vona-core 5.0.108 → 5.0.109

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
@@ -1729,6 +1729,7 @@ class AppLocale extends BeanSimple {
1729
1729
  }
1730
1730
  getText(supportCustomMessage, moduleScope, locale, key, ...args) {
1731
1731
  if (!key) return key;
1732
+ if (typeof key === 'object') key = String(key);
1732
1733
  if (typeof key !== 'string') throw new Error(`${key} should be string`);
1733
1734
  const pos = key.indexOf(LocaleModuleNameSeparator);
1734
1735
  if (pos > -1) {
@@ -1756,7 +1757,19 @@ class BeanScopeLocale extends BeanSimple {
1756
1757
  }
1757
1758
 
1758
1759
  function $localeScope(moduleName, key) {
1759
- return `${moduleName}::${String(key)}`;
1760
+ return $makeLocaleMagic(`${moduleName}::${String(key)}`);
1761
+ }
1762
+ function $makeLocaleMagic(str) {
1763
+ return {
1764
+ toString() {
1765
+ return str;
1766
+ },
1767
+ toJSON() {
1768
+ if (!str || !str.includes(LocaleModuleNameSeparator)) return str;
1769
+ const app = useApp();
1770
+ return app.meta.text(str);
1771
+ }
1772
+ };
1760
1773
  }
1761
1774
 
1762
1775
  const BeanModuleScope$1 = Symbol('BeanScopeScene#ModuleScope');
@@ -3216,4 +3229,4 @@ function prepareNativeBinding(nativeBinding) {
3216
3229
 
3217
3230
  zodExtendOpenApi();
3218
3231
 
3219
- export { $Class, $customKey, $localeScope, 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, loadJSONFile, localeDefault, onionNameFromBeanFullName, pathToHref, polyfillDispose, prepareEnv, registerMappedClassMetadataKey, requireDynamic, retry, saveJSONFile, setMappedClassMetadataKeys, useApp, usePrepareArg, usePrepareArgs, uuidv4 };
3232
+ 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, loadJSONFile, localeDefault, onionNameFromBeanFullName, pathToHref, polyfillDispose, prepareEnv, registerMappedClassMetadataKey, requireDynamic, retry, saveJSONFile, setMappedClassMetadataKeys, useApp, usePrepareArg, usePrepareArgs, uuidv4 };
@@ -15,3 +15,7 @@ export interface ILocaleRecord {
15
15
  'en-us': never;
16
16
  'zh-cn': never;
17
17
  }
18
+ export interface ILocaleMagic<T extends string = string> {
19
+ toString: () => T;
20
+ toJSON(): () => T;
21
+ }
@@ -1,2 +1,4 @@
1
1
  import type { IBeanScopeLocale } from '../../type.ts';
2
- export declare function $localeScope<M extends keyof IBeanScopeLocale, K extends keyof IBeanScopeLocale[M]>(moduleName: M, key: K): `${M}::${K extends string ? K : never}`;
2
+ import type { ILocaleMagic } from './type.ts';
3
+ export declare function $localeScope<M extends keyof IBeanScopeLocale, K extends keyof IBeanScopeLocale[M]>(moduleName: M, key: K): ILocaleMagic<`${M}::${K extends string ? K : never}`>;
4
+ export declare function $makeLocaleMagic<T extends string>(str: T): ILocaleMagic<T>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-core",
3
3
  "type": "module",
4
- "version": "5.0.108",
4
+ "version": "5.0.109",
5
5
  "description": "vona",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -36,9 +36,9 @@
36
36
  "@cabloy/utils": "^1.0.49",
37
37
  "@cabloy/word-utils": "^2.0.1",
38
38
  "@cabloy/zod-errors-custom": "^2.0.4",
39
- "@cabloy/zod-openapi": "^1.0.7",
39
+ "@cabloy/zod-openapi": "^1.0.8",
40
40
  "@cabloy/zod-query": "^2.0.4",
41
- "@cabloy/zod-to-openapi": "^8.1.4",
41
+ "@cabloy/zod-to-openapi": "^8.1.5",
42
42
  "chalk": "^5.3.0",
43
43
  "fs-extra": "^10.1.0",
44
44
  "koa": "^3.0.0",