@@ -28,6 +28,8 @@ import {
2828
2929import { debug as Debug } from 'debug'
3030import ignore from 'ignore'
31+
32+ const VERBOSE = process . env . DEBUG_VERBOSE
3133const debug = Debug ( 'vue-i18n-locale-message:commands:infuse' )
3234
3335type InfuseOptions = {
@@ -133,8 +135,8 @@ export const handler = async (args: Arguments<InfuseOptions>) => {
133135 const messages = readLocaleMessages ( messagesPath , args . match )
134136
135137 const { sfc, external } = splitLocaleMessages ( messages , nsDictionary , args . unbundleTo , args . unbundleMatch )
136- debug ( 'sfc' , sfc )
137- debug ( 'external' , external )
138+ VERBOSE && debug ( 'sfc' , sfc )
139+ VERBOSE && debug ( 'external' , external )
138140
139141 const meta = squeeze ( targetPath , sources )
140142 apply ( sfc , meta )
@@ -186,7 +188,7 @@ function apply (messages: LocaleMessages, meta: MetaLocaleMessage): MetaLocaleMe
186188 const { hierarchy } = parsePath ( target , component )
187189
188190 const collectMessages = getTargetLocaleMessages ( messages , hierarchy )
189- debug ( 'collect messages' , JSON . stringify ( collectMessages , null , 2 ) )
191+ VERBOSE && debug ( 'collect messages' , JSON . stringify ( collectMessages , null , 2 ) )
190192
191193 const sourceLocales : Locale [ ] = Object . keys ( collectMessages )
192194 const targetLocales = blocks . reduce ( ( locales , block ) => {
@@ -239,7 +241,7 @@ function apply (messages: LocaleMessages, meta: MetaLocaleMessage): MetaLocaleMe
239241
240242function getTargetLocaleMessages ( messages : LocaleMessages , hierarchy : string [ ] ) : LocaleMessages {
241243 return Object . keys ( messages ) . reduce ( ( target , locale ) => {
242- debug ( `processing curernt: locale=${ locale } , target=${ JSON . stringify ( target ) } ` )
244+ VERBOSE && debug ( `processing curernt: locale=${ locale } , target=${ JSON . stringify ( target ) } ` )
243245
244246 const obj = messages [ locale ]
245247 if ( obj ) {
@@ -253,7 +255,7 @@ function getTargetLocaleMessages (messages: LocaleMessages, hierarchy: string[])
253255 if ( ! key || ! o ) { break }
254256 o = o [ key ]
255257 prev = o
256- debug ( `processing o = ${ JSON . stringify ( o ) } , prev = ${ JSON . stringify ( prev ) } ` )
258+ VERBOSE && debug ( `processing o = ${ JSON . stringify ( o ) } , prev = ${ JSON . stringify ( prev ) } ` )
257259 }
258260
259261 if ( ! o && ! prev ) {
0 commit comments