Kind: Class
Source: atloria-monorepo/libs/parser-core/src/parsers/backend/jinja2-template.parser.ts
Jinja2 Template Parser
Extracts entities and relationships from Jinja2 template files.
Implements: IParser
Methods
| Method | Signature | Returns |
|---|---|---|
initialize | initialize(config: { rootDir: string }) | Promise<void> |
canParse | canParse(filePath: string) | boolean |
parseFile | parseFile(filePath: string, content: string) | Promise<ParseResult> |
parseFiles | parseFiles(files: ParseFileInput[]) | Promise<ParseResult[]> |
destroy | destroy() | Promise<void> |
Properties
| Property | Type |
|---|---|
name | any |
version | any |
supportedPatterns | any |
Where it refuses work
Jinja2TemplateParserstops the work with an early return when/from\s+flask\s+import|import\s+flask/i.test(content).Jinja2TemplateParserstops the work with an early return when/flask|jinja2/i.test(content).Jinja2TemplateParserstops the work with an early return whenfilePath.endsWith('.jinja2') || filePath.endsWith('.j2').Jinja2TemplateParserstops the work with an early return when!this.projectHasJinja2.Jinja2TemplateParserstops the work with an early return whentemplatesIndex !== -1 && templatesIndex < parts.length - 1.Jinja2TemplateParserstops the work with an early return whenmatch.
When something fails
Jinja2TemplateParserhandles failure in 3 places: it discards it silently in 2, and turns it into a return value in 1.
Was this page helpful?