Compare commits

..

12 Commits

Author SHA1 Message Date
46a0220273 1.0.22 2021-01-12 15:17:31 +00:00
46a6c903e1 fix(core): update 2021-01-12 15:17:31 +00:00
134151eb70 1.0.21 2021-01-12 15:07:45 +00:00
ac1c3ac53d fix(core): update 2021-01-12 15:07:45 +00:00
09c23d04f4 1.0.20 2021-01-12 14:18:17 +00:00
3f359cb58c fix(core): update 2021-01-12 14:18:16 +00:00
a85eb48343 1.0.19 2021-01-09 01:48:37 +00:00
7c851b5ed2 fix(core): update 2021-01-09 01:48:36 +00:00
bcd69059f8 1.0.18 2021-01-08 22:08:02 +00:00
acba539a6f fix(core): update 2021-01-08 22:08:01 +00:00
446b4c38ea 1.0.17 2021-01-08 22:06:26 +00:00
bc6d3f45f8 fix(core): update 2021-01-08 22:06:25 +00:00
5 changed files with 1559 additions and 1112 deletions

View File

@ -26,16 +26,28 @@ mirror:
- docker
- notpriv
audit:
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high
- npmci command npm audit --audit-level=high --only=dev
tags:
- docker
allow_failure: true
# ====================
# test stage

2621
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartssr",
"version": "1.0.16",
"version": "1.0.22",
"private": false,
"description": "a smart server side renderer supporting shadow dom",
"main": "dist_ts/index.js",
@ -13,20 +13,20 @@
"format": "(gitzone format)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.24",
"@gitzone/tstest": "^1.0.43",
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.52",
"@pushrocks/smartserve": "^1.1.41",
"@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^14.0.27",
"@types/node": "^14.14.20",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartfile": "^7.0.12",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartpuppeteer": "^1.0.15",
"@pushrocks/smarttime": "^3.0.24"
"@pushrocks/smartfile": "^8.0.8",
"@pushrocks/smartpromise": "^3.1.3",
"@pushrocks/smartpuppeteer": "^1.0.21",
"@pushrocks/smarttime": "^3.0.38"
},
"files": [
"ts/**/*",

View File

@ -11,7 +11,7 @@ export interface ISmartSSROptions {
*
*/
export class SmartSSR {
public browser: plugins.smartpuppeteer.puppeteer.Browser;
public browser: plugins.smartpuppeteer.IncognitoBrowser;
public options: ISmartSSROptions;
constructor(optionsArg?: ISmartSSROptions) {
@ -24,12 +24,13 @@ export class SmartSSR {
}
public async start() {
this.browser = await plugins.smartpuppeteer.getEnvAwareBrowserInstance();
this.browser = new plugins.smartpuppeteer.IncognitoBrowser();
await this.browser.start();
}
public async stop() {
if (this.browser) {
await plugins.smartdelay.delayFor(3000);
await this.browser.close();
await this.browser.stop();
this.browser = null;
} else {
console.log('browser was not in started mode');
@ -40,7 +41,7 @@ export class SmartSSR {
const overallTimeMeasurement = new plugins.smarttime.HrtMeasurement();
overallTimeMeasurement.start();
const resultDeferred = plugins.smartpromise.defer<string>();
const context = await this.browser.createIncognitoBrowserContext();
const context = await this.browser.getNewIncognitoContext();
const page = await context.newPage();
page.on('console', (msg) => {
console.log(`${urlArg}: ${msg.text()}`);
@ -50,6 +51,7 @@ export class SmartSSR {
renderTimeMeasurement.start();
await page.goto(urlArg, {
waitUntil: 'networkidle2',
timeout: 30000
});
let screenshotBuffer: Buffer;
@ -65,12 +67,11 @@ export class SmartSSR {
const renderedPageString = pageContent;
resultDeferred.resolve(renderedPageString);
const result = await resultDeferred.promise;
renderTimeMeasurement.stop();
// lets clean up async
context.close();
await context.close();
overallTimeMeasurement.stop();
console.log(

View File

@ -47,11 +47,12 @@ export function serializeFunction(rootNode) {
slotsForMove.push(slot);
});
for (const slot of slotsForMove) {
const slottedLightNodesForMove = [];
slot.assignedNodes().forEach((lightNode) => slottedLightNodesForMove.push(lightNode));
slottedLightNodesForMove.forEach((lightNode) => slot.parentNode.insertBefore(lightNode, slot));
slottedLightNodesForMove.forEach((lightNode) =>
slot.parentNode.insertBefore(lightNode, slot)
);
}
// lets modify the css