dragonfly_chrome_headless 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +12 -0
  4. data/Gemfile +4 -0
  5. data/README.md +53 -0
  6. data/Rakefile +10 -0
  7. data/bin/console +14 -0
  8. data/bin/setup +8 -0
  9. data/dragonfly_chrome_headless.gemspec +27 -0
  10. data/lib/dragonfly_chrome_headless.rb +9 -0
  11. data/lib/dragonfly_chrome_headless/plugin.rb +17 -0
  12. data/lib/dragonfly_chrome_headless/processors/rasterize.rb +33 -0
  13. data/lib/dragonfly_chrome_headless/version.rb +3 -0
  14. data/node_modules/.bin/chrome-remote-interface +1 -0
  15. data/node_modules/.bin/mkdirp +1 -0
  16. data/node_modules/.bin/rimraf +1 -0
  17. data/node_modules/@types/core-js/LICENSE +21 -0
  18. data/node_modules/@types/core-js/README.md +16 -0
  19. data/node_modules/@types/core-js/index.d.ts +2452 -0
  20. data/node_modules/@types/core-js/package.json +85 -0
  21. data/node_modules/@types/mkdirp/README.md +18 -0
  22. data/node_modules/@types/mkdirp/index.d.ts +14 -0
  23. data/node_modules/@types/mkdirp/package.json +77 -0
  24. data/node_modules/@types/mkdirp/types-metadata.json +25 -0
  25. data/node_modules/@types/node/README.md +16 -0
  26. data/node_modules/@types/node/index.d.ts +4132 -0
  27. data/node_modules/@types/node/package.json +84 -0
  28. data/node_modules/balanced-match/.npmignore +5 -0
  29. data/node_modules/balanced-match/LICENSE.md +21 -0
  30. data/node_modules/balanced-match/README.md +91 -0
  31. data/node_modules/balanced-match/index.js +59 -0
  32. data/node_modules/balanced-match/package.json +112 -0
  33. data/node_modules/brace-expansion/README.md +123 -0
  34. data/node_modules/brace-expansion/index.js +201 -0
  35. data/node_modules/brace-expansion/package.json +114 -0
  36. data/node_modules/chrome-launcher/.clang-format +6 -0
  37. data/node_modules/chrome-launcher/.npmignore +11 -0
  38. data/node_modules/chrome-launcher/README.md +123 -0
  39. data/node_modules/chrome-launcher/ask.js +32 -0
  40. data/node_modules/chrome-launcher/ask.ts +35 -0
  41. data/node_modules/chrome-launcher/chrome-finder.js +157 -0
  42. data/node_modules/chrome-launcher/chrome-finder.ts +186 -0
  43. data/node_modules/chrome-launcher/chrome-launcher.js +245 -0
  44. data/node_modules/chrome-launcher/chrome-launcher.ts +312 -0
  45. data/node_modules/chrome-launcher/compiled-check.js +14 -0
  46. data/node_modules/chrome-launcher/flags.js +27 -0
  47. data/node_modules/chrome-launcher/flags.ts +26 -0
  48. data/node_modules/chrome-launcher/index.js +7 -0
  49. data/node_modules/chrome-launcher/index.ts +1 -0
  50. data/node_modules/chrome-launcher/manual-chrome-launcher.js +30 -0
  51. data/node_modules/chrome-launcher/package.json +116 -0
  52. data/node_modules/chrome-launcher/random-port.js +24 -0
  53. data/node_modules/chrome-launcher/random-port.ts +23 -0
  54. data/node_modules/chrome-launcher/tsconfig.json +19 -0
  55. data/node_modules/chrome-launcher/utils.js +52 -0
  56. data/node_modules/chrome-launcher/utils.ts +44 -0
  57. data/node_modules/chrome-launcher/yarn.lock +1486 -0
  58. data/node_modules/chrome-remote-interface/LICENSE +18 -0
  59. data/node_modules/chrome-remote-interface/README.md +849 -0
  60. data/node_modules/chrome-remote-interface/bin/client.js +337 -0
  61. data/node_modules/chrome-remote-interface/chrome-remote-interface.js +11 -0
  62. data/node_modules/chrome-remote-interface/index.js +39 -0
  63. data/node_modules/chrome-remote-interface/lib/api.js +84 -0
  64. data/node_modules/chrome-remote-interface/lib/chrome.js +307 -0
  65. data/node_modules/chrome-remote-interface/lib/defaults.js +4 -0
  66. data/node_modules/chrome-remote-interface/lib/devtools.js +245 -0
  67. data/node_modules/chrome-remote-interface/lib/external-request.js +28 -0
  68. data/node_modules/chrome-remote-interface/lib/protocol.json +13780 -0
  69. data/node_modules/chrome-remote-interface/lib/websocket-wrapper.js +32 -0
  70. data/node_modules/chrome-remote-interface/package.json +128 -0
  71. data/node_modules/chrome-remote-interface/webpack.config.js +55 -0
  72. data/node_modules/commander/Readme.md +195 -0
  73. data/node_modules/commander/index.js +851 -0
  74. data/node_modules/commander/package.json +92 -0
  75. data/node_modules/concat-map/.travis.yml +4 -0
  76. data/node_modules/concat-map/LICENSE +18 -0
  77. data/node_modules/concat-map/README.markdown +62 -0
  78. data/node_modules/concat-map/example/map.js +6 -0
  79. data/node_modules/concat-map/index.js +13 -0
  80. data/node_modules/concat-map/package.json +117 -0
  81. data/node_modules/concat-map/test/map.js +39 -0
  82. data/node_modules/debug/.coveralls.yml +1 -0
  83. data/node_modules/debug/.eslintrc +11 -0
  84. data/node_modules/debug/.npmignore +9 -0
  85. data/node_modules/debug/.travis.yml +14 -0
  86. data/node_modules/debug/CHANGELOG.md +357 -0
  87. data/node_modules/debug/LICENSE +19 -0
  88. data/node_modules/debug/Makefile +50 -0
  89. data/node_modules/debug/Readme.md +312 -0
  90. data/node_modules/debug/component.json +19 -0
  91. data/node_modules/debug/karma.conf.js +70 -0
  92. data/node_modules/debug/node.js +1 -0
  93. data/node_modules/debug/package.json +124 -0
  94. data/node_modules/debug/src/browser.js +185 -0
  95. data/node_modules/debug/src/debug.js +202 -0
  96. data/node_modules/debug/src/index.js +10 -0
  97. data/node_modules/debug/src/node.js +246 -0
  98. data/node_modules/fs.realpath/LICENSE +43 -0
  99. data/node_modules/fs.realpath/README.md +33 -0
  100. data/node_modules/fs.realpath/index.js +66 -0
  101. data/node_modules/fs.realpath/old.js +303 -0
  102. data/node_modules/fs.realpath/package.json +94 -0
  103. data/node_modules/glob/LICENSE +15 -0
  104. data/node_modules/glob/README.md +368 -0
  105. data/node_modules/glob/changelog.md +67 -0
  106. data/node_modules/glob/common.js +240 -0
  107. data/node_modules/glob/glob.js +790 -0
  108. data/node_modules/glob/package.json +112 -0
  109. data/node_modules/glob/sync.js +486 -0
  110. data/node_modules/html-pdf-chrome/.npmignore +9 -0
  111. data/node_modules/html-pdf-chrome/LICENSE +21 -0
  112. data/node_modules/html-pdf-chrome/README.md +165 -0
  113. data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.d.ts +87 -0
  114. data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.js +4 -0
  115. data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.js.map +1 -0
  116. data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.d.ts +120 -0
  117. data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.js +206 -0
  118. data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.js.map +1 -0
  119. data/node_modules/html-pdf-chrome/lib/src/CreateResult.d.ts +70 -0
  120. data/node_modules/html-pdf-chrome/lib/src/CreateResult.js +98 -0
  121. data/node_modules/html-pdf-chrome/lib/src/CreateResult.js.map +1 -0
  122. data/node_modules/html-pdf-chrome/lib/src/index.d.ts +72 -0
  123. data/node_modules/html-pdf-chrome/lib/src/index.js +123 -0
  124. data/node_modules/html-pdf-chrome/lib/src/index.js.map +1 -0
  125. data/node_modules/html-pdf-chrome/package.json +133 -0
  126. data/node_modules/html-pdf-chrome/src/ChromePrintOptions.ts +99 -0
  127. data/node_modules/html-pdf-chrome/src/CompletionTrigger.ts +201 -0
  128. data/node_modules/html-pdf-chrome/src/CreateResult.ts +100 -0
  129. data/node_modules/html-pdf-chrome/src/index.ts +179 -0
  130. data/node_modules/inflight/LICENSE +15 -0
  131. data/node_modules/inflight/README.md +37 -0
  132. data/node_modules/inflight/inflight.js +54 -0
  133. data/node_modules/inflight/package.json +105 -0
  134. data/node_modules/inherits/LICENSE +16 -0
  135. data/node_modules/inherits/README.md +42 -0
  136. data/node_modules/inherits/inherits.js +7 -0
  137. data/node_modules/inherits/inherits_browser.js +23 -0
  138. data/node_modules/inherits/package.json +97 -0
  139. data/node_modules/lighthouse-logger/README.md +4 -0
  140. data/node_modules/lighthouse-logger/index.js +212 -0
  141. data/node_modules/lighthouse-logger/package.json +69 -0
  142. data/node_modules/lighthouse-logger/yarn.lock +13 -0
  143. data/node_modules/minimatch/LICENSE +15 -0
  144. data/node_modules/minimatch/README.md +209 -0
  145. data/node_modules/minimatch/minimatch.js +923 -0
  146. data/node_modules/minimatch/package.json +99 -0
  147. data/node_modules/minimist/.travis.yml +4 -0
  148. data/node_modules/minimist/LICENSE +18 -0
  149. data/node_modules/minimist/example/parse.js +2 -0
  150. data/node_modules/minimist/index.js +187 -0
  151. data/node_modules/minimist/package.json +101 -0
  152. data/node_modules/minimist/readme.markdown +73 -0
  153. data/node_modules/minimist/test/dash.js +24 -0
  154. data/node_modules/minimist/test/default_bool.js +20 -0
  155. data/node_modules/minimist/test/dotted.js +16 -0
  156. data/node_modules/minimist/test/long.js +31 -0
  157. data/node_modules/minimist/test/parse.js +318 -0
  158. data/node_modules/minimist/test/parse_modified.js +9 -0
  159. data/node_modules/minimist/test/short.js +67 -0
  160. data/node_modules/minimist/test/whitespace.js +8 -0
  161. data/node_modules/mkdirp/.travis.yml +8 -0
  162. data/node_modules/mkdirp/LICENSE +21 -0
  163. data/node_modules/mkdirp/bin/cmd.js +33 -0
  164. data/node_modules/mkdirp/bin/usage.txt +12 -0
  165. data/node_modules/mkdirp/examples/pow.js +6 -0
  166. data/node_modules/mkdirp/index.js +98 -0
  167. data/node_modules/mkdirp/package.json +93 -0
  168. data/node_modules/mkdirp/readme.markdown +100 -0
  169. data/node_modules/mkdirp/test/chmod.js +41 -0
  170. data/node_modules/mkdirp/test/clobber.js +38 -0
  171. data/node_modules/mkdirp/test/mkdirp.js +28 -0
  172. data/node_modules/mkdirp/test/opts_fs.js +29 -0
  173. data/node_modules/mkdirp/test/opts_fs_sync.js +27 -0
  174. data/node_modules/mkdirp/test/perm.js +32 -0
  175. data/node_modules/mkdirp/test/perm_sync.js +36 -0
  176. data/node_modules/mkdirp/test/race.js +37 -0
  177. data/node_modules/mkdirp/test/rel.js +32 -0
  178. data/node_modules/mkdirp/test/return.js +25 -0
  179. data/node_modules/mkdirp/test/return_sync.js +24 -0
  180. data/node_modules/mkdirp/test/root.js +19 -0
  181. data/node_modules/mkdirp/test/sync.js +32 -0
  182. data/node_modules/mkdirp/test/umask.js +28 -0
  183. data/node_modules/mkdirp/test/umask_sync.js +32 -0
  184. data/node_modules/ms/README.md +51 -0
  185. data/node_modules/ms/index.js +152 -0
  186. data/node_modules/ms/license.md +21 -0
  187. data/node_modules/ms/package.json +109 -0
  188. data/node_modules/once/LICENSE +15 -0
  189. data/node_modules/once/README.md +79 -0
  190. data/node_modules/once/once.js +42 -0
  191. data/node_modules/once/package.json +101 -0
  192. data/node_modules/path-is-absolute/index.js +20 -0
  193. data/node_modules/path-is-absolute/license +21 -0
  194. data/node_modules/path-is-absolute/package.json +111 -0
  195. data/node_modules/path-is-absolute/readme.md +59 -0
  196. data/node_modules/rimraf/LICENSE +15 -0
  197. data/node_modules/rimraf/README.md +101 -0
  198. data/node_modules/rimraf/bin.js +50 -0
  199. data/node_modules/rimraf/package.json +99 -0
  200. data/node_modules/rimraf/rimraf.js +363 -0
  201. data/node_modules/ultron/LICENSE +22 -0
  202. data/node_modules/ultron/index.js +138 -0
  203. data/node_modules/ultron/package.json +112 -0
  204. data/node_modules/wrappy/LICENSE +15 -0
  205. data/node_modules/wrappy/README.md +36 -0
  206. data/node_modules/wrappy/package.json +97 -0
  207. data/node_modules/wrappy/wrappy.js +33 -0
  208. data/node_modules/ws/LICENSE +21 -0
  209. data/node_modules/ws/README.md +259 -0
  210. data/node_modules/ws/SECURITY.md +33 -0
  211. data/node_modules/ws/index.js +15 -0
  212. data/node_modules/ws/lib/BufferUtil.fallback.js +56 -0
  213. data/node_modules/ws/lib/BufferUtil.js +15 -0
  214. data/node_modules/ws/lib/ErrorCodes.js +28 -0
  215. data/node_modules/ws/lib/EventTarget.js +158 -0
  216. data/node_modules/ws/lib/Extensions.js +69 -0
  217. data/node_modules/ws/lib/PerMessageDeflate.js +339 -0
  218. data/node_modules/ws/lib/Receiver.js +520 -0
  219. data/node_modules/ws/lib/Sender.js +438 -0
  220. data/node_modules/ws/lib/Validation.fallback.js +9 -0
  221. data/node_modules/ws/lib/Validation.js +17 -0
  222. data/node_modules/ws/lib/WebSocket.js +705 -0
  223. data/node_modules/ws/lib/WebSocketServer.js +336 -0
  224. data/node_modules/ws/package.json +122 -0
  225. data/package.json +26 -0
  226. data/samples/sample.html +13 -0
  227. data/script/rasterize.js +18 -0
  228. metadata +325 -0
