diff --git a/src/metadata/compileTemplates.ts b/src/metadata/compileTemplates.ts index 84effb7..a869f36 100644 --- a/src/metadata/compileTemplates.ts +++ b/src/metadata/compileTemplates.ts @@ -14,7 +14,7 @@ export const compileTemplates = ( const compiled = compileTemplate(templates, new Set(path), match[1]) if (compiled) { result.declares = mergeDeclares(result.declares, compiled.declares) - result.body += compiled.body + result.body = compiled.body + result.body } } return result diff --git a/src/metadata/templateSections.ts b/src/metadata/templateSections.ts index da17535..6f03d6c 100644 --- a/src/metadata/templateSections.ts +++ b/src/metadata/templateSections.ts @@ -2,7 +2,7 @@ import cleanQuery from './cleanQuery' export const extractSections = (view: string): TemplateSections => { const declaresRegex = - /declare \$(?[\w\d]+) as (?[\w\d]+)( = (?[\w\d]+))?;\s*/g + /declare \$(?[\w\d]+) as (?[\w\d]+)( = (?[\w\d]+));?\s*/g const declares = new Map() let match @@ -29,7 +29,6 @@ export const mergeDeclares = (left: Declares, right: Declares) => { export const compileDeclares = (declares: Declares) => { let result = '' - console.log('comipleDeclares', declares) for (const declare of declares) result += compileDeclare(declare) return result }