Compare commits

..

4 Commits

Author SHA1 Message Date
90089357cf 1.0.29 2021-08-16 10:31:39 +02:00
e36aed4b2b fix(core): update 2021-08-16 10:31:38 +02:00
4d2aa7a0ee 1.0.28 2021-08-16 10:30:46 +02:00
759fa1ff43 fix(core): update 2021-08-16 10:30:46 +02:00
5 changed files with 16369 additions and 46 deletions

View File

@ -36,6 +36,7 @@ auditProductionDependencies:
- npmci command npm audit --audit-level=high --only=prod --production - npmci command npm audit --audit-level=high --only=prod --production
tags: tags:
- docker - docker
allow_failure: true
auditDevDependencies: auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci

16384
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.27", "version": "1.0.29",
"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",

View File

@ -9,10 +9,6 @@ tap.test('should create a valid smartssr instance', async () => {
}); });
}); });
tap.test('should start the smartssr instance', async () => {
await testSSRInstance.start();
});
tap.test('should render central.eu', async (tools) => { tap.test('should render central.eu', async (tools) => {
await testSSRInstance.renderPage('https://lossless.com'); await testSSRInstance.renderPage('https://lossless.com');
}); });
@ -26,8 +22,4 @@ tap.skip.test('should render https://lossless.gmbh', async () => {
console.log(renderedPage); console.log(renderedPage);
}); });
tap.test('should stop the smartssr instance', async () => {
await testSSRInstance.stop();
});
tap.start(); tap.start();

View File

@ -11,7 +11,6 @@ export interface ISmartSSROptions {
* *
*/ */
export class SmartSSR { export class SmartSSR {
public browser: plugins.smartpuppeteer.IncognitoBrowser;
public options: ISmartSSROptions; public options: ISmartSSROptions;
constructor(optionsArg?: ISmartSSROptions) { constructor(optionsArg?: ISmartSSROptions) {
@ -23,25 +22,13 @@ export class SmartSSR {
}; };
} }
public async start() {
this.browser = new plugins.smartpuppeteer.IncognitoBrowser();
await this.browser.start();
}
public async stop() {
if (this.browser) {
await plugins.smartdelay.delayFor(3000);
await this.browser.stop();
this.browser = null;
} else {
console.log('browser was not in started mode');
}
}
public async renderPage(urlArg: string) { public async renderPage(urlArg: string) {
const overallTimeMeasurement = new plugins.smarttime.HrtMeasurement(); const overallTimeMeasurement = new plugins.smarttime.HrtMeasurement();
overallTimeMeasurement.start(); overallTimeMeasurement.start();
const resultDeferred = plugins.smartpromise.defer<string>(); const resultDeferred = plugins.smartpromise.defer<string>();
const context = await this.browser.getNewIncognitoContext(); const browser = new plugins.smartpuppeteer.IncognitoBrowser();
await browser.start();
const context = await browser.getNewIncognitoContext();
const page = await context.newPage(); const page = await context.newPage();
// lets protext against left open tabs // lets protext against left open tabs
@ -84,6 +71,7 @@ export class SmartSSR {
// lets clean up async // lets clean up async
await page.close(); await page.close();
await context.close(); await context.close();
await browser.stop();
overallTimeMeasurement.stop(); overallTimeMeasurement.stop();
console.log( console.log(