puppeteer-browser-ready 1.3.0 → 1.3.2
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 +23 -7
- package/dist/puppeteer-browser-ready.d.ts +1 -1
- package/dist/puppeteer-browser-ready.js +2 -2
- package/package.json +17 -20
package/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2020-
|
|
3
|
+
Copyright (c) 2020-2024 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
|
@@ -130,14 +130,28 @@ describe('The web page', () => {
|
|
|
130
130
|
before(loadWebPage);
|
|
131
131
|
after(closeWebPage);
|
|
132
132
|
|
|
133
|
-
it('has the correct URL
|
|
133
|
+
it('has the correct URL', () => {
|
|
134
134
|
const actual = { status: web.status, url: web.location.href };
|
|
135
135
|
const expected = { status: 200, url: url };
|
|
136
136
|
assertDeepStrictEqual(actual, expected);
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
it('
|
|
140
|
-
const actual =
|
|
139
|
+
it('title starts with "Pretty-Print JSON"', () => {
|
|
140
|
+
const actual = { title: web.title.substring(0, 17) };
|
|
141
|
+
const expected = { title: 'Pretty-Print JSON' };
|
|
142
|
+
assertDeepStrictEqual(actual, expected);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('body has exactly one header, main, and footer -- node-html-parsed', () => {
|
|
146
|
+
const getTags = (elems) => [...elems].map(elem => elem.tagName.toLowerCase());
|
|
147
|
+
const actual = getTags(web.root.querySelectorAll('body >*'));
|
|
148
|
+
const expected = ['header', 'main', 'footer'];
|
|
149
|
+
assertDeepStrictEqual(actual, expected);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('body has exactly one header, main, and footer -- page.$$eval()', async () => {
|
|
153
|
+
const getTags = (elems) => elems.map(elem => elem.nodeName.toLowerCase());
|
|
154
|
+
const actual = await web.page.$$eval('body >*', getTags);
|
|
141
155
|
const expected = ['header', 'main', 'footer'];
|
|
142
156
|
assertDeepStrictEqual(actual, expected);
|
|
143
157
|
});
|
|
@@ -160,8 +174,10 @@ describe('The document content', () => {
|
|
|
160
174
|
**Output:**
|
|
161
175
|
```
|
|
162
176
|
The web page
|
|
163
|
-
✓ has the correct URL
|
|
164
|
-
✓
|
|
177
|
+
✓ has the correct URL
|
|
178
|
+
✓ title starts with "Pretty-Print JSON"
|
|
179
|
+
✓ body has exactly one header, main, and footer -- node-html-parsed
|
|
180
|
+
✓ body has exactly one header, main, and footer -- page.$$eval()
|
|
165
181
|
|
|
166
182
|
The document content
|
|
167
183
|
✓ has a 🚀 traveling to 🪐!
|
|
@@ -218,14 +234,14 @@ Example configuration in **package.json** to allow 5,000 ms:
|
|
|
218
234
|
<br>
|
|
219
235
|
|
|
220
236
|
---
|
|
221
|
-
**CLI Build Tools**
|
|
237
|
+
**CLI Build Tools for package.json**
|
|
222
238
|
- 🎋 [add-dist-header](https://github.com/center-key/add-dist-header): _Prepend a one-line banner comment (with license notice) to distribution files_
|
|
223
239
|
- 📄 [copy-file-util](https://github.com/center-key/copy-file-util): _Copy or rename a file with optional package version number_
|
|
224
240
|
- 📂 [copy-folder-util](https://github.com/center-key/copy-folder-util): _Recursively copy files from one folder to another folder_
|
|
225
241
|
- 🪺 [recursive-exec](https://github.com/center-key/recursive-exec): _Run a command on each file in a folder and its subfolders_
|
|
226
242
|
- 🔍 [replacer-util](https://github.com/center-key/replacer-util): _Find and replace strings or template outputs in text files_
|
|
227
243
|
- 🔢 [rev-web-assets](https://github.com/center-key/rev-web-assets): _Revision web asset filenames with cache busting content hash fingerprints_
|
|
228
|
-
- 🚆 [run-scripts-util](https://github.com/center-key/run-scripts-util): _Organize npm scripts into named groups of easy to manage commands_
|
|
244
|
+
- 🚆 [run-scripts-util](https://github.com/center-key/run-scripts-util): _Organize npm package.json scripts into named groups of easy to manage commands_
|
|
229
245
|
- 🚦 [w3c-html-validator](https://github.com/center-key/w3c-html-validator): _Check the markup validity of HTML files using the W3C validator_
|
|
230
246
|
|
|
231
247
|
[MIT License](LICENSE.txt)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//! puppeteer-browser-ready v1.3.
|
|
1
|
+
//! puppeteer-browser-ready v1.3.2 ~~ https://github.com/center-key/puppeteer-browser-ready ~~ MIT License
|
|
2
2
|
|
|
3
3
|
import { Browser, HTTPResponse, Page } from 'puppeteer';
|
|
4
4
|
import { HTMLElement } from 'node-html-parser';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//! puppeteer-browser-ready v1.3.
|
|
1
|
+
//! puppeteer-browser-ready v1.3.2 ~~ https://github.com/center-key/puppeteer-browser-ready ~~ MIT License
|
|
2
2
|
|
|
3
3
|
import { parse } from 'node-html-parser';
|
|
4
4
|
import express from 'express';
|
|
@@ -46,7 +46,7 @@ const browserReady = {
|
|
|
46
46
|
const settings = { ...defaults, ...options };
|
|
47
47
|
const log = (label, msg) => settings.verbose &&
|
|
48
48
|
console.log(' ', Date.now() % 100000, label + ':', msg);
|
|
49
|
-
const rootInfo = (root) => root.constructor.name + '/' + root.firstChild
|
|
49
|
+
const rootInfo = (root) => root.constructor.name + '/' + root.firstChild?.toString();
|
|
50
50
|
const web = async (browser) => {
|
|
51
51
|
log('Connected', browser.isConnected());
|
|
52
52
|
try {
|
package/package.json
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "puppeteer-browser-ready",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Simple utility to go to a URL and wait for the HTTP response",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "dist/puppeteer-browser-ready.js",
|
|
8
|
-
"main": "dist/puppeteer-browser-ready.js",
|
|
9
8
|
"types": "dist/puppeteer-browser-ready.d.ts",
|
|
9
|
+
"exports": "./dist/puppeteer-browser-ready.js",
|
|
10
10
|
"files": [
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
"./": "./dist/"
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/center-key/puppeteer-browser-ready.git"
|
|
18
16
|
},
|
|
19
|
-
"repository": "github:center-key/puppeteer-browser-ready",
|
|
20
17
|
"homepage": "https://github.com/center-key/puppeteer-browser-ready",
|
|
21
18
|
"bugs": "https://github.com/center-key/puppeteer-browser-ready/issues",
|
|
22
19
|
"docs": "https://github.com/center-key/puppeteer-browser-ready#readme",
|
|
@@ -74,7 +71,7 @@
|
|
|
74
71
|
"build": [
|
|
75
72
|
"tsc",
|
|
76
73
|
"add-dist-header build dist",
|
|
77
|
-
"html-validator"
|
|
74
|
+
"html-validator spec"
|
|
78
75
|
]
|
|
79
76
|
},
|
|
80
77
|
"scripts": {
|
|
@@ -82,7 +79,7 @@
|
|
|
82
79
|
"test": "mocha spec/*.spec.js --timeout 7000 --retries 1"
|
|
83
80
|
},
|
|
84
81
|
"peerDependencies": {
|
|
85
|
-
"puppeteer": "^15 || ^16 || ^17 || ^18 || ^19.7 || ^20 || ^21"
|
|
82
|
+
"puppeteer": "^15 || ^16 || ^17 || ^18 || ^19.7 || ^20 || ^21 || ^22"
|
|
86
83
|
},
|
|
87
84
|
"dependencies": {
|
|
88
85
|
"express": "~4.18",
|
|
@@ -92,22 +89,22 @@
|
|
|
92
89
|
"devDependencies": {
|
|
93
90
|
"@types/express": "~4.17",
|
|
94
91
|
"@types/mocha": "~10.0",
|
|
95
|
-
"@types/node": "~20.
|
|
92
|
+
"@types/node": "~20.11",
|
|
96
93
|
"@types/ws": "~8.5",
|
|
97
|
-
"@typescript-eslint/eslint-plugin": "~6.
|
|
98
|
-
"@typescript-eslint/parser": "~6.
|
|
99
|
-
"add-dist-header": "~1.
|
|
100
|
-
"assert-deep-strict-equal": "~1.
|
|
94
|
+
"@typescript-eslint/eslint-plugin": "~6.21",
|
|
95
|
+
"@typescript-eslint/parser": "~6.21",
|
|
96
|
+
"add-dist-header": "~1.4",
|
|
97
|
+
"assert-deep-strict-equal": "~1.2",
|
|
101
98
|
"copy-file-util": "~1.1",
|
|
102
99
|
"copy-folder-util": "~1.1",
|
|
103
|
-
"eslint": "~8.
|
|
100
|
+
"eslint": "~8.56",
|
|
104
101
|
"jshint": "~2.13",
|
|
105
102
|
"mocha": "~10.2",
|
|
106
|
-
"open": "~
|
|
107
|
-
"puppeteer": "~
|
|
103
|
+
"open": "~10.0",
|
|
104
|
+
"puppeteer": "~22.0",
|
|
108
105
|
"rimraf": "~5.0",
|
|
109
106
|
"run-scripts-util": "~1.2",
|
|
110
|
-
"typescript": "~5.
|
|
111
|
-
"w3c-html-validator": "~1.
|
|
107
|
+
"typescript": "~5.3",
|
|
108
|
+
"w3c-html-validator": "~1.6"
|
|
112
109
|
}
|
|
113
110
|
}
|