1
0
mirror of https://github.com/c9fe/22120.git synced 2024-11-15 15:32:29 +01:00
22120/12.22120.js

3 lines
17 KiB
JavaScript
Raw Normal View History

2021-11-03 05:55:13 +01:00
#!/usr/bin/env node
/*! For license information please see 12.22120.js.LICENSE.txt */
"use strict";exports.id=12,exports.ids=[12],exports.modules={4534:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.win32=t.wsl=t.linux=t.darwin=t.darwinFast=void 0;const s=r(7147),o=r(1017),n=r(2037),i=r(2081),a=r(3150),c=r(8269),h=r(5317),l=/\r?\n/;function u(){const e=["/Contents/MacOS/Google Chrome Canary","/Contents/MacOS/Google Chrome"],t=[],r=p();r&&t.push(r),i.execSync("/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep -i 'google chrome\\( canary\\)\\?\\.app' | awk '{$1=\"\"; print $0}'").toString().split(l).forEach((r=>{e.forEach((e=>{const s=o.join(r.substring(0,r.indexOf(".app")+4).trim(),e);m(s)&&-1===t.indexOf(s)&&t.push(s)}))}));const s=a(process.env.HOME||n.homedir()),c=[{regex:new RegExp(`^${s}/Applications/.*Chrome\\.app`),weight:50},{regex:new RegExp(`^${s}/Applications/.*Chrome Canary\\.app`),weight:51},{regex:/^\/Applications\/.*Chrome.app/,weight:100},{regex:/^\/Applications\/.*Chrome Canary.app/,weight:101},{regex:/^\/Volumes\/.*Chrome.app/,weight:-2},{regex:/^\/Volumes\/.*Chrome Canary.app/,weight:-1}];return process.env.LIGHTHOUSE_CHROMIUM_PATH&&c.unshift({regex:new RegExp(a(process.env.LIGHTHOUSE_CHROMIUM_PATH)),weight:150}),process.env.CHROME_PATH&&c.unshift({regex:new RegExp(a(process.env.CHROME_PATH)),weight:151}),g(t,c)}function p(){return m(process.env.CHROME_PATH)?process.env.CHROME_PATH:m(process.env.LIGHTHOUSE_CHROMIUM_PATH)?(c.warn("ChromeLauncher","LIGHTHOUSE_CHROMIUM_PATH is deprecated, use CHROME_PATH env variable instead."),process.env.LIGHTHOUSE_CHROMIUM_PATH):void 0}function d(){const e=[],t=[`${o.sep}Google${o.sep}Chrome SxS${o.sep}Application${o.sep}chrome.exe`,`${o.sep}Google${o.sep}Chrome${o.sep}Application${o.sep}chrome.exe`],r=[process.env.LOCALAPPDATA,process.env.PROGRAMFILES,process.env["PROGRAMFILES(X86)"]].filter(Boolean),s=p();return s&&e.push(s),r.forEach((r=>t.forEach((t=>{const s=o.join(r,t);m(s)&&e.push(s)})))),e}function g(e,t){return e.map((e=>{for(const r of t)if(r.regex.test(e))return{path:e,weight:r.weight};return{path:e,weight:10}})).sort(((e,t)=>t.weight-e.weight)).map((e=>e.path))}function m(e){if(!e)return!1;try{return s.accessSync(e),!0}catch(e){return!1}}t.darwinFast=function(){const e=[process.env.CHROME_PATH,process.env.LIGHTHOUSE_CHROMIUM_PATH,"/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary","/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"];for(const t of e)if(t&&m(t))return t;return u()[0]},t.darwin=u,t.linux=function(){let e=[];const t=p();if(t&&e.push(t),[o.join(n.homedir(),".local/share/applications/"),"/usr/share/applications/"].forEach((t=>{e=e.concat(function(e){const t=/(^[^ ]+).*/,r="^Exec=/.*/(google-chrome|chrome|chromium)-.*";let s=[];if(m(e)){let o;try{o=i.execSync(`grep -ER "${r}" ${e} | awk -F '=' '{print $2}'`,{stdio:"pipe"})}catch(t){o=i.execSync(`grep -Er "${r}" ${e} | awk -F '=' '{print $2}'`,{stdio:"pipe"})}o=o.toString().split(l).map((e=>e.replace(t,"$1"))),o.forEach((e=>m(e)&&s.push(e)))}return s}(t))})),["google-chrome-stable","google-chrome","chromium-browser","chromium"].forEach((t=>{try{const r=i.execFileSync("which",[t],{stdio:"pipe"}).toString().split(l)[0];m(r)&&e.push(r)}catch(e){}})),!e.length)throw new h.ChromePathNotSetError;const r=[{regex:/chrome-wrapper$/,weight:51},{regex:/google-chrome-stable$/,weight:50},{regex:/google-chrome$/,weight:49},{regex:/chromium-browser$/,weight:48},{regex:/chromium$/,weight:47}];return process.env.LIGHTHOUSE_CHROMIUM_PATH&&r.unshift({regex:new RegExp(a(process.env.LIGHTHOUSE_CHROMIUM_PATH)),weight:100}),process.env.CHROME_PATH&&r.unshift({regex:new RegExp(a(process.env.CHROME_PATH)),weight:101}),g((s=e.filter(Boolean),Array.from(new Set(s))),r);var s},t.wsl=function(){return process.env.LOCALAPPDATA=h.getLocalAppDataPath(`${process.env.PATH}`),process.env.PROGRAMFILES="/mnt/c/Program Files",process.env["PROGRAMFILES(X86)"]="/mnt/c/Program Files (x86)",d()},t.win32=d},1723:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.killAll=t.laun