37 lines
809 B
JavaScript
37 lines
809 B
JavaScript
'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;
|