html-snapshots 1.3.2 → 1.4.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.
Files changed (247) hide show
  1. package/package.json +3 -3
  2. package/.c8rc.json +0 -5
  3. package/.eslintignore +0 -5
  4. package/.eslintrc.json +0 -16
  5. package/.github/issue_template.md +0 -16
  6. package/.github/workflows/verify.yml +0 -32
  7. package/docs/example-heroku-redis.md +0 -43
  8. package/docs/notes.md +0 -42
  9. package/examples/README.md +0 -149
  10. package/examples/custom/README.md +0 -22
  11. package/examples/custom/myFilter.js +0 -22
  12. package/examples/custom/package-lock.json +0 -2804
  13. package/examples/custom/package.json +0 -12
  14. package/examples/custom/snapshot.js +0 -28
  15. package/examples/debug-phantomjs/README.md +0 -38
  16. package/examples/debug-phantomjs/package-lock.json +0 -2922
  17. package/examples/debug-phantomjs/package.json +0 -12
  18. package/examples/debug-phantomjs/snapshot.js +0 -60
  19. package/examples/debug-puppeteer/README.md +0 -18
  20. package/examples/debug-puppeteer/package-lock.json +0 -2804
  21. package/examples/debug-puppeteer/package.json +0 -12
  22. package/examples/debug-puppeteer/snapshot.js +0 -30
  23. package/examples/html5rocks/README.md +0 -22
  24. package/examples/html5rocks/package-lock.json +0 -3218
  25. package/examples/html5rocks/package.json +0 -12
  26. package/examples/html5rocks/snapshot.js +0 -59
  27. package/examples/process-limit/README.md +0 -24
  28. package/examples/process-limit/package-lock.json +0 -2830
  29. package/examples/process-limit/package.json +0 -12
  30. package/examples/process-limit/snapshot.js +0 -30
  31. package/examples/simple-promise/README.md +0 -20
  32. package/examples/simple-promise/package-lock.json +0 -2830
  33. package/examples/simple-promise/package.json +0 -12
  34. package/examples/simple-promise/snapshot.js +0 -30
  35. package/examples/sitemap-index/README.md +0 -20
  36. package/examples/sitemap-index/package-lock.json +0 -2830
  37. package/examples/sitemap-index/package.json +0 -12
  38. package/examples/sitemap-index/snapshot.js +0 -34
  39. package/examples/verbose/README.md +0 -22
  40. package/examples/verbose/package-lock.json +0 -2805
  41. package/examples/verbose/package.json +0 -12
  42. package/examples/verbose/snapshot.js +0 -34
  43. package/test/helpers/options.js +0 -55
  44. package/test/helpers/result.js +0 -32
  45. package/test/helpers/sitemap.js +0 -130
  46. package/test/mocha/async/test.js +0 -416
  47. package/test/mocha/browsers/puppeteer.js +0 -129
  48. package/test/mocha/browsers/server/index.html +0 -9
  49. package/test/mocha/browsers/test.js +0 -11
  50. package/test/mocha/common/helpers.js +0 -87
  51. package/test/mocha/common/test.js +0 -188
  52. package/test/mocha/html-snapshots/basics.js +0 -88
  53. package/test/mocha/html-snapshots/myFilter.js +0 -10
  54. package/test/mocha/html-snapshots/phantomjs-options.js +0 -156
  55. package/test/mocha/html-snapshots/process-limit.js +0 -156
  56. package/test/mocha/html-snapshots/puppeteer.js +0 -47
  57. package/test/mocha/html-snapshots/robots.js +0 -194
  58. package/test/mocha/html-snapshots/server/contact/index.html +0 -57
  59. package/test/mocha/html-snapshots/server/favicon.ico +0 -0
  60. package/test/mocha/html-snapshots/server/fonts/facebolf-webfont.eot +0 -0
  61. package/test/mocha/html-snapshots/server/fonts/facebolf-webfont.svg +0 -220
  62. package/test/mocha/html-snapshots/server/fonts/facebolf-webfont.ttf +0 -0
  63. package/test/mocha/html-snapshots/server/fonts/facebolf-webfont.woff +0 -0
  64. package/test/mocha/html-snapshots/server/images/ajax-loader.gif +0 -0
  65. package/test/mocha/html-snapshots/server/images/art1.jpg +0 -0
  66. package/test/mocha/html-snapshots/server/images/carpet.jpg +0 -0
  67. package/test/mocha/html-snapshots/server/images/carpets/carpet1.jpg +0 -0
  68. package/test/mocha/html-snapshots/server/images/carpets/carpet1_th.jpg +0 -0
  69. package/test/mocha/html-snapshots/server/images/carpets/carpet2.jpg +0 -0
  70. package/test/mocha/html-snapshots/server/images/carpets/carpet2_th.jpg +0 -0
  71. package/test/mocha/html-snapshots/server/images/carpets/carpet3.jpg +0 -0
  72. package/test/mocha/html-snapshots/server/images/carpets/carpet3_th.jpg +0 -0
  73. package/test/mocha/html-snapshots/server/images/carpets/carpet4.jpg +0 -0
  74. package/test/mocha/html-snapshots/server/images/carpets/carpet4_th.jpg +0 -0
  75. package/test/mocha/html-snapshots/server/images/floor.jpg +0 -0
  76. package/test/mocha/html-snapshots/server/images/foundation/orbit/bullets.jpg +0 -0
  77. package/test/mocha/html-snapshots/server/images/foundation/orbit/left-arrow-small.png +0 -0
  78. package/test/mocha/html-snapshots/server/images/foundation/orbit/left-arrow.png +0 -0
  79. package/test/mocha/html-snapshots/server/images/foundation/orbit/loading.gif +0 -0
  80. package/test/mocha/html-snapshots/server/images/foundation/orbit/mask-black.png +0 -0
  81. package/test/mocha/html-snapshots/server/images/foundation/orbit/pause-black.png +0 -0
  82. package/test/mocha/html-snapshots/server/images/foundation/orbit/right-arrow-small.png +0 -0
  83. package/test/mocha/html-snapshots/server/images/foundation/orbit/right-arrow.png +0 -0
  84. package/test/mocha/html-snapshots/server/images/foundation/orbit/rotator-black.png +0 -0
  85. package/test/mocha/html-snapshots/server/images/foundation/orbit/timer-black.png +0 -0
  86. package/test/mocha/html-snapshots/server/images/home-sprite/certification.png +0 -0
  87. package/test/mocha/html-snapshots/server/images/home-sprite/cleantrust.png +0 -0
  88. package/test/mocha/html-snapshots/server/images/home-sprite/institute.png +0 -0
  89. package/test/mocha/html-snapshots/server/images/home-sprite-s1a48fdbd81.png +0 -0
  90. package/test/mocha/html-snapshots/server/images/logo-300.png +0 -0
  91. package/test/mocha/html-snapshots/server/images/slider1-lg.jpg +0 -0
  92. package/test/mocha/html-snapshots/server/images/slider1.jpg +0 -0
  93. package/test/mocha/html-snapshots/server/index.css +0 -1
  94. package/test/mocha/html-snapshots/server/index.html +0 -57
  95. package/test/mocha/html-snapshots/server/nojq/index.html +0 -46
  96. package/test/mocha/html-snapshots/server/pjsopts/index.html +0 -55
  97. package/test/mocha/html-snapshots/server/public/page-sitemap.xml +0 -16
  98. package/test/mocha/html-snapshots/server/public/wordpress/category-sitemap.xml +0 -13
  99. package/test/mocha/html-snapshots/server/public/wordpress/page-sitemap.xml +0 -16
  100. package/test/mocha/html-snapshots/server/public/wordpress/post-sitemap.xml +0 -27
  101. package/test/mocha/html-snapshots/server/public/wordpress/post_tag-sitemap.xml +0 -17
  102. package/test/mocha/html-snapshots/server/public/wordpress/product-sitemap.xml +0 -13
  103. package/test/mocha/html-snapshots/server/public/wordpress-2/category-sitemap.xml +0 -13
  104. package/test/mocha/html-snapshots/server/public/wordpress-2/page-sitemap.xml +0 -16
  105. package/test/mocha/html-snapshots/server/public/wordpress-2/post-sitemap.xml +0 -27
  106. package/test/mocha/html-snapshots/server/public/wordpress-2/post_tag-sitemap.xml +0 -17
  107. package/test/mocha/html-snapshots/server/public/wordpress-2/product-sitemap.xml +0 -13
  108. package/test/mocha/html-snapshots/server/require.js +0 -1
  109. package/test/mocha/html-snapshots/server/services/carpets/index.html +0 -57
  110. package/test/mocha/html-snapshots/server/test_robots.txt +0 -13
  111. package/test/mocha/html-snapshots/server/test_robots_sitemap.txt +0 -15
  112. package/test/mocha/html-snapshots/server/test_robots_sitemap.xml +0 -22
  113. package/test/mocha/html-snapshots/server/test_sitemap_index-2.xml +0 -25
  114. package/test/mocha/html-snapshots/server/test_sitemap_index-3.xml +0 -25
  115. package/test/mocha/html-snapshots/server/test_sitemap_index.xml +0 -25
  116. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/extras/custom-validity.js +0 -1
  117. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/extras/modernizr-custom.js +0 -1
  118. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/extras/mousepress.js +0 -1
  119. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/polyfiller.js +0 -1
  120. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/canvas2png.js +0 -1
  121. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/flashcanvas.js +0 -1
  122. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/flashcanvas.swf +0 -0
  123. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/proxy.php +0 -73
  124. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/save.php +0 -49
  125. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/canvas2png.js +0 -1
  126. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/flash10canvas.swf +0 -0
  127. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/flash9canvas.swf +0 -0
  128. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/flashcanvas.js +0 -1
  129. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/proxy.php +0 -73
  130. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/save.php +0 -49
  131. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/1.js +0 -1
  132. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/10.js +0 -1
  133. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/11.js +0 -1
  134. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/12.js +0 -1
  135. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/13.js +0 -1
  136. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/14.js +0 -1
  137. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/15.js +0 -1
  138. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/16.js +0 -1
  139. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/17.js +0 -1
  140. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/18.js +0 -1
  141. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/19.js +0 -1
  142. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/2.js +0 -1
  143. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/20.js +0 -1
  144. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/21.js +0 -1
  145. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/22.js +0 -1
  146. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/23.js +0 -1
  147. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/24.js +0 -1
  148. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/25.js +0 -1
  149. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/26.js +0 -1
  150. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/27.js +0 -1
  151. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/3.js +0 -1
  152. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/4.js +0 -1
  153. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/5.js +0 -1
  154. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/59.js +0 -1
  155. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/6.js +0 -1
  156. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/7.js +0 -1
  157. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/8.js +0 -1
  158. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/9.js +0 -1
  159. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/details.js +0 -1
  160. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/dom-extend.js +0 -1
  161. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/es5.js +0 -1
  162. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/excanvas.js +0 -1
  163. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-core.js +0 -1
  164. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-datalist.js +0 -1
  165. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-message.js +0 -1
  166. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-native-extend.js +0 -1
  167. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-number-date-api.js +0 -1
  168. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-number-date-ui.js +0 -1
  169. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-shim-extend.js +0 -1
  170. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/geolocation.js +0 -1
  171. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-ar.js +0 -1
  172. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-ch-ZN.js +0 -1
  173. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-de.txt +0 -33
  174. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-el.js +0 -1
  175. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-en.txt +0 -34
  176. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-es.js +0 -1
  177. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-fr.js +0 -1
  178. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-he.js +0 -1
  179. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-hi.js +0 -1
  180. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-hu.js +0 -1
  181. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-it.js +0 -1
  182. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-ja.js +0 -1
  183. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-nl.js +0 -1
  184. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-pt-PT.js +0 -1
  185. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-ru.js +0 -1
  186. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-sv.js +0 -1
  187. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/json-storage.js +0 -1
  188. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/jwplayer/license.txt +0 -1
  189. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/jwplayer/player.swf +0 -0
  190. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/jwplayer/readme.html +0 -87
  191. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-core.js +0 -1
  192. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-jaris.js +0 -1
  193. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-native-fix.js +0 -1
  194. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-swf.js +0 -1
  195. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-yt.js +0 -1
  196. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/styles/details-arrows.png +0 -0
  197. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/styles/forms.png +0 -0
  198. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/styles/polyfill-loader.gif +0 -0
  199. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/styles/shim.css +0 -1
  200. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/swf/JarisFLVPlayer.swf +0 -0
  201. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/swf/jwwebshims.swf +0 -0
  202. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/swf/localStorage.swf +0 -0
  203. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/track-ui.js +0 -1
  204. package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/track.js +0 -1
  205. package/test/mocha/html-snapshots/server/vendor/js/plugins/cload.js +0 -49
  206. package/test/mocha/html-snapshots/server/vendor/js/plugins/modernizr.js +0 -4
  207. package/test/mocha/html-snapshots/server/vendor/js/plugins/oldie.js +0 -74
  208. package/test/mocha/html-snapshots/sitemap-index.js +0 -140
  209. package/test/mocha/html-snapshots/sitemap.js +0 -104
  210. package/test/mocha/html-snapshots/snapshot-scripts.js +0 -206
  211. package/test/mocha/html-snapshots/test.js +0 -105
  212. package/test/mocha/html-snapshots/test_robots.txt +0 -13
  213. package/test/mocha/html-snapshots/test_sitemap.xml +0 -22
  214. package/test/mocha/html-snapshots/use-jquery.js +0 -144
  215. package/test/mocha/html-snapshots/utils.js +0 -200
  216. package/test/mocha/input-generators/server/public/wordpress/category-sitemap.xml +0 -13
  217. package/test/mocha/input-generators/server/public/wordpress/page-sitemap.xml +0 -16
  218. package/test/mocha/input-generators/server/public/wordpress/post-sitemap.xml +0 -55
  219. package/test/mocha/input-generators/server/public/wordpress/post_tag-sitemap.xml +0 -25
  220. package/test/mocha/input-generators/server/public/wordpress/product-sitemap.xml +0 -13
  221. package/test/mocha/input-generators/server/test_robots.txt +0 -15
  222. package/test/mocha/input-generators/server/test_robots_bad.txt +0 -11
  223. package/test/mocha/input-generators/server/test_robots_sitemap.txt +0 -17
  224. package/test/mocha/input-generators/server/test_robots_sitemap_bad.txt +0 -17
  225. package/test/mocha/input-generators/server/test_robots_sitemap_multi.txt +0 -18
  226. package/test/mocha/input-generators/server/test_sitemap.xml +0 -34
  227. package/test/mocha/input-generators/server/test_sitemap.xml.gz +0 -0
  228. package/test/mocha/input-generators/server/test_sitemap_bad.xml.gz +0 -0
  229. package/test/mocha/input-generators/server/test_sitemap_index.xml +0 -25
  230. package/test/mocha/input-generators/server/test_sitemap_index.xml.gz +0 -0
  231. package/test/mocha/input-generators/server/test_sitemap_index_empty.xml +0 -3
  232. package/test/mocha/input-generators/server/test_sitemap_index_malformed.xml +0 -2
  233. package/test/mocha/input-generators/sitemap-index.js +0 -87
  234. package/test/mocha/input-generators/sitemap.js +0 -320
  235. package/test/mocha/input-generators/test.js +0 -1447
  236. package/test/mocha/input-generators/test_line.txt +0 -5
  237. package/test/mocha/input-generators/test_robots.txt +0 -15
  238. package/test/mocha/input-generators/test_robots_bad.txt +0 -11
  239. package/test/mocha/input-generators/test_robots_sitemap.txt +0 -17
  240. package/test/mocha/input-generators/test_robots_sitemap_bad.txt +0 -17
  241. package/test/mocha/input-generators/test_robots_sitemap_multi.txt +0 -18
  242. package/test/mocha/input-generators/test_sitemap.xml +0 -34
  243. package/test/mocha/input-generators/test_sitemap.xml.gz +0 -0
  244. package/test/mocha/input-generators/test_sitemap_bad.xml.gz +0 -0
  245. package/test/mocha/input-generators/test_sitemap_index.xml +0 -25
  246. package/test/mocha/input-generators/test_sitemap_index.xml.gz +0 -0
  247. package/test/server/index.js +0 -32
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-snapshots",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "author": {
5
5
  "name": "Alex Grant",
