TemplateExpander class
A generic template expansion engine for matrix-based template processing.
Signature
export declare class TemplateExpander<TTemplate, TInstance>
Remarks
This class provides shared functionality for expanding template names and creating multiple instances from a single template definition with matrix parameters. It eliminates code duplication between Actions and BuildConfigurations classes by extracting the common template expansion logic.
Template expansion process:
- Matrix processing: Validates matrix structure and performs Liquid substitutions on matrix values.
- Combination generation: Computes the Cartesian product of all matrix parameter values.
- Name expansion: For each combination, substitutes matrix values into the template name.
- Instance creation: Invokes the factory callback to create instances with expanded names and matrix parameters.
The class is generic to support different template and instance types whilst maintaining type safety throughout the expansion process.
Constructors
|
Constructor |
Modifiers |
Description |
|---|---|---|
|
(constructor)({ engine, substitutionsVariables, log, }, input) |
Constructs a template expander instance. |
Properties
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
|
The Liquid templating engine for variable substitution. | ||
|
|
Logger |
The logger instance for output and diagnostics. | |
|
|
The variables available for substitution in templates. |
Methods
|
Method |
Modifiers |
Description |
|---|---|---|
|
_expandName({ templateName, combination, templateType, }, input) |
|
Expands a template name with matrix parameter substitutions. |
|
expandTemplate({ templateName, matrix, templateContent, templateType, instanceFactory, }, input) |
Expands a template into multiple instances based on matrix parameters. |
Generated via tsdoc2docusaurus 1.3.2 by API Extractor/Documenter 7.57.2.