@flow-state-dev/engine/resource-template
Classes
ResourceTemplateLoadError
Extends
Error
Constructors
Constructor
new ResourceTemplateLoadError(message, options?): ResourceTemplateLoadError;
Parameters
message
string
options?
cause?
unknown
sourcePath?
string
Returns
Overrides
Error.constructor
Properties
cause?
cause?: unknown;
Inherited from
Error.cause
message
message: string;
Inherited from
Error.message
name
name: string;
Inherited from
Error.name
sourcePath?
readonly sourcePath?: string;
stack?
stack?: string;
Inherited from
Error.stack
Functions
createResourceTemplateLoader()
function createResourceTemplateLoader(baseDir, options?): (relPath) => ResourceTemplate;
Build a resource template loader anchored at baseDir.
Parameters
baseDir
string
options?
partialsDir?
string
Returns
(relPath) => ResourceTemplate
Throws
when baseDir is not absolute.
loadResourceTemplate()
function loadResourceTemplate(
specifier,
importerUrl,
options?
): ResourceTemplate;
Load and parse a .md resource template relative to the calling module.
Parameters
specifier
string
Module-relative path, or an absolute path to the template file.
importerUrl
string
The caller's import.meta.url (ignored for absolute specifiers).
options?
Optional partials map override.
partials?
ResourceTemplatePartials
Returns
ResourceTemplate
Throws
when the file cannot be read.
Throws
(via parseResourceTemplate) on invalid content.