@d-zero/print 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +3 -2
- package/dist/png-to-pdf.d.ts +8 -2
- package/dist/png-to-pdf.js +7 -3
- package/dist/print-pdf-with-note.d.ts +10 -1
- package/dist/print-pdf-with-note.js +9 -0
- package/dist/print-pdf.d.ts +9 -1
- package/dist/print-pdf.js +10 -3
- package/dist/print-png.d.ts +10 -1
- package/dist/print-png.js +9 -0
- package/dist/print.d.ts +6 -0
- package/dist/print.js +18 -39
- package/dist/read-config.d.ts +4 -0
- package/dist/read-config.js +4 -0
- package/package.json +12 -9
- package/dist/label.d.ts +0 -2
- package/dist/label.js +0 -4
- package/dist/pdf.d.ts +0 -6
- package/dist/pdf.js +0 -74
- package/dist/scan-listener.d.ts +0 -2
- package/dist/scan-listener.js +0 -43
- package/dist/screenshot-listener.d.ts +0 -2
- package/dist/screenshot-listener.js +0 -43
package/dist/cli.js
CHANGED
|
@@ -10,14 +10,15 @@ const cli = minimist(process.argv.slice(2), {
|
|
|
10
10
|
});
|
|
11
11
|
const limit = cli.limit ? Number.parseInt(cli.limit) : undefined;
|
|
12
12
|
const debug = !!cli.debug;
|
|
13
|
+
const verbose = !!cli.verbose;
|
|
13
14
|
const type = cli.type === 'note' ? 'note' : cli.type === 'pdf' ? 'pdf' : 'png';
|
|
14
15
|
if (cli.listfile?.length) {
|
|
15
16
|
const { urlList, hooks } = await readConfig(cli.listfile);
|
|
16
|
-
await print(urlList, { type, limit, debug, hooks });
|
|
17
|
+
await print(urlList, { type, limit, debug, verbose, hooks });
|
|
17
18
|
process.exit(0);
|
|
18
19
|
}
|
|
19
20
|
if (cli._.length > 0) {
|
|
20
|
-
await print(cli._, { type, limit, debug });
|
|
21
|
+
await print(cli._, { type, limit, verbose, debug });
|
|
21
22
|
process.exit(0);
|
|
22
23
|
}
|
|
23
24
|
process.stderr.write([
|
package/dist/png-to-pdf.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type { Page } from '@d-zero/puppeteer-page';
|
|
1
2
|
import type { Screenshot } from '@d-zero/puppeteer-screenshot';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param page
|
|
6
|
+
* @param screenshots
|
|
7
|
+
* @param update
|
|
8
|
+
*/
|
|
9
|
+
export declare function pngToPdf(page: Page, screenshots: Record<string, Screenshot>, update: (log: string) => void): Promise<void>;
|
package/dist/png-to-pdf.js
CHANGED
|
@@ -2,9 +2,13 @@ import { rm } from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import c from 'ansi-colors';
|
|
4
4
|
import { printPdfWithNote } from './print-pdf-with-note.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param page
|
|
8
|
+
* @param screenshots
|
|
9
|
+
* @param update
|
|
10
|
+
*/
|
|
11
|
+
export async function pngToPdf(page, screenshots, update) {
|
|
8
12
|
for (const [sizeName, screenshot] of Object.entries(screenshots)) {
|
|
9
13
|
if (!screenshot.filePath) {
|
|
10
14
|
continue;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import type { Page } from '@d-zero/puppeteer-page';
|
|
1
2
|
import type { Screenshot } from '@d-zero/puppeteer-screenshot';
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param page
|
|
6
|
+
* @param root0
|
|
7
|
+
* @param root0.id
|
|
8
|
+
* @param root0.filePath
|
|
9
|
+
* @param root0.url
|
|
10
|
+
* @param root0.title
|
|
11
|
+
*/
|
|
3
12
|
export declare function printPdfWithNote(page: Page, { id, filePath, url, title }: Screenshot): Promise<void>;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param page
|
|
5
|
+
* @param root0
|
|
6
|
+
* @param root0.id
|
|
7
|
+
* @param root0.filePath
|
|
8
|
+
* @param root0.url
|
|
9
|
+
* @param root0.title
|
|
10
|
+
*/
|
|
2
11
|
export async function printPdfWithNote(page, { id, filePath, url, title }) {
|
|
3
12
|
if (!filePath) {
|
|
4
13
|
throw new Error(`No file path (ID: ${id}): ${url}`);
|
package/dist/print-pdf.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import type { Page } from '@d-zero/puppeteer-page';
|
|
1
2
|
import type { PageHook } from '@d-zero/puppeteer-page-scan';
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param page
|
|
6
|
+
* @param url
|
|
7
|
+
* @param filePath
|
|
8
|
+
* @param update
|
|
9
|
+
* @param hooks
|
|
10
|
+
*/
|
|
3
11
|
export declare function printPdf(page: Page, url: string, filePath: string, update: (log: string) => void, hooks?: readonly PageHook[]): Promise<void>;
|
package/dist/print-pdf.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { beforePageScan } from '@d-zero/puppeteer-page-scan';
|
|
2
|
-
|
|
1
|
+
import { beforePageScan, pageScanListener } from '@d-zero/puppeteer-page-scan';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param page
|
|
5
|
+
* @param url
|
|
6
|
+
* @param filePath
|
|
7
|
+
* @param update
|
|
8
|
+
* @param hooks
|
|
9
|
+
*/
|
|
3
10
|
export async function printPdf(page, url, filePath, update, hooks) {
|
|
4
11
|
await beforePageScan(page, url, {
|
|
5
12
|
name: 'pdf',
|
|
6
13
|
width: 1400,
|
|
7
|
-
listener:
|
|
14
|
+
listener: pageScanListener(update),
|
|
8
15
|
hooks,
|
|
9
16
|
});
|
|
10
17
|
update('📄 Save as PDF');
|
package/dist/print-png.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import type { Page } from '@d-zero/puppeteer-page';
|
|
1
2
|
import type { PageHook } from '@d-zero/puppeteer-screenshot';
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param page
|
|
6
|
+
* @param url
|
|
7
|
+
* @param fileId
|
|
8
|
+
* @param filePath
|
|
9
|
+
* @param update
|
|
10
|
+
* @param hooks
|
|
11
|
+
*/
|
|
3
12
|
export declare function printPng(page: Page, url: string, fileId: string, filePath: string, update: (log: string) => void, hooks?: readonly PageHook[]): Promise<Record<string, import("@d-zero/puppeteer-screenshot").Screenshot>>;
|
package/dist/print-png.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { screenshot, screenshotListener } from '@d-zero/puppeteer-screenshot';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param page
|
|
5
|
+
* @param url
|
|
6
|
+
* @param fileId
|
|
7
|
+
* @param filePath
|
|
8
|
+
* @param update
|
|
9
|
+
* @param hooks
|
|
10
|
+
*/
|
|
2
11
|
export function printPng(page, url, fileId, filePath, update, hooks) {
|
|
3
12
|
return screenshot(page, url, {
|
|
4
13
|
id: fileId,
|
package/dist/print.d.ts
CHANGED
|
@@ -4,8 +4,14 @@ export interface PrintOptions {
|
|
|
4
4
|
readonly type?: PrintType;
|
|
5
5
|
readonly limit?: number;
|
|
6
6
|
readonly debug?: boolean;
|
|
7
|
+
readonly verbose?: boolean;
|
|
7
8
|
readonly hooks?: readonly PageHook[];
|
|
8
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param urlList
|
|
13
|
+
* @param options
|
|
14
|
+
*/
|
|
9
15
|
export declare function print(urlList: readonly (string | {
|
|
10
16
|
id: string | null;
|
|
11
17
|
url: string;
|
package/dist/print.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import { mkdir } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { deal } from '@d-zero/dealer';
|
|
3
|
+
import { deal } from '@d-zero/puppeteer-dealer';
|
|
4
4
|
import c from 'ansi-colors';
|
|
5
|
-
import puppeteer from 'puppeteer';
|
|
6
5
|
import { pngToPdf } from './png-to-pdf.js';
|
|
7
6
|
import { printPdf } from './print-pdf.js';
|
|
8
7
|
import { printPng } from './print-png.js';
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param urlList
|
|
11
|
+
* @param options
|
|
12
|
+
*/
|
|
9
13
|
export async function print(urlList, options) {
|
|
10
|
-
const browser = await puppeteer.launch({
|
|
11
|
-
headless: true,
|
|
12
|
-
args: [
|
|
13
|
-
//
|
|
14
|
-
'--lang=ja',
|
|
15
|
-
'--no-zygote',
|
|
16
|
-
'--ignore-certificate-errors',
|
|
17
|
-
],
|
|
18
|
-
});
|
|
19
14
|
const dir = path.resolve(process.cwd(), '.print');
|
|
20
15
|
await mkdir(dir, { recursive: true }).catch(() => { });
|
|
21
16
|
const type = options?.type ?? 'png';
|
|
@@ -25,41 +20,25 @@ export async function print(urlList, options) {
|
|
|
25
20
|
return { id: null, url };
|
|
26
21
|
}
|
|
27
22
|
return url;
|
|
28
|
-
}), (
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
await page.setExtraHTTPHeaders({
|
|
33
|
-
'Accept-Language': 'ja-JP',
|
|
34
|
-
});
|
|
35
|
-
const fileId = id || index.toString().padStart(3, '0');
|
|
23
|
+
}), (_, done, total) => {
|
|
24
|
+
return `${c.bold.magenta('🎨 Print pages')} ${c.bgBlueBright(` ${type} `)} ${done}/${total}`;
|
|
25
|
+
}, {
|
|
26
|
+
async deal(page, id, url, logger) {
|
|
36
27
|
const ext = type === 'pdf' ? 'pdf' : 'png';
|
|
37
|
-
const fileName = `${
|
|
28
|
+
const fileName = `${id}.${ext}`;
|
|
38
29
|
const filePath = path.resolve(dir, fileName);
|
|
39
|
-
const lineHeader = `%braille% ${c.bgWhite(` ${fileId} `)} ${c.gray(url)}: `;
|
|
40
|
-
update(`${lineHeader}🔗 Open%dots%`);
|
|
41
30
|
if (type === 'pdf') {
|
|
42
|
-
await printPdf(page, url, filePath,
|
|
43
|
-
|
|
44
|
-
await page.close();
|
|
31
|
+
await printPdf(page, url, filePath, logger, hooks);
|
|
32
|
+
logger('🔚 Closing');
|
|
45
33
|
return;
|
|
46
34
|
}
|
|
47
|
-
const result = await printPng(page, url,
|
|
35
|
+
const result = await printPng(page, url, id, filePath, logger, hooks);
|
|
48
36
|
if (type === 'png') {
|
|
49
|
-
|
|
50
|
-
await page.close();
|
|
37
|
+
logger('🔚 Closing');
|
|
51
38
|
return;
|
|
52
39
|
}
|
|
53
|
-
await pngToPdf(
|
|
54
|
-
|
|
55
|
-
await page.close();
|
|
56
|
-
};
|
|
57
|
-
}, {
|
|
58
|
-
limit: options?.limit,
|
|
59
|
-
debug: options?.debug,
|
|
60
|
-
header(_, done, total) {
|
|
61
|
-
return `${c.bold.magenta('🎨 Print pages')} ${c.bgBlueBright(` ${type} `)} ${done}/${total}`;
|
|
40
|
+
await pngToPdf(page, result, logger);
|
|
41
|
+
logger('🔚 Closing');
|
|
62
42
|
},
|
|
63
|
-
});
|
|
64
|
-
await browser.close();
|
|
43
|
+
}, options);
|
|
65
44
|
}
|
package/dist/read-config.d.ts
CHANGED
package/dist/read-config.js
CHANGED
|
@@ -3,6 +3,10 @@ import path from 'node:path';
|
|
|
3
3
|
import { readPageHooks } from '@d-zero/puppeteer-page-scan';
|
|
4
4
|
import { toKvList } from '@d-zero/readtext/list';
|
|
5
5
|
import fm from 'front-matter';
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param filePath
|
|
9
|
+
*/
|
|
6
10
|
export async function readConfig(filePath) {
|
|
7
11
|
const fileContent = await fs.readFile(filePath, 'utf8');
|
|
8
12
|
const content =
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-zero/print",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Print web pages to PDF or image files.",
|
|
5
5
|
"author": "D-ZERO",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,19 +23,22 @@
|
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsc",
|
|
26
|
+
"watch": "tsc --watch",
|
|
26
27
|
"clean": "tsc --build --clean"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@d-zero/
|
|
30
|
-
"@d-zero/
|
|
31
|
-
"@d-zero/puppeteer-page-scan": "
|
|
32
|
-
"@d-zero/puppeteer-screenshot": "
|
|
33
|
-
"@d-zero/readtext": "1.1.
|
|
30
|
+
"@d-zero/html-distiller": "1.0.2",
|
|
31
|
+
"@d-zero/puppeteer-dealer": "0.3.0",
|
|
32
|
+
"@d-zero/puppeteer-page-scan": "3.0.0",
|
|
33
|
+
"@d-zero/puppeteer-screenshot": "3.0.0",
|
|
34
|
+
"@d-zero/readtext": "1.1.2",
|
|
34
35
|
"ansi-colors": "4.1.3",
|
|
35
36
|
"dayjs": "1.11.13",
|
|
36
37
|
"front-matter": "4.0.2",
|
|
37
|
-
"minimist": "1.2.8"
|
|
38
|
-
"puppeteer": "23.5.0"
|
|
38
|
+
"minimist": "1.2.8"
|
|
39
39
|
},
|
|
40
|
-
"
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@d-zero/puppeteer-page": "0.3.0"
|
|
42
|
+
},
|
|
43
|
+
"gitHead": "e4fd17857e31022d121527b00fd7f009dbdb2142"
|
|
41
44
|
}
|
package/dist/label.d.ts
DELETED
package/dist/label.js
DELETED
package/dist/pdf.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Screenshot } from '@d-zero/puppeteer-screenshot';
|
|
2
|
-
import type { Browser } from 'puppeteer';
|
|
3
|
-
export declare function pngToPdf(browser: Browser, screenshots: Record<string, Screenshot>, options?: {
|
|
4
|
-
note?: boolean;
|
|
5
|
-
update?: (log: string) => void;
|
|
6
|
-
}): Promise<void>;
|
package/dist/pdf.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { rm } from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import dayjs from 'dayjs';
|
|
4
|
-
import { label } from './label.js';
|
|
5
|
-
export async function pngToPdf(browser, screenshots, options) {
|
|
6
|
-
const page = await browser.newPage();
|
|
7
|
-
page.setDefaultNavigationTimeout(0);
|
|
8
|
-
const note = options?.note ?? true;
|
|
9
|
-
const datetime = dayjs().format('YYYY-MM-DD HH:mm');
|
|
10
|
-
for (const [sizeName, { id, filePath, url, title }] of Object.entries(screenshots)) {
|
|
11
|
-
if (!filePath) {
|
|
12
|
-
continue;
|
|
13
|
-
}
|
|
14
|
-
const update = (log) => options?.update?.(`${label(sizeName)}: ${log}`);
|
|
15
|
-
update(`🖼 Open an image file`);
|
|
16
|
-
await page.goto(`file://${filePath}`, {
|
|
17
|
-
waitUntil: 'networkidle0',
|
|
18
|
-
timeout: 5 * 60 * 1000,
|
|
19
|
-
});
|
|
20
|
-
let noteSettings = {};
|
|
21
|
-
if (note) {
|
|
22
|
-
await page.evaluate(() => {
|
|
23
|
-
const style = document.createElement('style');
|
|
24
|
-
style.textContent = `
|
|
25
|
-
html, body { height: auto !important; }
|
|
26
|
-
html, body { margin: 0; padding: 0; }
|
|
27
|
-
img { width: 100% !important; height: auto !important; }
|
|
28
|
-
`;
|
|
29
|
-
document.body.setAttribute('style', 'margin: 0; padding: 0;');
|
|
30
|
-
document.head.append(style);
|
|
31
|
-
});
|
|
32
|
-
noteSettings = {
|
|
33
|
-
displayHeaderFooter: true,
|
|
34
|
-
margin: { top: '1.3cm', bottom: '1cm', left: '1cm', right: '5cm' },
|
|
35
|
-
headerTemplate: `
|
|
36
|
-
<div style="font-size: 2mm; width: 100%; display: flex; justify-content: space-between; margin: 0 1cm; font-family: sans-serif;">
|
|
37
|
-
<div>
|
|
38
|
-
<div>Title: ${title}</div>
|
|
39
|
-
<div style="font-size: 0.6em">Printed: ${datetime}</div>
|
|
40
|
-
</div>
|
|
41
|
-
<div>
|
|
42
|
-
<div style="font-size: 3mm; margin-bottom: 1mm; text-align: right;">[ID: ${id}]</div>
|
|
43
|
-
<div style="text-align: right; background-color: #000; color: #fff;">Note:</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
`,
|
|
47
|
-
footerTemplate: `
|
|
48
|
-
<div style="font-size: 2mm; width: 100%; display: flex; justify-content: space-between; margin: 0 1cm; font-family: monospace;">
|
|
49
|
-
<div>
|
|
50
|
-
<span>[ID: ${id}] ${url}</span>
|
|
51
|
-
</div>
|
|
52
|
-
<div>
|
|
53
|
-
<span class="pageNumber"></span>/<span class="totalPages"></span>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
`,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
const dir = path.dirname(filePath);
|
|
60
|
-
const fileName = path.basename(filePath, path.extname(filePath));
|
|
61
|
-
const pdfPath = path.resolve(dir, `${fileName}.pdf`);
|
|
62
|
-
update('📝 Print as a PDF%dots%');
|
|
63
|
-
await page.pdf({
|
|
64
|
-
path: pdfPath,
|
|
65
|
-
timeout: 30_000 * 10, // Default * 10
|
|
66
|
-
format: 'A4',
|
|
67
|
-
printBackground: true,
|
|
68
|
-
margin: { top: '1cm', bottom: '1cm', left: '1cm', right: '1cm' },
|
|
69
|
-
...noteSettings,
|
|
70
|
-
});
|
|
71
|
-
update('🚮 Remove the screenshot image');
|
|
72
|
-
await rm(filePath);
|
|
73
|
-
}
|
|
74
|
-
}
|
package/dist/scan-listener.d.ts
DELETED
package/dist/scan-listener.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { label } from './label.js';
|
|
3
|
-
export function scanListener(update) {
|
|
4
|
-
return (phase, data) => {
|
|
5
|
-
const sizeLabel = label(data.name);
|
|
6
|
-
switch (phase) {
|
|
7
|
-
case 'setViewport': {
|
|
8
|
-
const { width } = data;
|
|
9
|
-
update(`${sizeLabel} ↔️ Change viewport size to ${width}px`);
|
|
10
|
-
break;
|
|
11
|
-
}
|
|
12
|
-
case 'load': {
|
|
13
|
-
const { type } = data;
|
|
14
|
-
update(`${sizeLabel} %earth% ${type === 'open' ? 'Open' : 'Reload'} page`);
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
case 'hook': {
|
|
18
|
-
const { message } = data;
|
|
19
|
-
update(`${sizeLabel} ${message}`);
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
case 'scroll': {
|
|
23
|
-
update(`${sizeLabel} %propeller% Scroll the page`);
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
case 'screenshotStart': {
|
|
27
|
-
update(`${sizeLabel} 📸 Take a screenshot`);
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
case 'screenshotSaving': {
|
|
31
|
-
const { path: filePath } = data;
|
|
32
|
-
const name = path.basename(filePath);
|
|
33
|
-
update(`${sizeLabel} 🖼 Save a file ${name}`);
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
case 'screenshotError': {
|
|
37
|
-
const { error } = data;
|
|
38
|
-
update(`${sizeLabel} ❌️ ${error.message}`);
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { label } from './label.js';
|
|
3
|
-
export function screenshotListener(update) {
|
|
4
|
-
return (phase, data) => {
|
|
5
|
-
const sizeLabel = label(data.name);
|
|
6
|
-
switch (phase) {
|
|
7
|
-
case 'setViewport': {
|
|
8
|
-
const { width } = data;
|
|
9
|
-
update(`${sizeLabel} ↔️ Change viewport size to ${width}px`);
|
|
10
|
-
break;
|
|
11
|
-
}
|
|
12
|
-
case 'load': {
|
|
13
|
-
const { type } = data;
|
|
14
|
-
update(`${sizeLabel} %earth% ${type === 'open' ? 'Open' : 'Reload'} page`);
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
case 'hook': {
|
|
18
|
-
const { message } = data;
|
|
19
|
-
update(`${sizeLabel} ${message}`);
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
case 'scroll': {
|
|
23
|
-
update(`${sizeLabel} %propeller% Scroll the page`);
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
case 'screenshotStart': {
|
|
27
|
-
update(`${sizeLabel} 📸 Take a screenshot`);
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
case 'screenshotSaving': {
|
|
31
|
-
const { path: filePath } = data;
|
|
32
|
-
const name = path.basename(filePath);
|
|
33
|
-
update(`${sizeLabel} 🖼 Save a file ${name}`);
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
case 'screenshotError': {
|
|
37
|
-
const { error } = data;
|
|
38
|
-
update(`${sizeLabel} ❌️ ${error.message}`);
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|