fix(core): update
This commit is contained in:
@ -55,7 +55,7 @@ export class SmartSSR {
|
||||
if (this.options.debug) {
|
||||
screenshotBuffer = await page.screenshot({
|
||||
encoding: 'binary',
|
||||
});
|
||||
}) as Buffer;
|
||||
}
|
||||
|
||||
await page.$eval('body', serializeFunction);
|
||||
|
@ -1,5 +1,5 @@
|
||||
declare var document: Document;
|
||||
export function serializeFunction(rootNode) {
|
||||
export function serializeFunction(rootNode: Node) {
|
||||
const uuidv4 = () => {
|
||||
return 'unixxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
||||
const r = (Math.random() * 16) | 0;
|
||||
@ -26,7 +26,7 @@ export function serializeFunction(rootNode) {
|
||||
};
|
||||
const loopProtection: any[] = [];
|
||||
|
||||
function serializeNode(nodeArg: HTMLElement, logThis = false) {
|
||||
function serializeNode(nodeArg: HTMLElement | any, logThis = false) {
|
||||
if (loopProtection.includes(nodeArg)) {
|
||||
return;
|
||||
}
|
||||
@ -45,12 +45,12 @@ export function serializeFunction(rootNode) {
|
||||
|
||||
// handle slot element
|
||||
const slotsForMove: HTMLSlotElement[] = [];
|
||||
slots.forEach((slot) => {
|
||||
slots.forEach((slot: any) => {
|
||||
slotsForMove.push(slot);
|
||||
});
|
||||
|
||||
for (const slot of slotsForMove) {
|
||||
const slottedLightNodesForMove = [];
|
||||
const slottedLightNodesForMove: any[] = [];
|
||||
slot.assignedNodes().forEach((lightNode) => slottedLightNodesForMove.push(lightNode));
|
||||
slottedLightNodesForMove.forEach((lightNode) =>
|
||||
slot.parentNode.insertBefore(lightNode, slot)
|
||||
@ -74,7 +74,7 @@ export function serializeFunction(rootNode) {
|
||||
}
|
||||
}
|
||||
|
||||
childNodes.forEach((childNode) => {
|
||||
childNodes.forEach((childNode: ChildNode) => {
|
||||
if (childNode instanceof HTMLElement) {
|
||||
if (childNode.tagName === 'STYLE') {
|
||||
childNode.textContent = prependCss(nodeUUID, childNode.textContent);
|
||||
|
Reference in New Issue
Block a user