2022-09-08 00:30:04 -06:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
const renderHydrogenToString = require('../hydrogen-render/render-hydrogen-to-string');
|
2023-04-24 22:50:53 -06:00
|
|
|
const renderPageHtml = require('../hydrogen-render/render-page-html');
|
2022-09-08 00:30:04 -06:00
|
|
|
|
2023-04-19 12:48:12 -06:00
|
|
|
async function renderHydrogenVmRenderScriptToPageHtml({
|
|
|
|
pageOptions,
|
2022-09-08 00:30:04 -06:00
|
|
|
vmRenderScriptFilePath,
|
|
|
|
vmRenderContext,
|
2023-05-01 23:39:01 -06:00
|
|
|
abortSignal,
|
2023-04-19 12:48:12 -06:00
|
|
|
}) {
|
2022-09-08 00:30:04 -06:00
|
|
|
assert(vmRenderScriptFilePath);
|
|
|
|
assert(vmRenderContext);
|
|
|
|
assert(pageOptions);
|
|
|
|
|
|
|
|
const hydrogenHtmlOutput = await renderHydrogenToString({
|
2023-05-01 23:39:01 -06:00
|
|
|
renderOptions: {
|
|
|
|
vmRenderScriptFilePath,
|
|
|
|
vmRenderContext,
|
|
|
|
pageOptions,
|
|
|
|
},
|
|
|
|
abortSignal,
|
2022-09-08 00:30:04 -06:00
|
|
|
});
|
|
|
|
|
2023-04-24 22:50:53 -06:00
|
|
|
const pageHtml = renderPageHtml({
|
|
|
|
pageOptions,
|
|
|
|
bodyHtml: hydrogenHtmlOutput,
|
|
|
|
vmRenderContext,
|
2022-11-09 17:57:33 -07:00
|
|
|
});
|
2022-09-08 00:30:04 -06:00
|
|
|
|
|
|
|
return pageHtml;
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = renderHydrogenVmRenderScriptToPageHtml;
|