fix(core): update
This commit is contained in:
		
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -15,8 +15,6 @@ node_modules/ | |||||||
|  |  | ||||||
| # builds | # builds | ||||||
| dist/ | dist/ | ||||||
| dist_web/ | dist_*/ | ||||||
| dist_serve/ |  | ||||||
| dist_ts_web/ |  | ||||||
|  |  | ||||||
| # custom | # custom | ||||||
| @@ -19,22 +19,23 @@ mirror: | |||||||
|   stage: security |   stage: security | ||||||
|   script: |   script: | ||||||
|     - npmci git mirror |     - npmci git mirror | ||||||
|  |   only: | ||||||
|  |     - tags | ||||||
|   tags: |   tags: | ||||||
|     - lossless |     - lossless | ||||||
|     - docker |     - docker | ||||||
|     - notpriv |     - notpriv | ||||||
|  |  | ||||||
| snyk: | audit: | ||||||
|   image: registry.gitlab.com/hosttoday/ht-docker-node:snyk |   image: registry.gitlab.com/hosttoday/ht-docker-node:npmci | ||||||
|   stage: security |   stage: security | ||||||
|   script: |   script: | ||||||
|     - npmci npm prepare |     - npmci npm prepare | ||||||
|     - npmci command npm install --ignore-scripts |     - npmci command npm install --ignore-scripts | ||||||
|     - npmci command snyk test |     - npmci command npm config set registry https://registry.npmjs.org | ||||||
|  |     - npmci command npm audit --audit-level=high | ||||||
|   tags: |   tags: | ||||||
|     - lossless |  | ||||||
|     - docker |     - docker | ||||||
|     - notpriv |  | ||||||
|  |  | ||||||
| # ==================== | # ==================== | ||||||
| # test stage | # test stage | ||||||
| @@ -49,9 +50,7 @@ testStable: | |||||||
|     - npmci npm test |     - npmci npm test | ||||||
|   coverage: /\d+.?\d+?\%\s*coverage/ |   coverage: /\d+.?\d+?\%\s*coverage/ | ||||||
|   tags: |   tags: | ||||||
|     - lossless |  | ||||||
|     - docker |     - docker | ||||||
|     - priv |  | ||||||
|  |  | ||||||
| testBuild: | testBuild: | ||||||
|   stage: test |   stage: test | ||||||
| @@ -62,9 +61,7 @@ testBuild: | |||||||
|     - npmci command npm run build |     - npmci command npm run build | ||||||
|   coverage: /\d+.?\d+?\%\s*coverage/ |   coverage: /\d+.?\d+?\%\s*coverage/ | ||||||
|   tags: |   tags: | ||||||
|     - lossless |  | ||||||
|     - docker |     - docker | ||||||
|     - notpriv |  | ||||||
|  |  | ||||||
| release: | release: | ||||||
|   stage: release |   stage: release | ||||||
| @@ -84,6 +81,8 @@ release: | |||||||
| codequality: | codequality: | ||||||
|   stage: metadata |   stage: metadata | ||||||
|   allow_failure: true |   allow_failure: true | ||||||
|  |   only: | ||||||
|  |     - tags | ||||||
|   script: |   script: | ||||||
|     - npmci command npm install -g tslint typescript |     - npmci command npm install -g tslint typescript | ||||||
|     - npmci npm prepare |     - npmci npm prepare | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							| @@ -15,7 +15,7 @@ | |||||||
|             "properties": { |             "properties": { | ||||||
|               "projectType": { |               "projectType": { | ||||||
|                 "type": "string", |                 "type": "string", | ||||||
|                 "enum": ["website", "element", "service", "npm"] |                 "enum": ["website", "element", "service", "npm", "wcc"] | ||||||
|               } |               } | ||||||
|             } |             } | ||||||
|           } |           } | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								package.json
									
									
									
									
									
								
							| @@ -3,8 +3,8 @@ | |||||||
