Compare commits

..

8 Commits

Author SHA1 Message Date
602fa2b7ff 1.0.25 2021-05-19 01:33:59 +00:00
b1aae3e5b9 fix(core): update 2021-05-19 01:33:58 +00:00
6b381d6115 1.0.24 2021-01-15 14:22:50 +00:00
25006901d9 fix(core): update 2021-01-15 14:22:49 +00:00
ee613836d1 1.0.23 2021-01-15 07:17:08 +00:00
4b53173618 fix(core): update 2021-01-15 07:17:08 +00:00
46a0220273 1.0.22 2021-01-12 15:17:31 +00:00
46a6c903e1 fix(core): update 2021-01-12 15:17:31 +00:00
5 changed files with 2179 additions and 1216 deletions

3360
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartssr", "name": "@pushrocks/smartssr",
"version": "1.0.21", "version": "1.0.25",
"private": false, "private": false,
"description": "a smart server side renderer supporting shadow dom", "description": "a smart server side renderer supporting shadow dom",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@ -14,17 +14,17 @@
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.52", "@gitzone/tstest": "^1.0.54",
"@pushrocks/smartserve": "^1.1.41", "@pushrocks/smartserve": "^1.1.41",
"@pushrocks/tapbundle": "^3.2.9", "@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^14.14.20", "@types/node": "^14.14.20",
"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.10",
"@pushrocks/smartfile": "^8.0.8", "@pushrocks/smartfile": "^8.0.10",
"@pushrocks/smartpromise": "^3.1.3", "@pushrocks/smartpromise": "^3.1.5",
"@pushrocks/smartpuppeteer": "^1.0.21", "@pushrocks/smartpuppeteer": "^1.0.21",
"@pushrocks/smarttime": "^3.0.38" "@pushrocks/smarttime": "^3.0.38"
}, },

View File

@ -13,13 +13,11 @@ tap.test('should start the smartssr instance', async () => {
await testSSRInstance.start(); await testSSRInstance.start();
}); });
tap.skip.test('should render central.eu', async (tools) => { tap.test('should render central.eu', async (tools) => {
await testSSRInstance.renderPage( await testSSRInstance.renderPage('https://in.work');
'https://central.eu/article/5e76873b9cf69b7bf6bc78bc/Introducing%3A%20central.eu'
);
}); });
tap.test('should render lossless.com', async () => { tap.skip.test('should render lossless.com', async () => {
await testSSRInstance.renderPage('https://lossless.com'); await testSSRInstance.renderPage('https://lossless.com');
}); });

View File

@ -43,6 +43,17 @@ export class SmartSSR {
const resultDeferred = plugins.smartpromise.defer<string>(); const resultDeferred = plugins.smartpromise.defer<string>();
const context = await this.browser.getNewIncognitoContext(); const context = await this.browser.getNewIncognitoContext();
const page = await context.newPage(); 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) => { page.on('console', (msg) => {
console.log(`${urlArg}: ${msg.text()}`); console.log(`${urlArg}: ${msg.text()}`);
}); });
@ -51,7 +62,7 @@ export class SmartSSR {
renderTimeMeasurement.start(); renderTimeMeasurement.start();
await page.goto(urlArg, { await page.goto(urlArg, {
waitUntil: 'networkidle2', waitUntil: 'networkidle2',
timeout: 0 timeout: 30000,
}); });
let screenshotBuffer: Buffer; let screenshotBuffer: Buffer;
@ -71,6 +82,7 @@ export class SmartSSR {
renderTimeMeasurement.stop(); renderTimeMeasurement.stop();
// lets clean up async // lets clean up async
await page.close();
await context.close(); await context.close();
overallTimeMeasurement.stop(); overallTimeMeasurement.stop();

View File

@ -69,6 +69,9 @@ export function serializeFunction(rootNode) {
noteForAppending.push(childNode); noteForAppending.push(childNode);
} }
}); });
while (nodeArg.firstChild) {
nodeArg.removeChild(nodeArg.firstChild);
}
noteForAppending.forEach((childNode) => { noteForAppending.forEach((childNode) => {
nodeArg.append(childNode); nodeArg.append(childNode);
}); });