html-snapshots 0.19.0 → 1.0.1

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.
Files changed (47) hide show
  1. package/.github/workflows/verify.yml +2 -2
  2. package/HISTORY.md +42 -0
  3. package/README.md +92 -244
  4. package/examples/README.md +149 -0
  5. package/examples/custom/package-lock.json +1090 -9
  6. package/examples/custom/package.json +1 -1
  7. package/examples/debug-phantomjs/package-lock.json +1977 -292
  8. package/examples/debug-phantomjs/package.json +1 -1
  9. package/examples/debug-phantomjs/snapshot.js +1 -0
  10. package/examples/debug-puppeteer/README.md +18 -0
  11. package/examples/debug-puppeteer/package-lock.json +2804 -0
  12. package/examples/debug-puppeteer/package.json +12 -0
  13. package/examples/debug-puppeteer/snapshot.js +30 -0
  14. package/examples/html5rocks/package-lock.json +734 -18
  15. package/examples/html5rocks/package.json +1 -1
  16. package/examples/html5rocks/snapshot.js +0 -6
  17. package/examples/process-limit/package-lock.json +734 -18
  18. package/examples/process-limit/package.json +1 -1
  19. package/examples/simple-promise/package-lock.json +734 -18
  20. package/examples/simple-promise/package.json +1 -1
  21. package/examples/sitemap-index/package-lock.json +734 -18
  22. package/examples/sitemap-index/package.json +1 -1
  23. package/examples/sitemap-index/snapshot.js +0 -1
  24. package/examples/verbose/package-lock.json +734 -19
  25. package/examples/verbose/package.json +1 -1
  26. package/examples/verbose/snapshot.js +1 -0
  27. package/lib/html-snapshots.js +87 -4
  28. package/lib/input-generators/_base.js +7 -1
  29. package/lib/puppeteer/index.js +98 -0
  30. package/lib/puppeteer/removeScripts.js +8 -0
  31. package/package.json +6 -2
  32. package/test/mocha/browsers/puppeteer.js +106 -0
  33. package/test/mocha/browsers/server/index.html +9 -0
  34. package/test/mocha/browsers/test.js +11 -0
  35. package/test/mocha/html-snapshots/basics.js +60 -47
  36. package/test/mocha/html-snapshots/phantomjs-options.js +54 -60
  37. package/test/mocha/html-snapshots/process-limit.js +100 -92
  38. package/test/mocha/html-snapshots/puppeteer.js +47 -0
  39. package/test/mocha/html-snapshots/robots.js +137 -120
  40. package/test/mocha/html-snapshots/server/public/page-sitemap.xml +16 -0
  41. package/test/mocha/html-snapshots/sitemap-index.js +89 -80
  42. package/test/mocha/html-snapshots/sitemap.js +75 -31
  43. package/test/mocha/html-snapshots/snapshot-scripts.js +124 -120
  44. package/test/mocha/html-snapshots/test.js +11 -2
  45. package/test/mocha/html-snapshots/use-jquery.js +65 -64
  46. package/test/mocha/html-snapshots/utils.js +29 -29
  47. package/examples/utils/index.js +0 -25
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "html-snapshots-example",
3
+ "version": "0.1.0",
4
+ "author": "Alex Grant <alex@localnerve.com>",
5
+ "description": "An example using html-snapshots",
6
+ "scripts": {
7
+ "start": "node ./snapshot.js"
8
+ },
9
+ "dependencies": {
10
+ "html-snapshots": "^1.0.0"
11
+ }
12
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Debug puppeteer processing of a page on a sample website.
3
+ *
4
+ * The debug flag applies to all pages, so best to use it to debug one problem page at a time separately.
5
+ *
6
+ * Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
7
+ */
8
+ const path = require("path");
9
+ const util = require("util");
10
+ const htmlSnapshots = require("html-snapshots");
11
+
12
+ htmlSnapshots.run({
13
+ source: [ "https://google.com" ],
14
+ outputDir: path.join(__dirname, "./tmp"),
15
+ outputDirClean: true,
16
+ selector: "body",
17
+ timeout: 60000,
18
+ debug: {
19
+ flag: true,
20
+ slowMo: 2000
21
+ }
22
+ })
23
+ .then(completed => {
24
+ console.log("completed snapshots:");
25
+ console.log(util.inspect(completed));
26
+ })
27
+ .catch(error => {
28
+ console.error("error occurred");
29
+ console.error(util.inspect(error));
30
+ });