dragonfly_chrome_headless 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,32 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
8
|
+
const readline = require('readline');
|
9
|
+
function ask(question, options) {
|
10
|
+
return new Promise(resolve => {
|
11
|
+
const iface = readline.createInterface(process.stdin, process.stdout);
|
12
|
+
const optionsStr = options.map((o, i) => i + 1 + '. ' + o).join('\r\n');
|
13
|
+
iface.setPrompt(question + '\r\n' + optionsStr + '\r\nChoice: ');
|
14
|
+
iface.prompt();
|
15
|
+
iface.on('line', (_answer) => {
|
16
|
+
const answer = toInt(_answer);
|
17
|
+
if (answer > 0 && answer <= options.length) {
|
18
|
+
iface.close();
|
19
|
+
resolve(options[answer - 1]);
|
20
|
+
}
|
21
|
+
else {
|
22
|
+
iface.prompt();
|
23
|
+
}
|
24
|
+
});
|
25
|
+
});
|
26
|
+
}
|
27
|
+
exports.ask = ask;
|
28
|
+
function toInt(n) {
|
29
|
+
const result = parseInt(n, 10);
|
30
|
+
return isNaN(result) ? 0 : result;
|
31
|
+
}
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYXNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7O0dBSUc7QUFDSCxZQUFZLENBQUM7O0FBRWIsTUFBTSxRQUFRLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0FBRXJDLGFBQWEsUUFBZ0IsRUFBRSxPQUFpQjtJQUM5QyxNQUFNLENBQUMsSUFBSSxPQUFPLENBQUMsT0FBTztRQUN4QixNQUFNLEtBQUssR0FBRyxRQUFRLENBQUMsZUFBZSxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO1FBQ3RFLE1BQU0sVUFBVSxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLEdBQUcsSUFBSSxHQUFHLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUV4RSxLQUFLLENBQUMsU0FBUyxDQUFDLFFBQVEsR0FBRyxNQUFNLEdBQUcsVUFBVSxHQUFHLGNBQWMsQ0FBQyxDQUFDO1FBQ2pFLEtBQUssQ0FBQyxNQUFNLEVBQUUsQ0FBQztRQUVmLEtBQUssQ0FBQyxFQUFFLENBQUMsTUFBTSxFQUFFLENBQUMsT0FBZTtZQUMvQixNQUFNLE1BQU0sR0FBRyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUM7WUFDOUIsRUFBRSxDQUFDLENBQUMsTUFBTSxHQUFHLENBQUMsSUFBSSxNQUFNLElBQUksT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7Z0JBQzNDLEtBQUssQ0FBQyxLQUFLLEVBQUUsQ0FBQztnQkFDZCxPQUFPLENBQUMsT0FBTyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQy9CLENBQUM7WUFBQyxJQUFJLENBQUMsQ0FBQztnQkFDTixLQUFLLENBQUMsTUFBTSxFQUFFLENBQUM7WUFDakIsQ0FBQztRQUNILENBQUMsQ0FBQyxDQUFDO0lBQ0wsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDO0FBT08sa0JBQUc7QUFMWCxlQUFlLENBQVM7SUFDdEIsTUFBTSxNQUFNLEdBQUcsUUFBUSxDQUFDLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FBQztJQUMvQixNQUFNLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsR0FBRyxNQUFNLENBQUM7QUFDcEMsQ0FBQyJ9
|
@@ -0,0 +1,35 @@
|
|
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 readline = require('readline');
|
9
|
+
|
10
|
+
function ask(question: string, options: string[]): Promise<string> {
|
11
|
+
return new Promise(resolve => {
|
12
|
+
const iface = readline.createInterface(process.stdin, process.stdout);
|
13
|
+
const optionsStr = options.map((o, i) => i + 1 + '. ' + o).join('\r\n');
|
14
|
+
|
15
|
+
iface.setPrompt(question + '\r\n' + optionsStr + '\r\nChoice: ');
|
16
|
+
iface.prompt();
|
17
|
+
|
18
|
+
iface.on('line', (_answer: string) => {
|
19
|
+
const answer = toInt(_answer);
|
20
|
+
if (answer > 0 && answer <= options.length) {
|
21
|
+
iface.close();
|
22
|
+
resolve(options[answer - 1]);
|
23
|
+
} else {
|
24
|
+
iface.prompt();
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
28
|
+
}
|
29
|
+
|
30
|
+
function toInt(n: string): number {
|
31
|
+
const result = parseInt(n, 10);
|
32
|
+
return isNaN(result) ? 0 : result;
|
33
|
+
}
|
34
|
+
|
35
|
+
export {ask};
|
@@ -0,0 +1,157 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
8
|
+
const fs = require('fs');
|
9
|
+
const path = require('path');
|
10
|
+
const execSync = require('child_process').execSync;
|
11
|
+
const execFileSync = require('child_process').execFileSync;
|
12
|
+
const newLineRegex = /\r?\n/;
|
13
|
+
function darwin() {
|
14
|
+
const suffixes = ['/Contents/MacOS/Google Chrome Canary', '/Contents/MacOS/Google Chrome'];
|
15
|
+
const LSREGISTER = '/System/Library/Frameworks/CoreServices.framework' +
|
16
|
+
'/Versions/A/Frameworks/LaunchServices.framework' +
|
17
|
+
'/Versions/A/Support/lsregister';
|
18
|
+
const installations = [];
|
19
|
+
execSync(`${LSREGISTER} -dump` +
|
20
|
+
' | grep -i \'google chrome\\( canary\\)\\?.app$\'' +
|
21
|
+
' | awk \'{$1=""; print $0}\'')
|
22
|
+
.toString()
|
23
|
+
.split(newLineRegex)
|
24
|
+
.forEach((inst) => {
|
25
|
+
suffixes.forEach(suffix => {
|
26
|
+
const execPath = path.join(inst.trim(), suffix);
|
27
|
+
if (canAccess(execPath)) {
|
28
|
+
installations.push(execPath);
|
29
|
+
}
|
30
|
+
});
|
31
|
+
});
|
32
|
+
// Retains one per line to maintain readability.
|
33
|
+
// clang-format off
|
34
|
+
const priorities = [
|
35
|
+
{ regex: new RegExp(`^${process.env.HOME}/Applications/.*Chrome.app`), weight: 50 },
|
36
|
+
{ regex: new RegExp(`^${process.env.HOME}/Applications/.*Chrome Canary.app`), weight: 51 },
|
37
|
+
{ regex: /^\/Applications\/.*Chrome.app/, weight: 100 },
|
38
|
+
{ regex: /^\/Applications\/.*Chrome Canary.app/, weight: 101 },
|
39
|
+
{ regex: /^\/Volumes\/.*Chrome.app/, weight: -2 },
|
40
|
+
{ regex: /^\/Volumes\/.*Chrome Canary.app/, weight: -1 }
|
41
|
+
];
|
42
|
+
// clang-format on
|
43
|
+
return sort(installations, priorities);
|
44
|
+
}
|
45
|
+
exports.darwin = darwin;
|
46
|
+
/**
|
47
|
+
* Look for linux executables in 3 ways
|
48
|
+
* 1. Look into LIGHTHOUSE_CHROMIUM_PATH env variable
|
49
|
+
* 2. Look into the directories where .desktop are saved on gnome based distro's
|
50
|
+
* 3. Look for google-chrome-stable & google-chrome executables by using the which command
|
51
|
+
*/
|
52
|
+
function linux() {
|
53
|
+
let installations = [];
|
54
|
+
// 1. Look into LIGHTHOUSE_CHROMIUM_PATH env variable
|
55
|
+
if (canAccess(process.env.LIGHTHOUSE_CHROMIUM_PATH)) {
|
56
|
+
installations.push(process.env.LIGHTHOUSE_CHROMIUM_PATH);
|
57
|
+
}
|
58
|
+
// 2. Look into the directories where .desktop are saved on gnome based distro's
|
59
|
+
const desktopInstallationFolders = [
|
60
|
+
path.join(require('os').homedir(), '.local/share/applications/'),
|
61
|
+
'/usr/share/applications/',
|
62
|
+
];
|
63
|
+
desktopInstallationFolders.forEach(folder => {
|
64
|
+
installations = installations.concat(findChromeExecutables(folder));
|
65
|
+
});
|
66
|
+
// Look for google-chrome-stable & google-chrome executables by using the which command
|
67
|
+
const executables = [
|
68
|
+
'google-chrome-stable',
|
69
|
+
'google-chrome',
|
70
|
+
];
|
71
|
+
executables.forEach((executable) => {
|
72
|
+
try {
|
73
|
+
const chromePath = execFileSync('which', [executable]).toString().split(newLineRegex)[0];
|
74
|
+
if (canAccess(chromePath)) {
|
75
|
+
installations.push(chromePath);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
catch (e) {
|
79
|
+
// Not installed.
|
80
|
+
}
|
81
|
+
});
|
82
|
+
if (!installations.length) {
|
83
|
+
throw new Error('The environment variable LIGHTHOUSE_CHROMIUM_PATH must be set to ' +
|
84
|
+
'executable of a build of Chromium version 54.0 or later.');
|
85
|
+
}
|
86
|
+
const priorities = [
|
87
|
+
{ regex: /chrome-wrapper$/, weight: 51 }, { regex: /google-chrome-stable$/, weight: 50 },
|
88
|
+
{ regex: /google-chrome$/, weight: 49 },
|
89
|
+
{ regex: new RegExp(process.env.LIGHTHOUSE_CHROMIUM_PATH), weight: 100 }
|
90
|
+
];
|
91
|
+
return sort(uniq(installations.filter(Boolean)), priorities);
|
92
|
+
}
|
93
|
+
exports.linux = linux;
|
94
|
+
function win32() {
|
95
|
+
const installations = [];
|
96
|
+
const suffixes = [
|
97
|
+
'\\Google\\Chrome SxS\\Application\\chrome.exe', '\\Google\\Chrome\\Application\\chrome.exe'
|
98
|
+
];
|
99
|
+
const prefixes = [process.env.LOCALAPPDATA, process.env.PROGRAMFILES, process.env['PROGRAMFILES(X86)']];
|
100
|
+
if (canAccess(process.env.LIGHTHOUSE_CHROMIUM_PATH)) {
|
101
|
+
installations.push(process.env.LIGHTHOUSE_CHROMIUM_PATH);
|
102
|
+
}
|
103
|
+
prefixes.forEach(prefix => suffixes.forEach(suffix => {
|
104
|
+
const chromePath = path.join(prefix, suffix);
|
105
|
+
if (canAccess(chromePath)) {
|
106
|
+
installations.push(chromePath);
|
107
|
+
}
|
108
|
+
}));
|
109
|
+
return installations;
|
110
|
+
}
|
111
|
+
exports.win32 = win32;
|
112
|
+
function sort(installations, priorities) {
|
113
|
+
const defaultPriority = 10;
|
114
|
+
return installations
|
115
|
+
.map((inst) => {
|
116
|
+
for (const pair of priorities) {
|
117
|
+
if (pair.regex.test(inst)) {
|
118
|
+
return { path: inst, weight: pair.weight };
|
119
|
+
}
|
120
|
+
}
|
121
|
+
return { path: inst, weight: defaultPriority };
|
122
|
+
})
|
123
|
+
.sort((a, b) => (b.weight - a.weight))
|
124
|
+
.map(pair => pair.path);
|
125
|
+
}
|
126
|
+
function canAccess(file) {
|
127
|
+
if (!file) {
|
128
|
+
return false;
|
129
|
+
}
|
130
|
+
try {
|
131
|
+
fs.accessSync(file);
|
132
|
+
return true;
|
133
|
+
}
|
134
|
+
catch (e) {
|
135
|
+
return false;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
function uniq(arr) {
|
139
|
+
return Array.from(new Set(arr));
|
140
|
+
}
|
141
|
+
function findChromeExecutables(folder) {
|
142
|
+
const argumentsRegex = /(^[^ ]+).*/; // Take everything up to the first space
|
143
|
+
const chromeExecRegex = '^Exec=\/.*\/(google|chrome|chromium)-.*';
|
144
|
+
let installations = [];
|
145
|
+
if (canAccess(folder)) {
|
146
|
+
// Output of the grep & print looks like:
|
147
|
+
// /opt/google/chrome/google-chrome --profile-directory
|
148
|
+
// /home/user/Downloads/chrome-linux/chrome-wrapper %U
|
149
|
+
let execPaths = execSync(`grep -ER "${chromeExecRegex}" ${folder} | awk -F '=' '{print $2}'`)
|
150
|
+
.toString()
|
151
|
+
.split(newLineRegex)
|
152
|
+
.map((execPath) => execPath.replace(argumentsRegex, '$1'));
|
153
|
+
execPaths.forEach((execPath) => canAccess(execPath) && installations.push(execPath));
|
154
|
+
}
|
155
|
+
return installations;
|
156
|
+
}
|
157
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hyb21lLWZpbmRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImNocm9tZS1maW5kZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7R0FJRztBQUNILFlBQVksQ0FBQzs7QUFFYixNQUFNLEVBQUUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7QUFDekIsTUFBTSxJQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBQzdCLE1BQU0sUUFBUSxHQUFHLE9BQU8sQ0FBQyxlQUFlLENBQUMsQ0FBQyxRQUFRLENBQUM7QUFDbkQsTUFBTSxZQUFZLEdBQUcsT0FBTyxDQUFDLGVBQWUsQ0FBQyxDQUFDLFlBQVksQ0FBQztBQUUzRCxNQUFNLFlBQVksR0FBRyxPQUFPLENBQUM7QUFJN0I7SUFDRSxNQUFNLFFBQVEsR0FBRyxDQUFDLHNDQUFzQyxFQUFFLCtCQUErQixDQUFDLENBQUM7SUFFM0YsTUFBTSxVQUFVLEdBQUcsbURBQW1EO1FBQ2xFLGlEQUFpRDtRQUNqRCxnQ0FBZ0MsQ0FBQztJQUVyQyx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M7UUFDWCxNQUFNLENBQUMsS0FBSyxDQUFDO0lBQ2YsQ0FBQztBQUNILENBQUM7QUFFRCxjQUFjLEdBQWU7SUFDM0IsTUFBTSxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztBQUNsQyxDQUFDO0FBRUQsK0JBQStCLE1BQWM7SUFDM0MsTUFBTSxjQUFjLEdBQUcsWUFBWSxDQUFDLENBQUMsd0NBQXdDO0lBQzdFLE1BQU0sZUFBZSxHQUFHLHlDQUF5QyxDQUFDO0lBRWxFLElBQUksYUFBYSxHQUFrQixFQUFFLENBQUM7SUFDdEMsRUFBRSxDQUFDLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUN0Qix5Q0FBeUM7UUFDekMsMERBQTBEO1FBQzFELHlEQUF5RDtRQUN6RCxJQUFJLFNBQVMsR0FBRyxRQUFRLENBQUMsYUFBYSxlQUFlLEtBQUssTUFBTSw0QkFBNEIsQ0FBQzthQUN4RSxRQUFRLEVBQUU7YUFDVixLQUFLLENBQUMsWUFBWSxDQUFDO2FBQ25CLEdBQUcsQ0FBQyxDQUFDLFFBQWdCLEtBQUssUUFBUSxDQUFDLE9BQU8sQ0FBQyxjQUFjLEVBQUUsSUFBSSxDQUFDLENBQUMsQ0FBQztRQUV2RixTQUFTLENBQUMsT0FBTyxDQUFDLENBQUMsUUFBZ0IsS0FBSyxTQUFTLENBQUMsUUFBUSxDQUFDLElBQUksYUFBYSxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDO0lBQy9GLENBQUM7SUFFRCxNQUFNLENBQUMsYUFBYSxDQUFDO0FBQ3ZCLENBQUMifQ==
|
@@ -0,0 +1,186 @@
|
|
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 fs = require('fs');
|
9
|
+
const path = require('path');
|
10
|
+
const execSync = require('child_process').execSync;
|
11
|
+
const execFileSync = require('child_process').execFileSync;
|
12
|
+
|
13
|
+
const newLineRegex = /\r?\n/;
|
14
|
+
|
15
|
+
type Priorities = Array<{regex: RegExp, weight: number}>;
|
16
|
+
|
17
|
+
export function darwin() {
|
18
|
+
const suffixes = ['/Contents/MacOS/Google Chrome Canary', '/Contents/MacOS/Google Chrome'];
|
19
|
+
|
20
|
+
const LSREGISTER = '/System/Library/Frameworks/CoreServices.framework' +
|
21
|
+
'/Versions/A/Frameworks/LaunchServices.framework' +
|
22
|
+
'/Versions/A/Support/lsregister';
|
23
|
+
|
24
|
+
const installations: Array<string> = [];
|
25
|
+
|
26
|
+
execSync(
|
27
|
+
`${LSREGISTER} -dump` +
|
28
|
+
' | grep -i \'google chrome\\( canary\\)\\?.app$\'' +
|
29
|
+
' | awk \'{$1=""; print $0}\'')
|
30
|
+
.toString()
|
31
|
+
.split(newLineRegex)
|
32
|
+
.forEach((inst: string) => {
|
33
|
+
suffixes.forEach(suffix => {
|
34
|
+
const execPath = path.join(inst.trim(), suffix);
|
35
|
+
if (canAccess(execPath)) {
|
36
|
+
installations.push(execPath);
|
37
|
+
}
|
38
|
+
});
|
39
|
+
});
|
40
|
+
|
41
|
+
// Retains one per line to maintain readability.
|
42
|
+
// clang-format off
|
43
|
+
const priorities: Priorities = [
|
44
|
+
{regex: new RegExp(`^${process.env.HOME}/Applications/.*Chrome.app`), weight: 50},
|
45
|
+
{regex: new RegExp(`^${process.env.HOME}/Applications/.*Chrome Canary.app`), weight: 51},
|
46
|
+
{regex: /^\/Applications\/.*Chrome.app/, weight: 100},
|
47
|
+
{regex: /^\/Applications\/.*Chrome Canary.app/, weight: 101},
|
48
|
+
{regex: /^\/Volumes\/.*Chrome.app/, weight: -2},
|
49
|
+
{regex: /^\/Volumes\/.*Chrome Canary.app/, weight: -1}
|
50
|
+
];
|
51
|
+
// clang-format on
|
52
|
+
|
53
|
+
return sort(installations, priorities);
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Look for linux executables in 3 ways
|
58
|
+
* 1. Look into LIGHTHOUSE_CHROMIUM_PATH env variable
|
59
|
+
* 2. Look into the directories where .desktop are saved on gnome based distro's
|
60
|
+
* 3. Look for google-chrome-stable & google-chrome executables by using the which command
|
61
|
+
*/
|
62
|
+
export function linux() {
|
63
|
+
let installations: string[] = [];
|
64
|
+
|
65
|
+
// 1. Look into LIGHTHOUSE_CHROMIUM_PATH env variable
|
66
|
+
if (canAccess(process.env.LIGHTHOUSE_CHROMIUM_PATH)) {
|
67
|
+
installations.push(process.env.LIGHTHOUSE_CHROMIUM_PATH as string);
|
68
|
+
}
|
69
|
+
|
70
|
+
// 2. Look into the directories where .desktop are saved on gnome based distro's
|
71
|
+
const desktopInstallationFolders = [
|
72
|
+
path.join(require('os').homedir(), '.local/share/applications/'),
|
73
|
+
'/usr/share/applications/',
|
74
|
+
];
|
75
|
+
desktopInstallationFolders.forEach(folder => {
|
76
|
+
installations = installations.concat(findChromeExecutables(folder));
|
77
|
+
});
|
78
|
+
|
79
|
+
// Look for google-chrome-stable & google-chrome executables by using the which command
|
80
|
+
const executables = [
|
81
|
+
'google-chrome-stable',
|
82
|
+
'google-chrome',
|
83
|
+
];
|
84
|
+
executables.forEach((executable: string) => {
|
85
|
+
try {
|
86
|
+
const chromePath =
|
87
|
+
execFileSync('which', [executable]).toString().split(newLineRegex)[0] as string;
|
88
|
+
|
89
|
+
if (canAccess(chromePath)) {
|
90
|
+
installations.push(chromePath);
|
91
|
+
}
|
92
|
+
} catch (e) {
|
93
|
+
// Not installed.
|
94
|
+
}
|
95
|
+
});
|
96
|
+
|
97
|
+
if (!installations.length) {
|
98
|
+
throw new Error(
|
99
|
+
'The environment variable LIGHTHOUSE_CHROMIUM_PATH must be set to ' +
|
100
|
+
'executable of a build of Chromium version 54.0 or later.');
|
101
|
+
}
|
102
|
+
|
103
|
+
const priorities: Priorities = [
|
104
|
+
{regex: /chrome-wrapper$/, weight: 51}, {regex: /google-chrome-stable$/, weight: 50},
|
105
|
+
{regex: /google-chrome$/, weight: 49},
|
106
|
+
{regex: new RegExp(process.env.LIGHTHOUSE_CHROMIUM_PATH), weight: 100}
|
107
|
+
];
|
108
|
+
|
109
|
+
return sort(uniq(installations.filter(Boolean)), priorities);
|
110
|
+
}
|
111
|
+
|
112
|
+
export function win32() {
|
113
|
+
const installations: Array<string> = [];
|
114
|
+
const suffixes = [
|
115
|
+
'\\Google\\Chrome SxS\\Application\\chrome.exe', '\\Google\\Chrome\\Application\\chrome.exe'
|
116
|
+
];
|
117
|
+
const prefixes =
|
118
|
+
[process.env.LOCALAPPDATA, process.env.PROGRAMFILES, process.env['PROGRAMFILES(X86)']];
|
119
|
+
|
120
|
+
if (canAccess(process.env.LIGHTHOUSE_CHROMIUM_PATH)) {
|
121
|
+
installations.push(process.env.LIGHTHOUSE_CHROMIUM_PATH);
|
122
|
+
}
|
123
|
+
|
124
|
+
prefixes.forEach(prefix => suffixes.forEach(suffix => {
|
125
|
+
const chromePath = path.join(prefix, suffix);
|
126
|
+
if (canAccess(chromePath)) {
|
127
|
+
installations.push(chromePath);
|
128
|
+
}
|
129
|
+
}));
|
130
|
+
return installations;
|
131
|
+
}
|
132
|
+
|
133
|
+
function sort(installations: string[], priorities: Priorities) {
|
134
|
+
const defaultPriority = 10;
|
135
|
+
return installations
|
136
|
+
// assign priorities
|
137
|
+
.map((inst: string) => {
|
138
|
+
for (const pair of priorities) {
|
139
|
+
if (pair.regex.test(inst)) {
|
140
|
+
return {path: inst, weight: pair.weight};
|
141
|
+
}
|
142
|
+
}
|
143
|
+
return {path: inst, weight: defaultPriority};
|
144
|
+
})
|
145
|
+
// sort based on priorities
|
146
|
+
.sort((a, b) => (b.weight - a.weight))
|
147
|
+
// remove priority flag
|
148
|
+
.map(pair => pair.path);
|
149
|
+
}
|
150
|
+
|
151
|
+
function canAccess(file: string): Boolean {
|
152
|
+
if (!file) {
|
153
|
+
return false;
|
154
|
+
}
|
155
|
+
|
156
|
+
try {
|
157
|
+
fs.accessSync(file);
|
158
|
+
return true;
|
159
|
+
} catch (e) {
|
160
|
+
return false;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
|
164
|
+
function uniq(arr: Array<any>) {
|
165
|
+
return Array.from(new Set(arr));
|
166
|
+
}
|
167
|
+
|
168
|
+
function findChromeExecutables(folder: string): Array<string> {
|
169
|
+
const argumentsRegex = /(^[^ ]+).*/; // Take everything up to the first space
|
170
|
+
const chromeExecRegex = '^Exec=\/.*\/(google|chrome|chromium)-.*';
|
171
|
+
|
172
|
+
let installations: Array<string> = [];
|
173
|
+
if (canAccess(folder)) {
|
174
|
+
// Output of the grep & print looks like:
|
175
|
+
// /opt/google/chrome/google-chrome --profile-directory
|
176
|
+
// /home/user/Downloads/chrome-linux/chrome-wrapper %U
|
177
|
+
let execPaths = execSync(`grep -ER "${chromeExecRegex}" ${folder} | awk -F '=' '{print $2}'`)
|
178
|
+
.toString()
|
179
|
+
.split(newLineRegex)
|
180
|
+
.map((execPath: string) => execPath.replace(argumentsRegex, '$1'));
|
181
|
+
|
182
|
+
execPaths.forEach((execPath: string) => canAccess(execPath) && installations.push(execPath));
|
183
|
+
}
|
184
|
+
|
185
|
+
return installations;
|
186
|
+
}
|
@@ -0,0 +1,245 @@
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
11
|
+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
13
|
+
});
|
14
|
+
};
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
16
|
+
const childProcess = require("child_process");
|
17
|
+
const fs = require("fs");
|
18
|
+
const chromeFinder = require("./chrome-finder");
|
19
|
+
const random_port_1 = require("./random-port");
|
20
|
+
const flags_1 = require("./flags");
|
21
|
+
const utils_1 = require("./utils");
|
22
|
+
const net = require("net");
|
23
|
+
const rimraf = require('rimraf');
|
24
|
+
const log = require('lighthouse-logger');
|
25
|
+
const spawn = childProcess.spawn;
|
26
|
+
const execSync = childProcess.execSync;
|
27
|
+
const isWindows = process.platform === 'win32';
|
28
|
+
const _SIGINT = 'SIGINT';
|
29
|
+
const _SIGINT_EXIT_CODE = 130;
|
30
|
+
const _SUPPORTED_PLATFORMS = new Set(['darwin', 'linux', 'win32']);
|
31
|
+
function launch(opts = {}) {
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
33
|
+
opts.handleSIGINT = utils_1.defaults(opts.handleSIGINT, true);
|
34
|
+
const instance = new Launcher(opts);
|
35
|
+
// Kill spawned Chrome process in case of ctrl-C.
|
36
|
+
if (opts.handleSIGINT) {
|
37
|
+
process.on(_SIGINT, () => __awaiter(this, void 0, void 0, function* () {
|
38
|
+
yield instance.kill();
|
39
|
+
process.exit(_SIGINT_EXIT_CODE);
|
40
|
+
}));
|
41
|
+
}
|
42
|
+
yield instance.launch();
|
43
|
+
return { pid: instance.pid, port: instance.port, kill: () => __awaiter(this, void 0, void 0, function* () { return instance.kill(); }) };
|
44
|
+
});
|
45
|
+
}
|
46
|
+
exports.launch = launch;
|
47
|
+
class Launcher {
|
48
|
+
constructor(opts = {}, moduleOverrides = {}) {
|
49
|
+
this.opts = opts;
|
50
|
+
this.tmpDirandPidFileReady = false;
|
51
|
+
this.pollInterval = 500;
|
52
|
+
this.fs = moduleOverrides.fs || fs;
|
53
|
+
this.rimraf = moduleOverrides.rimraf || rimraf;
|
54
|
+
this.spawn = moduleOverrides.spawn || spawn;
|
55
|
+
log.setLevel(utils_1.defaults(this.opts.logLevel, 'info'));
|
56
|
+
// choose the first one (default)
|
57
|
+
this.startingUrl = utils_1.defaults(this.opts.startingUrl, 'about:blank');
|
58
|
+
this.chromeFlags = utils_1.defaults(this.opts.chromeFlags, []);
|
59
|
+
this.requestedPort = utils_1.defaults(this.opts.port, 0);
|
60
|
+
this.chromePath = this.opts.chromePath;
|
61
|
+
}
|
62
|
+
get flags() {
|
63
|
+
const flags = flags_1.DEFAULT_FLAGS.concat([
|
64
|
+
`--remote-debugging-port=${this.port}`,
|
65
|
+
// Place Chrome profile in a custom location we'll rm -rf later
|
66
|
+
`--user-data-dir=${this.userDataDir}`
|
67
|
+
]);
|
68
|
+
if (process.platform === 'linux') {
|
69
|
+
flags.push('--disable-setuid-sandbox');
|
70
|
+
}
|
71
|
+
flags.push(...this.chromeFlags);
|
72
|
+
flags.push(this.startingUrl);
|
73
|
+
return flags;
|
74
|
+
}
|
75
|
+
// Wrapper function to enable easy testing.
|
76
|
+
makeTmpDir() {
|
77
|
+
return utils_1.makeTmpDir();
|
78
|
+
}
|
79
|
+
prepare() {
|
80
|
+
const platform = process.platform;
|
81
|
+
if (!_SUPPORTED_PLATFORMS.has(platform)) {
|
82
|
+
throw new Error(`Platform ${platform} is not supported`);
|
83
|
+
}
|
84
|
+
this.userDataDir = this.opts.userDataDir || this.makeTmpDir();
|
85
|
+
this.outFile = this.fs.openSync(`${this.userDataDir}/chrome-out.log`, 'a');
|
86
|
+
this.errFile = this.fs.openSync(`${this.userDataDir}/chrome-err.log`, 'a');
|
87
|
+
// fix for Node4
|
88
|
+
// you can't pass a fd to fs.writeFileSync
|
89
|
+
this.pidFile = `${this.userDataDir}/chrome.pid`;
|
90
|
+
log.verbose('ChromeLauncher', `created ${this.userDataDir}`);
|
91
|
+
this.tmpDirandPidFileReady = true;
|
92
|
+
}
|
93
|
+
launch() {
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
95
|
+
if (this.requestedPort !== 0) {
|
96
|
+
this.port = this.requestedPort;
|
97
|
+
// If an explict port is passed first look for an open connection...
|
98
|
+
try {
|
99
|
+
return yield this.isDebuggerReady();
|
100
|
+
}
|
101
|
+
catch (err) {
|
102
|
+
log.log('ChromeLauncher', `No debugging port found on port ${this.port}, launching a new Chrome.`);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
if (!this.tmpDirandPidFileReady) {
|
106
|
+
this.prepare();
|
107
|
+
}
|
108
|
+
if (this.chromePath === undefined) {
|
109
|
+
const installations = yield chromeFinder[process.platform]();
|
110
|
+
if (installations.length === 0) {
|
111
|
+
throw new Error('No Chrome Installations Found');
|
112
|
+
}
|
113
|
+
this.chromePath = installations[0];
|
114
|
+
}
|
115
|
+
this.pid = yield this.spawnProcess(this.chromePath);
|
116
|
+
return Promise.resolve();
|
117
|
+
});
|
118
|
+
}
|
119
|
+
spawnProcess(execPath) {
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
121
|
+
// Typescript is losing track of the return type without the explict typing.
|
122
|
+
const spawnPromise = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
123
|
+
if (this.chrome) {
|
124
|
+
log.log('ChromeLauncher', `Chrome already running with pid ${this.chrome.pid}.`);
|
125
|
+
return resolve(this.chrome.pid);
|
126
|
+
}
|
127
|
+
// If a zero value port is set, it means the launcher
|
128
|
+
// is responsible for generating the port number.
|
129
|
+
// We do this here so that we can know the port before
|
130
|
+
// we pass it into chrome.
|
131
|
+
if (this.requestedPort === 0) {
|
132
|
+
this.port = yield random_port_1.getRandomPort();
|
133
|
+
}
|
134
|
+
const chrome = this.spawn(execPath, this.flags, { detached: true, stdio: ['ignore', this.outFile, this.errFile] });
|
135
|
+
this.chrome = chrome;
|
136
|
+
this.fs.writeFileSync(this.pidFile, chrome.pid.toString());
|
137
|
+
log.verbose('ChromeLauncher', `Chrome running with pid ${chrome.pid} on port ${this.port}.`);
|
138
|
+
resolve(chrome.pid);
|
139
|
+
}));
|
140
|
+
const pid = yield spawnPromise;
|
141
|
+
yield this.waitUntilReady();
|
142
|
+
return pid;
|
143
|
+
});
|
144
|
+
}
|
145
|
+
cleanup(client) {
|
146
|
+
if (client) {
|
147
|
+
client.removeAllListeners();
|
148
|
+
client.end();
|
149
|
+
client.destroy();
|
150
|
+
client.unref();
|
151
|
+
}
|
152
|
+
}
|
153
|
+
// resolves if ready, rejects otherwise
|
154
|
+
isDebuggerReady() {
|
155
|
+
return new Promise((resolve, reject) => {
|
156
|
+
const client = net.createConnection(this.port);
|
157
|
+
client.once('error', err => {
|
158
|
+
this.cleanup(client);
|
159
|
+
reject(err);
|
160
|
+
});
|
161
|
+
client.once('connect', () => {
|
162
|
+
this.cleanup(client);
|
163
|
+
resolve();
|
164
|
+
});
|
165
|
+
});
|
166
|
+
}
|
167
|
+
// resolves when debugger is ready, rejects after 10 polls
|
168
|
+
waitUntilReady() {
|
169
|
+
const launcher = this;
|
170
|
+
return new Promise((resolve, reject) => {
|
171
|
+
let retries = 0;
|
172
|
+
let waitStatus = 'Waiting for browser.';
|
173
|
+
const poll = () => {
|
174
|
+
if (retries === 0) {
|
175
|
+
log.log('ChromeLauncher', waitStatus);
|
176
|
+
}
|
177
|
+
retries++;
|
178
|
+
waitStatus += '..';
|
179
|
+
log.log('ChromeLauncher', waitStatus);
|
180
|
+
launcher.isDebuggerReady()
|
181
|
+
.then(() => {
|
182
|
+
log.log('ChromeLauncher', waitStatus + `${log.greenify(log.tick)}`);
|
183
|
+
resolve();
|
184
|
+
})
|
185
|
+
.catch(err => {
|
186
|
+
if (retries > 10) {
|
187
|
+
log.error('ChromeLauncher', err.message);
|
188
|
+
const stderr = this.fs.readFileSync(`${this.userDataDir}/chrome-err.log`, { encoding: 'utf-8' });
|
189
|
+
log.error('ChromeLauncher', `Logging contents of ${this.userDataDir}/chrome-err.log`);
|
190
|
+
log.error('ChromeLauncher', stderr);
|
191
|
+
return reject(err);
|
192
|
+
}
|
193
|
+
utils_1.delay(launcher.pollInterval).then(poll);
|
194
|
+
});
|
195
|
+
};
|
196
|
+
poll();
|
197
|
+
});
|
198
|
+
}
|
199
|
+
kill() {
|
200
|
+
return new Promise(resolve => {
|
201
|
+
if (this.chrome) {
|
202
|
+
this.chrome.on('close', () => {
|
203
|
+
this.destroyTmp().then(resolve);
|
204
|
+
});
|
205
|
+
log.log('ChromeLauncher', 'Killing all Chrome Instances');
|
206
|
+
try {
|
207
|
+
if (isWindows) {
|
208
|
+
execSync(`taskkill /pid ${this.chrome.pid} /T /F`);
|
209
|
+
}
|
210
|
+
else {
|
211
|
+
process.kill(-this.chrome.pid);
|
212
|
+
}
|
213
|
+
}
|
214
|
+
catch (err) {
|
215
|
+
log.warn('ChromeLauncher', `Chrome could not be killed ${err.message}`);
|
216
|
+
}
|
217
|
+
delete this.chrome;
|
218
|
+
}
|
219
|
+
else {
|
220
|
+
// fail silently as we did not start chrome
|
221
|
+
resolve();
|
222
|
+
}
|
223
|
+
});
|
224
|
+
}
|
225
|
+
destroyTmp() {
|
226
|
+
return new Promise(resolve => {
|
227
|
+
// Only clean up the tmp dir if we created it.
|
228
|
+
if (this.userDataDir === undefined || this.opts.userDataDir !== undefined) {
|
229
|
+
return resolve();
|
230
|
+
}
|
231
|
+
if (this.outFile) {
|
232
|
+
this.fs.closeSync(this.outFile);
|
233
|
+
delete this.outFile;
|
234
|
+
}
|
235
|
+
if (this.errFile) {
|
236
|
+
this.fs.closeSync(this.errFile);
|
237
|
+
delete this.errFile;
|
238
|
+
}
|
239
|
+
this.rimraf(this.userDataDir, () => resolve());
|
240
|
+
});
|
241
|
+
}
|
242
|
+
}
|
243
|
+
exports.Launcher = Launcher;
|
244
|
+
;
|
245
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hyb21lLWxhdW5jaGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY2hyb21lLWxhdW5jaGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7O0dBSUc7QUFDSCxZQUFZLENBQUM7Ozs7Ozs7Ozs7QUFFYiw4Q0FBOEM7QUFDOUMseUJBQXlCO0FBQ3pCLGdEQUFnRDtBQUNoRCwrQ0FBNEM7QUFDNUMsbUNBQXNDO0FBQ3RDLG1DQUFvRDtBQUNwRCwyQkFBMkI7QUFDM0IsTUFBTSxNQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0FBQ2pDLE1BQU0sR0FBRyxHQUFHLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQyxDQUFDO0FBQ3pDLE1BQU0sS0FBSyxHQUFHLFlBQVksQ0FBQyxLQUFLLENBQUM7QUFDakMsTUFBTSxRQUFRLEdBQUcsWUFBWSxDQUFDLFFBQVEsQ0FBQztBQUN2QyxNQUFNLFNBQVMsR0FBRyxPQUFPLENBQUMsUUFBUSxLQUFLLE9BQU8sQ0FBQztBQUMvQyxNQUFNLE9BQU8sR0FBRyxRQUFRLENBQUM7QUFDekIsTUFBTSxpQkFBaUIsR0FBRyxHQUFHLENBQUM7QUFDOUIsTUFBTSxvQkFBb0IsR0FBRyxJQUFJLEdBQUcsQ0FBQyxDQUFDLFFBQVEsRUFBRSxPQUFPLEV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