mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
## Summary Manual backport of https://github.com/elastic/kibana/pull/218449 to move usage of `handlebars` to `kbn/handlebars` The changes in the PR to main were on code that doesn't exist in 9.0/8.x/7.17 hence requiring a manual backport to usage of `compileAST` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
171bfdf1d0
commit
dbbd9339cd
2 changed files with 3 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
import Handlebars from '@kbn/handlebars';
|
||||
import { safeLoad, safeDump } from 'js-yaml';
|
||||
import type { Logger } from '@kbn/core/server';
|
||||
|
||||
|
@ -21,7 +21,7 @@ export function compileTemplate(variables: PackagePolicyConfigRecord, templateSt
|
|||
const { vars, yamlValues } = buildTemplateVariables(logger, variables);
|
||||
let compiledTemplate: string;
|
||||
try {
|
||||
const template = handlebars.compile(templateStr, { noEscape: true });
|
||||
const template = handlebars.compileAST(templateStr, { noEscape: true });
|
||||
compiledTemplate = template(vars);
|
||||
} catch (err) {
|
||||
throw new PackageInvalidArchiveError(`Error while compiling agent template: ${err.message}`);
|
||||
|
|
|
@ -119,5 +119,6 @@
|
|||
"@kbn/field-formats-plugin",
|
||||
"@kbn/core-security-server",
|
||||
"@kbn/core-http-server-utils",
|
||||
"@kbn/handlebars",
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue