matrix-public-archive/server/hydrogen-render/render-hydrogen-vm-render-s...

37 lines
809 B
JavaScript
Raw Permalink Normal View History

'use strict';
const assert = require('assert');
const renderHydrogenToString = require('../hydrogen-render/render-hydrogen-to-string');
const renderPageHtml = require('../hydrogen-render/render-page-html');
async function renderHydrogenVmRenderScriptToPageHtml({
pageOptions,
vmRenderScriptFilePath,
vmRenderContext,
abortSignal,
}) {
assert(vmRenderScriptFilePath);
assert(vmRenderContext);
assert(pageOptions);
const hydrogenHtmlOutput = await renderHydrogenToString({
renderOptions: {
vmRenderScriptFilePath,
vmRenderContext,
pageOptions,
},
abortSignal,
});
const pageHtml = renderPageHtml({
pageOptions,
bodyHtml: hydrogenHtmlOutput,
vmRenderContext,
});
return pageHtml;
}
module.exports = renderHydrogenVmRenderScriptToPageHtml;