fix(core): update
This commit is contained in:
parent
344e213c41
commit
d0ee536301
14809
package-lock.json
generated
14809
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -13,19 +13,19 @@
|
|||||||
"serve": "tsrun scripts/serve.ts"
|
"serve": "tsrun scripts/serve.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.25",
|
"@gitzone/tsbuild": "^2.1.26",
|
||||||
"@gitzone/tstest": "^1.0.54",
|
"@gitzone/tstest": "^1.0.54",
|
||||||
"@pushrocks/smartserve": "^1.1.41",
|
"@pushrocks/smartserve": "^1.1.41",
|
||||||
"@pushrocks/tapbundle": "^3.2.14",
|
"@pushrocks/tapbundle": "^3.2.14",
|
||||||
"@types/node": "^15.3.0",
|
"@types/node": "^16.6.1",
|
||||||
"tslint": "^6.1.3",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartdelay": "^2.0.10",
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
"@pushrocks/smartfile": "^8.0.10",
|
"@pushrocks/smartfile": "^8.0.10",
|
||||||
"@pushrocks/smartpromise": "^3.1.5",
|
"@pushrocks/smartpromise": "^3.1.6",
|
||||||
"@pushrocks/smartpuppeteer": "^1.0.21",
|
"@pushrocks/smartpuppeteer": "^1.0.25",
|
||||||
"@pushrocks/smarttime": "^3.0.38"
|
"@pushrocks/smarttime": "^3.0.38"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -55,7 +55,7 @@ export class SmartSSR {
|
|||||||
if (this.options.debug) {
|
if (this.options.debug) {
|
||||||
screenshotBuffer = await page.screenshot({
|
screenshotBuffer = await page.screenshot({
|
||||||
encoding: 'binary',
|
encoding: 'binary',
|
||||||
});
|
}) as Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
await page.$eval('body', serializeFunction);
|
await page.$eval('body', serializeFunction);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
declare var document: Document;
|
declare var document: Document;
|
||||||
export function serializeFunction(rootNode) {
|
export function serializeFunction(rootNode: Node) {
|
||||||
const uuidv4 = () => {
|
const uuidv4 = () => {
|
||||||
return 'unixxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
return 'unixxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
||||||
const r = (Math.random() * 16) | 0;
|
const r = (Math.random() * 16) | 0;
|
||||||
@ -26,7 +26,7 @@ export function serializeFunction(rootNode) {
|
|||||||
};
|
};
|
||||||
const loopProtection: any[] = [];
|
const loopProtection: any[] = [];
|
||||||
|
|
||||||
function serializeNode(nodeArg: HTMLElement, logThis = false) {
|
function serializeNode(nodeArg: HTMLElement | any, logThis = false) {
|
||||||
if (loopProtection.includes(nodeArg)) {
|
if (loopProtection.includes(nodeArg)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -45,12 +45,12 @@ export function serializeFunction(rootNode) {
|
|||||||
|
|
||||||
// handle slot element
|
// handle slot element
|
||||||
const slotsForMove: HTMLSlotElement[] = [];
|
const slotsForMove: HTMLSlotElement[] = [];
|
||||||
slots.forEach((slot) => {
|
slots.forEach((slot: any) => {
|
||||||
slotsForMove.push(slot);
|
slotsForMove.push(slot);
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const slot of slotsForMove) {
|
for (const slot of slotsForMove) {
|
||||||
const slottedLightNodesForMove = [];
|
const slottedLightNodesForMove: any[] = [];
|
||||||
slot.assignedNodes().forEach((lightNode) => slottedLightNodesForMove.push(lightNode));
|
slot.assignedNodes().forEach((lightNode) => slottedLightNodesForMove.push(lightNode));
|
||||||
slottedLightNodesForMove.forEach((lightNode) =>
|
slottedLightNodesForMove.forEach((lightNode) =>
|
||||||
slot.parentNode.insertBefore(lightNode, slot)
|
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 instanceof HTMLElement) {
|
||||||
if (childNode.tagName === 'STYLE') {
|
if (childNode.tagName === 'STYLE') {
|
||||||
childNode.textContent = prependCss(nodeUUID, childNode.textContent);
|
childNode.textContent = prependCss(nodeUUID, childNode.textContent);
|
||||||
|
Loading…
Reference in New Issue
Block a user