puppeteer-browser-ready 0.5.6 → 0.5.8
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/LICENSE.txt +1 -1
- package/README.md +4 -4
- package/dist/puppeteer-browser-ready.d.ts +14 -12
- package/dist/puppeteer-browser-ready.js +1 -2
- package/dist/puppeteer-browser-ready.umd.cjs +1 -2
- package/package.json +30 -26
package/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2020-
|
|
3
|
+
Copyright (c) 2020-2023 Individual contributors to puppeteer-browser-ready
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ import { browserReady } from 'puppeteer-browser-ready';
|
|
|
27
27
|
|
|
28
28
|
## B) Usage
|
|
29
29
|
Use the `browserReady.goto(url, options)` function to tell Puppeteer which page to open.
|
|
30
|
-
The **Promise** will resolve with a **Web** object containing a `title` field and a `html` field.
|
|
30
|
+
The **Promise** will resolve with a **Web** object containing a `title` field and a `html` field.
|
|
31
31
|
Pass the **Web** object to the `browserReady.close(web)` function to disconnect the page.
|
|
32
32
|
```javascript
|
|
33
33
|
const url = 'https://pretty-print-json.js.org/';
|
|
@@ -50,8 +50,8 @@ after(async () => await browserReady.close(web));
|
|
|
50
50
|
| `verbose` | **boolean** | `true` | Output informational messages. |
|
|
51
51
|
|
|
52
52
|
## C) TypeScript Declarations
|
|
53
|
-
|
|
54
|
-
[puppeteer-browser-ready.
|
|
53
|
+
See the TypeScript declarations at the top of the
|
|
54
|
+
[puppeteer-browser-ready.ts](puppeteer-browser-ready.ts) file.
|
|
55
55
|
|
|
56
56
|
The `browserReady.goto(url, options)` function returns a function that takes a Puppeteer **Browser**
|
|
57
57
|
object and returns a **Promise** that resolves with a **Web** object:
|
|
@@ -123,7 +123,7 @@ const url = 'https://pretty-print-json.js.org/';
|
|
|
123
123
|
let web; //fields: browser, page, response, status, location, title, html, $
|
|
124
124
|
const loadWebPage = async () =>
|
|
125
125
|
web = await puppeteer.launch().then(browserReady.goto(url));
|
|
126
|
-
const closeWebPage = async () =>
|
|
126
|
+
const closeWebPage = async () =>
|
|
127
127
|
await browserReady.close(web);
|
|
128
128
|
|
|
129
129
|
/////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
//! puppeteer-browser-ready v0.5.
|
|
1
|
+
//! puppeteer-browser-ready v0.5.8 ~~ https://github.com/center-key/puppeteer-browser-ready ~~ MIT License
|
|
2
2
|
|
|
3
3
|
/// <reference types="cheerio" />
|
|
4
|
-
import httpTerminator from 'http-terminator';
|
|
5
4
|
import { Browser, HTTPResponse, Page } from 'puppeteer';
|
|
6
5
|
import { Server } from 'http';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import httpTerminator from 'http-terminator';
|
|
7
|
+
export type StartWebServerSettings = {
|
|
8
|
+
folder: string;
|
|
9
|
+
port: number;
|
|
10
|
+
verbose: boolean;
|
|
11
|
+
autoCleanup: boolean;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type StartWebServerOptions = Partial<StartWebServerSettings>;
|
|
14
|
+
export type Http = {
|
|
14
15
|
server: Server;
|
|
15
16
|
terminator: httpTerminator.HttpTerminator;
|
|
16
17
|
folder: string;
|
|
@@ -18,7 +19,7 @@ export declare type Http = {
|
|
|
18
19
|
port: number;
|
|
19
20
|
verbose: boolean;
|
|
20
21
|
};
|
|
21
|
-
export
|
|
22
|
+
export type Web = {
|
|
22
23
|
browser: Browser;
|
|
23
24
|
page: Page;
|
|
24
25
|
response: HTTPResponse | null;
|
|
@@ -28,10 +29,11 @@ export declare type Web = {
|
|
|
28
29
|
html: string | null;
|
|
29
30
|
$: cheerio.Root | null;
|
|
30
31
|
};
|
|
31
|
-
export
|
|
32
|
-
addCheerio
|
|
33
|
-
verbose
|
|
32
|
+
export type BrowserReadySettings = {
|
|
33
|
+
addCheerio: boolean;
|
|
34
|
+
verbose: boolean;
|
|
34
35
|
};
|
|
36
|
+
export type BrowserReadyOptions = Partial<BrowserReadySettings>;
|
|
35
37
|
declare const browserReady: {
|
|
36
38
|
log(...args: unknown[]): void;
|
|
37
39
|
startWebServer(options?: StartWebServerOptions): Promise<Http>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//! puppeteer-browser-ready v0.5.
|
|
1
|
+
//! puppeteer-browser-ready v0.5.8 ~~ https://github.com/center-key/puppeteer-browser-ready ~~ MIT License
|
|
2
2
|
|
|
3
3
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
4
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
|
-
// Imports
|
|
13
12
|
import cheerio from 'cheerio';
|
|
14
13
|
import express from 'express';
|
|
15
14
|
import httpTerminator from 'http-terminator';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//! puppeteer-browser-ready v0.5.
|
|
1
|
+
//! puppeteer-browser-ready v0.5.8 ~~ https://github.com/center-key/puppeteer-browser-ready ~~ MIT License
|
|
2
2
|
|
|
3
3
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
4
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -24,7 +24,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
"use strict";
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.browserReady = void 0;
|
|
27
|
-
// Imports
|
|
28
27
|
const cheerio_1 = __importDefault(require("cheerio"));
|
|
29
28
|
const express_1 = __importDefault(require("express"));
|
|
30
29
|
const http_terminator_1 = __importDefault(require("http-terminator"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "puppeteer-browser-ready",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "Simple utility to go to a URL and wait for the HTTP response (written in TypeScript)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"url"
|
|
35
35
|
],
|
|
36
36
|
"jshintConfig": {
|
|
37
|
-
"esversion":
|
|
37
|
+
"esversion": 11,
|
|
38
38
|
"strict": "implied",
|
|
39
39
|
"eqeqeq": true,
|
|
40
40
|
"latedef": true,
|
|
@@ -64,20 +64,24 @@
|
|
|
64
64
|
"@typescript-eslint/no-non-null-assertion": "off"
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
+
"runScriptsConfig": {
|
|
68
|
+
"build": [
|
|
69
|
+
"rimraf build dist **/.DS_Store",
|
|
70
|
+
"jshint . --exclude-path .gitignore",
|
|
71
|
+
"eslint --max-warnings 0 . --ext .ts",
|
|
72
|
+
"tsc",
|
|
73
|
+
"tsc --module UMD --outDir build/umd",
|
|
74
|
+
"copy-file build/umd/puppeteer-browser-ready.js build/puppeteer-browser-ready.umd.cjs",
|
|
75
|
+
"add-dist-header build dist",
|
|
76
|
+
"html-validator"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
67
79
|
"scripts": {
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"step:03": "eslint --max-warnings 0 . --ext .ts",
|
|
71
|
-
"step:04": "tsc",
|
|
72
|
-
"step:05": "tsc --module UMD --outDir build/umd",
|
|
73
|
-
"step:06": "cpy build/umd/puppeteer-browser-ready.js build --rename=puppeteer-browser-ready.umd.cjs --flat=true",
|
|
74
|
-
"step:07": "add-dist-header build dist",
|
|
75
|
-
"step:08": "w3c-html-validator",
|
|
76
|
-
"pretest": "npm-run-all step:*",
|
|
77
|
-
"test": "mocha spec/*.spec.js --timeout 5000"
|
|
80
|
+
"pretest": "run-scripts build",
|
|
81
|
+
"test": "mocha spec/*.spec.js --timeout 5000 --retries 1"
|
|
78
82
|
},
|
|
79
83
|
"peerDependencies": {
|
|
80
|
-
"puppeteer": "^5 || ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || ^13 || ^14 || ^15 || ^16 || ^17 || ^18"
|
|
84
|
+
"puppeteer": "^5 || ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || ^13 || ^14 || ^15 || ^16 || ^17 || ^18 || ^19"
|
|
81
85
|
},
|
|
82
86
|
"dependencies": {
|
|
83
87
|
"cheerio": "~1.0.0-rc.12",
|
|
@@ -87,22 +91,22 @@
|
|
|
87
91
|
"devDependencies": {
|
|
88
92
|
"@types/cheerio": "~0.22",
|
|
89
93
|
"@types/express": "~4.17",
|
|
90
|
-
"@types/node": "~18.
|
|
94
|
+
"@types/node": "~18.11",
|
|
91
95
|
"@types/ws": "~8.5",
|
|
92
|
-
"@typescript-eslint/eslint-plugin": "~5.
|
|
93
|
-
"@typescript-eslint/parser": "~5.
|
|
94
|
-
"add-dist-header": "~0.
|
|
96
|
+
"@typescript-eslint/eslint-plugin": "~5.48",
|
|
97
|
+
"@typescript-eslint/parser": "~5.48",
|
|
98
|
+
"add-dist-header": "~0.3",
|
|
95
99
|
"assert-deep-strict-equal": "~1.0",
|
|
96
|
-
"
|
|
97
|
-
"copy-folder-
|
|
98
|
-
"eslint": "~8.
|
|
100
|
+
"copy-file-util": "~0.1",
|
|
101
|
+
"copy-folder-util": "~0.2",
|
|
102
|
+
"eslint": "~8.32",
|
|
99
103
|
"jshint": "~2.13",
|
|
100
|
-
"mocha": "~10.
|
|
101
|
-
"npm-run-all2": "~6.0",
|
|
104
|
+
"mocha": "~10.2",
|
|
102
105
|
"open": "~8.4",
|
|
103
|
-
"puppeteer": "~
|
|
104
|
-
"rimraf": "~
|
|
105
|
-
"
|
|
106
|
-
"
|
|
106
|
+
"puppeteer": "~19.5",
|
|
107
|
+
"rimraf": "~4.0",
|
|
108
|
+
"run-scripts-util": "~0.1",
|
|
109
|
+
"typescript": "~4.9",
|
|
110
|
+
"w3c-html-validator": "~1.3"
|
|
107
111
|
}
|
|
108
112
|
}
|