Skip to content

Commit be18faf

Browse files
authored
fix: add debug log (#260)
1 parent f783f77 commit be18faf

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/commands/infuse.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,11 @@ function removeItem<T> (item: T, items: T[]): boolean {
182182

183183
function apply (messages: LocaleMessages, meta: MetaLocaleMessage): MetaLocaleMessage {
184184
const { target, components } = meta
185+
debug(`apply meta.target = ${target}`)
185186

186187
for (const [component, blocks] of Object.entries(components)) {
187-
debug(`apply component = ${component}, blocks = ${JSON.stringify(blocks)}`)
188188
const { hierarchy } = parsePath(target, component)
189+
debug(`apply component = ${component}, hierarchy = ${hierarchy}, blocks = ${JSON.stringify(blocks)}`)
189190

190191
const collectMessages = getTargetLocaleMessages(messages, hierarchy)
191192
VERBOSE && debug('collect messages', JSON.stringify(collectMessages, null, 2))

src/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@ export function reflectSFCDescriptor (basePath: string, components: SFCFileInfo[
8888

8989
export function parsePath (basePath: string, targetPath: string) {
9090
const { dir, name } = path.parse(targetPath)
91+
debug(`parsePath: dir = ${dir}, name = ${name}`)
9192
// eslint-disable-next-line @typescript-eslint/no-unused-vars
9293
const [_, target] = dir.split(basePath)
94+
debug(`parsePath: 1st splited _ = ${_}, target = ${target}`)
9395
const parsedTargetPath = target.split(path.sep)
96+
debug(`parsePath: 2nd splited parsedTargetPath = ${parsedTargetPath}`)
9497
parsedTargetPath.shift()
9598
debug(`parsePath: contentPath = ${targetPath}, component = ${name}, messageHierarchy = ${parsedTargetPath}`)
9699
return {

0 commit comments

Comments
 (0)