Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
567507c88b | |||
35f7bdd984 | |||
602fa2b7ff | |||
b1aae3e5b9 |
3388
package-lock.json
generated
3388
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartssr",
|
||||
"version": "1.0.24",
|
||||
"version": "1.0.26",
|
||||
"private": false,
|
||||
"description": "a smart server side renderer supporting shadow dom",
|
||||
"main": "dist_ts/index.js",
|
||||
@ -14,17 +14,17 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.25",
|
||||
"@gitzone/tstest": "^1.0.52",
|
||||
"@gitzone/tstest": "^1.0.54",
|
||||
"@pushrocks/smartserve": "^1.1.41",
|
||||
"@pushrocks/tapbundle": "^3.2.9",
|
||||
"@types/node": "^14.14.20",
|
||||
"@pushrocks/tapbundle": "^3.2.14",
|
||||
"@types/node": "^15.3.0",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartdelay": "^2.0.10",
|
||||
"@pushrocks/smartfile": "^8.0.8",
|
||||
"@pushrocks/smartpromise": "^3.1.3",
|
||||
"@pushrocks/smartfile": "^8.0.10",
|
||||
"@pushrocks/smartpromise": "^3.1.5",
|
||||
"@pushrocks/smartpuppeteer": "^1.0.21",
|
||||
"@pushrocks/smarttime": "^3.0.38"
|
||||
},
|
||||
|
@ -23,6 +23,7 @@ tap.skip.test('should render lossless.com', async () => {
|
||||
|
||||
tap.skip.test('should render https://lossless.gmbh', async () => {
|
||||
const renderedPage = await testSSRInstance.renderPage('https://lossless.gmbh');
|
||||
console.log(renderedPage);
|
||||
});
|
||||
|
||||
tap.test('should stop the smartssr instance', async () => {
|
||||
|
@ -43,6 +43,17 @@ export class SmartSSR {
|
||||
const resultDeferred = plugins.smartpromise.defer<string>();
|
||||
const context = await this.browser.getNewIncognitoContext();
|
||||
const page = await context.newPage();
|
||||
|
||||
// lets protext against left open tabs
|
||||
plugins.smartdelay.delayFor(30000).then(() => {
|
||||
if (!page.isClosed) {
|
||||
page.close();
|
||||
context.close();
|
||||
throw new Error(`failed to render ${urlArg}`);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
page.on('console', (msg) => {
|
||||
console.log(`${urlArg}: ${msg.text()}`);
|
||||
});
|
||||
@ -71,6 +82,7 @@ export class SmartSSR {
|
||||
renderTimeMeasurement.stop();
|
||||
|
||||
// lets clean up async
|
||||
await page.close();
|
||||
await context.close();
|
||||
|
||||
overallTimeMeasurement.stop();
|
||||
|
@ -39,6 +39,8 @@ export function serializeFunction(rootNode) {
|
||||
const nodeUUID = uuidv4();
|
||||
|
||||
nodeArg.classList.add(nodeUUID);
|
||||
|
||||
// find all slots
|
||||
const slots = nodeArg.shadowRoot.querySelectorAll('slot');
|
||||
|
||||
// handle slot element
|
||||
@ -59,6 +61,14 @@ export function serializeFunction(rootNode) {
|
||||
const childNodes = nodeArg.shadowRoot.childNodes;
|
||||
// tslint:disable-next-line: prefer-for-of
|
||||
const noteForAppending: HTMLElement[] = [];
|
||||
|
||||
// lets care about static css first
|
||||
if ((nodeArg.constructor as any).styles?.cssText) {
|
||||
const styleTag = document.createElement('style');
|
||||
styleTag.textContent = prependCss(nodeUUID, (nodeArg.constructor as any).styles.cssText);
|
||||
noteForAppending.push(styleTag);
|
||||
}
|
||||
|
||||
childNodes.forEach((childNode) => {
|
||||
if (childNode instanceof HTMLElement) {
|
||||
if (childNode.tagName === 'STYLE') {
|
||||
|
Reference in New Issue
Block a user