dragonfly_chrome_headless 0.2.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.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +12 -0
- data/Gemfile +4 -0
- data/README.md +53 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/dragonfly_chrome_headless.gemspec +27 -0
- data/lib/dragonfly_chrome_headless.rb +9 -0
- data/lib/dragonfly_chrome_headless/plugin.rb +17 -0
- data/lib/dragonfly_chrome_headless/processors/rasterize.rb +33 -0
- data/lib/dragonfly_chrome_headless/version.rb +3 -0
- data/node_modules/.bin/chrome-remote-interface +1 -0
- data/node_modules/.bin/mkdirp +1 -0
- data/node_modules/.bin/rimraf +1 -0
- data/node_modules/@types/core-js/LICENSE +21 -0
- data/node_modules/@types/core-js/README.md +16 -0
- data/node_modules/@types/core-js/index.d.ts +2452 -0
- data/node_modules/@types/core-js/package.json +85 -0
- data/node_modules/@types/mkdirp/README.md +18 -0
- data/node_modules/@types/mkdirp/index.d.ts +14 -0
- data/node_modules/@types/mkdirp/package.json +77 -0
- data/node_modules/@types/mkdirp/types-metadata.json +25 -0
- data/node_modules/@types/node/README.md +16 -0
- data/node_modules/@types/node/index.d.ts +4132 -0
- data/node_modules/@types/node/package.json +84 -0
- data/node_modules/balanced-match/.npmignore +5 -0
- data/node_modules/balanced-match/LICENSE.md +21 -0
- data/node_modules/balanced-match/README.md +91 -0
- data/node_modules/balanced-match/index.js +59 -0
- data/node_modules/balanced-match/package.json +112 -0
- data/node_modules/brace-expansion/README.md +123 -0
- data/node_modules/brace-expansion/index.js +201 -0
- data/node_modules/brace-expansion/package.json +114 -0
- data/node_modules/chrome-launcher/.clang-format +6 -0
- data/node_modules/chrome-launcher/.npmignore +11 -0
- data/node_modules/chrome-launcher/README.md +123 -0
- data/node_modules/chrome-launcher/ask.js +32 -0
- data/node_modules/chrome-launcher/ask.ts +35 -0
- data/node_modules/chrome-launcher/chrome-finder.js +157 -0
- data/node_modules/chrome-launcher/chrome-finder.ts +186 -0
- data/node_modules/chrome-launcher/chrome-launcher.js +245 -0
- data/node_modules/chrome-launcher/chrome-launcher.ts +312 -0
- data/node_modules/chrome-launcher/compiled-check.js +14 -0
- data/node_modules/chrome-launcher/flags.js +27 -0
- data/node_modules/chrome-launcher/flags.ts +26 -0
- data/node_modules/chrome-launcher/index.js +7 -0
- data/node_modules/chrome-launcher/index.ts +1 -0
- data/node_modules/chrome-launcher/manual-chrome-launcher.js +30 -0
- data/node_modules/chrome-launcher/package.json +116 -0
- data/node_modules/chrome-launcher/random-port.js +24 -0
- data/node_modules/chrome-launcher/random-port.ts +23 -0
- data/node_modules/chrome-launcher/tsconfig.json +19 -0
- data/node_modules/chrome-launcher/utils.js +52 -0
- data/node_modules/chrome-launcher/utils.ts +44 -0
- data/node_modules/chrome-launcher/yarn.lock +1486 -0
- data/node_modules/chrome-remote-interface/LICENSE +18 -0
- data/node_modules/chrome-remote-interface/README.md +849 -0
- data/node_modules/chrome-remote-interface/bin/client.js +337 -0
- data/node_modules/chrome-remote-interface/chrome-remote-interface.js +11 -0
- data/node_modules/chrome-remote-interface/index.js +39 -0
- data/node_modules/chrome-remote-interface/lib/api.js +84 -0
- data/node_modules/chrome-remote-interface/lib/chrome.js +307 -0
- data/node_modules/chrome-remote-interface/lib/defaults.js +4 -0
- data/node_modules/chrome-remote-interface/lib/devtools.js +245 -0
- data/node_modules/chrome-remote-interface/lib/external-request.js +28 -0
- data/node_modules/chrome-remote-interface/lib/protocol.json +13780 -0
- data/node_modules/chrome-remote-interface/lib/websocket-wrapper.js +32 -0
- data/node_modules/chrome-remote-interface/package.json +128 -0
- data/node_modules/chrome-remote-interface/webpack.config.js +55 -0
- data/node_modules/commander/Readme.md +195 -0
- data/node_modules/commander/index.js +851 -0
- data/node_modules/commander/package.json +92 -0
- data/node_modules/concat-map/.travis.yml +4 -0
- data/node_modules/concat-map/LICENSE +18 -0
- data/node_modules/concat-map/README.markdown +62 -0
- data/node_modules/concat-map/example/map.js +6 -0
- data/node_modules/concat-map/index.js +13 -0
- data/node_modules/concat-map/package.json +117 -0
- data/node_modules/concat-map/test/map.js +39 -0
- data/node_modules/debug/.coveralls.yml +1 -0
- data/node_modules/debug/.eslintrc +11 -0
- data/node_modules/debug/.npmignore +9 -0
- data/node_modules/debug/.travis.yml +14 -0
- data/node_modules/debug/CHANGELOG.md +357 -0
- data/node_modules/debug/LICENSE +19 -0
- data/node_modules/debug/Makefile +50 -0
- data/node_modules/debug/Readme.md +312 -0
- data/node_modules/debug/component.json +19 -0
- data/node_modules/debug/karma.conf.js +70 -0
- data/node_modules/debug/node.js +1 -0
- data/node_modules/debug/package.json +124 -0
- data/node_modules/debug/src/browser.js +185 -0
- data/node_modules/debug/src/debug.js +202 -0
- data/node_modules/debug/src/index.js +10 -0
- data/node_modules/debug/src/node.js +246 -0
- data/node_modules/fs.realpath/LICENSE +43 -0
- data/node_modules/fs.realpath/README.md +33 -0
- data/node_modules/fs.realpath/index.js +66 -0
- data/node_modules/fs.realpath/old.js +303 -0
- data/node_modules/fs.realpath/package.json +94 -0
- data/node_modules/glob/LICENSE +15 -0
- data/node_modules/glob/README.md +368 -0
- data/node_modules/glob/changelog.md +67 -0
- data/node_modules/glob/common.js +240 -0
- data/node_modules/glob/glob.js +790 -0
- data/node_modules/glob/package.json +112 -0
- data/node_modules/glob/sync.js +486 -0
- data/node_modules/html-pdf-chrome/.npmignore +9 -0
- data/node_modules/html-pdf-chrome/LICENSE +21 -0
- data/node_modules/html-pdf-chrome/README.md +165 -0
- data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.d.ts +87 -0
- data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.js +4 -0
- data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.js.map +1 -0
- data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.d.ts +120 -0
- data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.js +206 -0
- data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.js.map +1 -0
- data/node_modules/html-pdf-chrome/lib/src/CreateResult.d.ts +70 -0
- data/node_modules/html-pdf-chrome/lib/src/CreateResult.js +98 -0
- data/node_modules/html-pdf-chrome/lib/src/CreateResult.js.map +1 -0
- data/node_modules/html-pdf-chrome/lib/src/index.d.ts +72 -0
- data/node_modules/html-pdf-chrome/lib/src/index.js +123 -0
- data/node_modules/html-pdf-chrome/lib/src/index.js.map +1 -0
- data/node_modules/html-pdf-chrome/package.json +133 -0
- data/node_modules/html-pdf-chrome/src/ChromePrintOptions.ts +99 -0
- data/node_modules/html-pdf-chrome/src/CompletionTrigger.ts +201 -0
- data/node_modules/html-pdf-chrome/src/CreateResult.ts +100 -0
- data/node_modules/html-pdf-chrome/src/index.ts +179 -0
- data/node_modules/inflight/LICENSE +15 -0
- data/node_modules/inflight/README.md +37 -0
- data/node_modules/inflight/inflight.js +54 -0
- data/node_modules/inflight/package.json +105 -0
- data/node_modules/inherits/LICENSE +16 -0
- data/node_modules/inherits/README.md +42 -0
- data/node_modules/inherits/inherits.js +7 -0
- data/node_modules/inherits/inherits_browser.js +23 -0
- data/node_modules/inherits/package.json +97 -0
- data/node_modules/lighthouse-logger/README.md +4 -0
- data/node_modules/lighthouse-logger/index.js +212 -0
- data/node_modules/lighthouse-logger/package.json +69 -0
- data/node_modules/lighthouse-logger/yarn.lock +13 -0
- data/node_modules/minimatch/LICENSE +15 -0
- data/node_modules/minimatch/README.md +209 -0
- data/node_modules/minimatch/minimatch.js +923 -0
- data/node_modules/minimatch/package.json +99 -0
- data/node_modules/minimist/.travis.yml +4 -0
- data/node_modules/minimist/LICENSE +18 -0
- data/node_modules/minimist/example/parse.js +2 -0
- data/node_modules/minimist/index.js +187 -0
- data/node_modules/minimist/package.json +101 -0
- data/node_modules/minimist/readme.markdown +73 -0
- data/node_modules/minimist/test/dash.js +24 -0
- data/node_modules/minimist/test/default_bool.js +20 -0
- data/node_modules/minimist/test/dotted.js +16 -0
- data/node_modules/minimist/test/long.js +31 -0
- data/node_modules/minimist/test/parse.js +318 -0
- data/node_modules/minimist/test/parse_modified.js +9 -0
- data/node_modules/minimist/test/short.js +67 -0
- data/node_modules/minimist/test/whitespace.js +8 -0
- data/node_modules/mkdirp/.travis.yml +8 -0
- data/node_modules/mkdirp/LICENSE +21 -0
- data/node_modules/mkdirp/bin/cmd.js +33 -0
- data/node_modules/mkdirp/bin/usage.txt +12 -0
- data/node_modules/mkdirp/examples/pow.js +6 -0
- data/node_modules/mkdirp/index.js +98 -0
- data/node_modules/mkdirp/package.json +93 -0
- data/node_modules/mkdirp/readme.markdown +100 -0
- data/node_modules/mkdirp/test/chmod.js +41 -0
- data/node_modules/mkdirp/test/clobber.js +38 -0
- data/node_modules/mkdirp/test/mkdirp.js +28 -0
- data/node_modules/mkdirp/test/opts_fs.js +29 -0
- data/node_modules/mkdirp/test/opts_fs_sync.js +27 -0
- data/node_modules/mkdirp/test/perm.js +32 -0
- data/node_modules/mkdirp/test/perm_sync.js +36 -0
- data/node_modules/mkdirp/test/race.js +37 -0
- data/node_modules/mkdirp/test/rel.js +32 -0
- data/node_modules/mkdirp/test/return.js +25 -0
- data/node_modules/mkdirp/test/return_sync.js +24 -0
- data/node_modules/mkdirp/test/root.js +19 -0
- data/node_modules/mkdirp/test/sync.js +32 -0
- data/node_modules/mkdirp/test/umask.js +28 -0
- data/node_modules/mkdirp/test/umask_sync.js +32 -0
- data/node_modules/ms/README.md +51 -0
- data/node_modules/ms/index.js +152 -0
- data/node_modules/ms/license.md +21 -0
- data/node_modules/ms/package.json +109 -0
- data/node_modules/once/LICENSE +15 -0
- data/node_modules/once/README.md +79 -0
- data/node_modules/once/once.js +42 -0
- data/node_modules/once/package.json +101 -0
- data/node_modules/path-is-absolute/index.js +20 -0
- data/node_modules/path-is-absolute/license +21 -0
- data/node_modules/path-is-absolute/package.json +111 -0
- data/node_modules/path-is-absolute/readme.md +59 -0
- data/node_modules/rimraf/LICENSE +15 -0
- data/node_modules/rimraf/README.md +101 -0
- data/node_modules/rimraf/bin.js +50 -0
- data/node_modules/rimraf/package.json +99 -0
- data/node_modules/rimraf/rimraf.js +363 -0
- data/node_modules/ultron/LICENSE +22 -0
- data/node_modules/ultron/index.js +138 -0
- data/node_modules/ultron/package.json +112 -0
- data/node_modules/wrappy/LICENSE +15 -0
- data/node_modules/wrappy/README.md +36 -0
- data/node_modules/wrappy/package.json +97 -0
- data/node_modules/wrappy/wrappy.js +33 -0
- data/node_modules/ws/LICENSE +21 -0
- data/node_modules/ws/README.md +259 -0
- data/node_modules/ws/SECURITY.md +33 -0
- data/node_modules/ws/index.js +15 -0
- data/node_modules/ws/lib/BufferUtil.fallback.js +56 -0
- data/node_modules/ws/lib/BufferUtil.js +15 -0
- data/node_modules/ws/lib/ErrorCodes.js +28 -0
- data/node_modules/ws/lib/EventTarget.js +158 -0
- data/node_modules/ws/lib/Extensions.js +69 -0
- data/node_modules/ws/lib/PerMessageDeflate.js +339 -0
- data/node_modules/ws/lib/Receiver.js +520 -0
- data/node_modules/ws/lib/Sender.js +438 -0
- data/node_modules/ws/lib/Validation.fallback.js +9 -0
- data/node_modules/ws/lib/Validation.js +17 -0
- data/node_modules/ws/lib/WebSocket.js +705 -0
- data/node_modules/ws/lib/WebSocketServer.js +336 -0
- data/node_modules/ws/package.json +122 -0
- data/package.json +26 -0
- data/samples/sample.html +13 -0
- data/script/rasterize.js +18 -0
- 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,123 @@
|
|
|
1
|
+
# Chrome Launcher [](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
|
+
```
|