html-snapshots 0.18.3 → 0.19.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/.eslintrc.json +4 -5
- package/README.md +73 -68
- package/examples/custom/myFilter.js +2 -2
- package/examples/custom/package-lock.json +939 -4
- package/examples/custom/package.json +1 -1
- package/examples/custom/snapshot.js +8 -10
- package/examples/debug-phantomjs/package-lock.json +6 -6
- package/examples/debug-phantomjs/package.json +1 -1
- package/examples/debug-phantomjs/snapshot.js +12 -14
- package/examples/html5rocks/package-lock.json +1306 -5
- package/examples/html5rocks/package.json +1 -1
- package/examples/html5rocks/snapshot.js +15 -18
- package/examples/process-limit/package-lock.json +1306 -5
- package/examples/process-limit/package.json +1 -1
- package/examples/process-limit/snapshot.js +8 -10
- package/examples/simple-promise/package-lock.json +1306 -5
- package/examples/simple-promise/package.json +1 -1
- package/examples/simple-promise/snapshot.js +6 -8
- package/examples/sitemap-index/package-lock.json +1306 -5
- package/examples/sitemap-index/package.json +1 -1
- package/examples/sitemap-index/snapshot.js +6 -6
- package/examples/utils/index.js +2 -4
- package/examples/verbose/package-lock.json +1307 -5
- package/examples/verbose/package.json +1 -1
- package/examples/verbose/snapshot.js +11 -14
- package/lib/async/index.js +0 -1
- package/lib/common/index.js +1 -1
- package/lib/common/sitemap/index.js +16 -0
- package/lib/common/sitemap/sitemap-collection.js +94 -0
- package/lib/common/sitemap/sitemap-index.js +68 -0
- package/lib/common/{sitemap.js → sitemap/sitemap.js} +68 -57
- package/lib/html-snapshots.js +0 -1
- package/lib/input-generators/array.js +0 -1
- package/lib/input-generators/robots.js +98 -58
- package/lib/input-generators/sitemap-index.js +3 -124
- package/lib/input-generators/sitemap.js +3 -7
- package/lib/input-generators/textfile.js +2 -6
- package/package.json +5 -4
- package/test/helpers/options.js +4 -2
- package/test/mocha/html-snapshots/process-limit.js +46 -48
- package/test/mocha/html-snapshots/robots.js +156 -138
- package/test/mocha/html-snapshots/server/test_robots.txt +13 -0
- package/test/mocha/html-snapshots/server/test_robots_sitemap.txt +15 -0
- package/test/mocha/html-snapshots/server/test_robots_sitemap.xml +22 -0
- package/test/mocha/html-snapshots/sitemap-index.js +58 -57
- package/test/mocha/html-snapshots/snapshot-scripts.js +55 -54
- package/test/mocha/html-snapshots/test.js +16 -16
- package/test/mocha/html-snapshots/test_robots.txt +0 -2
- package/test/mocha/html-snapshots/utils.js +0 -1
- package/test/mocha/input-generators/server/test_robots.txt +0 -2
- package/test/mocha/input-generators/server/test_robots_bad.txt +0 -2
- package/test/mocha/input-generators/server/test_robots_sitemap.txt +17 -0
- package/test/mocha/input-generators/server/test_robots_sitemap_bad.txt +17 -0
- package/test/mocha/input-generators/server/test_robots_sitemap_multi.txt +18 -0
- package/test/mocha/input-generators/server/test_sitemap_index_empty.xml +3 -0
- package/test/mocha/input-generators/server/test_sitemap_index_malformed.xml +2 -0
- package/test/mocha/input-generators/sitemap-index.js +65 -9
- package/test/mocha/input-generators/test.js +276 -280
- package/test/mocha/input-generators/test_robots.txt +0 -2
- package/test/mocha/input-generators/test_robots_bad.txt +0 -2
- package/test/mocha/input-generators/test_robots_sitemap.txt +17 -0
- package/test/mocha/input-generators/test_robots_sitemap_bad.txt +17 -0
- package/test/mocha/input-generators/test_robots_sitemap_multi.txt +18 -0
- package/lib/common/node.js +0 -26
- package/test/mocha/common/node.js +0 -100
|
@@ -5,26 +5,24 @@
|
|
|
5
5
|
* Use sitemap.xml to snapshot an entire site.
|
|
6
6
|
* Use a customFilter to update the output before the snapshots are written.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const path = require("path");
|
|
9
|
+
const util = require("util");
|
|
10
|
+
const htmlSnapshots = require("html-snapshots");
|
|
11
11
|
|
|
12
12
|
htmlSnapshots.run({
|
|
13
13
|
input: "sitemap",
|
|
14
|
-
source: "
|
|
14
|
+
source: "https://sitemaps.org/sitemap.xml",
|
|
15
15
|
outputDir: path.join(__dirname, "./tmp"),
|
|
16
16
|
outputDirClean: true,
|
|
17
|
-
selector: "
|
|
17
|
+
selector: "#mainContent",
|
|
18
18
|
snapshotScript: {
|
|
19
19
|
script: "customFilter",
|
|
20
20
|
module: path.join(__dirname, "myFilter.js")
|
|
21
21
|
},
|
|
22
|
-
timeout:
|
|
22
|
+
timeout: 10000
|
|
23
23
|
})
|
|
24
|
-
.then(
|
|
24
|
+
.then(completed => {
|
|
25
25
|
console.log("completed snapshots:");
|
|
26
26
|
console.log(util.inspect(completed));
|
|
27
27
|
})
|
|
28
|
-
.catch(
|
|
29
|
-
console.error(err);
|
|
30
|
-
});
|
|
28
|
+
.catch(console.error);
|
|
@@ -297,9 +297,9 @@
|
|
|
297
297
|
}
|
|
298
298
|
},
|
|
299
299
|
"html-snapshots": {
|
|
300
|
-
"version": "0.18.
|
|
301
|
-
"resolved": "https://registry.npmjs.org/html-snapshots/-/html-snapshots-0.18.
|
|
302
|
-
"integrity": "sha512-
|
|
300
|
+
"version": "0.18.3",
|
|
301
|
+
"resolved": "https://registry.npmjs.org/html-snapshots/-/html-snapshots-0.18.3.tgz",
|
|
302
|
+
"integrity": "sha512-mNEyRLstWDTtP0VZxSu/+86snmWtgeH5ebIeiJXfiaMCjmj8ca+ASE0SSGy0aM63oVhHpXov4nipqCHCjctGQQ==",
|
|
303
303
|
"requires": {
|
|
304
304
|
"async": "3.2.4",
|
|
305
305
|
"async-lock": "1.3.2",
|
|
@@ -571,9 +571,9 @@
|
|
|
571
571
|
"integrity": "sha512-UdA8mJ4weIkUBO224tIarHzuHs4HuYiJvsuGT7j/SPQiUJVjYvNDBIPa0hAorduOfjGohB/qHWRa/lrrWX/mXw=="
|
|
572
572
|
},
|
|
573
573
|
"psl": {
|
|
574
|
-
"version": "1.
|
|
575
|
-
"resolved": "https://registry.npmjs.org/psl/-/psl-1.
|
|
576
|
-
"integrity": "sha512-
|
|
574
|
+
"version": "1.9.0",
|
|
575
|
+
"resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
|
|
576
|
+
"integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag=="
|
|
577
577
|
},
|
|
578
578
|
"punycode": {
|
|
579
579
|
"version": "2.1.1",
|
|
@@ -8,20 +8,18 @@
|
|
|
8
8
|
* Demonstrates phantomjsOptions usage on a per-page basis.
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const path = require("path");
|
|
12
|
+
const util = require("util");
|
|
13
|
+
const assert = require("assert");
|
|
14
|
+
const htmlSnapshots = require("html-snapshots");
|
|
15
15
|
|
|
16
16
|
// Assert if NOT an error
|
|
17
17
|
function mustBeError(err) {
|
|
18
18
|
assert.throws(
|
|
19
|
-
|
|
19
|
+
() => {
|
|
20
20
|
assert.ifError(err);
|
|
21
21
|
},
|
|
22
|
-
|
|
23
|
-
return !!err;
|
|
24
|
-
}
|
|
22
|
+
err => !!err
|
|
25
23
|
);
|
|
26
24
|
}
|
|
27
25
|
|
|
@@ -29,21 +27,21 @@ function mustBeError(err) {
|
|
|
29
27
|
// but this also demonstrates the use of phantomjsOptions in the per-page case.
|
|
30
28
|
htmlSnapshots.run({
|
|
31
29
|
input: "sitemap",
|
|
32
|
-
source: "
|
|
30
|
+
source: "https://www.sitemaps.org/sitemap.xml",
|
|
33
31
|
outputDir: path.join(__dirname, "./tmp"),
|
|
34
32
|
outputDirClean: true,
|
|
35
|
-
selector: "
|
|
36
|
-
timeout:
|
|
33
|
+
selector: "#mainContent",
|
|
34
|
+
timeout: 10000,
|
|
37
35
|
phantomjsOptions: {
|
|
38
36
|
// The key must exactly match the loc as defined in the sitemap.xml
|
|
39
|
-
"
|
|
37
|
+
"https://www.sitemaps.org/protocol.html": "--remote-debugger-port=9000"
|
|
40
38
|
}
|
|
41
|
-
},
|
|
39
|
+
}, (err, completed) => {
|
|
42
40
|
|
|
43
41
|
console.log("completed snapshots:");
|
|
44
42
|
console.log(util.inspect(completed));
|
|
45
43
|
|
|
46
|
-
// We expect the
|
|
44
|
+
// We expect the protocol.html page will timeout because we've held it in the debugger
|
|
47
45
|
// It will succeed if you use --remote-debugger-autorun=true
|
|
48
46
|
// However, the PhantomJS process instances won't exit so that you can (re)debug
|
|
49
47
|
mustBeError(err);
|