@@ -37,11 +37,13 @@ import {
3737 getLocaleChain ,
3838 NOT_REOSLVED ,
3939 handleFlatJson ,
40- MessageFunction
40+ MessageFunction ,
41+ setAdditionalMeta
4142} from '@intlify/core-base'
4243import { VueDevToolsTimelineEvents } from '@intlify/vue-devtools'
4344import { I18nWarnCodes , getWarnMessage } from './warnings'
4445import { I18nErrorCodes , createI18nError } from './errors'
46+ import { VERSION } from './misc'
4547
4648import type { ComponentInternalInstance , VNode , VNodeArrayChildren } from 'vue'
4749import type { WritableComputedRef , ComputedRef } from '@vue/reactivity'
@@ -323,7 +325,6 @@ export interface ComposerInternalOptions<
323325 __i18n ?: CustomBlocks < Message >
324326 __i18nGlobal ?: CustomBlocks < Message >
325327 __root ?: Composer < Messages , DateTimeFormats , NumberFormats , Message >
326- __meta ?: MetaInfo
327328}
328329
329330/**
@@ -1171,6 +1172,14 @@ function deepCopy(src: any, des: any): void {
11711172 }
11721173}
11731174
1175+ // for Intlify DevTools
1176+ const getMetaInfo = /* #__PURE__*/ ( ) : MetaInfo | null => {
1177+ const instance = getCurrentInstance ( )
1178+ return instance && ( instance . type as any ) [ DEVTOOLS_META ] // eslint-disable-line @typescript-eslint/no-explicit-any
1179+ ? { [ DEVTOOLS_META ] : ( instance . type as any ) [ DEVTOOLS_META ] } // eslint-disable-line @typescript-eslint/no-explicit-any
1180+ : null
1181+ }
1182+
11741183/**
11751184 * Create composer interface factory
11761185 *
@@ -1199,7 +1208,7 @@ export function createComposer<
11991208 Options [ 'numberFormats' ] ,
12001209 Message
12011210> {
1202- const { __root, __meta } = options as ComposerInternalOptions <
1211+ const { __root } = options as ComposerInternalOptions <
12031212 Messages ,
12041213 DateTimeFormats ,
12051214 NumberFormats ,
@@ -1312,6 +1321,7 @@ export function createComposer<
13121321 Message
13131322 > {
13141323 return createCoreContext < Message > ( {
1324+ version : VERSION ,
13151325 locale : _locale . value ,
13161326 fallbackLocale : _fallbackLocale . value ,
13171327 messages : _messages . value ,
@@ -1336,7 +1346,7 @@ export function createComposer<
13361346 __v_emitter : isPlainObject ( _context )
13371347 ? ( ( _context as unknown ) as CoreInternalContext ) . __v_emitter
13381348 : undefined ,
1339- __meta : Object . assign ( { framework : 'vue' } , __meta || { } )
1349+ __meta : { framework : 'vue' }
13401350 } as CoreOptions < Message > ) as CoreContext <
13411351 Messages ,
13421352 DateTimeFormats ,
@@ -1434,7 +1444,18 @@ export function createComposer<
14341444 successCondition : ( val : unknown ) => boolean
14351445 ) : U {
14361446 trackReactivityValues ( ) // track reactive dependency
1437- const ret = fn ( _context )
1447+ // NOTE: experimental !!
1448+ let ret : unknown
1449+ if ( __DEV__ || __FEATURE_PROD_INTLIFY_DEVTOOLS__ ) {
1450+ try {
1451+ setAdditionalMeta ( getMetaInfo ( ) )
1452+ ret = fn ( _context )
1453+ } finally {
1454+ setAdditionalMeta ( null )
1455+ }
1456+ } else {
1457+ ret = fn ( _context )
1458+ }
14381459 if ( isNumber ( ret ) && ret === NOT_REOSLVED ) {
14391460 const [ key , arg2 ] = argumentParser ( )
14401461 if (
@@ -1842,8 +1863,7 @@ export function createComposer<
18421863 [ TransrateVNodeSymbol ] : transrateVNode ,
18431864 [ NumberPartsSymbol ] : numberParts ,
18441865 [ DatetimePartsSymbol ] : datetimeParts ,
1845- [ SetPluralRulesSymbol ] : setPluralRules ,
1846- [ DevToolsMetaSymbol ] : __meta
1866+ [ SetPluralRulesSymbol ] : setPluralRules
18471867 }
18481868
18491869 // for vue-devtools timeline event
0 commit comments