fix(core): update

This commit is contained in:
Philipp Kunz 2021-08-17 12:54:19 +02:00
parent 344e213c41
commit d0ee536301
4 changed files with 6267 additions and 8628 deletions

14873
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,19 +13,19 @@
"serve": "tsrun scripts/serve.ts"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsbuild": "^2.1.26",
"@gitzone/tstest": "^1.0.54",
"@pushrocks/smartserve": "^1.1.41",
"@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^15.3.0",
"@types/node": "^16.6.1",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartfile": "^8.0.10",
"@pushrocks/smartpromise": "^3.1.5",
"@pushrocks/smartpuppeteer": "^1.0.21",
"@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartpuppeteer": "^1.0.25",
"@pushrocks/smarttime": "^3.0.38"
},
"files": [

View File

@ -55,7 +55,7 @@ export class SmartSSR {
if (this.options.debug) {
screenshotBuffer = await page.screenshot({
encoding: 'binary',
});
}) as Buffer;
}
await page.$eval('body', serializeFunction);

View File

@ -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);