@socketsecurity/cli-with-sentry 1.14.0 → 1.15.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.
- package/CHANGELOG.md +18 -0
- package/README.md +31 -6
- package/dist/cli.js +355 -206
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +7 -4
- package/dist/constants.js.map +1 -1
- package/dist/manifest-scripts/dotnet-tool/socket-facts-dotnet.dll +0 -0
- package/dist/manifest-scripts/maven-extension/coana-maven-extension.jar +0 -0
- package/dist/shadow-npm-bin2.js +5 -2
- package/dist/shadow-npm-bin2.js.map +1 -1
- package/dist/shadow-pnpm-bin2.js +3 -2
- package/dist/shadow-pnpm-bin2.js.map +1 -1
- package/dist/shadow-yarn-bin.js +4 -2
- package/dist/shadow-yarn-bin.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/config/handle-config-set.d.mts.map +1 -1
- package/dist/types/commands/login/apply-login.d.mts.map +1 -1
- package/dist/types/commands/login/attempt-login.d.mts +5 -1
- package/dist/types/commands/login/attempt-login.d.mts.map +1 -1
- package/dist/types/commands/login/cmd-login.d.mts.map +1 -1
- package/dist/types/commands/logout/apply-logout.d.mts.map +1 -1
- package/dist/types/commands/logout/attempt-logout.d.mts +1 -1
- package/dist/types/commands/logout/attempt-logout.d.mts.map +1 -1
- package/dist/types/commands/manifest/bazel/bazel-socket-json-trust.d.mts +35 -0
- package/dist/types/commands/manifest/bazel/bazel-socket-json-trust.d.mts.map +1 -0
- package/dist/types/commands/manifest/bazel/cmd-manifest-bazel.d.mts.map +1 -1
- package/dist/types/commands/scan/fetch-report-data.d.mts +1 -8
- package/dist/types/commands/scan/fetch-report-data.d.mts.map +1 -1
- package/dist/types/commands/scan/generate-report.d.mts +1 -2
- package/dist/types/commands/scan/generate-report.d.mts.map +1 -1
- package/dist/types/commands/scan/output-scan-report.d.mts +0 -2
- package/dist/types/commands/scan/output-scan-report.d.mts.map +1 -1
- package/dist/types/constants.d.mts +4 -2
- package/dist/types/constants.d.mts.map +1 -1
- package/dist/types/shadow/npm-base.d.mts.map +1 -1
- package/dist/types/shadow/pnpm/bin.d.mts.map +1 -1
- package/dist/types/shadow/yarn/bin.d.mts.map +1 -1
- package/dist/types/utils/api-transport.d.mts +4 -0
- package/dist/types/utils/api-transport.d.mts.map +1 -0
- package/dist/types/utils/api.d.mts +2 -1
- package/dist/types/utils/api.d.mts.map +1 -1
- package/dist/types/utils/cmd.d.mts.map +1 -1
- package/dist/types/utils/coana-release.d.mts.map +1 -1
- package/dist/types/utils/config.d.mts +1 -0
- package/dist/types/utils/config.d.mts.map +1 -1
- package/dist/types/utils/oauth.d.mts +33 -0
- package/dist/types/utils/oauth.d.mts.map +1 -0
- package/dist/types/utils/package-manager.d.mts +2 -2
- package/dist/types/utils/package-manager.d.mts.map +1 -1
- package/dist/types/utils/sdk.d.mts +14 -6
- package/dist/types/utils/sdk.d.mts.map +1 -1
- package/dist/utils.js +809 -128
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +567 -567
- package/package.json +2 -2
- package/requirements.json +2 -2
package/dist/vendor.js
CHANGED
|
@@ -22,6 +22,8 @@ var require$$12 = require$$1$7;
|
|
|
22
22
|
var require$$13 = require$$2$4;
|
|
23
23
|
var require$$14 = require('node:console');
|
|
24
24
|
var require$$15 = require('node:tty');
|
|
25
|
+
var node_buffer = require$$0$b;
|
|
26
|
+
var childProcess = require('node:child_process');
|
|
25
27
|
var require$$0$d = os$4;
|
|
26
28
|
var require$$1$9 = require$$15;
|
|
27
29
|
var require$$0$e = require$$10;
|
|
@@ -29,8 +31,6 @@ var require$$0$f = path$4;
|
|
|
29
31
|
var require$$0$g = require('node:stream');
|
|
30
32
|
var require$$0$i = require('node:events');
|
|
31
33
|
var require$$0$h = u;
|
|
32
|
-
var node_buffer = require$$0$b;
|
|
33
|
-
var childProcess = require('node:child_process');
|
|
34
34
|
var require$$0$j = require$$0$i;
|
|
35
35
|
var require$$1$a = require$$0$g;
|
|
36
36
|
var require$$2$5 = require('node:string_decoder');
|
|
@@ -24651,35 +24651,6 @@ function requireConfig$3() {
|
|
|
24651
24651
|
|
|
24652
24652
|
var configExports = requireConfig$3();
|
|
24653
24653
|
|
|
24654
|
-
var isInteractive;
|
|
24655
|
-
var hasRequiredIsInteractive;
|
|
24656
|
-
|
|
24657
|
-
function requireIsInteractive () {
|
|
24658
|
-
if (hasRequiredIsInteractive) return isInteractive;
|
|
24659
|
-
hasRequiredIsInteractive = 1;
|
|
24660
|
-
|
|
24661
|
-
let _process;
|
|
24662
|
-
function getProcess() {
|
|
24663
|
-
if (_process === undefined) {
|
|
24664
|
-
// Use non-'node:' prefixed require to avoid Webpack errors.
|
|
24665
|
-
// eslint-disable-next-line n/prefer-node-protocol
|
|
24666
|
-
_process = require$$0$a;
|
|
24667
|
-
}
|
|
24668
|
-
return _process
|
|
24669
|
-
}
|
|
24670
|
-
|
|
24671
|
-
isInteractive = function isInteractive({ stream = getProcess().stdout } = {}) {
|
|
24672
|
-
if (!(stream && stream.isTTY)) {
|
|
24673
|
-
return false
|
|
24674
|
-
}
|
|
24675
|
-
const { env } = getProcess();
|
|
24676
|
-
return env.TERM !== 'dumb' && !('CI' in env)
|
|
24677
|
-
};
|
|
24678
|
-
return isInteractive;
|
|
24679
|
-
}
|
|
24680
|
-
|
|
24681
|
-
var isInteractiveExports = /*@__PURE__*/ requireIsInteractive();
|
|
24682
|
-
|
|
24683
24654
|
var dist$e = {};
|
|
24684
24655
|
|
|
24685
24656
|
var hasRequiredDist$e;function requireDist$e(){if(hasRequiredDist$e)return dist$e;hasRequiredDist$e=1;(function(exports){Object.defineProperty(exports,Symbol.toStringTag,{value:'Module'});//#region \0rolldown/runtime.js
|
|
@@ -33932,6 +33903,541 @@ exports.ResponseError=ResponseError;exports.SocketSdk=SocketSdk;exports.assemble
|
|
|
33932
33903
|
|
|
33933
33904
|
var distExports$1 = requireDist$e();
|
|
33934
33905
|
|
|
33906
|
+
let isDockerCached;
|
|
33907
|
+
function hasDockerEnv() {
|
|
33908
|
+
try {
|
|
33909
|
+
u.statSync('/.dockerenv');
|
|
33910
|
+
return true;
|
|
33911
|
+
} catch {
|
|
33912
|
+
return false;
|
|
33913
|
+
}
|
|
33914
|
+
}
|
|
33915
|
+
function hasDockerCGroup() {
|
|
33916
|
+
try {
|
|
33917
|
+
return u.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
|
|
33918
|
+
} catch {
|
|
33919
|
+
return false;
|
|
33920
|
+
}
|
|
33921
|
+
}
|
|
33922
|
+
function isDocker() {
|
|
33923
|
+
// TODO: Use `??=` when targeting Node.js 16.
|
|
33924
|
+
if (isDockerCached === undefined) {
|
|
33925
|
+
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
33926
|
+
}
|
|
33927
|
+
return isDockerCached;
|
|
33928
|
+
}
|
|
33929
|
+
|
|
33930
|
+
let cachedResult;
|
|
33931
|
+
|
|
33932
|
+
// Podman detection
|
|
33933
|
+
const hasContainerEnv = () => {
|
|
33934
|
+
try {
|
|
33935
|
+
u.statSync('/run/.containerenv');
|
|
33936
|
+
return true;
|
|
33937
|
+
} catch {
|
|
33938
|
+
return false;
|
|
33939
|
+
}
|
|
33940
|
+
};
|
|
33941
|
+
function isInsideContainer() {
|
|
33942
|
+
// TODO: Use `??=` when targeting Node.js 16.
|
|
33943
|
+
if (cachedResult === undefined) {
|
|
33944
|
+
cachedResult = hasContainerEnv() || isDocker();
|
|
33945
|
+
}
|
|
33946
|
+
return cachedResult;
|
|
33947
|
+
}
|
|
33948
|
+
|
|
33949
|
+
const isWsl = () => {
|
|
33950
|
+
if (process$2.platform !== 'linux') {
|
|
33951
|
+
return false;
|
|
33952
|
+
}
|
|
33953
|
+
if (os$4.release().toLowerCase().includes('microsoft')) {
|
|
33954
|
+
if (isInsideContainer()) {
|
|
33955
|
+
return false;
|
|
33956
|
+
}
|
|
33957
|
+
return true;
|
|
33958
|
+
}
|
|
33959
|
+
try {
|
|
33960
|
+
return u.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft') ? !isInsideContainer() : false;
|
|
33961
|
+
} catch {
|
|
33962
|
+
return false;
|
|
33963
|
+
}
|
|
33964
|
+
};
|
|
33965
|
+
var isWsl$1 = process$2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
33966
|
+
|
|
33967
|
+
const wslDrivesMountPoint = (() => {
|
|
33968
|
+
// Default value for "root" param
|
|
33969
|
+
// according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config
|
|
33970
|
+
const defaultMountPoint = '/mnt/';
|
|
33971
|
+
let mountPoint;
|
|
33972
|
+
return async function () {
|
|
33973
|
+
if (mountPoint) {
|
|
33974
|
+
// Return memoized mount point value
|
|
33975
|
+
return mountPoint;
|
|
33976
|
+
}
|
|
33977
|
+
const configFilePath = '/etc/wsl.conf';
|
|
33978
|
+
let isConfigFileExists = false;
|
|
33979
|
+
try {
|
|
33980
|
+
await fs$6.access(configFilePath, fs$6.constants.F_OK);
|
|
33981
|
+
isConfigFileExists = true;
|
|
33982
|
+
} catch {}
|
|
33983
|
+
if (!isConfigFileExists) {
|
|
33984
|
+
return defaultMountPoint;
|
|
33985
|
+
}
|
|
33986
|
+
const configContent = await fs$6.readFile(configFilePath, {
|
|
33987
|
+
encoding: 'utf8'
|
|
33988
|
+
});
|
|
33989
|
+
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
33990
|
+
if (!configMountPoint) {
|
|
33991
|
+
return defaultMountPoint;
|
|
33992
|
+
}
|
|
33993
|
+
mountPoint = configMountPoint.groups.mountPoint.trim();
|
|
33994
|
+
mountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;
|
|
33995
|
+
return mountPoint;
|
|
33996
|
+
};
|
|
33997
|
+
})();
|
|
33998
|
+
const powerShellPathFromWsl = async () => {
|
|
33999
|
+
const mountPoint = await wslDrivesMountPoint();
|
|
34000
|
+
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
34001
|
+
};
|
|
34002
|
+
const powerShellPath = async () => {
|
|
34003
|
+
if (isWsl$1) {
|
|
34004
|
+
return powerShellPathFromWsl();
|
|
34005
|
+
}
|
|
34006
|
+
return `${process$2.env.SYSTEMROOT || process$2.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
34007
|
+
};
|
|
34008
|
+
|
|
34009
|
+
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
34010
|
+
const define = value => Object.defineProperty(object, propertyName, {
|
|
34011
|
+
value,
|
|
34012
|
+
enumerable: true,
|
|
34013
|
+
writable: true
|
|
34014
|
+
});
|
|
34015
|
+
Object.defineProperty(object, propertyName, {
|
|
34016
|
+
configurable: true,
|
|
34017
|
+
enumerable: true,
|
|
34018
|
+
get() {
|
|
34019
|
+
const result = valueGetter();
|
|
34020
|
+
define(result);
|
|
34021
|
+
return result;
|
|
34022
|
+
},
|
|
34023
|
+
set(value) {
|
|
34024
|
+
define(value);
|
|
34025
|
+
}
|
|
34026
|
+
});
|
|
34027
|
+
return object;
|
|
34028
|
+
}
|
|
34029
|
+
|
|
34030
|
+
const execFileAsync$3 = require$$10.promisify(childProcess.execFile);
|
|
34031
|
+
async function defaultBrowserId() {
|
|
34032
|
+
if (process$2.platform !== 'darwin') {
|
|
34033
|
+
throw new Error('macOS only');
|
|
34034
|
+
}
|
|
34035
|
+
const {
|
|
34036
|
+
stdout
|
|
34037
|
+
} = await execFileAsync$3('defaults', ['read', 'com.apple.LaunchServices/com.apple.launchservices.secure', 'LSHandlers']);
|
|
34038
|
+
|
|
34039
|
+
// `(?!-)` is to prevent matching `LSHandlerRoleAll = "-";`.
|
|
34040
|
+
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
34041
|
+
return match?.groups.id ?? 'com.apple.Safari';
|
|
34042
|
+
}
|
|
34043
|
+
|
|
34044
|
+
const execFileAsync$2 = require$$10.promisify(childProcess.execFile);
|
|
34045
|
+
async function runAppleScript(script, {
|
|
34046
|
+
humanReadableOutput = true,
|
|
34047
|
+
signal
|
|
34048
|
+
} = {}) {
|
|
34049
|
+
if (process$2.platform !== 'darwin') {
|
|
34050
|
+
throw new Error('macOS only');
|
|
34051
|
+
}
|
|
34052
|
+
const outputArguments = humanReadableOutput ? [] : ['-ss'];
|
|
34053
|
+
const execOptions = {};
|
|
34054
|
+
if (signal) {
|
|
34055
|
+
execOptions.signal = signal;
|
|
34056
|
+
}
|
|
34057
|
+
const {
|
|
34058
|
+
stdout
|
|
34059
|
+
} = await execFileAsync$2('osascript', ['-e', script, outputArguments], execOptions);
|
|
34060
|
+
return stdout.trim();
|
|
34061
|
+
}
|
|
34062
|
+
|
|
34063
|
+
async function bundleName(bundleId) {
|
|
34064
|
+
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
34065
|
+
}
|
|
34066
|
+
|
|
34067
|
+
const execFileAsync$1 = require$$10.promisify(childProcess.execFile);
|
|
34068
|
+
|
|
34069
|
+
// Windows doesn't have browser IDs in the same way macOS/Linux does so we give fake
|
|
34070
|
+
// ones that look real and match the macOS/Linux versions for cross-platform apps.
|
|
34071
|
+
const windowsBrowserProgIds = {
|
|
34072
|
+
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: {
|
|
34073
|
+
name: 'Edge',
|
|
34074
|
+
id: 'com.microsoft.edge.old'
|
|
34075
|
+
},
|
|
34076
|
+
MSEdgeDHTML: {
|
|
34077
|
+
name: 'Edge',
|
|
34078
|
+
id: 'com.microsoft.edge'
|
|
34079
|
+
},
|
|
34080
|
+
// On macOS, it's "com.microsoft.edgemac"
|
|
34081
|
+
MSEdgeHTM: {
|
|
34082
|
+
name: 'Edge',
|
|
34083
|
+
id: 'com.microsoft.edge'
|
|
34084
|
+
},
|
|
34085
|
+
// Newer Edge/Win10 releases
|
|
34086
|
+
'IE.HTTP': {
|
|
34087
|
+
name: 'Internet Explorer',
|
|
34088
|
+
id: 'com.microsoft.ie'
|
|
34089
|
+
},
|
|
34090
|
+
FirefoxURL: {
|
|
34091
|
+
name: 'Firefox',
|
|
34092
|
+
id: 'org.mozilla.firefox'
|
|
34093
|
+
},
|
|
34094
|
+
ChromeHTML: {
|
|
34095
|
+
name: 'Chrome',
|
|
34096
|
+
id: 'com.google.chrome'
|
|
34097
|
+
},
|
|
34098
|
+
BraveHTML: {
|
|
34099
|
+
name: 'Brave',
|
|
34100
|
+
id: 'com.brave.Browser'
|
|
34101
|
+
},
|
|
34102
|
+
BraveBHTML: {
|
|
34103
|
+
name: 'Brave Beta',
|
|
34104
|
+
id: 'com.brave.Browser.beta'
|
|
34105
|
+
},
|
|
34106
|
+
BraveSSHTM: {
|
|
34107
|
+
name: 'Brave Nightly',
|
|
34108
|
+
id: 'com.brave.Browser.nightly'
|
|
34109
|
+
}
|
|
34110
|
+
};
|
|
34111
|
+
class UnknownBrowserError extends Error {}
|
|
34112
|
+
async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
|
|
34113
|
+
const {
|
|
34114
|
+
stdout
|
|
34115
|
+
} = await _execFileAsync('reg', ['QUERY', ' HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice', '/v', 'ProgId']);
|
|
34116
|
+
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
34117
|
+
if (!match) {
|
|
34118
|
+
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
34119
|
+
}
|
|
34120
|
+
const {
|
|
34121
|
+
id
|
|
34122
|
+
} = match.groups;
|
|
34123
|
+
const browser = windowsBrowserProgIds[id];
|
|
34124
|
+
if (!browser) {
|
|
34125
|
+
throw new UnknownBrowserError(`Unknown browser ID: ${id}`);
|
|
34126
|
+
}
|
|
34127
|
+
return browser;
|
|
34128
|
+
}
|
|
34129
|
+
|
|
34130
|
+
const execFileAsync = require$$10.promisify(childProcess.execFile);
|
|
34131
|
+
|
|
34132
|
+
// Inlined: https://github.com/sindresorhus/titleize/blob/main/index.js
|
|
34133
|
+
const titleize = string => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, x => x.toUpperCase());
|
|
34134
|
+
async function defaultBrowser() {
|
|
34135
|
+
if (process$2.platform === 'darwin') {
|
|
34136
|
+
const id = await defaultBrowserId();
|
|
34137
|
+
const name = await bundleName(id);
|
|
34138
|
+
return {
|
|
34139
|
+
name,
|
|
34140
|
+
id
|
|
34141
|
+
};
|
|
34142
|
+
}
|
|
34143
|
+
if (process$2.platform === 'linux') {
|
|
34144
|
+
const {
|
|
34145
|
+
stdout
|
|
34146
|
+
} = await execFileAsync('xdg-mime', ['query', 'default', 'x-scheme-handler/http']);
|
|
34147
|
+
const id = stdout.trim();
|
|
34148
|
+
const name = titleize(id.replace(/.desktop$/, '').replace('-', ' '));
|
|
34149
|
+
return {
|
|
34150
|
+
name,
|
|
34151
|
+
id
|
|
34152
|
+
};
|
|
34153
|
+
}
|
|
34154
|
+
if (process$2.platform === 'win32') {
|
|
34155
|
+
return defaultBrowser$1();
|
|
34156
|
+
}
|
|
34157
|
+
throw new Error('Only macOS, Linux, and Windows are supported');
|
|
34158
|
+
}
|
|
34159
|
+
|
|
34160
|
+
const execFile = require$$10.promisify(childProcess.execFile);
|
|
34161
|
+
|
|
34162
|
+
// Path to included `xdg-open`.
|
|
34163
|
+
const __dirname$1 = path$4.dirname(require$$0$8.fileURLToPath((typeof document === 'undefined' ? require$$0$8.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vendor.js', document.baseURI).href))));
|
|
34164
|
+
const localXdgOpenPath = path$4.join(__dirname$1, 'xdg-open');
|
|
34165
|
+
const {
|
|
34166
|
+
platform,
|
|
34167
|
+
arch
|
|
34168
|
+
} = process$2;
|
|
34169
|
+
|
|
34170
|
+
/**
|
|
34171
|
+
Get the default browser name in Windows from WSL.
|
|
34172
|
+
|
|
34173
|
+
@returns {Promise<string>} Browser name.
|
|
34174
|
+
*/
|
|
34175
|
+
async function getWindowsDefaultBrowserFromWsl() {
|
|
34176
|
+
const powershellPath = await powerShellPath();
|
|
34177
|
+
const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
34178
|
+
const encodedCommand = node_buffer.Buffer.from(rawCommand, 'utf16le').toString('base64');
|
|
34179
|
+
const {
|
|
34180
|
+
stdout
|
|
34181
|
+
} = await execFile(powershellPath, ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand', encodedCommand], {
|
|
34182
|
+
encoding: 'utf8'
|
|
34183
|
+
});
|
|
34184
|
+
const progId = stdout.trim();
|
|
34185
|
+
|
|
34186
|
+
// Map ProgId to browser IDs
|
|
34187
|
+
const browserMap = {
|
|
34188
|
+
ChromeHTML: 'com.google.chrome',
|
|
34189
|
+
BraveHTML: 'com.brave.Browser',
|
|
34190
|
+
MSEdgeHTM: 'com.microsoft.edge',
|
|
34191
|
+
FirefoxURL: 'org.mozilla.firefox'
|
|
34192
|
+
};
|
|
34193
|
+
return browserMap[progId] ? {
|
|
34194
|
+
id: browserMap[progId]
|
|
34195
|
+
} : {};
|
|
34196
|
+
}
|
|
34197
|
+
const pTryEach = async (array, mapper) => {
|
|
34198
|
+
let latestError;
|
|
34199
|
+
for (const item of array) {
|
|
34200
|
+
try {
|
|
34201
|
+
return await mapper(item); // eslint-disable-line no-await-in-loop
|
|
34202
|
+
} catch (error) {
|
|
34203
|
+
latestError = error;
|
|
34204
|
+
}
|
|
34205
|
+
}
|
|
34206
|
+
throw latestError;
|
|
34207
|
+
};
|
|
34208
|
+
|
|
34209
|
+
// eslint-disable-next-line complexity
|
|
34210
|
+
const baseOpen = async options => {
|
|
34211
|
+
options = {
|
|
34212
|
+
wait: false,
|
|
34213
|
+
background: false,
|
|
34214
|
+
newInstance: false,
|
|
34215
|
+
allowNonzeroExitCode: false,
|
|
34216
|
+
...options
|
|
34217
|
+
};
|
|
34218
|
+
if (Array.isArray(options.app)) {
|
|
34219
|
+
return pTryEach(options.app, singleApp => baseOpen({
|
|
34220
|
+
...options,
|
|
34221
|
+
app: singleApp
|
|
34222
|
+
}));
|
|
34223
|
+
}
|
|
34224
|
+
let {
|
|
34225
|
+
name: app,
|
|
34226
|
+
arguments: appArguments = []
|
|
34227
|
+
} = options.app ?? {};
|
|
34228
|
+
appArguments = [...appArguments];
|
|
34229
|
+
if (Array.isArray(app)) {
|
|
34230
|
+
return pTryEach(app, appName => baseOpen({
|
|
34231
|
+
...options,
|
|
34232
|
+
app: {
|
|
34233
|
+
name: appName,
|
|
34234
|
+
arguments: appArguments
|
|
34235
|
+
}
|
|
34236
|
+
}));
|
|
34237
|
+
}
|
|
34238
|
+
if (app === 'browser' || app === 'browserPrivate') {
|
|
34239
|
+
// IDs from default-browser for macOS and windows are the same
|
|
34240
|
+
const ids = {
|
|
34241
|
+
'com.google.chrome': 'chrome',
|
|
34242
|
+
'google-chrome.desktop': 'chrome',
|
|
34243
|
+
'com.brave.Browser': 'brave',
|
|
34244
|
+
'org.mozilla.firefox': 'firefox',
|
|
34245
|
+
'firefox.desktop': 'firefox',
|
|
34246
|
+
'com.microsoft.msedge': 'edge',
|
|
34247
|
+
'com.microsoft.edge': 'edge',
|
|
34248
|
+
'com.microsoft.edgemac': 'edge',
|
|
34249
|
+
'microsoft-edge.desktop': 'edge'
|
|
34250
|
+
};
|
|
34251
|
+
|
|
34252
|
+
// Incognito flags for each browser in `apps`.
|
|
34253
|
+
const flags = {
|
|
34254
|
+
chrome: '--incognito',
|
|
34255
|
+
brave: '--incognito',
|
|
34256
|
+
firefox: '--private-window',
|
|
34257
|
+
edge: '--inPrivate'
|
|
34258
|
+
};
|
|
34259
|
+
const browser = isWsl$1 ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser();
|
|
34260
|
+
if (browser.id in ids) {
|
|
34261
|
+
const browserName = ids[browser.id];
|
|
34262
|
+
if (app === 'browserPrivate') {
|
|
34263
|
+
appArguments.push(flags[browserName]);
|
|
34264
|
+
}
|
|
34265
|
+
return baseOpen({
|
|
34266
|
+
...options,
|
|
34267
|
+
app: {
|
|
34268
|
+
name: apps[browserName],
|
|
34269
|
+
arguments: appArguments
|
|
34270
|
+
}
|
|
34271
|
+
});
|
|
34272
|
+
}
|
|
34273
|
+
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
34274
|
+
}
|
|
34275
|
+
let command;
|
|
34276
|
+
const cliArguments = [];
|
|
34277
|
+
const childProcessOptions = {};
|
|
34278
|
+
if (platform === 'darwin') {
|
|
34279
|
+
command = 'open';
|
|
34280
|
+
if (options.wait) {
|
|
34281
|
+
cliArguments.push('--wait-apps');
|
|
34282
|
+
}
|
|
34283
|
+
if (options.background) {
|
|
34284
|
+
cliArguments.push('--background');
|
|
34285
|
+
}
|
|
34286
|
+
if (options.newInstance) {
|
|
34287
|
+
cliArguments.push('--new');
|
|
34288
|
+
}
|
|
34289
|
+
if (app) {
|
|
34290
|
+
cliArguments.push('-a', app);
|
|
34291
|
+
}
|
|
34292
|
+
} else if (platform === 'win32' || isWsl$1 && !isInsideContainer() && !app) {
|
|
34293
|
+
command = await powerShellPath();
|
|
34294
|
+
cliArguments.push('-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand');
|
|
34295
|
+
if (!isWsl$1) {
|
|
34296
|
+
childProcessOptions.windowsVerbatimArguments = true;
|
|
34297
|
+
}
|
|
34298
|
+
const encodedArguments = ['Start'];
|
|
34299
|
+
if (options.wait) {
|
|
34300
|
+
encodedArguments.push('-Wait');
|
|
34301
|
+
}
|
|
34302
|
+
if (app) {
|
|
34303
|
+
// Double quote with double quotes to ensure the inner quotes are passed through.
|
|
34304
|
+
// Inner quotes are delimited for PowerShell interpretation with backticks.
|
|
34305
|
+
encodedArguments.push(`"\`"${app}\`""`);
|
|
34306
|
+
if (options.target) {
|
|
34307
|
+
appArguments.push(options.target);
|
|
34308
|
+
}
|
|
34309
|
+
} else if (options.target) {
|
|
34310
|
+
encodedArguments.push(`"${options.target}"`);
|
|
34311
|
+
}
|
|
34312
|
+
if (appArguments.length > 0) {
|
|
34313
|
+
appArguments = appArguments.map(argument => `"\`"${argument}\`""`);
|
|
34314
|
+
encodedArguments.push('-ArgumentList', appArguments.join(','));
|
|
34315
|
+
}
|
|
34316
|
+
|
|
34317
|
+
// Using Base64-encoded command, accepted by PowerShell, to allow special characters.
|
|
34318
|
+
options.target = node_buffer.Buffer.from(encodedArguments.join(' '), 'utf16le').toString('base64');
|
|
34319
|
+
} else {
|
|
34320
|
+
if (app) {
|
|
34321
|
+
command = app;
|
|
34322
|
+
} else {
|
|
34323
|
+
// When bundled by Webpack, there's no actual package file path and no local `xdg-open`.
|
|
34324
|
+
const isBundled = !__dirname$1 || __dirname$1 === '/';
|
|
34325
|
+
|
|
34326
|
+
// Check if local `xdg-open` exists and is executable.
|
|
34327
|
+
let exeLocalXdgOpen = false;
|
|
34328
|
+
try {
|
|
34329
|
+
await fs$6.access(localXdgOpenPath, fs$6.constants.X_OK);
|
|
34330
|
+
exeLocalXdgOpen = true;
|
|
34331
|
+
} catch {}
|
|
34332
|
+
const useSystemXdgOpen = process$2.versions.electron ?? (platform === 'android' || isBundled || !exeLocalXdgOpen);
|
|
34333
|
+
command = useSystemXdgOpen ? 'xdg-open' : localXdgOpenPath;
|
|
34334
|
+
}
|
|
34335
|
+
if (appArguments.length > 0) {
|
|
34336
|
+
cliArguments.push(...appArguments);
|
|
34337
|
+
}
|
|
34338
|
+
if (!options.wait) {
|
|
34339
|
+
// `xdg-open` will block the process unless stdio is ignored
|
|
34340
|
+
// and it's detached from the parent even if it's unref'd.
|
|
34341
|
+
childProcessOptions.stdio = 'ignore';
|
|
34342
|
+
childProcessOptions.detached = true;
|
|
34343
|
+
}
|
|
34344
|
+
}
|
|
34345
|
+
if (platform === 'darwin' && appArguments.length > 0) {
|
|
34346
|
+
cliArguments.push('--args', ...appArguments);
|
|
34347
|
+
}
|
|
34348
|
+
|
|
34349
|
+
// This has to come after `--args`.
|
|
34350
|
+
if (options.target) {
|
|
34351
|
+
cliArguments.push(options.target);
|
|
34352
|
+
}
|
|
34353
|
+
const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
|
|
34354
|
+
if (options.wait) {
|
|
34355
|
+
return new Promise((resolve, reject) => {
|
|
34356
|
+
subprocess.once('error', reject);
|
|
34357
|
+
subprocess.once('close', exitCode => {
|
|
34358
|
+
if (!options.allowNonzeroExitCode && exitCode > 0) {
|
|
34359
|
+
reject(new Error(`Exited with code ${exitCode}`));
|
|
34360
|
+
return;
|
|
34361
|
+
}
|
|
34362
|
+
resolve(subprocess);
|
|
34363
|
+
});
|
|
34364
|
+
});
|
|
34365
|
+
}
|
|
34366
|
+
subprocess.unref();
|
|
34367
|
+
return subprocess;
|
|
34368
|
+
};
|
|
34369
|
+
const open = (target, options) => {
|
|
34370
|
+
if (typeof target !== 'string') {
|
|
34371
|
+
throw new TypeError('Expected a `target`');
|
|
34372
|
+
}
|
|
34373
|
+
return baseOpen({
|
|
34374
|
+
...options,
|
|
34375
|
+
target
|
|
34376
|
+
});
|
|
34377
|
+
};
|
|
34378
|
+
function detectArchBinary(binary) {
|
|
34379
|
+
if (typeof binary === 'string' || Array.isArray(binary)) {
|
|
34380
|
+
return binary;
|
|
34381
|
+
}
|
|
34382
|
+
const {
|
|
34383
|
+
[arch]: archBinary
|
|
34384
|
+
} = binary;
|
|
34385
|
+
if (!archBinary) {
|
|
34386
|
+
throw new Error(`${arch} is not supported`);
|
|
34387
|
+
}
|
|
34388
|
+
return archBinary;
|
|
34389
|
+
}
|
|
34390
|
+
function detectPlatformBinary({
|
|
34391
|
+
[platform]: platformBinary
|
|
34392
|
+
}, {
|
|
34393
|
+
wsl
|
|
34394
|
+
}) {
|
|
34395
|
+
if (wsl && isWsl$1) {
|
|
34396
|
+
return detectArchBinary(wsl);
|
|
34397
|
+
}
|
|
34398
|
+
if (!platformBinary) {
|
|
34399
|
+
throw new Error(`${platform} is not supported`);
|
|
34400
|
+
}
|
|
34401
|
+
return detectArchBinary(platformBinary);
|
|
34402
|
+
}
|
|
34403
|
+
const apps = {};
|
|
34404
|
+
defineLazyProperty(apps, 'chrome', () => detectPlatformBinary({
|
|
34405
|
+
darwin: 'google chrome',
|
|
34406
|
+
win32: 'chrome',
|
|
34407
|
+
linux: ['google-chrome', 'google-chrome-stable', 'chromium']
|
|
34408
|
+
}, {
|
|
34409
|
+
wsl: {
|
|
34410
|
+
ia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',
|
|
34411
|
+
x64: ['/mnt/c/Program Files/Google/Chrome/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe']
|
|
34412
|
+
}
|
|
34413
|
+
}));
|
|
34414
|
+
defineLazyProperty(apps, 'brave', () => detectPlatformBinary({
|
|
34415
|
+
darwin: 'brave browser',
|
|
34416
|
+
win32: 'brave',
|
|
34417
|
+
linux: ['brave-browser', 'brave']
|
|
34418
|
+
}, {
|
|
34419
|
+
wsl: {
|
|
34420
|
+
ia32: '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe',
|
|
34421
|
+
x64: ['/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe', '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe']
|
|
34422
|
+
}
|
|
34423
|
+
}));
|
|
34424
|
+
defineLazyProperty(apps, 'firefox', () => detectPlatformBinary({
|
|
34425
|
+
darwin: 'firefox',
|
|
34426
|
+
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
34427
|
+
linux: 'firefox'
|
|
34428
|
+
}, {
|
|
34429
|
+
wsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe'
|
|
34430
|
+
}));
|
|
34431
|
+
defineLazyProperty(apps, 'edge', () => detectPlatformBinary({
|
|
34432
|
+
darwin: 'microsoft edge',
|
|
34433
|
+
win32: 'msedge',
|
|
34434
|
+
linux: ['microsoft-edge', 'microsoft-edge-dev']
|
|
34435
|
+
}, {
|
|
34436
|
+
wsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'
|
|
34437
|
+
}));
|
|
34438
|
+
defineLazyProperty(apps, 'browser', () => 'browser');
|
|
34439
|
+
defineLazyProperty(apps, 'browserPrivate', () => 'browserPrivate');
|
|
34440
|
+
|
|
33935
34441
|
var yoctocolorsCjs;
|
|
33936
34442
|
var hasRequiredYoctocolorsCjs;
|
|
33937
34443
|
function requireYoctocolorsCjs() {
|
|
@@ -46593,541 +47099,6 @@ function requirePackageurlJs() {
|
|
|
46593
47099
|
|
|
46594
47100
|
var packageurlJsExports = /*@__PURE__*/ requirePackageurlJs();
|
|
46595
47101
|
|
|
46596
|
-
let isDockerCached;
|
|
46597
|
-
function hasDockerEnv() {
|
|
46598
|
-
try {
|
|
46599
|
-
u.statSync('/.dockerenv');
|
|
46600
|
-
return true;
|
|
46601
|
-
} catch {
|
|
46602
|
-
return false;
|
|
46603
|
-
}
|
|
46604
|
-
}
|
|
46605
|
-
function hasDockerCGroup() {
|
|
46606
|
-
try {
|
|
46607
|
-
return u.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
|
|
46608
|
-
} catch {
|
|
46609
|
-
return false;
|
|
46610
|
-
}
|
|
46611
|
-
}
|
|
46612
|
-
function isDocker() {
|
|
46613
|
-
// TODO: Use `??=` when targeting Node.js 16.
|
|
46614
|
-
if (isDockerCached === undefined) {
|
|
46615
|
-
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
46616
|
-
}
|
|
46617
|
-
return isDockerCached;
|
|
46618
|
-
}
|
|
46619
|
-
|
|
46620
|
-
let cachedResult;
|
|
46621
|
-
|
|
46622
|
-
// Podman detection
|
|
46623
|
-
const hasContainerEnv = () => {
|
|
46624
|
-
try {
|
|
46625
|
-
u.statSync('/run/.containerenv');
|
|
46626
|
-
return true;
|
|
46627
|
-
} catch {
|
|
46628
|
-
return false;
|
|
46629
|
-
}
|
|
46630
|
-
};
|
|
46631
|
-
function isInsideContainer() {
|
|
46632
|
-
// TODO: Use `??=` when targeting Node.js 16.
|
|
46633
|
-
if (cachedResult === undefined) {
|
|
46634
|
-
cachedResult = hasContainerEnv() || isDocker();
|
|
46635
|
-
}
|
|
46636
|
-
return cachedResult;
|
|
46637
|
-
}
|
|
46638
|
-
|
|
46639
|
-
const isWsl = () => {
|
|
46640
|
-
if (process$2.platform !== 'linux') {
|
|
46641
|
-
return false;
|
|
46642
|
-
}
|
|
46643
|
-
if (os$4.release().toLowerCase().includes('microsoft')) {
|
|
46644
|
-
if (isInsideContainer()) {
|
|
46645
|
-
return false;
|
|
46646
|
-
}
|
|
46647
|
-
return true;
|
|
46648
|
-
}
|
|
46649
|
-
try {
|
|
46650
|
-
return u.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft') ? !isInsideContainer() : false;
|
|
46651
|
-
} catch {
|
|
46652
|
-
return false;
|
|
46653
|
-
}
|
|
46654
|
-
};
|
|
46655
|
-
var isWsl$1 = process$2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
46656
|
-
|
|
46657
|
-
const wslDrivesMountPoint = (() => {
|
|
46658
|
-
// Default value for "root" param
|
|
46659
|
-
// according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config
|
|
46660
|
-
const defaultMountPoint = '/mnt/';
|
|
46661
|
-
let mountPoint;
|
|
46662
|
-
return async function () {
|
|
46663
|
-
if (mountPoint) {
|
|
46664
|
-
// Return memoized mount point value
|
|
46665
|
-
return mountPoint;
|
|
46666
|
-
}
|
|
46667
|
-
const configFilePath = '/etc/wsl.conf';
|
|
46668
|
-
let isConfigFileExists = false;
|
|
46669
|
-
try {
|
|
46670
|
-
await fs$6.access(configFilePath, fs$6.constants.F_OK);
|
|
46671
|
-
isConfigFileExists = true;
|
|
46672
|
-
} catch {}
|
|
46673
|
-
if (!isConfigFileExists) {
|
|
46674
|
-
return defaultMountPoint;
|
|
46675
|
-
}
|
|
46676
|
-
const configContent = await fs$6.readFile(configFilePath, {
|
|
46677
|
-
encoding: 'utf8'
|
|
46678
|
-
});
|
|
46679
|
-
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
46680
|
-
if (!configMountPoint) {
|
|
46681
|
-
return defaultMountPoint;
|
|
46682
|
-
}
|
|
46683
|
-
mountPoint = configMountPoint.groups.mountPoint.trim();
|
|
46684
|
-
mountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;
|
|
46685
|
-
return mountPoint;
|
|
46686
|
-
};
|
|
46687
|
-
})();
|
|
46688
|
-
const powerShellPathFromWsl = async () => {
|
|
46689
|
-
const mountPoint = await wslDrivesMountPoint();
|
|
46690
|
-
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
46691
|
-
};
|
|
46692
|
-
const powerShellPath = async () => {
|
|
46693
|
-
if (isWsl$1) {
|
|
46694
|
-
return powerShellPathFromWsl();
|
|
46695
|
-
}
|
|
46696
|
-
return `${process$2.env.SYSTEMROOT || process$2.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
46697
|
-
};
|
|
46698
|
-
|
|
46699
|
-
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
46700
|
-
const define = value => Object.defineProperty(object, propertyName, {
|
|
46701
|
-
value,
|
|
46702
|
-
enumerable: true,
|
|
46703
|
-
writable: true
|
|
46704
|
-
});
|
|
46705
|
-
Object.defineProperty(object, propertyName, {
|
|
46706
|
-
configurable: true,
|
|
46707
|
-
enumerable: true,
|
|
46708
|
-
get() {
|
|
46709
|
-
const result = valueGetter();
|
|
46710
|
-
define(result);
|
|
46711
|
-
return result;
|
|
46712
|
-
},
|
|
46713
|
-
set(value) {
|
|
46714
|
-
define(value);
|
|
46715
|
-
}
|
|
46716
|
-
});
|
|
46717
|
-
return object;
|
|
46718
|
-
}
|
|
46719
|
-
|
|
46720
|
-
const execFileAsync$3 = require$$10.promisify(childProcess.execFile);
|
|
46721
|
-
async function defaultBrowserId() {
|
|
46722
|
-
if (process$2.platform !== 'darwin') {
|
|
46723
|
-
throw new Error('macOS only');
|
|
46724
|
-
}
|
|
46725
|
-
const {
|
|
46726
|
-
stdout
|
|
46727
|
-
} = await execFileAsync$3('defaults', ['read', 'com.apple.LaunchServices/com.apple.launchservices.secure', 'LSHandlers']);
|
|
46728
|
-
|
|
46729
|
-
// `(?!-)` is to prevent matching `LSHandlerRoleAll = "-";`.
|
|
46730
|
-
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
46731
|
-
return match?.groups.id ?? 'com.apple.Safari';
|
|
46732
|
-
}
|
|
46733
|
-
|
|
46734
|
-
const execFileAsync$2 = require$$10.promisify(childProcess.execFile);
|
|
46735
|
-
async function runAppleScript(script, {
|
|
46736
|
-
humanReadableOutput = true,
|
|
46737
|
-
signal
|
|
46738
|
-
} = {}) {
|
|
46739
|
-
if (process$2.platform !== 'darwin') {
|
|
46740
|
-
throw new Error('macOS only');
|
|
46741
|
-
}
|
|
46742
|
-
const outputArguments = humanReadableOutput ? [] : ['-ss'];
|
|
46743
|
-
const execOptions = {};
|
|
46744
|
-
if (signal) {
|
|
46745
|
-
execOptions.signal = signal;
|
|
46746
|
-
}
|
|
46747
|
-
const {
|
|
46748
|
-
stdout
|
|
46749
|
-
} = await execFileAsync$2('osascript', ['-e', script, outputArguments], execOptions);
|
|
46750
|
-
return stdout.trim();
|
|
46751
|
-
}
|
|
46752
|
-
|
|
46753
|
-
async function bundleName(bundleId) {
|
|
46754
|
-
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
46755
|
-
}
|
|
46756
|
-
|
|
46757
|
-
const execFileAsync$1 = require$$10.promisify(childProcess.execFile);
|
|
46758
|
-
|
|
46759
|
-
// Windows doesn't have browser IDs in the same way macOS/Linux does so we give fake
|
|
46760
|
-
// ones that look real and match the macOS/Linux versions for cross-platform apps.
|
|
46761
|
-
const windowsBrowserProgIds = {
|
|
46762
|
-
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: {
|
|
46763
|
-
name: 'Edge',
|
|
46764
|
-
id: 'com.microsoft.edge.old'
|
|
46765
|
-
},
|
|
46766
|
-
MSEdgeDHTML: {
|
|
46767
|
-
name: 'Edge',
|
|
46768
|
-
id: 'com.microsoft.edge'
|
|
46769
|
-
},
|
|
46770
|
-
// On macOS, it's "com.microsoft.edgemac"
|
|
46771
|
-
MSEdgeHTM: {
|
|
46772
|
-
name: 'Edge',
|
|
46773
|
-
id: 'com.microsoft.edge'
|
|
46774
|
-
},
|
|
46775
|
-
// Newer Edge/Win10 releases
|
|
46776
|
-
'IE.HTTP': {
|
|
46777
|
-
name: 'Internet Explorer',
|
|
46778
|
-
id: 'com.microsoft.ie'
|
|
46779
|
-
},
|
|
46780
|
-
FirefoxURL: {
|
|
46781
|
-
name: 'Firefox',
|
|
46782
|
-
id: 'org.mozilla.firefox'
|
|
46783
|
-
},
|
|
46784
|
-
ChromeHTML: {
|
|
46785
|
-
name: 'Chrome',
|
|
46786
|
-
id: 'com.google.chrome'
|
|
46787
|
-
},
|
|
46788
|
-
BraveHTML: {
|
|
46789
|
-
name: 'Brave',
|
|
46790
|
-
id: 'com.brave.Browser'
|
|
46791
|
-
},
|
|
46792
|
-
BraveBHTML: {
|
|
46793
|
-
name: 'Brave Beta',
|
|
46794
|
-
id: 'com.brave.Browser.beta'
|
|
46795
|
-
},
|
|
46796
|
-
BraveSSHTM: {
|
|
46797
|
-
name: 'Brave Nightly',
|
|
46798
|
-
id: 'com.brave.Browser.nightly'
|
|
46799
|
-
}
|
|
46800
|
-
};
|
|
46801
|
-
class UnknownBrowserError extends Error {}
|
|
46802
|
-
async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
|
|
46803
|
-
const {
|
|
46804
|
-
stdout
|
|
46805
|
-
} = await _execFileAsync('reg', ['QUERY', ' HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice', '/v', 'ProgId']);
|
|
46806
|
-
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
46807
|
-
if (!match) {
|
|
46808
|
-
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
46809
|
-
}
|
|
46810
|
-
const {
|
|
46811
|
-
id
|
|
46812
|
-
} = match.groups;
|
|
46813
|
-
const browser = windowsBrowserProgIds[id];
|
|
46814
|
-
if (!browser) {
|
|
46815
|
-
throw new UnknownBrowserError(`Unknown browser ID: ${id}`);
|
|
46816
|
-
}
|
|
46817
|
-
return browser;
|
|
46818
|
-
}
|
|
46819
|
-
|
|
46820
|
-
const execFileAsync = require$$10.promisify(childProcess.execFile);
|
|
46821
|
-
|
|
46822
|
-
// Inlined: https://github.com/sindresorhus/titleize/blob/main/index.js
|
|
46823
|
-
const titleize = string => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, x => x.toUpperCase());
|
|
46824
|
-
async function defaultBrowser() {
|
|
46825
|
-
if (process$2.platform === 'darwin') {
|
|
46826
|
-
const id = await defaultBrowserId();
|
|
46827
|
-
const name = await bundleName(id);
|
|
46828
|
-
return {
|
|
46829
|
-
name,
|
|
46830
|
-
id
|
|
46831
|
-
};
|
|
46832
|
-
}
|
|
46833
|
-
if (process$2.platform === 'linux') {
|
|
46834
|
-
const {
|
|
46835
|
-
stdout
|
|
46836
|
-
} = await execFileAsync('xdg-mime', ['query', 'default', 'x-scheme-handler/http']);
|
|
46837
|
-
const id = stdout.trim();
|
|
46838
|
-
const name = titleize(id.replace(/.desktop$/, '').replace('-', ' '));
|
|
46839
|
-
return {
|
|
46840
|
-
name,
|
|
46841
|
-
id
|
|
46842
|
-
};
|
|
46843
|
-
}
|
|
46844
|
-
if (process$2.platform === 'win32') {
|
|
46845
|
-
return defaultBrowser$1();
|
|
46846
|
-
}
|
|
46847
|
-
throw new Error('Only macOS, Linux, and Windows are supported');
|
|
46848
|
-
}
|
|
46849
|
-
|
|
46850
|
-
const execFile = require$$10.promisify(childProcess.execFile);
|
|
46851
|
-
|
|
46852
|
-
// Path to included `xdg-open`.
|
|
46853
|
-
const __dirname$1 = path$4.dirname(require$$0$8.fileURLToPath((typeof document === 'undefined' ? require$$0$8.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vendor.js', document.baseURI).href))));
|
|
46854
|
-
const localXdgOpenPath = path$4.join(__dirname$1, 'xdg-open');
|
|
46855
|
-
const {
|
|
46856
|
-
platform,
|
|
46857
|
-
arch
|
|
46858
|
-
} = process$2;
|
|
46859
|
-
|
|
46860
|
-
/**
|
|
46861
|
-
Get the default browser name in Windows from WSL.
|
|
46862
|
-
|
|
46863
|
-
@returns {Promise<string>} Browser name.
|
|
46864
|
-
*/
|
|
46865
|
-
async function getWindowsDefaultBrowserFromWsl() {
|
|
46866
|
-
const powershellPath = await powerShellPath();
|
|
46867
|
-
const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
46868
|
-
const encodedCommand = node_buffer.Buffer.from(rawCommand, 'utf16le').toString('base64');
|
|
46869
|
-
const {
|
|
46870
|
-
stdout
|
|
46871
|
-
} = await execFile(powershellPath, ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand', encodedCommand], {
|
|
46872
|
-
encoding: 'utf8'
|
|
46873
|
-
});
|
|
46874
|
-
const progId = stdout.trim();
|
|
46875
|
-
|
|
46876
|
-
// Map ProgId to browser IDs
|
|
46877
|
-
const browserMap = {
|
|
46878
|
-
ChromeHTML: 'com.google.chrome',
|
|
46879
|
-
BraveHTML: 'com.brave.Browser',
|
|
46880
|
-
MSEdgeHTM: 'com.microsoft.edge',
|
|
46881
|
-
FirefoxURL: 'org.mozilla.firefox'
|
|
46882
|
-
};
|
|
46883
|
-
return browserMap[progId] ? {
|
|
46884
|
-
id: browserMap[progId]
|
|
46885
|
-
} : {};
|
|
46886
|
-
}
|
|
46887
|
-
const pTryEach = async (array, mapper) => {
|
|
46888
|
-
let latestError;
|
|
46889
|
-
for (const item of array) {
|
|
46890
|
-
try {
|
|
46891
|
-
return await mapper(item); // eslint-disable-line no-await-in-loop
|
|
46892
|
-
} catch (error) {
|
|
46893
|
-
latestError = error;
|
|
46894
|
-
}
|
|
46895
|
-
}
|
|
46896
|
-
throw latestError;
|
|
46897
|
-
};
|
|
46898
|
-
|
|
46899
|
-
// eslint-disable-next-line complexity
|
|
46900
|
-
const baseOpen = async options => {
|
|
46901
|
-
options = {
|
|
46902
|
-
wait: false,
|
|
46903
|
-
background: false,
|
|
46904
|
-
newInstance: false,
|
|
46905
|
-
allowNonzeroExitCode: false,
|
|
46906
|
-
...options
|
|
46907
|
-
};
|
|
46908
|
-
if (Array.isArray(options.app)) {
|
|
46909
|
-
return pTryEach(options.app, singleApp => baseOpen({
|
|
46910
|
-
...options,
|
|
46911
|
-
app: singleApp
|
|
46912
|
-
}));
|
|
46913
|
-
}
|
|
46914
|
-
let {
|
|
46915
|
-
name: app,
|
|
46916
|
-
arguments: appArguments = []
|
|
46917
|
-
} = options.app ?? {};
|
|
46918
|
-
appArguments = [...appArguments];
|
|
46919
|
-
if (Array.isArray(app)) {
|
|
46920
|
-
return pTryEach(app, appName => baseOpen({
|
|
46921
|
-
...options,
|
|
46922
|
-
app: {
|
|
46923
|
-
name: appName,
|
|
46924
|
-
arguments: appArguments
|
|
46925
|
-
}
|
|
46926
|
-
}));
|
|
46927
|
-
}
|
|
46928
|
-
if (app === 'browser' || app === 'browserPrivate') {
|
|
46929
|
-
// IDs from default-browser for macOS and windows are the same
|
|
46930
|
-
const ids = {
|
|
46931
|
-
'com.google.chrome': 'chrome',
|
|
46932
|
-
'google-chrome.desktop': 'chrome',
|
|
46933
|
-
'com.brave.Browser': 'brave',
|
|
46934
|
-
'org.mozilla.firefox': 'firefox',
|
|
46935
|
-
'firefox.desktop': 'firefox',
|
|
46936
|
-
'com.microsoft.msedge': 'edge',
|
|
46937
|
-
'com.microsoft.edge': 'edge',
|
|
46938
|
-
'com.microsoft.edgemac': 'edge',
|
|
46939
|
-
'microsoft-edge.desktop': 'edge'
|
|
46940
|
-
};
|
|
46941
|
-
|
|
46942
|
-
// Incognito flags for each browser in `apps`.
|
|
46943
|
-
const flags = {
|
|
46944
|
-
chrome: '--incognito',
|
|
46945
|
-
brave: '--incognito',
|
|
46946
|
-
firefox: '--private-window',
|
|
46947
|
-
edge: '--inPrivate'
|
|
46948
|
-
};
|
|
46949
|
-
const browser = isWsl$1 ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser();
|
|
46950
|
-
if (browser.id in ids) {
|
|
46951
|
-
const browserName = ids[browser.id];
|
|
46952
|
-
if (app === 'browserPrivate') {
|
|
46953
|
-
appArguments.push(flags[browserName]);
|
|
46954
|
-
}
|
|
46955
|
-
return baseOpen({
|
|
46956
|
-
...options,
|
|
46957
|
-
app: {
|
|
46958
|
-
name: apps[browserName],
|
|
46959
|
-
arguments: appArguments
|
|
46960
|
-
}
|
|
46961
|
-
});
|
|
46962
|
-
}
|
|
46963
|
-
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
46964
|
-
}
|
|
46965
|
-
let command;
|
|
46966
|
-
const cliArguments = [];
|
|
46967
|
-
const childProcessOptions = {};
|
|
46968
|
-
if (platform === 'darwin') {
|
|
46969
|
-
command = 'open';
|
|
46970
|
-
if (options.wait) {
|
|
46971
|
-
cliArguments.push('--wait-apps');
|
|
46972
|
-
}
|
|
46973
|
-
if (options.background) {
|
|
46974
|
-
cliArguments.push('--background');
|
|
46975
|
-
}
|
|
46976
|
-
if (options.newInstance) {
|
|
46977
|
-
cliArguments.push('--new');
|
|
46978
|
-
}
|
|
46979
|
-
if (app) {
|
|
46980
|
-
cliArguments.push('-a', app);
|
|
46981
|
-
}
|
|
46982
|
-
} else if (platform === 'win32' || isWsl$1 && !isInsideContainer() && !app) {
|
|
46983
|
-
command = await powerShellPath();
|
|
46984
|
-
cliArguments.push('-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand');
|
|
46985
|
-
if (!isWsl$1) {
|
|
46986
|
-
childProcessOptions.windowsVerbatimArguments = true;
|
|
46987
|
-
}
|
|
46988
|
-
const encodedArguments = ['Start'];
|
|
46989
|
-
if (options.wait) {
|
|
46990
|
-
encodedArguments.push('-Wait');
|
|
46991
|
-
}
|
|
46992
|
-
if (app) {
|
|
46993
|
-
// Double quote with double quotes to ensure the inner quotes are passed through.
|
|
46994
|
-
// Inner quotes are delimited for PowerShell interpretation with backticks.
|
|
46995
|
-
encodedArguments.push(`"\`"${app}\`""`);
|
|
46996
|
-
if (options.target) {
|
|
46997
|
-
appArguments.push(options.target);
|
|
46998
|
-
}
|
|
46999
|
-
} else if (options.target) {
|
|
47000
|
-
encodedArguments.push(`"${options.target}"`);
|
|
47001
|
-
}
|
|
47002
|
-
if (appArguments.length > 0) {
|
|
47003
|
-
appArguments = appArguments.map(argument => `"\`"${argument}\`""`);
|
|
47004
|
-
encodedArguments.push('-ArgumentList', appArguments.join(','));
|
|
47005
|
-
}
|
|
47006
|
-
|
|
47007
|
-
// Using Base64-encoded command, accepted by PowerShell, to allow special characters.
|
|
47008
|
-
options.target = node_buffer.Buffer.from(encodedArguments.join(' '), 'utf16le').toString('base64');
|
|
47009
|
-
} else {
|
|
47010
|
-
if (app) {
|
|
47011
|
-
command = app;
|
|
47012
|
-
} else {
|
|
47013
|
-
// When bundled by Webpack, there's no actual package file path and no local `xdg-open`.
|
|
47014
|
-
const isBundled = !__dirname$1 || __dirname$1 === '/';
|
|
47015
|
-
|
|
47016
|
-
// Check if local `xdg-open` exists and is executable.
|
|
47017
|
-
let exeLocalXdgOpen = false;
|
|
47018
|
-
try {
|
|
47019
|
-
await fs$6.access(localXdgOpenPath, fs$6.constants.X_OK);
|
|
47020
|
-
exeLocalXdgOpen = true;
|
|
47021
|
-
} catch {}
|
|
47022
|
-
const useSystemXdgOpen = process$2.versions.electron ?? (platform === 'android' || isBundled || !exeLocalXdgOpen);
|
|
47023
|
-
command = useSystemXdgOpen ? 'xdg-open' : localXdgOpenPath;
|
|
47024
|
-
}
|
|
47025
|
-
if (appArguments.length > 0) {
|
|
47026
|
-
cliArguments.push(...appArguments);
|
|
47027
|
-
}
|
|
47028
|
-
if (!options.wait) {
|
|
47029
|
-
// `xdg-open` will block the process unless stdio is ignored
|
|
47030
|
-
// and it's detached from the parent even if it's unref'd.
|
|
47031
|
-
childProcessOptions.stdio = 'ignore';
|
|
47032
|
-
childProcessOptions.detached = true;
|
|
47033
|
-
}
|
|
47034
|
-
}
|
|
47035
|
-
if (platform === 'darwin' && appArguments.length > 0) {
|
|
47036
|
-
cliArguments.push('--args', ...appArguments);
|
|
47037
|
-
}
|
|
47038
|
-
|
|
47039
|
-
// This has to come after `--args`.
|
|
47040
|
-
if (options.target) {
|
|
47041
|
-
cliArguments.push(options.target);
|
|
47042
|
-
}
|
|
47043
|
-
const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
|
|
47044
|
-
if (options.wait) {
|
|
47045
|
-
return new Promise((resolve, reject) => {
|
|
47046
|
-
subprocess.once('error', reject);
|
|
47047
|
-
subprocess.once('close', exitCode => {
|
|
47048
|
-
if (!options.allowNonzeroExitCode && exitCode > 0) {
|
|
47049
|
-
reject(new Error(`Exited with code ${exitCode}`));
|
|
47050
|
-
return;
|
|
47051
|
-
}
|
|
47052
|
-
resolve(subprocess);
|
|
47053
|
-
});
|
|
47054
|
-
});
|
|
47055
|
-
}
|
|
47056
|
-
subprocess.unref();
|
|
47057
|
-
return subprocess;
|
|
47058
|
-
};
|
|
47059
|
-
const open = (target, options) => {
|
|
47060
|
-
if (typeof target !== 'string') {
|
|
47061
|
-
throw new TypeError('Expected a `target`');
|
|
47062
|
-
}
|
|
47063
|
-
return baseOpen({
|
|
47064
|
-
...options,
|
|
47065
|
-
target
|
|
47066
|
-
});
|
|
47067
|
-
};
|
|
47068
|
-
function detectArchBinary(binary) {
|
|
47069
|
-
if (typeof binary === 'string' || Array.isArray(binary)) {
|
|
47070
|
-
return binary;
|
|
47071
|
-
}
|
|
47072
|
-
const {
|
|
47073
|
-
[arch]: archBinary
|
|
47074
|
-
} = binary;
|
|
47075
|
-
if (!archBinary) {
|
|
47076
|
-
throw new Error(`${arch} is not supported`);
|
|
47077
|
-
}
|
|
47078
|
-
return archBinary;
|
|
47079
|
-
}
|
|
47080
|
-
function detectPlatformBinary({
|
|
47081
|
-
[platform]: platformBinary
|
|
47082
|
-
}, {
|
|
47083
|
-
wsl
|
|
47084
|
-
}) {
|
|
47085
|
-
if (wsl && isWsl$1) {
|
|
47086
|
-
return detectArchBinary(wsl);
|
|
47087
|
-
}
|
|
47088
|
-
if (!platformBinary) {
|
|
47089
|
-
throw new Error(`${platform} is not supported`);
|
|
47090
|
-
}
|
|
47091
|
-
return detectArchBinary(platformBinary);
|
|
47092
|
-
}
|
|
47093
|
-
const apps = {};
|
|
47094
|
-
defineLazyProperty(apps, 'chrome', () => detectPlatformBinary({
|
|
47095
|
-
darwin: 'google chrome',
|
|
47096
|
-
win32: 'chrome',
|
|
47097
|
-
linux: ['google-chrome', 'google-chrome-stable', 'chromium']
|
|
47098
|
-
}, {
|
|
47099
|
-
wsl: {
|
|
47100
|
-
ia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',
|
|
47101
|
-
x64: ['/mnt/c/Program Files/Google/Chrome/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe']
|
|
47102
|
-
}
|
|
47103
|
-
}));
|
|
47104
|
-
defineLazyProperty(apps, 'brave', () => detectPlatformBinary({
|
|
47105
|
-
darwin: 'brave browser',
|
|
47106
|
-
win32: 'brave',
|
|
47107
|
-
linux: ['brave-browser', 'brave']
|
|
47108
|
-
}, {
|
|
47109
|
-
wsl: {
|
|
47110
|
-
ia32: '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe',
|
|
47111
|
-
x64: ['/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe', '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe']
|
|
47112
|
-
}
|
|
47113
|
-
}));
|
|
47114
|
-
defineLazyProperty(apps, 'firefox', () => detectPlatformBinary({
|
|
47115
|
-
darwin: 'firefox',
|
|
47116
|
-
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
47117
|
-
linux: 'firefox'
|
|
47118
|
-
}, {
|
|
47119
|
-
wsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe'
|
|
47120
|
-
}));
|
|
47121
|
-
defineLazyProperty(apps, 'edge', () => detectPlatformBinary({
|
|
47122
|
-
darwin: 'microsoft edge',
|
|
47123
|
-
win32: 'msedge',
|
|
47124
|
-
linux: ['microsoft-edge', 'microsoft-edge-dev']
|
|
47125
|
-
}, {
|
|
47126
|
-
wsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'
|
|
47127
|
-
}));
|
|
47128
|
-
defineLazyProperty(apps, 'browser', () => 'browser');
|
|
47129
|
-
defineLazyProperty(apps, 'browserPrivate', () => 'browserPrivate');
|
|
47130
|
-
|
|
47131
47102
|
var re$1 = {exports: {}};
|
|
47132
47103
|
|
|
47133
47104
|
var constants$4;
|
|
@@ -55696,6 +55667,35 @@ const Octokit = Octokit$1.plugin(requestLog, legacyRestEndpointMethods, paginate
|
|
|
55696
55667
|
userAgent: `octokit-rest.js/${VERSION}`
|
|
55697
55668
|
});
|
|
55698
55669
|
|
|
55670
|
+
var isInteractive;
|
|
55671
|
+
var hasRequiredIsInteractive;
|
|
55672
|
+
|
|
55673
|
+
function requireIsInteractive () {
|
|
55674
|
+
if (hasRequiredIsInteractive) return isInteractive;
|
|
55675
|
+
hasRequiredIsInteractive = 1;
|
|
55676
|
+
|
|
55677
|
+
let _process;
|
|
55678
|
+
function getProcess() {
|
|
55679
|
+
if (_process === undefined) {
|
|
55680
|
+
// Use non-'node:' prefixed require to avoid Webpack errors.
|
|
55681
|
+
// eslint-disable-next-line n/prefer-node-protocol
|
|
55682
|
+
_process = require$$0$a;
|
|
55683
|
+
}
|
|
55684
|
+
return _process
|
|
55685
|
+
}
|
|
55686
|
+
|
|
55687
|
+
isInteractive = function isInteractive({ stream = getProcess().stdout } = {}) {
|
|
55688
|
+
if (!(stream && stream.isTTY)) {
|
|
55689
|
+
return false
|
|
55690
|
+
}
|
|
55691
|
+
const { env } = getProcess();
|
|
55692
|
+
return env.TERM !== 'dumb' && !('CI' in env)
|
|
55693
|
+
};
|
|
55694
|
+
return isInteractive;
|
|
55695
|
+
}
|
|
55696
|
+
|
|
55697
|
+
var isInteractiveExports = /*@__PURE__*/ requireIsInteractive();
|
|
55698
|
+
|
|
55699
55699
|
/**
|
|
55700
55700
|
* @license
|
|
55701
55701
|
* Copyright (c) 2016, Contributors
|
|
@@ -185188,5 +185188,5 @@ exports.uo = uo;
|
|
|
185188
185188
|
exports.updater = updater$1;
|
|
185189
185189
|
exports.yargsParser = yargsParser;
|
|
185190
185190
|
exports.yoctocolorsCjsExports = yoctocolorsCjsExports;
|
|
185191
|
-
//# debugId=
|
|
185191
|
+
//# debugId=4663857b-ca88-4ad9-b6d6-b38b5eec85d3
|
|
185192
185192
|
//# sourceMappingURL=vendor.js.map
|