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,201 @@
1
+ var concatMap = require('concat-map');
2
+ var balanced = require('balanced-match');
3
+
4
+ module.exports = expandTop;
5
+
6
+ var escSlash = '\0SLASH'+Math.random()+'\0';
7
+ var escOpen = '\0OPEN'+Math.random()+'\0';
8
+ var escClose = '\0CLOSE'+Math.random()+'\0';
9
+ var escComma = '\0COMMA'+Math.random()+'\0';
10
+ var escPeriod = '\0PERIOD'+Math.random()+'\0';
11
+
12
+ function numeric(str) {
13
+ return parseInt(str, 10) == str
14
+ ? parseInt(str, 10)
15
+ : str.charCodeAt(0);
16
+ }
17
+
18
+ function escapeBraces(str) {
19
+ return str.split('\\\\').join(escSlash)
20
+ .split('\\{').join(escOpen)
21
+ .split('\\}').join(escClose)
22
+ .split('\\,').join(escComma)
23
+ .split('\\.').join(escPeriod);
24
+ }
25
+
26
+ function unescapeBraces(str) {
27
+ return str.split(escSlash).join('\\')
28
+ .split(escOpen).join('{')
29
+ .split(escClose).join('}')
30
+ .split(escComma).join(',')
31
+ .split(escPeriod).join('.');
32
+ }
33
+
34
+
35
+ // Basically just str.split(","), but handling cases
36
+ // where we have nested braced sections, which should be
37
+ // treated as individual members, like {a,{b,c},d}
38
+ function parseCommaParts(str) {
39
+ if (!str)
40
+ return [''];
41
+
42
+ var parts = [];
43
+ var m = balanced('{', '}', str);
44
+
45
+ if (!m)
46
+ return str.split(',');
47
+
48
+ var pre = m.pre;
49
+ var body = m.body;
50
+ var post = m.post;
51
+ var p = pre.split(',');
52
+
53
+ p[p.length-1] += '{' + body + '}';
54
+ var postParts = parseCommaParts(post);
55
+ if (post.length) {
56
+ p[p.length-1] += postParts.shift();
57
+ p.push.apply(p, postParts);
58
+ }
59
+
60
+ parts.push.apply(parts, p);
61
+
62
+ return parts;
63
+ }
64
+
65
+ function expandTop(str) {
66
+ if (!str)
67
+ return [];
68
+
69
+ // I don't know why Bash 4.3 does this, but it does.
70
+ // Anything starting with {} will have the first two bytes preserved
71
+ // but *only* at the top level, so {},a}b will not expand to anything,
72
+ // but a{},b}c will be expanded to [a}c,abc].
73
+ // One could argue that this is a bug in Bash, but since the goal of
74
+ // this module is to match Bash's rules, we escape a leading {}
75
+ if (str.substr(0, 2) === '{}') {
76
+ str = '\\{\\}' + str.substr(2);
77
+ }
78
+
79
+ return expand(escapeBraces(str), true).map(unescapeBraces);
80
+ }
81
+
82
+ function identity(e) {
83
+ return e;
84
+ }
85
+
86
+ function embrace(str) {
87
+ return '{' + str + '}';
88
+ }
89
+ function isPadded(el) {
90
+ return /^-?0\d/.test(el);
91
+ }
92
+
93
+ function lte(i, y) {
94
+ return i <= y;
95
+ }
96
+ function gte(i, y) {
97
+ return i >= y;
98
+ }
99
+
100
+ function expand(str, isTop) {
101
+ var expansions = [];
102
+
103
+ var m = balanced('{', '}', str);
104
+ if (!m || /\$$/.test(m.pre)) return [str];
105
+
106
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
107
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
108
+ var isSequence = isNumericSequence || isAlphaSequence;
109
+ var isOptions = m.body.indexOf(',') >= 0;
110
+ if (!isSequence && !isOptions) {
111
+ // {a},b}
112
+ if (m.post.match(/,.*\}/)) {
113
+ str = m.pre + '{' + m.body + escClose + m.post;
114
+ return expand(str);
115
+ }
116
+ return [str];
117
+ }
118
+
119
+ var n;
120
+ if (isSequence) {
121
+ n = m.body.split(/\.\./);
122
+ } else {
123
+ n = parseCommaParts(m.body);
124
+ if (n.length === 1) {
125
+ // x{{a,b}}y ==> x{a}y x{b}y
126
+ n = expand(n[0], false).map(embrace);
127
+ if (n.length === 1) {
128
+ var post = m.post.length
129
+ ? expand(m.post, false)
130
+ : [''];
131
+ return post.map(function(p) {
132
+ return m.pre + n[0] + p;
133
+ });
134
+ }
135
+ }
136
+ }
137
+
138
+ // at this point, n is the parts, and we know it's not a comma set
139
+ // with a single entry.
140
+
141
+ // no need to expand pre, since it is guaranteed to be free of brace-sets
142
+ var pre = m.pre;
143
+ var post = m.post.length
144
+ ? expand(m.post, false)
145
+ : [''];
146
+
147
+ var N;
148
+
149
+ if (isSequence) {
150
+ var x = numeric(n[0]);
151
+ var y = numeric(n[1]);
152
+ var width = Math.max(n[0].length, n[1].length)
153
+ var incr = n.length == 3
154
+ ? Math.abs(numeric(n[2]))
155
+ : 1;
156
+ var test = lte;
157
+ var reverse = y < x;
158
+ if (reverse) {
159
+ incr *= -1;
160
+ test = gte;
161
+ }
162
+ var pad = n.some(isPadded);
163
+
164
+ N = [];
165
+
166
+ for (var i = x; test(i, y); i += incr) {
167
+ var c;
168
+ if (isAlphaSequence) {
169
+ c = String.fromCharCode(i);
170
+ if (c === '\\')
171
+ c = '';
172
+ } else {
173
+ c = String(i);
174
+ if (pad) {
175
+ var need = width - c.length;
176
+ if (need > 0) {
177
+ var z = new Array(need + 1).join('0');
178
+ if (i < 0)
179
+ c = '-' + z + c.slice(1);
180
+ else
181
+ c = z + c;
182
+ }
183
+ }
184
+ }
185
+ N.push(c);
186
+ }
187
+ } else {
188
+ N = concatMap(n, function(el) { return expand(el, false) });
189
+ }
190
+
191
+ for (var j = 0; j < N.length; j++) {
192
+ for (var k = 0; k < post.length; k++) {
193
+ var expansion = pre + N[j] + post[k];
194
+ if (!isTop || isSequence || expansion)
195
+ expansions.push(expansion);
196
+ }
197
+ }
198
+
199
+ return expansions;
200
+ }
201
+
@@ -0,0 +1,114 @@
1
+ {
2
+ "_args": [
3
+ [
4
+ {
5
+ "raw": "brace-expansion@^1.1.7",
6
+ "scope": null,
7
+ "escapedName": "brace-expansion",
8
+ "name": "brace-expansion",
9
+ "rawSpec": "^1.1.7",
10
+ "spec": ">=1.1.7 <2.0.0",
11
+ "type": "range"
12
+ },
13
+ "/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/minimatch"
14
+ ]
15
+ ],
16
+ "_from": "brace-expansion@>=1.1.7 <2.0.0",
17
+ "_id": "brace-expansion@1.1.8",
18
+ "_inCache": true,
19
+ "_location": "/brace-expansion",
20
+ "_nodeVersion": "7.8.0",
21
+ "_npmOperationalInternal": {
22
+ "host": "s3://npm-registry-packages",
23
+ "tmp": "tmp/brace-expansion-1.1.8.tgz_1497251980593_0.6575565172825009"
24
+ },
25
+ "_npmUser": {
26
+ "name": "juliangruber",
27
+ "email": "julian@juliangruber.com"
28
+ },
29
+ "_npmVersion": "4.2.0",
30
+ "_phantomChildren": {},
31
+ "_requested": {
32
+ "raw": "brace-expansion@^1.1.7",
33
+ "scope": null,
34
+ "escapedName": "brace-expansion",
35
+ "name": "brace-expansion",
36
+ "rawSpec": "^1.1.7",
37
+ "spec": ">=1.1.7 <2.0.0",
38
+ "type": "range"
39
+ },
40
+ "_requiredBy": [
41
+ "/minimatch"
42
+ ],
43
+ "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
44
+ "_shasum": "c07b211c7c952ec1f8efd51a77ef0d1d3990a292",
45
+ "_shrinkwrap": null,
46
+ "_spec": "brace-expansion@^1.1.7",
47
+ "_where": "/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/minimatch",
48
+ "author": {
49
+ "name": "Julian Gruber",
50
+ "email": "mail@juliangruber.com",
51
+ "url": "http://juliangruber.com"
52
+ },
53
+ "bugs": {
54
+ "url": "https://github.com/juliangruber/brace-expansion/issues"
55
+ },
56
+ "dependencies": {
57
+ "balanced-match": "^1.0.0",
58
+ "concat-map": "0.0.1"
59
+ },
60
+ "description": "Brace expansion as known from sh/bash",
61
+ "devDependencies": {
62
+ "matcha": "^0.7.0",
63
+ "tape": "^4.6.0"
64
+ },
65
+ "directories": {},
66
+ "dist": {
67
+ "shasum": "c07b211c7c952ec1f8efd51a77ef0d1d3990a292",
68
+ "tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz"
69
+ },
70
+ "gitHead": "8f59e68bd5c915a0d624e8e39354e1ccf672edf6",
71
+ "homepage": "https://github.com/juliangruber/brace-expansion",
72
+ "keywords": [],
73
+ "license": "MIT",
74
+ "main": "index.js",
75
+ "maintainers": [
76
+ {
77
+ "name": "juliangruber",
78
+ "email": "julian@juliangruber.com"
79
+ },
80
+ {
81
+ "name": "isaacs",
82
+ "email": "isaacs@npmjs.com"
83
+ }
84
+ ],
85
+ "name": "brace-expansion",
86
+ "optionalDependencies": {},
87
+ "readme": "ERROR: No README data found!",
88
+ "repository": {
89
+ "type": "git",
90
+ "url": "git://github.com/juliangruber/brace-expansion.git"
91
+ },
92
+ "scripts": {
93
+ "bench": "matcha test/perf/bench.js",
94
+ "gentest": "bash test/generate.sh",
95
+ "test": "tape test/*.js"
96
+ },
97
+ "testling": {
98
+ "files": "test/*.js",
99
+ "browsers": [
100
+ "ie/8..latest",
101
+ "firefox/20..latest",
102
+ "firefox/nightly",
103
+ "chrome/25..latest",
104
+ "chrome/canary",
105
+ "opera/12..latest",
106
+ "opera/next",
107
+ "safari/5.1..latest",
108
+ "ipad/6.0..latest",
109
+ "iphone/6.0..latest",
110
+ "android-browser/4.2..latest"
111
+ ]
112
+ },
113
+ "version": "1.1.8"
114
+ }
@@ -0,0 +1,6 @@
1
+ ---
2
+ BasedOnStyle: Google
3
+ Language: JavaScript
4
+ ColumnLimit: 100
5
+ ReflowComments: false
6
+ SpacesBeforeTrailingComments: 1
@@ -0,0 +1,11 @@
1
+ # folders
2
+ .vscode/
3
+ test/
4
+
5
+ # dev files
6
+ .appveyor.yml
7
+ .editorconfig
8
+ .eslintignore
9
+ .eslintrc.js
10
+ .travis.yml
11
+ gulpfile.js
@@ -0,0 +1,123 @@
1
+ # Chrome Launcher [![NPM chrome-launcher package](https://img.shields.io/npm/v/chrome-launcher.svg)](https://npmjs.org/package/chrome-launcher)
2
+
3
+ Launch Google Chrome with ease from node.
4
+
5
+ * [Disables many Chrome services](https://github.com/GoogleChrome/lighthouse/blob/master/chrome-launcher/flags.ts) that add noise to automated scenarios
6
+ * Opens up the browser's `remote-debugging-port` on an available port
7
+ * Automagically locates a Chrome binary to launch
8
+ * Uses a fresh Chrome profile for each launch, and cleans itself up on `kill()`
9
+ * Binds `Ctrl-C` (by default) to terminate the Chrome process
10
+ * Exposes a small set of [options](#api) for configurability over these details
11
+
12
+ ### Installing
13
+
14
+ ```sh
15
+ yarn add chrome-launcher
16
+
17
+ # or with npm:
18
+ npm install chrome-launcher
19
+ ```
20
+
21
+
22
+ ## API
23
+
24
+ ### `.launch([opts])`
25
+
26
+ #### Launch options
27
+
28
+ ```js
29
+ {
30
+ // (optional) remote debugging port number to use. If provided port is already busy, launch() will reject
31
+ // Default: an available port is autoselected
32
+ port: number;
33
+
34
+ // (optional) Additional flags to pass to Chrome, for example: ['--headless', '--disable-gpu']
35
+ // See all flags here: http://peter.sh/experiments/chromium-command-line-switches/
36
+ // Do note, many flags are set by default: https://github.com/GoogleChrome/lighthouse/blob/master/chrome-launcher/flags.ts
37
+ chromeFlags: Array<string>;
38
+
39
+ // (optional) Close the Chrome process on `Ctrl-C`
40
+ // Default: true
41
+ handleSIGINT: boolean;
42
+
43
+ // (optional) Explicit path of intended Chrome binary
44
+ // If the `LIGHTHOUSE_CHROMIUM_PATH` env variable is set, that will be used
45
+ // By default, any detected Chrome Canary or Chrome (stable) will be launched
46
+ chromePath: string;
47
+
48
+ // (optional) Chrome profile path to use
49
+ // By default, a fresh Chrome profile will be created
50
+ userDataDir: string;
51
+
52
+ // (optional) Starting URL to open the browser with
53
+ // Default: `about:blank`
54
+ startingUrl: string;
55
+
56
+ // (optional) Logging level: verbose, info, error, silent
57
+ // Default: 'info'
58
+ logLevel: string;
59
+ };
60
+ ```
61
+
62
+ #### Launched chrome interface
63
+
64
+ #### `.launch().then(chrome => ...`
65
+
66
+ ```js
67
+ // The remote debugging port exposed by the launched chrome
68
+ chrome.port: number;
69
+
70
+ // Method kill Chrome (and cleanup the profile folder)
71
+ chrome.kill: () => Promise<{}>;
72
+
73
+ // The process id
74
+ chrome.pid: number;
75
+ ```
76
+
77
+
78
+ ## Examples
79
+
80
+ #### Launching chrome:
81
+
82
+ ```js
83
+ const chromeLauncher = require('chrome-launcher');
84
+
85
+ chromeLauncher.launch({
86
+ startingUrl: 'https://google.com'
87
+ }).then(chrome => {
88
+ console.log(`Chrome debugging port running on ${chrome.port}`);
89
+ });
90
+ ```
91
+
92
+
93
+ #### Launching headless chrome:
94
+
95
+ ```js
96
+ const chromeLauncher = require('chrome-launcher');
97
+
98
+ chromeLauncher.launch({
99
+ startingUrl: 'https://google.com',
100
+ chromeFlags: ['--headless', '--disable-gpu']
101
+ }).then(chrome => {
102
+ console.log(`Chrome debugging port running on ${chrome.port}`);
103
+ });
104
+ ```
105
+
106
+ ### Continuous Integration
107
+
108
+ In a CI environment like Travis, Chrome may not be installed. If you want to use `chrome-launcher`, you can install Chrome using Lighthouse's `download-chrome.sh` script:
109
+
110
+ `curl -L https://raw.githubusercontent.com/GoogleChrome/lighthouse/v2.1.0/lighthouse-core/scripts/download-chrome.sh | bash`
111
+
112
+ Then in `.travis.yml`, use it like so:
113
+
114
+ ```yaml
115
+ language: node_js
116
+ install:
117
+ - yarn install
118
+ before_script:
119
+ - export DISPLAY=:99.0
120
+ - export LIGHTHOUSE_CHROMIUM_PATH="$(pwd)/chrome-linux/chrome"
121
+ - sh -e /etc/init.d/xvfb start
122
+ - curl -L https://raw.githubusercontent.com/GoogleChrome/lighthouse/v2.1.0/lighthouse-core/scripts/download-chrome.sh | bash
123
+ ```