-
Notifications
You must be signed in to change notification settings - Fork 4
/
handlebars-helper-provider.ts
46 lines (42 loc) · 1.06 KB
/
handlebars-helper-provider.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* Handlebars helper provider
*/
import { FilePath } from "../../utils/files.js"
import { TkmLogger } from "../../utils/logging.js"
import { HandlebarsHelper } from "./handlebars-helper.js"
import {
HandlebarsCompileOptions,
HandlebarsSafeString,
HandlebarsTemplateDelegate,
} from "./handlebars-template-engine.js"
export interface InitHandlebarsHelperProps {
/**
* Current project directory.
*/
readonly projectDir: FilePath
/**
* Logger instance.
*/
readonly logger: TkmLogger
/**
* Compile template string
*/
readonly compile: (
templateString: string,
options?: HandlebarsCompileOptions,
) => HandlebarsTemplateDelegate
/**
* Create Handlebars SafeString instance. Handlebars will not perform
* html escape for SafeStrings.
*/
readonly safeString: (str: string) => HandlebarsSafeString
}
/**
* Allows more customization to helper.
*/
export interface HandlebarsHelperProvider {
/**
* Initialize a Handlebars helper
*/
readonly init: (props: InitHandlebarsHelperProps) => Promise<HandlebarsHelper>
}