@xpack/xpm-lib 3.1.2 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/README.md +16 -212
  2. package/dist/classes/actions.d.ts +58 -0
  3. package/dist/classes/actions.d.ts.map +1 -0
  4. package/dist/classes/actions.js +250 -0
  5. package/dist/classes/actions.js.map +1 -0
  6. package/dist/classes/build-configurations.d.ts +78 -0
  7. package/dist/classes/build-configurations.d.ts.map +1 -0
  8. package/dist/classes/build-configurations.js +489 -0
  9. package/dist/classes/build-configurations.js.map +1 -0
  10. package/dist/classes/combinations-generator.d.ts +19 -0
  11. package/dist/classes/combinations-generator.d.ts.map +1 -0
  12. package/dist/classes/combinations-generator.js +48 -0
  13. package/dist/classes/combinations-generator.js.map +1 -0
  14. package/dist/classes/data-model.d.ts +21 -0
  15. package/dist/classes/data-model.d.ts.map +1 -0
  16. package/dist/classes/data-model.js +47 -0
  17. package/dist/classes/data-model.js.map +1 -0
  18. package/dist/classes/errors.d.ts +13 -0
  19. package/dist/classes/errors.d.ts.map +1 -0
  20. package/dist/classes/errors.js +13 -0
  21. package/dist/classes/errors.js.map +1 -0
  22. package/dist/classes/init-template-base.d.ts +47 -0
  23. package/dist/classes/init-template-base.d.ts.map +1 -0
  24. package/dist/classes/init-template-base.js +358 -0
  25. package/dist/classes/init-template-base.js.map +1 -0
  26. package/dist/classes/liquid-drop.d.ts +28 -0
  27. package/dist/classes/liquid-drop.d.ts.map +1 -0
  28. package/dist/classes/liquid-drop.js +70 -0
  29. package/dist/classes/liquid-drop.js.map +1 -0
  30. package/dist/classes/liquid-engine.d.ts +7 -0
  31. package/dist/classes/liquid-engine.d.ts.map +1 -0
  32. package/dist/classes/liquid-engine.js +72 -0
  33. package/dist/classes/liquid-engine.js.map +1 -0
  34. package/dist/classes/package.d.ts +31 -0
  35. package/dist/classes/package.d.ts.map +1 -0
  36. package/dist/classes/package.js +268 -0
  37. package/dist/classes/package.js.map +1 -0
  38. package/dist/classes/platform-detector.d.ts +14 -0
  39. package/dist/classes/platform-detector.d.ts.map +1 -0
  40. package/dist/classes/platform-detector.js +26 -0
  41. package/dist/classes/platform-detector.js.map +1 -0
  42. package/dist/classes/policies.d.ts +14 -0
  43. package/dist/classes/policies.d.ts.map +1 -0
  44. package/dist/classes/policies.js +20 -0
  45. package/dist/classes/policies.js.map +1 -0
  46. package/dist/classes/template-expander.d.ts +29 -0
  47. package/dist/classes/template-expander.d.ts.map +1 -0
  48. package/dist/classes/template-expander.js +62 -0
  49. package/dist/classes/template-expander.js.map +1 -0
  50. package/dist/data/substitutions-variables.d.ts +43 -0
  51. package/dist/data/substitutions-variables.d.ts.map +1 -0
  52. package/dist/{lib → data}/substitutions-variables.js +1 -16
  53. package/dist/data/substitutions-variables.js.map +1 -0
  54. package/dist/functions/chmod-recursively.d.ts +9 -0
  55. package/dist/functions/chmod-recursively.d.ts.map +1 -0
  56. package/dist/functions/chmod-recursively.js +66 -0
  57. package/dist/functions/chmod-recursively.js.map +1 -0
  58. package/dist/functions/filter-paths.d.ts +5 -0
  59. package/dist/functions/filter-paths.d.ts.map +1 -0
  60. package/dist/functions/filter-paths.js +16 -0
  61. package/dist/functions/filter-paths.js.map +1 -0
  62. package/dist/functions/is-something.d.ts +9 -0
  63. package/dist/functions/is-something.d.ts.map +1 -0
  64. package/dist/functions/is-something.js +25 -0
  65. package/dist/functions/is-something.js.map +1 -0
  66. package/dist/functions/matrix-expander.d.ts +17 -0
  67. package/dist/functions/matrix-expander.d.ts.map +1 -0
  68. package/dist/functions/matrix-expander.js +52 -0
  69. package/dist/functions/matrix-expander.js.map +1 -0
  70. package/dist/functions/perform-substitutions.d.ts +12 -0
  71. package/dist/functions/perform-substitutions.d.ts.map +1 -0
  72. package/dist/functions/perform-substitutions.js +76 -0
  73. package/dist/functions/perform-substitutions.js.map +1 -0
  74. package/dist/functions/utils.d.ts +8 -0
  75. package/dist/functions/utils.d.ts.map +1 -0
  76. package/dist/functions/utils.js +16 -0
  77. package/dist/functions/utils.js.map +1 -0
  78. package/dist/index.d.ts +22 -15
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/index.js +22 -29
  81. package/dist/index.js.map +1 -1
  82. package/dist/{lib/types.d.ts → types/json.d.ts} +31 -22
  83. package/dist/types/json.d.ts.map +1 -0
  84. package/dist/types/json.js +2 -0
  85. package/dist/types/json.js.map +1 -0
  86. package/dist/types/xpm-init-template.d.ts +21 -0
  87. package/dist/types/xpm-init-template.d.ts.map +1 -0
  88. package/dist/types/xpm-init-template.js +2 -0
  89. package/dist/types/xpm-init-template.js.map +1 -0
  90. package/dist/types/xpm.d.ts +16 -0
  91. package/dist/types/xpm.d.ts.map +1 -0
  92. package/dist/types/xpm.js +2 -0
  93. package/dist/types/xpm.js.map +1 -0
  94. package/package.json +53 -44
  95. package/src/CODE-REVIEW.md +2167 -0
  96. package/src/README.md +393 -6
  97. package/src/classes/actions.ts +1157 -0
  98. package/src/classes/build-configurations.ts +2127 -0
  99. package/src/classes/combinations-generator.ts +331 -0
  100. package/src/classes/data-model.ts +337 -0
  101. package/src/classes/errors.ts +105 -0
  102. package/src/classes/init-template-base.ts +1028 -0
  103. package/src/classes/liquid-drop.ts +376 -0
  104. package/src/classes/liquid-engine.ts +249 -0
  105. package/src/classes/package.ts +765 -0
  106. package/src/classes/platform-detector.ts +237 -0
  107. package/src/classes/policies.ts +200 -0
  108. package/src/classes/template-expander.ts +330 -0
  109. package/src/data/substitutions-variables.ts +390 -0
  110. package/src/functions/chmod-recursively.ts +195 -0
  111. package/src/functions/filter-paths.ts +126 -0
  112. package/src/functions/is-something.ts +223 -0
  113. package/src/functions/matrix-expander.ts +172 -0
  114. package/src/functions/perform-substitutions.ts +253 -0
  115. package/src/functions/utils.ts +151 -0
  116. package/src/index.ts +72 -19
  117. package/src/types/json.ts +519 -0
  118. package/src/types/xpm-init-template.ts +282 -0
  119. package/src/types/xpm.ts +162 -0
  120. package/dist/lib/chmod-recursive.d.ts +0 -7
  121. package/dist/lib/chmod-recursive.d.ts.map +0 -1
  122. package/dist/lib/chmod-recursive.js +0 -81
  123. package/dist/lib/chmod-recursive.js.map +0 -1
  124. package/dist/lib/errors.d.ts +0 -11
  125. package/dist/lib/errors.d.ts.map +0 -1
  126. package/dist/lib/errors.js +0 -26
  127. package/dist/lib/errors.js.map +0 -1
  128. package/dist/lib/functions/chmod-recursive.d.ts +0 -7
  129. package/dist/lib/functions/chmod-recursive.d.ts.map +0 -1
  130. package/dist/lib/functions/chmod-recursive.js +0 -81
  131. package/dist/lib/functions/chmod-recursive.js.map +0 -1
  132. package/dist/lib/functions/perform-substitutions.d.ts +0 -20
  133. package/dist/lib/functions/perform-substitutions.d.ts.map +0 -1
  134. package/dist/lib/functions/perform-substitutions.js +0 -85
  135. package/dist/lib/functions/perform-substitutions.js.map +0 -1
  136. package/dist/lib/functions/utils.d.ts +0 -30
  137. package/dist/lib/functions/utils.d.ts.map +0 -1
  138. package/dist/lib/functions/utils.js +0 -70
  139. package/dist/lib/functions/utils.js.map +0 -1
  140. package/dist/lib/init-template-base.d.ts +0 -46
  141. package/dist/lib/init-template-base.d.ts.map +0 -1
  142. package/dist/lib/init-template-base.js +0 -281
  143. package/dist/lib/init-template-base.js.map +0 -1
  144. package/dist/lib/liquid-actions.d.ts +0 -37
  145. package/dist/lib/liquid-actions.d.ts.map +0 -1
  146. package/dist/lib/liquid-actions.js +0 -148
  147. package/dist/lib/liquid-actions.js.map +0 -1
  148. package/dist/lib/liquid-build-configurations.d.ts +0 -47
  149. package/dist/lib/liquid-build-configurations.d.ts.map +0 -1
  150. package/dist/lib/liquid-build-configurations.js +0 -282
  151. package/dist/lib/liquid-build-configurations.js.map +0 -1
  152. package/dist/lib/liquid-drop.d.ts +0 -13
  153. package/dist/lib/liquid-drop.d.ts.map +0 -1
  154. package/dist/lib/liquid-drop.js +0 -56
  155. package/dist/lib/liquid-drop.js.map +0 -1
  156. package/dist/lib/liquid-engine.d.ts +0 -5
  157. package/dist/lib/liquid-engine.d.ts.map +0 -1
  158. package/dist/lib/liquid-engine.js +0 -85
  159. package/dist/lib/liquid-engine.js.map +0 -1
  160. package/dist/lib/liquid-package.d.ts +0 -17
  161. package/dist/lib/liquid-package.d.ts.map +0 -1
  162. package/dist/lib/liquid-package.js +0 -70
  163. package/dist/lib/liquid-package.js.map +0 -1
  164. package/dist/lib/package.d.ts +0 -66
  165. package/dist/lib/package.d.ts.map +0 -1
  166. package/dist/lib/package.js +0 -700
  167. package/dist/lib/package.js.map +0 -1
  168. package/dist/lib/perform-substitutions.d.ts +0 -20
  169. package/dist/lib/perform-substitutions.d.ts.map +0 -1
  170. package/dist/lib/perform-substitutions.js +0 -85
  171. package/dist/lib/perform-substitutions.js.map +0 -1
  172. package/dist/lib/policies.d.ts +0 -14
  173. package/dist/lib/policies.d.ts.map +0 -1
  174. package/dist/lib/policies.js +0 -33
  175. package/dist/lib/policies.js.map +0 -1
  176. package/dist/lib/substitutions-variables.d.ts +0 -117
  177. package/dist/lib/substitutions-variables.d.ts.map +0 -1
  178. package/dist/lib/substitutions-variables.js.map +0 -1
  179. package/dist/lib/types.d.ts.map +0 -1
  180. package/dist/lib/types.js +0 -13
  181. package/dist/lib/types.js.map +0 -1
  182. package/dist/lib/utils.d.ts +0 -30
  183. package/dist/lib/utils.d.ts.map +0 -1
  184. package/dist/lib/utils.js +0 -70
  185. package/dist/lib/utils.js.map +0 -1
  186. package/dist/tsconfig.tsbuildinfo +0 -1
  187. package/src/lib/errors.ts +0 -29
  188. package/src/lib/functions/chmod-recursive.ts +0 -103
  189. package/src/lib/functions/perform-substitutions.ts +0 -116
  190. package/src/lib/functions/utils.ts +0 -88
  191. package/src/lib/init-template-base.ts +0 -408
  192. package/src/lib/liquid-actions.ts +0 -223
  193. package/src/lib/liquid-build-configurations.ts +0 -433
  194. package/src/lib/liquid-drop.ts +0 -99
  195. package/src/lib/liquid-engine.ts +0 -135
  196. package/src/lib/liquid-package.ts +0 -108
  197. package/src/lib/package.ts +0 -947
  198. package/src/lib/policies.ts +0 -51
  199. package/src/lib/substitutions-variables.ts +0 -177
  200. package/src/lib/types.ts +0 -109
  201. package/src/package.json +0 -3
  202. package/src/tsconfig.json +0 -10
@@ -0,0 +1,330 @@
1
+ /*
2
+ * This file is part of the xPack project (http://xpack.github.io).
3
+ * Copyright (c) 2021-2026 Liviu Ionescu. All rights reserved.
4
+ *
5
+ * Permission to use, copy, modify, and/or distribute this software
6
+ * for any purpose is hereby granted, under the terms of the MIT license.
7
+ *
8
+ * If a copy of the license was not distributed with this file, it can
9
+ * be obtained from https://opensource.org/license/mit.
10
+ */
11
+
12
+ // ----------------------------------------------------------------------------
13
+
14
+ import { Logger } from '@xpack/logger'
15
+
16
+ // ----------------------------------------------------------------------------
17
+
18
+ import { LiquidSubstitutionsVariables } from '../data/substitutions-variables.js'
19
+ import { processMatrixForExpansion } from '../functions/matrix-expander.js'
20
+ import { performSubstitutions } from '../functions/perform-substitutions.js'
21
+ import { getErrorMessage } from '../functions/utils.js'
22
+ import { CombinationsGenerator } from './combinations-generator.js'
23
+ import { ConfigurationError } from './errors.js'
24
+ import { LiquidEngine } from './liquid-engine.js'
25
+ import { JsonTemplateMatrix } from '../types/json.js'
26
+
27
+ // ============================================================================
28
+
29
+ /**
30
+ * Configuration parameters for constructing a template expander instance.
31
+ *
32
+ * @remarks
33
+ * This interface defines the required configuration for creating an
34
+ * instance of {@link TemplateExpander}. All properties are mandatory.
35
+ *
36
+ * The parameters provide the Liquid templating engine, substitution
37
+ * variables hierarchy, and logger for diagnostic output during template
38
+ * expansion operations.
39
+ */
40
+ export interface TemplateExpanderConstructorParameters {
41
+ /**
42
+ * The Liquid templating engine for variable substitution.
43
+ */
44
+ engine: LiquidEngine
45
+
46
+ /**
47
+ * The variables available for substitution in templates.
48
+ */
49
+ substitutionsVariables: LiquidSubstitutionsVariables
50
+
51
+ /**
52
+ * The logger instance for output and diagnostics.
53
+ */
54
+ log: Logger
55
+ }
56
+
57
+ /**
58
+ * Callback function type for creating instances from template expansions.
59
+ *
60
+ * @remarks
61
+ * This function is invoked for each combination generated during template
62
+ * expansion. It receives the expanded name, matrix combination parameters,
63
+ * and the template content, and must return a new instance of type
64
+ * <code>TInstance</code>.
65
+ *
66
+ * The callback is responsible for:
67
+ *
68
+ * <ol>
69
+ * <li>Creating the appropriate instance type (e.g., <code>Action</code> or
70
+ * <code>BuildConfiguration</code>).</li>
71
+ * <li>Passing the expanded name to the instance constructor.</li>
72
+ * <li>Storing the matrix parameters for later template evaluation.</li>
73
+ * <li>Associating the template content with the instance.</li>
74
+ * </ol>
75
+ *
76
+ * @typeParam TTemplate - The type of the template content (e.g.,
77
+ * <code>JsonActionContent</code> or
78
+ * <code>JsonBuildConfigurationContent</code>).
79
+ * @typeParam TInstance - The type of instance to create (e.g.,
80
+ * <code>Action</code> or <code>BuildConfiguration</code>).
81
+ *
82
+ * @param expandedName - The name after Liquid substitution with matrix
83
+ * parameters (e.g., <code>test-x64</code> from
84
+ * <code>test-\{\{ matrix.arch \}\}</code>).
85
+ * @param combination - The matrix parameter values for this combination
86
+ * (e.g., <code>\{ arch: 'x64', platform: 'linux' \}</code>).
87
+ * @param templateContent - The template content to associate with the
88
+ * instance.
89
+ * @param originalTemplateName - The original template name before expansion
90
+ * (e.g., <code>test-\{\{ matrix.arch \}\}</code>).
91
+ * @returns The newly created instance.
92
+ */
93
+ export type InstanceFactoryCallback<TTemplate, TInstance> = (
94
+ expandedName: string,
95
+ combination: Record<string, string>,
96
+ templateContent: TTemplate,
97
+ originalTemplateName: string
98
+ ) => TInstance
99
+
100
+ /**
101
+ * A generic template expansion engine for matrix-based template processing.
102
+ *
103
+ * @remarks
104
+ * This class provides shared functionality for expanding template names
105
+ * and creating multiple instances from a single template definition with
106
+ * matrix parameters. It eliminates code duplication between
107
+ * {@link Actions} and {@link BuildConfigurations} classes by extracting
108
+ * the common template expansion logic.
109
+ *
110
+ * Template expansion process:
111
+ *
112
+ * <ol>
113
+ * <li><b>Matrix processing:</b> Validates matrix structure and performs
114
+ * Liquid substitutions on matrix values.</li>
115
+ * <li><b>Combination generation:</b> Computes the Cartesian product of all
116
+ * matrix parameter values.</li>
117
+ * <li><b>Name expansion:</b> For each combination, substitutes matrix values
118
+ * into the template name.</li>
119
+ * <li><b>Instance creation:</b> Invokes the factory callback to create
120
+ * instances with expanded names and matrix parameters.</li>
121
+ * </ol>
122
+ *
123
+ * The class is generic to support different template and instance types
124
+ * whilst maintaining type safety throughout the expansion process.
125
+ *
126
+ * @typeParam TTemplate - The type of template content (e.g.,
127
+ * <code>JsonActionContent</code> or
128
+ * <code>JsonBuildConfigurationContent</code>).
129
+ * @typeParam TInstance - The type of instance to create (e.g.,
130
+ * <code>Action</code> or <code>BuildConfiguration</code>).
131
+ */
132
+ export class TemplateExpander<TTemplate, TInstance> {
133
+ // --------------------------------------------------------------------------
134
+ // Public Members.
135
+
136
+ /**
137
+ * The Liquid templating engine for variable substitution.
138
+ */
139
+ readonly engine: LiquidEngine
140
+
141
+ /**
142
+ * The variables available for substitution in templates.
143
+ */
144
+ readonly substitutionsVariables: LiquidSubstitutionsVariables
145
+
146
+ /**
147
+ * The logger instance for output and diagnostics.
148
+ */
149
+ readonly log: Logger
150
+
151
+ // --------------------------------------------------------------------------
152
+ // Constructor.
153
+
154
+ /**
155
+ * Constructs a template expander instance.
156
+ *
157
+ * @param engine - The Liquid templating engine for variable substitution.
158
+ * @param substitutionsVariables - The variables available for substitution
159
+ * in templates.
160
+ * @param log - The logger instance for output and diagnostics.
161
+ */
162
+ constructor({
163
+ engine,
164
+ substitutionsVariables,
165
+ log,
166
+ }: TemplateExpanderConstructorParameters) {
167
+ this.engine = engine
168
+ this.substitutionsVariables = substitutionsVariables
169
+ this.log = log
170
+ }
171
+
172
+ // --------------------------------------------------------------------------
173
+ // Public Methods.
174
+
175
+ /**
176
+ * Expands a template into multiple instances based on matrix parameters.
177
+ *
178
+ * @remarks
179
+ * This method orchestrates the template expansion process by validating
180
+ * the matrix, generating all parameter combinations, expanding the
181
+ * template name for each combination, and creating instances via the
182
+ * factory callback.
183
+ *
184
+ * Processing steps:
185
+ *
186
+ * <ol>
187
+ * <li>Processes the matrix to extract and validate parameter keys and
188
+ * values.</li>
189
+ * <li>Generates all combinations using the Cartesian product.</li>
190
+ * <li>For each combination:
191
+ * <ol>
192
+ * <li>Performs Liquid substitution on the template name with matrix
193
+ * parameters.</li>
194
+ * <li>Invokes the factory callback to create an instance.</li>
195
+ * <li>Stores the instance in the result map.</li>
196
+ * </ol>
197
+ * </li>
198
+ * </ol>
199
+ *
200
+ * The factory callback is responsible for creating the appropriate
201
+ * instance type and associating it with the expanded name and matrix
202
+ * parameters.
203
+ *
204
+ * @param templateName - The template name containing Liquid variables
205
+ * (e.g., <code>test-\{\{ matrix.arch \}\}</code>).
206
+ * @param matrix - The matrix object containing parameter definitions.
207
+ * @param templateContent - The template content to pass to the factory.
208
+ * @param templateType - A descriptive name for the template type (e.g.,
209
+ * "action" or "buildConfiguration"), used in error messages.
210
+ * @param instanceFactory - A callback function that creates instances from
211
+ * expanded names and matrix combinations.
212
+ * @returns A promise that resolves to a map of expanded names to their
213
+ * corresponding instances.
214
+ *
215
+ * @throws {@link ConfigurationError}
216
+ * If the matrix structure is invalid, template name substitution fails,
217
+ * or the factory callback throws an error.
218
+ */
219
+ async expandTemplate({
220
+ templateName,
221
+ matrix,
222
+ templateContent,
223
+ templateType,
224
+ instanceFactory,
225
+ }: {
226
+ templateName: string
227
+ matrix: JsonTemplateMatrix
228
+ templateContent: TTemplate
229
+ templateType: string
230
+ instanceFactory: InstanceFactoryCallback<TTemplate, TInstance>
231
+ }): Promise<Map<string, TInstance>> {
232
+ const log = this.log
233
+ log.trace(`${TemplateExpander.name}.expandTemplate(${templateName})`)
234
+
235
+ const instances = new Map<string, TInstance>()
236
+
237
+ // Process matrix for expansion
238
+ const { matrixKeys, matrixValues } = await processMatrixForExpansion({
239
+ matrix,
240
+ templateName,
241
+ templateType: templateType as 'action' | 'buildConfiguration',
242
+ engine: this.engine,
243
+ substitutionsVariables: this.substitutionsVariables,
244
+ log: this.log,
245
+ })
246
+
247
+ // Generate all combinations (Cartesian product)
248
+ const combinationsGenerator = new CombinationsGenerator({
249
+ matrixKeys,
250
+ matrixValues,
251
+ log: this.log,
252
+ })
253
+
254
+ // Use generator pattern for memory efficiency
255
+ // Expand template for each combination
256
+ for (const combination of combinationsGenerator.generate()) {
257
+ const expandedName = await this._expandName({
258
+ templateName,
259
+ combination,
260
+ templateType,
261
+ })
262
+
263
+ const instance = instanceFactory(
264
+ expandedName,
265
+ combination,
266
+ templateContent,
267
+ templateName
268
+ )
269
+
270
+ instances.set(expandedName, instance)
271
+ }
272
+
273
+ return instances
274
+ }
275
+
276
+ // --------------------------------------------------------------------------
277
+ // Protected Methods.
278
+
279
+ /**
280
+ * Expands a template name with matrix parameter substitutions.
281
+ *
282
+ * @remarks
283
+ * This helper method performs Liquid template substitution on the template
284
+ * name using the specific matrix combination values. It wraps the
285
+ * substitution operation with error handling to provide context about
286
+ * which template failed.
287
+ *
288
+ * The method adds the matrix parameters to the substitution variables
289
+ * hierarchy under the <code>matrix</code> namespace, making them
290
+ * accessible in Liquid templates via syntax like
291
+ * <code>\{\{ matrix.arch \}\}</code>.
292
+ *
293
+ * @param templateName - The template name containing Liquid variables.
294
+ * @param combination - The matrix parameter values for this combination.
295
+ * @param templateType - A descriptive name for the template type, used in
296
+ * error messages.
297
+ * @returns A promise that resolves to the expanded name after substitution.
298
+ *
299
+ * @throws {@link ConfigurationError}
300
+ * If Liquid substitution fails, with context about the template name.
301
+ */
302
+ protected async _expandName({
303
+ templateName,
304
+ combination,
305
+ templateType,
306
+ }: {
307
+ templateName: string
308
+ combination: Record<string, string>
309
+ templateType: string
310
+ }): Promise<string> {
311
+ try {
312
+ return await performSubstitutions({
313
+ input: templateName,
314
+ engine: this.engine,
315
+ substitutionsVariables: {
316
+ ...this.substitutionsVariables,
317
+ matrix: combination,
318
+ },
319
+ log: this.log,
320
+ })
321
+ } catch (error) {
322
+ const message =
323
+ getErrorMessage(error) +
324
+ ` in ${templateType} "${templateName}" name substitution`
325
+ throw new ConfigurationError(message)
326
+ }
327
+ }
328
+ }
329
+
330
+ // ----------------------------------------------------------------------------