@codeandmoney/jargal 0.0.0-rc.4 → 0.0.0-rc.5
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.
- package/jargal.ts +5 -5
- package/package.json +1 -1
package/jargal.ts
CHANGED
|
@@ -42,11 +42,11 @@ export class Jargal<const in out Context> {
|
|
|
42
42
|
return this as any;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
render(params?: {
|
|
46
|
-
composeRenderData?: (ctx: Context) => RenderEntry[]
|
|
45
|
+
async render(params?: {
|
|
46
|
+
composeRenderData?: (ctx: Context) => RenderEntry[] | Promise<RenderEntry[]>;
|
|
47
47
|
scope?: Context extends { templates: { [key: string]: any } } ? keyof Context["templates"] : "default";
|
|
48
|
-
}): Jargal<Context & { renderedContent: { savePath: string; content: string }[] }
|
|
49
|
-
const composeData: (ctx: Context) => RenderEntry[] =
|
|
48
|
+
}): Promise<Jargal<Context & { renderedContent: { savePath: string; content: string }[] }>> {
|
|
49
|
+
const composeData: (ctx: Context) => RenderEntry[] | Promise<RenderEntry[]> =
|
|
50
50
|
params?.composeRenderData ??
|
|
51
51
|
// @ts-expect-error
|
|
52
52
|
((ctx: Context) => ctx.renderData);
|
|
@@ -54,7 +54,7 @@ export class Jargal<const in out Context> {
|
|
|
54
54
|
// @ts-expect-error
|
|
55
55
|
const templatesToRender = this.#context.templates[params?.scope ?? "default"] as TemplatesMap;
|
|
56
56
|
|
|
57
|
-
const composedData = composeData(this.#context);
|
|
57
|
+
const composedData = await composeData(this.#context);
|
|
58
58
|
|
|
59
59
|
for (const renderEntry of composedData) {
|
|
60
60
|
if (!renderEntry.control || renderEntry.control === "auto") {
|