6
6
  "email": "alex@localnerve.com",
@@ -55,7 +55,7 @@
55
55
  "async": "3.2.4",
56
56
  "async-lock": "1.4.0",
57
57
  "combine-errors": "3.0.3",
58
- "got": "12.5.2",
58
+ "got": "12.5.3",
59
59
  "lodash": "4.17.21",
60
60
  "mkdirp": "1.0.4",
61
61
  "phantomjs-prebuilt": "2.1.16",
@@ -64,7 +64,7 @@
64
64
  "xml2js": "0.4.23"
65
65
  },
66
66
  "devDependencies": {
67
- "eslint": "8.26.0",
67
+ "eslint": "8.27.0",
68
68
  "express": "4.18.2",
69
69
  "mocha": "10.1.0",
70
70
  "c8": "7.12.0",
package/.c8rc.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "reports-dir": "coverage",
3
- "reporter": "lcov",
4
- "exclude": ["tmp", "docs", "node_modules", "test", ".github", "coverage", "examples"]
5
- }
package/.eslintignore DELETED
@@ -1,5 +0,0 @@
1
- examples/*
2
- docs/*
3
- tmp/*
4
- coverage/*
5
- test/mocha/html-snapshots/server
package/.eslintrc.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "parserOptions": {
3
- "ecmaVersion": 2020,
4
- "sourceType": "module"
5
- },
6
- "env": {
7
- "node": true,
8
- "es2020": true
9
- },
10
- "extends": [
11
- "eslint:recommended"
12
- ],
13
- "rules": {
14
- "no-console": 0
15
- }
16
- }
@@ -1,16 +0,0 @@
1
- ### Expected Behavior
2
-
3
-
4
-
5
- ### Actual Behavior
6
-
7
-
8
-
9
- ### Options
10
- ```javascript
11
- {
12
- // Paste the html-snapshots options you used to create the problem here.
13
- }
14
- ```
15
-
16
- ### Node Version
@@ -1,32 +0,0 @@
1
- name: Verify
2
- on:
3
- push:
4
- branches: [ master ]
5
- pull_request:
6
- branches: [ master ]
7
-
8
- jobs:
9
- verify:
10
-
11
- runs-on: ubuntu-latest
12
-
13
- strategy:
14
- matrix:
15
- node-version: [14.x, 16.x, 18.x]
16
- # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
17
-
18
- steps:
19
- - uses: actions/checkout@v3
20
- - name: Use Node.js ${{ matrix.node-version }}
21
- uses: actions/setup-node@v3
22
- with:
23
- node-version: ${{ matrix.node-version }}
24
- - run: npm ci
25
- - name: Lint, Test, And Coverage
26
- run: npm run lint && xvfb-run -a npm run test:cover
27
- - name: Coverage Upload
28
- if: ${{ success() }}
29
- uses: coverallsapp/github-action@master
30
- with:
31
- github-token: ${{ secrets.GITHUB_TOKEN }}
32
- path-to-lcov: ./coverage/lcov.info
@@ -1,43 +0,0 @@
1
- # A Real html-snapshots Usage Example
2
-
3
- > This article explains an implementation using [html-snapshots](https://github.com/localnerve/html-snapshots) in the wild \(with real, working code\). Please note the code referenced in this article was written by LocalNerve and is subject to the terms of this [license](https://github.com/localnerve/wpspa/blob/master/LICENSE.txt).
4
- **NOTE:** This is an older article and usage style is html-snapshots version 0.13.2.
5
-
6
- ## Summary
7
- The [WPSPA](http://github.com/localnerve/wpspa) project uses [html-snapshots](https://github.com/localnerve/html-snapshots) on [Heroku](https://www.heroku.com/) to populate a Redis store from which the snapshotted html is served on \_escaped\_fragment\_ requests. The [html-snapshots](https://github.com/localnerve/html-snapshots) library is run in a Heroku worker process that periodically keeps the snapshots up-to-date with a CMS.
8
-
9
- The application content and routes in [WPSPA](http://github.com/localnerve/wpspa) are dynamic, so this required me to run [html-snapshots](https://github.com/localnerve/html-snapshots) in a worker on the server to get the dynamic content updates over time.
10
-
11
- > Langauge: Javascript
12
-
13
- > Tools: NodeJS, ExpressJS, PhantomJS, Redis
14
-
15
- ## Serving Html Snapshots in a Scalable Cloud Environment
16
- Since [WPSPA](http://github.com/localnerve/wpspa) runs on Heroku, it is serving the application from [Dynos](https://devcenter.heroku.com/articles/dynos). In essence, Dynos are billable CPU/Memory hours with independent, ephemeral file systems. Dynos can be created and destroyed at will to scale the application. Which one you get when you visit the site is up to the [Heroku routing mesh](https://devcenter.heroku.com/articles/http-routing).
17
-
18
- When a Dyno is started, it gets a copy of the files that it was deployed with in its ephemeral file system. So if your app serves dynamic content from a CMS \(as is the case with [WPSPA](http://github.com/localnerve/wpspa)\), anytime your Dyno starts you get an out-of-date version of the snapshots in the ephemeral file system. In general, managing and serving continually updated content with static html snapshot files will not work on Heroku \(or probably any scalable environment\).
19
-
20
- To see this problem further, the snapshots are being taken from a worker process running on a schedule in a short-lived worker Dyno. The worker does not have access or control of the other Dynos, nor should it. So, to make the snapshots available to web Dynos, they have to be stored in a commonly accessible area \(accessible to worker and web Dynos\), and persist when any or all of them are destroyed. For [WPSPA](http://github.com/localnerve/wpspa), I chose to store them in Redis.
21
-
22
- ### ExpressJS
23
- The snapshots produced by [html-snapshots](https://github.com/localnerve/html-snapshots) are served by custom [ExpressJS](http://expressjs.com/) middleware. The middleware checks to see if it has received an \_escaped\_fragment\_ request. If it has, it retreives the snapshot from Redis and sends it to the client.
24
-
25
- > Middleware code: [wpspa/server/middleware/snapshots.js](https://github.com/localnerve/wpspa/blob/master/server/middleware/snapshots.js)
26
-
27
- The snapshots middleware is loaded higher in the stack, and an example of that placement \(in relation to other things\) can be found in the [WPSPA](http://github.com/localnerve/wpspa) main application file.
28
-
29
- > Application code: [wpspa/app.js](https://github.com/localnerve/wpspa/blob/master/app.js)
30
-
31
- ### NodeJS Worker
32
- A NodeJS worker process runs periodically to update the html snapshots with content updates from the CMS. I call it the [snapshots](https://github.com/localnerve/wpspa/blob/master/server/workers/snapshots/lib/index.js) worker process. To do this, it gets the actual routes used in the application, produces the snapshots for them using [html-snapshots](https://github.com/localnerve/html-snapshots), then stores them in Redis to be served later on request by the ExpressJS middleware. Actually, the snapshots worker doesn't get the application routes itself, because that task alone is a handy, reusable thing. As such, that task was factored out into its own worker process called [routes](https://github.com/localnerve/wpspa/blob/master/server/workers/routes/lib/index.js).
33
- The [routes](https://github.com/localnerve/wpspa/blob/master/server/workers/routes/lib/index.js) worker process runs the [WPSPA](http://github.com/localnerve/wpspa) app on the server, waits for it to load up in PhantomJS, then asks it what it thinks its application routes are. It then stores those routes in Redis for consumption by the [snapshots](https://github.com/localnerve/wpspa/blob/master/server/workers/snapshots/lib/index.js) worker process as described above. \(The dynamic routes are also consumed by other typical web server things, like a dynamic robots.txt and sitemap.xml\).
34
-
35
- > Snapshots worker code: [snapshots](https://github.com/localnerve/wpspa/blob/master/server/workers/snapshots/lib/index.js)
36
-
37
- > Routes worker code: [routes](https://github.com/localnerve/wpspa/blob/master/server/workers/routes/lib/index.js)
38
-
39
- ## Process Limit
40
- I eat my own dogfood. That's how I find out about things sometimes, and this project was no exception. Using [html-snapshots](https://github.com/localnerve/html-snapshots) on Heroku is how I found out that unconditionally spawning processes for each application route is a not-so-good feature to have. So a while back, I added a limiting [process model](https://github.com/localnerve/html-snapshots/tree/rc-7.1#process-model) and an option to control the size of the process pool, [processLimit](https://github.com/localnerve/html-snapshots/blob/master/README.md#process-control-options). For the [WPSPA](http://github.com/localnerve/wpspa) example on Heroku, the [processLimit is set to one](https://github.com/localnerve/wpspa/blob/16c8b5ef2dbea6593572e914f5f3693c0f9f73fc/server/config/config.json#L43) to force only one PhantomJS process to be running at once for the [snapshots](https://github.com/localnerve/wpspa/blob/master/server/workers/snapshots/lib/index.js) worker process, as I run it in a [one-off Dyno](https://devcenter.heroku.com/articles/one-off-dynos), or in the [scheduler](https://addons.heroku.com/scheduler), with a single billable Dyno available to the Heroku account.
41
-
42
- ## Finally
43
- I hope this brief tour of a Heroku/Redis html-snapshots implementation in [WPSPA](http://github.com/localnerve/wpspa) helped you think about your html snapshot implementation needs.
package/docs/notes.md DELETED
@@ -1,42 +0,0 @@
1
- # Background and Other Notes
2
-
3
- ## Why Does This Exist?
4
- The whole reason I created this library was so that I could be certain I snapshotted the page when expected content arrived (not after some arbitrary time expiration). This way, I could be certain the snapshot actually contained the content I expect.
5
-
6
- ## What if I Don't Know About The Rendered Page Content?
7
- If you aren't interested in exact snapshots, or just want to explore because you don't know about the content detail yet, try this:
8
- 1. Use `"body"` as the `selector` option value (every page will probably have a body).
9
- 2. Set the `checkInterval` option high to give the page some time to render before it is written out. `checkInterval` is the time the phantomjs script waits to check for `selector`, so consider this "render time".
10
- 3. Set the `pollInterval` option higher than `checkInterval`.
11
- 4. Set the `timeout` option much higher to give the whole thing time to transpire. Consider `timeout` as a multiple of `pollInterval`.
12
-
13
- ## What Happens If Your Content Does Not Appear
14
- If your content does not show up visibly in a page according to the page's selector you configured in options, you get a timeout error - not a snapshot.
15
-
16
- > That means the element you select **cannot be hidden** by any method.
17
-
18
- ### Why Visible?
19
- The intention of this library is to take a snapshot when dynamic content has been rendered in the browser, and not before. One way to do that is to check for evidence that the element you selected has been rendered, and that's what the default scripts in this library do.
20
-
21
- ## Caveats
22
-
23
- ### Each Snapshot is Created in a Separate Process
24
- html-snapshots creates a new process for each page to snapshot, and they run in parallel.
25
- To control the parallel processing load, you can specify the `processLimit` option to limit the size of the process pool. In other words, you can limit the number of pages being processed in parallel at any one time. The default pool size is set to 4 PhantomJS processes at a time.
26
-
27
- ### The Default Snapshot Scripts
28
- The default snapshot scripts are:
29
- - ["default"](https://github.com/localnerve/html-snapshots/blob/master/lib/phantom/default.js)
30
- - ["removeScripts"](https://github.com/localnerve/html-snapshots/blob/master/lib/phantom/removeScripts.js)
31
- - ["customFilter"](https://github.com/localnerve/html-snapshots/blob/master/lib/phantom/customFilter.js)
32
-
33
- As of v0.6.x, these do not rely on jQuery unless you specify a true `useJQuery` option. If you set `useJQuery` to true \(globally or per-page\), the page being snapshotted **must load jQuery itself**.
34
-
35
- #### When Using jQuery
36
- When using jQuery, the default snapshot scripts use jQuery is(:visible) on your supplied selector to determine document readiness \(and then triggers the snapshot\). Last I checked, this is only available in Zepto by building in a special [selector module](https://github.com/madrobby/zepto/issues/323).
37
-
38
- #### When Not Using jQuery
39
- When not using jQuery \(the new default behavior, from v0.6.x\), [document.querySelector](https://developer.mozilla.org/en-US/docs/Web/API/document.querySelector) is used to select the element using your supplied selector. The element selected must be an HTMLElement, and is considered visible \(triggering a snapshot\) if both offsetWidth and offsetHeight exist.
40
-
41
- ### Override the Default Snapshot Scripts
42
- To override the default snapshot scripts, supply a path to your own phantomjs script using the `snapshotScript` option.
@@ -1,149 +0,0 @@
1
- # Examples
2
-
3
- + [Per-page Selectors](#example---per-page-selectors-and-timeouts)
4
- + [Per-page Output Paths](#example---per-page-special-output-paths)
5
- + [Per-page jQuery](#example---per-page-selectors-and-jquery)
6
- + [Array Input](#example---array)
7
- + [More Array Input](./simple-promise/)
8
- + [Array Input DRY](./html5rocks/)
9
- + [Sitemap Index](./sitemap-index/)
10
- + [Process Limit](./process-limit/)
11
- + [Script Removal](#example---remote-robotstxt-remove-script-tags-from-html-snapshots)
12
- + [Custom Filters](./custom/)
13
- + [Debug PhantomJS w/Verbose Output](./verbose/)
14
- + [Debug PhantomJS w/Attach](./debug-phantomjs/)
15
- + [Debug Puppeteer in devtools](./debug-puppeteer/)
16
-
17
- ### Example - Per page selectors and timeouts
18
- ```javascript
19
- const htmlSnapshots = require('html-snapshots');
20
- htmlSnapshots.run({
21
- input: 'sitemap',
22
- source: 'https://host.domain/sitemap.xml',
23
- outputDir: './snapshots',
24
- outputDirClean: true,
25
- selector: {
26
- 'https://host.domain/': '#home-content',
27
- '__default': '#dynamic-content'
28
- },
29
- timeout: {
30
- 'https://host.domain/superslowpage/': 20000,
31
- '__default': 10000
32
- }
33
- })
34
- .then(completed => {
35
- // completed is an array of full file paths to the completed snapshots.
36
- })
37
- .catch(error => {
38
- // error is an Error instance.
39
- // error.completed is an array of snapshot file paths that were completed.
40
- // error.notCompleted is an array of file paths that did NOT complete.
41
- });
42
- ```
43
- This reads the urls from your sitemap.xml and produces snapshots in the ./snapshots directory. In this example, a selector named "#dynamic-content" appears in all pages across the site except the home page, where "#home-content" appears \(the appearance of a selector in the output triggers the snapshot\). Finally, a default timeout of 10000 ms is set on all pages except http://https://host.domain/superslowpage/, where it waits 20000 ms.
44
-
45
- ### Example - Per page special output paths
46
- ```javascript
47
- const htmlSnapshots = require('html-snapshots');
48
- htmlSnapshots.run({
49
- input: 'sitemap',
50
- source: 'https://host.domain/sitemap.xml',
51
- outputDir: './snapshots',
52
- outputDirClean: true,
53
- outputPath: {
54
- 'https://host.domain/services/?page=1': 'services/page/1',
55
- 'https://host.domain/services/?page=2': 'services/page/2'
56
- },
57
- selector: '#dynamic-content'
58
- })
59
- .then(completed => {
60
- // completed is an array of full file paths to the completed snapshots.
61
- })
62
- .catch(error => {
63
- // error is an Error instance.
64
- // error.completed is an array of snapshot file paths that were completed.
65
- // error.notCompleted is an array of file paths that did NOT complete.
66
- });
67
- ```
68
- This example implies there are a couple of pages with query strings in sitemap.xml, and we don't want html-snapshots to create directories with query string characters in the names. We would also have a rewrite rule that reflects this same mapping when `_escaped_fragment_` shows up in the querystring of a request so we serve the snapshot from the appropriate directory.
69
-
70
- ### Example - Per page selectors and jQuery
71
- ```javascript
72
- const htmlSnapshots = require('html-snapshots');
73
- htmlSnapshots.run({
74
- source: '/path/to/robots.txt',
75
- hostname: 'mysite.com',
76
- outputDir: './snapshots',
77
- outputDirClean: true,
78
- browser: 'phantomjs',
79
- selector: {
80
- '__default': '#dynamic-content',
81
- '/jqpage': 'A-Selector-Not-Supported-By-querySelector'
82
- },
83
- useJQuery: {
84
- '/jqpage': true,
85
- '__default': false
86
- }
87
- })
88
- .then(completed => {
89
- // completed is an array of full file paths to the completed snapshots.
90
- })
91
- .catch(error => {
92
- // error is an Error instance.
93
- // error.completed is an array of snapshot file paths that were completed.
94
- // error.notCompleted is an array of file paths that did NOT complete.
95
- });
96
- ```
97
- This reads the urls from your robots.txt and produces snapshots in the ./snapshots directory. In this example, a selector named "#dynamic-content" appears in all pages across the site except in "/jqpage", where a selector not supported by [querySelector](https://developer.mozilla.org/en-US/docs/Web/API/document.querySelector) is used. Further, "/jqpage" loads jQuery itself \(required\). All the other pages don't need to use special selectors, so the default is set to `false`. Notice that since a robots.txt input is used, full URLs are **not** used to match selectors. Instead, paths \(and QueryStrings and any Hashes\) are used, just as specified in the robots.txt file itself.
98
-
99
- ### Example - Array
100
- ```javascript
101
- const htmlSnapshots = require('html-snapshots');
102
- htmlSnapshots.run({
103
- input: 'array',
104
- source: ['http://mysite.com', 'http://mysite.com/contact', 'http://mysite.com:82/special'],
105
- outputDir: './snapshots',
106
- outputDirClean: true,
107
- selector: '#dynamic-content'
108
- })
109
- .then(completed => {
110
- // completed is an array of full file paths to the completed snapshots.
111
- })
112
- .catch(error => {
113
- // error is an Error instance.
114
- // error.completed is an array of snapshot file paths that were completed.
115
- // error.notCompleted is an array of file paths that did NOT complete.
116
- });
117
- ```
118
- Generates snapshots for "/", "/contact", and "/special" from mysite.com. "/special" uses port 82. All use http protocol. Array input can be powerful, check out a [simple example](/examples/simple-promise), or a more [complex example](/examples/html5rocks).
119
-
120
- ### Example - Remote robots.txt, remove script tags from html snapshots
121
- ```javascript
122
- const assert = require('assert');
123
- const fs = require('fs');
124
- const htmlSnapshots = require('html-snapshots');
125
-
126
- htmlSnapshots.run({
127
- source: 'http://localhost/robots.txt',
128
- outputDir: './snapshots',
129
- outputDirClean: true,
130
- selector: '#dynamic-content',
131
- snapshotScript: {
132
- script: 'removeScripts'
133
- }
134
- })
135
- .then(completed => {
136
- completed.forEach(snapshotFile => {
137
- const content = fs.readFileSync(snapshotFile, { encoding: 'utf8'});
138
- assert.equal(false, /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi.test(content));
139
- });
140
- // It didn't throw b/c there are no script tags in the html snapshots
141
- console.log('stripped all script tags as expected');
142
- })
143
- .catch(error => {
144
- // error is an Error instance.
145
- // error.completed is an array of snapshot file paths that were completed.
146
- // error.notCompleted is an array of file paths that did NOT complete.
147
- });
148
- ```
149
- Removes all script tags from the output of the html snapshot. Custom filters are also supported, see the customFilter Example in the explanation of the `snapshotScript` option. Also, check out the concrete [example](/examples/custom).
@@ -1,22 +0,0 @@
1
- # Example
2
-
3
- > Snapshot a sample website using a sitemap and custom-filter
4
-
5
- > All examples assume you already have NodeJS installed on your local machine
6
-
7
- ## How To Run
8
- 1. Clone this repo
9
- 2. Open a command prompt
10
- 3. Change to the examples/custom directory
11
- 4. Run `npm install`
12
- 5. Run `npm start`
13
-
14
- ## What It Does
15
- This example snapshots the entire website of the WPSPA example application using its sitemap to drive.
16
-
17
- It makes use of a [custom filter](https://github.com/localnerve/html-snapshots/blob/master/examples/custom/myFilter.js) to strip various tags \(and even replace some text\) from the output before the snapshots are stored.
18
-
19
- ## Notes on Interpreting Results
20
- This example creates a local `tmp` directory where the snapshot output is stored.
21
- Inspect the output directory structure and contents.
22
- Compare snapshots with the original website to see what happened.
@@ -1,22 +0,0 @@
1
- /*
2
- * Example custom filter for html-snapshots.
3
- * Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
4
- *
5
- * Processes the snapshot output before it is finalized.
6
- */
7
- module.exports = function(content) {
8
- var filterVersion = "1.0-20220921";
9
-
10
- return content
11
- // remove all script tags
12
- .replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "")
13
- // remove all meta tags
14
- .replace(/<meta\s.*?(\/)?>/gi, "")
15
- // remove all link tags
16
- .replace(/<link\s.*?(\/)?>/gi, "")
17
- // replace select words
18
- .replace(/\bSitemaps\b/ig, "Replaced-Sitemaps")
19
- // add an attribute to the body for tracking and identification
20
- .replace(/<body\b/i, "<body data-snapshot-filter=\""+filterVersion+"\" ")
21
- ;
22
- };