@@ -28,6 +28,8 @@ import {
28
28
29
29
import { debug as Debug } from 'debug'
30
30
import ignore from 'ignore'
31
+
32
+ const VERBOSE = process . env . DEBUG_VERBOSE
31
33
const debug = Debug ( 'vue-i18n-locale-message:commands:infuse' )
32
34
33
35
type InfuseOptions = {
@@ -133,8 +135,8 @@ export const handler = async (args: Arguments<InfuseOptions>) => {
133
135
const messages = readLocaleMessages ( messagesPath , args . match )
134
136
135
137
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 )
138
140
139
141
const meta = squeeze ( targetPath , sources )
140
142
apply ( sfc , meta )
@@ -186,7 +188,7 @@ function apply (messages: LocaleMessages, meta: MetaLocaleMessage): MetaLocaleMe
186
188
const { hierarchy } = parsePath ( target , component )
187
189
188
190
const collectMessages = getTargetLocaleMessages ( messages , hierarchy )
189
- debug ( 'collect messages' , JSON . stringify ( collectMessages , null , 2 ) )
191
+ VERBOSE && debug ( 'collect messages' , JSON . stringify ( collectMessages , null , 2 ) )
190
192
191
193
const sourceLocales : Locale [ ] = Object . keys ( collectMessages )
192
194
const targetLocales = blocks . reduce ( ( locales , block ) => {
@@ -239,7 +241,7 @@ function apply (messages: LocaleMessages, meta: MetaLocaleMessage): MetaLocaleMe
239
241
240
242
function getTargetLocaleMessages ( messages : LocaleMessages , hierarchy : string [ ] ) : LocaleMessages {
241
243
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 ) } ` )
243
245
244
246
const obj = messages [ locale ]
245
247
if ( obj ) {
@@ -253,7 +255,7 @@ function getTargetLocaleMessages (messages: LocaleMessages, hierarchy: string[])
253
255
if ( ! key || ! o ) { break }
254
256
o = o [ key ]
255
257
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 ) } ` )
257
259
}
258
260
259
261
if ( ! o && ! prev ) {
0 commit comments