Skip to content

Commit 5252d76

Browse files
committed
Merge ..\old-capture-template
2 parents 0eda7c2 + b12d23b commit 5252d76

File tree

4 files changed

+102
-128
lines changed

4 files changed

+102
-128
lines changed

package-lock.json

Lines changed: 78 additions & 93 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "capture-template",
3-
"version": "1.1.13",
3+
"version": "1.1.16",
44
"description": "This library is responsible for expanding a template web page and then capturing it PNG or PDF.",
55
"main": "build/index.js",
66
"types": "build/index.d.ts",
@@ -38,7 +38,8 @@
3838
"chai": "4.1.2",
3939
"express": "^4.16.4",
4040
"fs-extra": "^7.0.1",
41-
"inflate-template": "^1.1.6",
41+
"inflate-template": "^1.1.8",
42+
"mime-types": "^2.1.26",
4243
"nightmare": "^3.0.1",
4344
"promisify-any": "^2.0.1",
4445
"yargs": "^12.0.5"
@@ -47,6 +48,7 @@
4748
"@types/chai": "4.0.4",
4849
"@types/express": "^4.16.1",
4950
"@types/fs-extra": "^5.0.5",
51+
"@types/mime-types": "^2.1.0",
5052
"@types/mocha": "2.2.43",
5153
"@types/node": "8.0.28",
5254
"@types/yargs": "^11.1.2",

src/web-page-renderer.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class WebPageRenderer implements IWebPageRenderer {
140140

141141
this.nightmare.on('page', (type: string, message: string, stack: any) => {
142142
if (type === "error") {
143-
this.error("Browser page error: " + message);
143+
this.error("Browser page error: " + JSON.stringify(message, null, 4));
144144
this.error(stack);
145145
}
146146
});
@@ -156,18 +156,17 @@ export class WebPageRenderer implements IWebPageRenderer {
156156
this.nightmare.on('console', (type: string, message: string) => {
157157

158158
if (type === 'log') {
159-
this.info('LOG: ' + message);
159+
this.info('LOG: ' + JSON.stringify(message, null, 4));
160160
return;
161161
}
162162

163163
if (type === 'warn') {
164-
this.warn('LOG: ' + message);
164+
this.warn('LOG: ' + JSON.stringify(message, null, 4));
165165
return;
166166
}
167167

168168
if (type === 'error') {
169-
this.error("Browser JavaScript error:");
170-
this.error(message);
169+
this.error("Browser JavaScript error: " + JSON.stringify(message, null, 4));
171170
}
172171
});
173172
}
@@ -237,7 +236,7 @@ export class WebPageRenderer implements IWebPageRenderer {
237236
async renderPDF (webPageUrl: string, outputFilePath: string, options: IRenderOptions): Promise<void> {
238237
this.preRenderCheck(options);
239238
this.nightmare.goto(webPageUrl);
240-
this.nightmare.wait(options.waitSelector)
239+
this.nightmare.wait(options.waitSelector);
241240
await this.nightmare.evaluate(() => {
242241
const body = document.querySelector("body");
243242
return {

0 commit comments

Comments
 (0)