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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
User-agent: *
|
|
2
|
+
|
|
3
|
+
Allow: /
|
|
4
|
+
Allow: /contact
|
|
5
|
+
Allow: /services/carpets
|
|
6
|
+
Allow: /services/test?arg=one
|
|
7
|
+
Allow: /services/#hash
|
|
8
|
+
|
|
9
|
+
Disallow: /api/
|
|
10
|
+
Disallow: /vendor/
|
|
11
|
+
Disallow: /fonts/
|
|
12
|
+
Disallow: /images/
|
|
13
|
+
|
|
14
|
+
Sitemap: http://localhost:8033/test_sitemap.xml
|
|
15
|
+
|
|
16
|
+
User-agent: ia_archiver
|
|
17
|
+
Disallow: /
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
User-agent: *
|
|
2
|
+
|
|
3
|
+
Allow: /
|
|
4
|
+
Allow: /contact
|
|
5
|
+
Allow: /services/carpets
|
|
6
|
+
Allow: /services/test?arg=one
|
|
7
|
+
Allow: /services/#hash
|
|
8
|
+
|
|
9
|
+
Disallow: /api/
|
|
10
|
+
Disallow: /vendor/
|
|
11
|
+
Disallow: /fonts/
|
|
12
|
+
Disallow: /images/
|
|
13
|
+
|
|
14
|
+
Sitemap: http://badhost.nowhere/sitemap.xml
|
|
15
|
+
|
|
16
|
+
User-agent: ia_archiver
|
|
17
|
+
Disallow: /
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
User-agent: *
|
|
2
|
+
|
|
3
|
+
Allow: /
|
|
4
|
+
Allow: /contact
|
|
5
|
+
Allow: /services/carpets
|
|
6
|
+
Allow: /services/test?arg=one
|
|
7
|
+
Allow: /services/#hash
|
|
8
|
+
|
|
9
|
+
Disallow: /api/
|
|
10
|
+
Disallow: /vendor/
|
|
11
|
+
Disallow: /fonts/
|
|
12
|
+
Disallow: /images/
|
|
13
|
+
|
|
14
|
+
Sitemap: http://localhost:8033/test_sitemap.xml
|
|
15
|
+
Sitemap: http://localhost:8033/test_sitemap_index.xml
|
|
16
|
+
|
|
17
|
+
User-agent: ia_archiver
|
|
18
|
+
Disallow: /
|
package/lib/common/node.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/***
|
|
2
|
-
* nodeCall
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
|
|
5
|
-
* Licensed under the MIT license.
|
|
6
|
-
*/
|
|
7
|
-
/* global Promise */
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Utility to promisify a Node function
|
|
11
|
-
*
|
|
12
|
-
* @param {Function} nodeFunc - The node-style function to Promisify.
|
|
13
|
-
*/
|
|
14
|
-
function nodeCall (nodeFunc, ...nodeArgs) {
|
|
15
|
-
return new Promise((resolve, reject) => {
|
|
16
|
-
nodeArgs.push((err, value) => {
|
|
17
|
-
if (err) {
|
|
18
|
-
return reject(err);
|
|
19
|
-
}
|
|
20
|
-
return resolve(value);
|
|
21
|
-
});
|
|
22
|
-
nodeFunc.apply(nodeFunc, nodeArgs);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
module.exports = nodeCall;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common node tests.
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
|
|
5
|
-
*/
|
|
6
|
-
/* global describe, it */
|
|
7
|
-
var assert = require("assert");
|
|
8
|
-
var nodeCall = require("../../../lib/common/node");
|
|
9
|
-
|
|
10
|
-
describe("node", function () {
|
|
11
|
-
var resolveTo = "hello world";
|
|
12
|
-
var firstArg = "one",
|
|
13
|
-
secondArg = "two",
|
|
14
|
-
thirdArg = "three";
|
|
15
|
-
|
|
16
|
-
function test (first, second) {
|
|
17
|
-
var result;
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
assert.equal(first, second);
|
|
21
|
-
} catch (e) {
|
|
22
|
-
result = e;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function noArgs (cb) {
|
|
29
|
-
cb(null, resolveTo);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function oneArg (one, cb) {
|
|
33
|
-
cb(test(one, firstArg), resolveTo);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function twoArgs (one, two, cb) {
|
|
37
|
-
var first = test(one, firstArg);
|
|
38
|
-
var second = test(two, secondArg);
|
|
39
|
-
cb(first || second, resolveTo);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function threeArgs (one, two, three, cb) {
|
|
43
|
-
var first = test(one, firstArg);
|
|
44
|
-
var second = test(two, secondArg);
|
|
45
|
-
var third = test(three, thirdArg);
|
|
46
|
-
cb(first || second || third, resolveTo);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function errorFn (cb) {
|
|
50
|
-
cb(new Error("my error message"));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
it("should return a promise that resolves with no arguments", function (done) {
|
|
54
|
-
nodeCall(noArgs)
|
|
55
|
-
.then(function (value) {
|
|
56
|
-
done(test(value, resolveTo));
|
|
57
|
-
})
|
|
58
|
-
.catch(done);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it("should return a promise that resolves with one arguments", function (done) {
|
|
62
|
-
nodeCall(oneArg, firstArg)
|
|
63
|
-
.then(function (value) {
|
|
64
|
-
done(test(value, resolveTo));
|
|
65
|
-
})
|
|
66
|
-
.catch(done);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("should return a promise that resolves with two arguments", function (done) {
|
|
70
|
-
nodeCall(twoArgs, firstArg, secondArg)
|
|
71
|
-
.then(function (value) {
|
|
72
|
-
done(test(value, resolveTo));
|
|
73
|
-
})
|
|
74
|
-
.catch(done);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it("should return a promise that resolves with three arguments", function (done) {
|
|
78
|
-
nodeCall(threeArgs, firstArg, secondArg, thirdArg)
|
|
79
|
-
.then(function (value) {
|
|
80
|
-
done(test(value, resolveTo));
|
|
81
|
-
})
|
|
82
|
-
.catch(done);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("should return a promise that resolves to error", function (done) {
|
|
86
|
-
nodeCall(errorFn)
|
|
87
|
-
.then(function () {
|
|
88
|
-
done(new Error("Unexpected success. Should have been error"));
|
|
89
|
-
})
|
|
90
|
-
.catch(function (err) {
|
|
91
|
-
try {
|
|
92
|
-
assert.ok(err instanceof Error);
|
|
93
|
-
} catch (e) {
|
|
94
|
-
done(e);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
done();
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
});
|