|   "version": "1.0.10", |   "version": "1.0.10", | ||||||
|   "private": false, |   "private": false, | ||||||
|   "description": "a smart server side renderer supporting shadow dom", |   "description": "a smart server side renderer supporting shadow dom", | ||||||
|   "main": "dist/index.js", |   "main": "dist_ts/index.js", | ||||||
|   "typings": "dist/index.d.ts", |   "typings": "dist_ts/index.d.ts", | ||||||
|   "author": "Lossless GmbH", |   "author": "Lossless GmbH", | ||||||
|   "license": "MIT", |   "license": "MIT", | ||||||
|   "scripts": { |   "scripts": { | ||||||
| @@ -32,11 +32,15 @@ | |||||||
|     "ts/**/*", |     "ts/**/*", | ||||||
|     "ts_web/**/*", |     "ts_web/**/*", | ||||||
|     "dist/**/*", |     "dist/**/*", | ||||||
|     "dist_web/**/*", |     "dist_*/**/*", | ||||||
|  |     "dist_ts/**/*", | ||||||
|     "dist_ts_web/**/*", |     "dist_ts_web/**/*", | ||||||
|     "assets/**/*", |     "assets/**/*", | ||||||
|     "cli.js", |     "cli.js", | ||||||
|     "npmextra.json", |     "npmextra.json", | ||||||
|     "readme.md" |     "readme.md" | ||||||
|  |   ], | ||||||
|  |   "browserslist": [ | ||||||
|  |     "last 1 chrome versions" | ||||||
|   ] |   ] | ||||||
| } | } | ||||||
							
								
								
									
										21
									
								
								readme.md
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								readme.md
									
									
									
									
									
								
							| @@ -8,13 +8,20 @@ a smart server side renderer supporting shadow dom | |||||||
