Skip to main content

CompilerProps

Stentor API Reference


Stentor API Reference / stentor-utils/src / CompilerProps

Interface: CompilerProps

Defined in: packages/stentor-utils/src/compilers/compiler.ts:22

Properties​

replaceWhenUndefined?​

readonly optional replaceWhenUndefined: boolean

Defined in: packages/stentor-utils/src/compilers/compiler.ts:29

When true, it will replace the ${foo} with undefined or null if the value for foo cannot be found. Default behavior will leave ${foo} if it does not have a value.

A caveat to this is when the foo is in a string such as "${foo}" then it will replace it with an empty string instead of undefined, thus "" instead of "undefined". The reason for this is "" is falsey and "undefined" is not. If you are doing string comparisons then this will be a problem.


macros?​

readonly optional macros: MacroMap

Defined in: packages/stentor-utils/src/compilers/compiler.ts:42

When provided it overrides the DEFAULT_MACROS and are used when compiling the templates.

You can include the DEFAULT_MACROS if you include them:

macros: {
...DEFAULT_MACROS,
...myMacros
}

additionalContext?​

readonly optional additionalContext: Record\<string, unknown>

Defined in: packages/stentor-utils/src/compilers/compiler.ts:47

When provided, the additional context will be used when compiling the templates. This is an opportunity to inject more information beyond the provided request and context objects.