@@ -0,0 +1,15 @@
1
+ The ISC License
2
+
3
+ Copyright (c) Isaac Z. Schlueter
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15
+ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,37 @@
1
+ # inflight
2
+
3
+ Add callbacks to requests in flight to avoid async duplication
4
+
5
+ ## USAGE
6
+
7
+ ```javascript
8
+ var inflight = require('inflight')
9
+
10
+ // some request that does some stuff
11
+ function req(key, callback) {
12
+ // key is any random string. like a url or filename or whatever.
13
+ //
14
+ // will return either a falsey value, indicating that the
15
+ // request for this key is already in flight, or a new callback
16
+ // which when called will call all callbacks passed to inflightk
17
+ // with the same key
18
+ callback = inflight(key, callback)
19
+
20
+ // If we got a falsey value back, then there's already a req going
21
+ if (!callback) return
22
+
23
+ // this is where you'd fetch the url or whatever
24
+ // callback is also once()-ified, so it can safely be assigned
25
+ // to multiple events etc. First call wins.
26
+ setTimeout(function() {
27
+ callback(null, key)
28
+ }, 100)
29
+ }
30
+
31
+ // only assigns a single setTimeout
32
+ // when it dings, all cbs get called
33
+ req('foo', cb1)
34
+ req('foo', cb2)
35
+ req('foo', cb3)
36
+ req('foo', cb4)
37
+ ```
@@ -0,0 +1,54 @@
1
+ var wrappy = require('wrappy')
2
+ var reqs = Object.create(null)
3
+ var once = require('once')
4
+
5
+ module.exports = wrappy(inflight)
6
+
7
+ function inflight (key, cb) {
8
+ if (reqs[key]) {
9
+ reqs[key].push(cb)
10
+ return null
11
+ } else {
12
+ reqs[key] = [cb]
13
+ return makeres(key)
14
+ }
15
+ }
16
+
17
+ function makeres (key) {
18
+ return once(function RES () {
19
+ var cbs = reqs[key]
20
+ var len = cbs.length
21
+ var args = slice(arguments)
22
+
23
+ // XXX It's somewhat ambiguous whether a new callback added in this
24
+ // pass should be queued for later execution if something in the
25
+ // list of callbacks throws, or if it should just be discarded.
26
+ // However, it's such an edge case that it hardly matters, and either
27
+ // choice is likely as surprising as the other.
28
+ // As it happens, we do go ahead and schedule it for later execution.
29
+ try {
30
+ for (var i = 0; i < len; i++) {
31
+ cbs[i].apply(null, args)
32
+ }
33
+ } finally {
34
+ if (cbs.length > len) {
35
+ // added more in the interim.
36
+ // de-zalgo, just in case, but don't call again.
37
+ cbs.splice(0, len)
38
+ process.nextTick(function () {
39
+ RES.apply(null, args)
40
+ })
41
+ } else {
42
+ delete reqs[key]
43
+ }
44
+ }
45
+ })
46
+ }
47
+
48
+ function slice (args) {
49
+ var length = args.length
50
+ var array = []
51
+
52
+ for (var i = 0; i < length; i++) array[i] = args[i]
53
+ return array
54
+ }
@@ -0,0 +1,105 @@
1
+ {
2
+ "_args": [
3
+ [
4
+ {
5
+ "raw": "inflight@^1.0.4",
6
+ "scope": null,
7
+ "escapedName": "inflight",
8
+ "name": "inflight",
9
+ "rawSpec": "^1.0.4",
10
+ "spec": ">=1.0.4 <2.0.0",
11
+ "type": "range"
12
+ },
13
+ "/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/glob"
14
+ ]
15
+ ],
16
+ "_from": "inflight@>=1.0.4 <2.0.0",
17
+ "_id": "inflight@1.0.6",
18
+ "_inCache": true,
19
+ "_location": "/inflight",
20
+ "_nodeVersion": "6.5.0",
21
+ "_npmOperationalInternal": {
22
+ "host": "packages-16-east.internal.npmjs.com",
23
+ "tmp": "tmp/inflight-1.0.6.tgz_1476330807696_0.10388551792129874"
24
+ },
25
+ "_npmUser": {
26
+ "name": "isaacs",
27
+ "email": "i@izs.me"
28
+ },
29
+ "_npmVersion": "3.10.7",
30
+ "_phantomChildren": {},
31
+ "_requested": {
32
+ "raw": "inflight@^1.0.4",
33
+ "scope": null,
34
+ "escapedName": "inflight",
35
+ "name": "inflight",
36
+ "rawSpec": "^1.0.4",
37
+ "spec": ">=1.0.4 <2.0.0",
38
+ "type": "range"
39
+ },
40
+ "_requiredBy": [
41
+ "/glob"
42
+ ],
43
+ "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
44
+ "_shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9",
45
+ "_shrinkwrap": null,
46
+ "_spec": "inflight@^1.0.4",
47
+ "_where": "/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/glob",
48
+ "author": {
49
+ "name": "Isaac Z. Schlueter",
50
+ "email": "i@izs.me",
51
+ "url": "http://blog.izs.me/"
52
+ },
53
+ "bugs": {
54
+ "url": "https://github.com/isaacs/inflight/issues"
55
+ },
56
+ "dependencies": {
57
+ "once": "^1.3.0",
58
+ "wrappy": "1"
59
+ },
60
+ "description": "Add callbacks to requests in flight to avoid async duplication",
61
+ "devDependencies": {
62
+ "tap": "^7.1.2"
63
+ },
64
+ "directories": {},
65
+ "dist": {
66
+ "shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9",
67
+ "tarball": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz"
68
+ },
69
+ "files": [
70
+ "inflight.js"
71
+ ],
72
+ "gitHead": "a547881738c8f57b27795e584071d67cf6ac1a57",
73
+ "homepage": "https://github.com/isaacs/inflight",
74
+ "license": "ISC",
75
+ "main": "inflight.js",
76
+ "maintainers": [
77
+ {
78
+ "name": "iarna",
79
+ "email": "me@re-becca.org"
80
+ },
81
+ {
82
+ "name": "isaacs",
83
+ "email": "i@izs.me"
84
+ },
85
+ {
86
+ "name": "othiym23",
87
+ "email": "ogd@aoaioxxysz.net"
88
+ },
89
+ {
90
+ "name": "zkat",
91
+ "email": "kat@sykosomatic.org"
92
+ }
93
+ ],
94
+ "name": "inflight",
95
+ "optionalDependencies": {},
96
+ "readme": "ERROR: No README data found!",
97
+ "repository": {
98
+ "type": "git",
99
+ "url": "git+https://github.com/npm/inflight.git"
100
+ },
101
+ "scripts": {
102
+ "test": "tap test.js --100"
103
+ },
104
+ "version": "1.0.6"
105
+ }
@@ -0,0 +1,16 @@
1
+ The ISC License
2
+
3
+ Copyright (c) Isaac Z. Schlueter
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
11
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
16
+
@@ -0,0 +1,42 @@
1
+ Browser-friendly inheritance fully compatible with standard node.js
2
+ [inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).
3
+
4
+ This package exports standard `inherits` from node.js `util` module in
5
+ node environment, but also provides alternative browser-friendly
6
+ implementation through [browser
7
+ field](https://gist.github.com/shtylman/4339901). Alternative
8
+ implementation is a literal copy of standard one located in standalone
9
+ module to avoid requiring of `util`. It also has a shim for old
10
+ browsers with no `Object.create` support.
11
+
12
+ While keeping you sure you are using standard `inherits`
13
+ implementation in node.js environment, it allows bundlers such as
14
+ [browserify](https://github.com/substack/node-browserify) to not
15
+ include full `util` package to your client code if all you need is
16
+ just `inherits` function. It worth, because browser shim for `util`
17
+ package is large and `inherits` is often the single function you need
18
+ from it.
19
+
20
+ It's recommended to use this package instead of
21
+ `require('util').inherits` for any code that has chances to be used
22
+ not only in node.js but in browser too.
23
+
24
+ ## usage
25
+
26
+ ```js
27
+ var inherits = require('inherits');
28
+ // then use exactly as the standard one
29
+ ```
30
+
31
+ ## note on version ~1.0
32
+
33
+ Version ~1.0 had completely different motivation and is not compatible
34
+ neither with 2.0 nor with standard node.js `inherits`.
35
+
36
+ If you are using version ~1.0 and planning to switch to ~2.0, be
37
+ careful:
38
+
39
+ * new version uses `super_` instead of `super` for referencing
40
+ superclass
41
+ * new version overwrites current prototype while old one preserves any
42
+ existing fields on it
@@ -0,0 +1,7 @@
1
+ try {
2
+ var util = require('util');
3
+ if (typeof util.inherits !== 'function') throw '';
4
+ module.exports = util.inherits;
5
+ } catch (e) {
6
+ module.exports = require('./inherits_browser.js');
7
+ }
@@ -0,0 +1,23 @@
1
+ if (typeof Object.create === 'function') {
2
+ // implementation from standard node.js 'util' module
3
+ module.exports = function inherits(ctor, superCtor) {
4
+ ctor.super_ = superCtor
5
+ ctor.prototype = Object.create(superCtor.prototype, {
6
+ constructor: {
7
+ value: ctor,
8
+ enumerable: false,
9
+ writable: true,
10
+ configurable: true
11
+ }
12
+ });
13
+ };
14
+ } else {
15
+ // old school shim for old browsers
16
+ module.exports = function inherits(ctor, superCtor) {
17
+ ctor.super_ = superCtor
18
+ var TempCtor = function () {}
19
+ TempCtor.prototype = superCtor.prototype
20
+ ctor.prototype = new TempCtor()
21
+ ctor.prototype.constructor = ctor
22
+ }
23
+ }
@@ -0,0 +1,97 @@
1
+ {
2
+ "_args": [
3
+ [
4
+ {
5
+ "raw": "inherits@2",
6
+ "scope": null,
7
+ "escapedName": "inherits",
8
+ "name": "inherits",
9
+ "rawSpec": "2",
10
+ "spec": ">=2.0.0 <3.0.0",
11
+ "type": "range"
12
+ },
13
+ "/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/glob"
14
+ ]
15
+ ],
16
+ "_from": "inherits@>=2.0.0 <3.0.0",
17
+ "_id": "inherits@2.0.3",
18
+ "_inCache": true,
19
+ "_location": "/inherits",
20
+ "_nodeVersion": "6.5.0",
21
+ "_npmOperationalInternal": {
22
+ "host": "packages-16-east.internal.npmjs.com",
23
+ "tmp": "tmp/inherits-2.0.3.tgz_1473295776489_0.08142363070510328"
24
+ },
25
+ "_npmUser": {
26
+ "name": "isaacs",
27
+ "email": "i@izs.me"
28
+ },
29
+ "_npmVersion": "3.10.7",
30
+ "_phantomChildren": {},
31
+ "_requested": {
32
+ "raw": "inherits@2",
33
+ "scope": null,
34
+ "escapedName": "inherits",
35
+ "name": "inherits",
36
+ "rawSpec": "2",
37
+ "spec": ">=2.0.0 <3.0.0",
38
+ "type": "range"
39
+ },
40
+ "_requiredBy": [
41
+ "/glob"
42
+ ],
43
+ "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
44
+ "_shasum": "633c2c83e3da42a502f52466022480f4208261de",
45
+ "_shrinkwrap": null,
46
+ "_spec": "inherits@2",
47
+ "_where": "/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/glob",
48
+ "browser": "./inherits_browser.js",
49
+ "bugs": {
50
+ "url": "https://github.com/isaacs/inherits/issues"
51
+ },
52
+ "dependencies": {},
53
+ "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
54
+ "devDependencies": {
55
+ "tap": "^7.1.0"
56
+ },
57
+ "directories": {},
58
+ "dist": {
59
+ "shasum": "633c2c83e3da42a502f52466022480f4208261de",
60
+ "tarball": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"
61
+ },
62
+ "files": [
63
+ "inherits.js",
64
+ "inherits_browser.js"
65
+ ],
66
+ "gitHead": "e05d0fb27c61a3ec687214f0476386b765364d5f",
67
+ "homepage": "https://github.com/isaacs/inherits#readme",
68
+ "keywords": [
69
+ "inheritance",
70
+ "class",
71
+ "klass",
72
+ "oop",
73
+ "object-oriented",
74
+ "inherits",
75
+ "browser",
76
+ "browserify"
77
+ ],
78
+ "license": "ISC",
79
+ "main": "./inherits.js",
80
+ "maintainers": [
81
+ {
82
+ "name": "isaacs",
83
+ "email": "i@izs.me"
84
+ }
85
+ ],
86
+ "name": "inherits",
87
+ "optionalDependencies": {},
88
+ "readme": "ERROR: No README data found!",
89
+ "repository": {
90
+ "type": "git",
91
+ "url": "git://github.com/isaacs/inherits.git"
92
+ },
93
+ "scripts": {
94
+ "test": "node test"
95
+ },
96
+ "version": "2.0.3"
97
+ }
@@ -0,0 +1,4 @@
1
+ # Lighthouse logger
2
+
3
+ A shared logging utility class for lighthouse and friends.
4
+
@@ -0,0 +1,212 @@
1
+ /**
2
+ * @license Copyright 2016 Google Inc. All Rights Reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
+ */
6
+ 'use strict';
7
+
8
+ const debug = require('debug');
9
+ const EventEmitter = require('events').EventEmitter;
10
+ const isWindows = process.platform === 'win32';
11
+
12
+ // process.browser is set when browserify'd via the `process` npm module
13
+ const isBrowser = process.browser;
14
+
15
+ const colors = {
16
+ red: isBrowser ? 'crimson' : 1,
17
+ yellow: isBrowser ? 'gold' : 3,
18
+ cyan: isBrowser ? 'darkturquoise' : 6,
19
+ green: isBrowser ? 'forestgreen' : 2,
20
+ blue: isBrowser ? 'steelblue' : 4,
21
+ magenta: isBrowser ? 'palevioletred' : 5
22
+ };
23
+
24
+ // whitelist non-red/yellow colors for debug()
25
+ debug.colors = [colors.cyan, colors.green, colors.blue, colors.magenta];
26
+
27
+ class Emitter extends EventEmitter {
28
+ /**
29
+ * Fires off all status updates. Listen with
30
+ * `require('lib/log').events.addListener('status', callback)`
31
+ * @param {string} title
32
+ * @param {!Array<*>} argsArray
33
+ */
34
+ issueStatus(title, argsArray) {
35
+ if (title === 'status' || title === 'statusEnd') {
36
+ this.emit(title, [title, ...argsArray]);
37
+ }
38
+ }
39
+
40
+ /**
41
+ * Fires off all warnings. Listen with
42
+ * `require('lib/log').events.addListener('warning', callback)`
43
+ * @param {string} title
44
+ * @param {!Array<*>} argsArray
45
+ */
46
+ issueWarning(title, argsArray) {
47
+ this.emit('warning', [title, ...argsArray]);
48
+ }
49
+ }
50
+
51
+ const loggersByTitle = {};
52
+ const loggingBufferColumns = 25;
53
+
54
+ class Log {
55
+
56
+ static _logToStdErr(title, argsArray) {
57
+ const log = Log.loggerfn(title);
58
+ log(...argsArray);
59
+ }
60
+
61
+ static loggerfn(title) {
62
+ let log = loggersByTitle[title];
63
+ if (!log) {
64
+ log = debug(title);
65
+ loggersByTitle[title] = log;
66
+ // errors with red, warnings with yellow.
67
+ if (title.endsWith('error')) {
68
+ log.color = colors.red;
69
+ } else if (title.endsWith('warn')) {
70
+ log.color = colors.yellow;
71
+ }
72
+ }
73
+ return log;
74
+ }
75
+
76
+ static setLevel(level) {
77
+ switch (level) {
78
+ case 'silent':
79
+ debug.enable('-*');
80
+ break;
81
+ case 'verbose':
82
+ debug.enable('*');
83
+ break;
84
+ case 'error':
85
+ debug.enable('-*, *:error');
86
+ break;
87
+ default:
88
+ debug.enable('*, -*:verbose');
89
+ }
90
+ }
91
+
92
+ /**
93
+ * A simple formatting utility for event logging.
94
+ * @param {string} prefix
95
+ * @param {!Object} data A JSON-serializable object of event data to log.
96
+ * @param {string=} level Optional logging level. Defaults to 'log'.
97
+ */
98
+ static formatProtocol(prefix, data, level) {
99
+ const columns = (!process || process.browser) ? Infinity : process.stdout.columns;
100
+ const method = data.method || '?????';
101
+ const maxLength = columns - method.length - prefix.length - loggingBufferColumns;
102
+ // IO.read blacklisted here to avoid logging megabytes of trace data
103
+ const snippet = (data.params && method !== 'IO.read') ?
104
+ JSON.stringify(data.params).substr(0, maxLength) : '';
105
+ Log._logToStdErr(`${prefix}:${level || ''}`, [method, snippet]);
106
+ }
107
+
108
+ static log(title, ...args) {
109
+ Log.events.issueStatus(title, args);
110
+ return Log._logToStdErr(title, args);
111
+ }
112
+
113
+ static warn(title, ...args) {
114
+ Log.events.issueWarning(title, args);
115
+ return Log._logToStdErr(`${title}:warn`, args);
116
+ }
117
+
118
+ static error(title, ...args) {
119
+ return Log._logToStdErr(`${title}:error`, args);
120
+ }
121
+
122
+ static verbose(title, ...args) {
123
+ Log.events.issueStatus(title, args);
124
+ return Log._logToStdErr(`${title}:verbose`, args);
125
+ }
126
+
127
+ /**
128
+ * Add surrounding escape sequences to turn a string green when logged.
129
+ * @param {string} str
130
+ * @return {string}
131
+ */
132
+ static greenify(str) {
133
+ return `${Log.green}${str}${Log.reset}`;
134
+ }
135
+
136
+ /**
137
+ * Add surrounding escape sequences to turn a string red when logged.
138
+ * @param {string} str
139
+ * @return {string}
140
+ */
141
+ static redify(str) {
142
+ return `${Log.red}${str}${Log.reset}`;
143
+ }
144
+
145
+ static get green() {
146
+ return '\x1B[32m';
147
+ }
148
+
149
+ static get red() {
150
+ return '\x1B[31m';
151
+ }
152
+
153
+ static get yellow() {
154
+ return '\x1b[33m';
155
+ }
156
+
157
+ static get purple() {
158
+ return '\x1b[95m';
159
+ }
160
+
161
+ static get reset() {
162
+ return '\x1B[0m';
163
+ }
164
+
165
+ static get bold() {
166
+ return '\x1b[1m';
167
+ }
168
+
169
+ static get dim() {
170
+ return '\x1b[2m';
171
+ }
172
+
173
+ static get tick() {
174
+ return isWindows ? '\u221A' : '✓';
175
+ }
176
+
177
+ static get cross() {
178
+ return isWindows ? '\u00D7' : '✘';
179
+ }
180
+
181
+ static get whiteSmallSquare() {
182
+ return isWindows ? '\u0387' : '▫';
183
+ }
184
+
185
+ static get heavyHorizontal() {
186
+ return isWindows ? '\u2500' : '━';
187
+ }
188
+
189
+ static get heavyVertical() {
190
+ return isWindows ? '\u2502 ' : '┃ ';
191
+ }
192
+
193
+ static get heavyUpAndRight() {
194
+ return isWindows ? '\u2514' : '┗';
195
+ }
196
+
197
+ static get heavyVerticalAndRight() {
198
+ return isWindows ? '\u251C' : '┣';
199
+ }
200
+
201
+ static get heavyDownAndHorizontal() {
202
+ return isWindows ? '\u252C' : '┳';
203
+ }
204
+
205
+ static get doubleLightHorizontal() {
206
+ return '──';
207
+ }
208
+ }
209
+
210
+ Log.events = new Emitter();
211
+
212
+ module.exports = Log;