| * [docs (typedoc)](https://pushrocks.gitlab.io/smartssr/) | * [docs (typedoc)](https://pushrocks.gitlab.io/smartssr/) | ||||||
|  |  | ||||||
| ## Status for master | ## Status for master | ||||||
| [](https://gitlab.com/pushrocks/smartssr/commits/master) |  | ||||||
| [](https://gitlab.com/pushrocks/smartssr/commits/master) | Status Category | Status Badge | ||||||
| [](https://www.npmjs.com/package/@pushrocks/smartssr) | -- | -- | ||||||
| [](https://snyk.io/test/npm/@pushrocks/smartssr) | GitLab Pipelines | [](https://lossless.cloud) | ||||||
| [](https://nodejs.org/dist/latest-v10.x/docs/api/) | GitLab Pipline Test Coverage | [](https://lossless.cloud) | ||||||
| [](https://nodejs.org/dist/latest-v10.x/docs/api/) | npm | [](https://lossless.cloud) | ||||||
| [](https://prettier.io/) | Snyk | [](https://lossless.cloud) | ||||||
|  | TypeScript Support | [](https://lossless.cloud) | ||||||
|  | node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/) | ||||||
|  | Code Style | [](https://lossless.cloud) | ||||||
|  | PackagePhobia (total standalone install weight) | [](https://lossless.cloud) | ||||||
|  | PackagePhobia (package size on registry) | [](https://lossless.cloud) | ||||||
|  | BundlePhobia (total size when bundled) | [](https://lossless.cloud) | ||||||
|  | Platform support | [](https://lossless.cloud) [](https://lossless.cloud) | ||||||
|  |  | ||||||
| ## Usage | ## Usage | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ let testSSRInstance: smartssr.SmartSSR; | |||||||
|  |  | ||||||
| tap.test('should create a valid smartssr instance', async () => { | tap.test('should create a valid smartssr instance', async () => { | ||||||
|   testSSRInstance = new smartssr.SmartSSR({ |   testSSRInstance = new smartssr.SmartSSR({ | ||||||
|     debug: true |     debug: true, | ||||||
|   }); |   }); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| @@ -13,8 +13,10 @@ tap.test('should start the smartssr instance', async () => { | |||||||
|   await testSSRInstance.start(); |   await testSSRInstance.start(); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| tap.test('should render central.eu', async tools => { | tap.test('should render central.eu', async (tools) => { | ||||||
|   await testSSRInstance.renderPage('https://central.eu/article/5e76873b9cf69b7bf6bc78bc/Introducing%3A%20central.eu'); |   await testSSRInstance.renderPage( | ||||||
|  |     'https://central.eu/article/5e76873b9cf69b7bf6bc78bc/Introducing%3A%20central.eu' | ||||||
|  |   ); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| tap.skip.test('should render lossless.com', async () => { | tap.skip.test('should render lossless.com', async () => { | ||||||
|   | |||||||
| @@ -16,10 +16,10 @@ export class SmartSSR { | |||||||
|  |  | ||||||
|   constructor(optionsArg?: ISmartSSROptions) { |   constructor(optionsArg?: ISmartSSROptions) { | ||||||
|     this.options = { |     this.options = { | ||||||
|       ... { |       ...{ | ||||||
|         debug: false |         debug: false, | ||||||
|       }, |       }, | ||||||
|       ...optionsArg |       ...optionsArg, | ||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -42,17 +42,17 @@ export class SmartSSR { | |||||||
|     const resultDeferred = plugins.smartpromise.defer<string>(); |     const resultDeferred = plugins.smartpromise.defer<string>(); | ||||||
|     const context = await this.browser.createIncognitoBrowserContext(); |     const context = await this.browser.createIncognitoBrowserContext(); | ||||||
|     const page = await context.newPage(); |     const page = await context.newPage(); | ||||||
|     page.on('console', msg => { |     page.on('console', (msg) => { | ||||||
|       console.log(`${urlArg}: ${msg.text()}`); |       console.log(`${urlArg}: ${msg.text()}`); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     page.on('load', async (...args) => { |     page.on('load', async (...args) => { | ||||||
|       await plugins.smartdelay.delayFor(5000); |       await plugins.smartdelay.delayFor(5000); | ||||||
|       let screenshotBuffer: Buffer; |       let screenshotBuffer: Buffer; | ||||||
|        |  | ||||||
|       if (this.options.debug) { |       if (this.options.debug) { | ||||||
|         screenshotBuffer = await page.screenshot({ |         screenshotBuffer = await page.screenshot({ | ||||||
|           encoding: 'binary' |           encoding: 'binary', | ||||||
|         }); |         }); | ||||||
|       } |       } | ||||||
|  |  | ||||||
| @@ -60,7 +60,7 @@ export class SmartSSR { | |||||||
|       const pageContent = await page.content(); |       const pageContent = await page.content(); | ||||||
|       const renderedPageString = pageContent; |       const renderedPageString = pageContent; | ||||||
|       resultDeferred.resolve(renderedPageString); |       resultDeferred.resolve(renderedPageString); | ||||||
|        |  | ||||||
|       if (this.options.debug) { |       if (this.options.debug) { | ||||||
|         plugins.smartfile.memory.toFsSync( |         plugins.smartfile.memory.toFsSync( | ||||||
|           renderedPageString, |           renderedPageString, | ||||||
| @@ -69,7 +69,6 @@ export class SmartSSR { | |||||||
|         const fs = await import('fs'); |         const fs = await import('fs'); | ||||||
|         fs.writeFileSync(plugins.path.join(paths.noGitDir, 'test.png'), screenshotBuffer); |         fs.writeFileSync(plugins.path.join(paths.noGitDir, 'test.png'), screenshotBuffer); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     const renderTimeMeasurement = new plugins.smarttime.HrtMeasurement(); |     const renderTimeMeasurement = new plugins.smarttime.HrtMeasurement(); | ||||||
| @@ -82,8 +81,12 @@ export class SmartSSR { | |||||||
|     context.close(); |     context.close(); | ||||||
|  |  | ||||||
|     overallTimeMeasurement.stop(); |     overallTimeMeasurement.stop(); | ||||||
|     console.log(`Overall it took ${overallTimeMeasurement.milliSeconds} milliseconds to render ${urlArg}`); |     console.log( | ||||||
|     console.log(`The rendering alone took ${renderTimeMeasurement.milliSeconds} milliseconds for ${urlArg}`) |       `Overall it took ${overallTimeMeasurement.milliSeconds} milliseconds to render ${urlArg}` | ||||||
|  |     ); | ||||||
|  |     console.log( | ||||||
|  |       `The rendering alone took ${renderTimeMeasurement.milliSeconds} milliseconds for ${urlArg}` | ||||||
|  |     ); | ||||||
|     return result; |     return result; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -34,7 +34,7 @@ export function serializeFunction(rootNode) { | |||||||
|     // console.log(nodeArg.nodeName); |     // console.log(nodeArg.nodeName); | ||||||
|     if (nodeArg.shadowRoot) { |     if (nodeArg.shadowRoot) { | ||||||
|       nodeArg.setAttribute('smartssr', 'yes'); |       nodeArg.setAttribute('smartssr', 'yes'); | ||||||
|        |  | ||||||
|       // lets handle the current node |       // lets handle the current node | ||||||
|       const nodeUUID = uuidv4(); |       const nodeUUID = uuidv4(); | ||||||
|  |  | ||||||
| @@ -64,7 +64,7 @@ export function serializeFunction(rootNode) { | |||||||
|           noteForAppending.push(childNode); |           noteForAppending.push(childNode); | ||||||
|         } |         } | ||||||
|       }); |       }); | ||||||
|       noteForAppending.forEach(childNode => { |       noteForAppending.forEach((childNode) => { | ||||||
|         nodeArg.append(childNode); |         nodeArg.append(childNode); | ||||||
|       }); |       }); | ||||||
|     } else { |     } else { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user