vibelet 1.2.197 → 1.2.199
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/README.md +1 -1
- package/dist/index.cjs +1 -1
- package/dist/inventory-scan-worker.cjs +1 -1
- package/dist/runtime-version.cjs +1 -1
- package/dist/tailcat/vibelet-tailcat-darwin-amd64 +0 -0
- package/dist/tailcat/vibelet-tailcat-darwin-arm64 +0 -0
- package/dist/tailcat/vibelet-tailcat-linux-amd64 +0 -0
- package/dist/tailcat/vibelet-tailcat-linux-arm64 +0 -0
- package/dist/tailcat/vibelet-tailcat-win32-amd64.exe +0 -0
- package/dist/tailcat/vibelet-tailcat-win32-arm64.exe +0 -0
- package/dist/vibelet.mjs +981 -42
- package/package.json +3 -2
package/dist/vibelet.mjs
CHANGED
|
@@ -11263,6 +11263,13 @@ module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs");
|
|
|
11263
11263
|
|
|
11264
11264
|
/***/ }),
|
|
11265
11265
|
|
|
11266
|
+
/***/ 1455:
|
|
11267
|
+
/***/ ((module) => {
|
|
11268
|
+
|
|
11269
|
+
module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs/promises");
|
|
11270
|
+
|
|
11271
|
+
/***/ }),
|
|
11272
|
+
|
|
11266
11273
|
/***/ 8995:
|
|
11267
11274
|
/***/ ((module) => {
|
|
11268
11275
|
|
|
@@ -11291,6 +11298,13 @@ module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:url");
|
|
|
11291
11298
|
|
|
11292
11299
|
/***/ }),
|
|
11293
11300
|
|
|
11301
|
+
/***/ 7975:
|
|
11302
|
+
/***/ ((module) => {
|
|
11303
|
+
|
|
11304
|
+
module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:util");
|
|
11305
|
+
|
|
11306
|
+
/***/ }),
|
|
11307
|
+
|
|
11294
11308
|
/***/ 2203:
|
|
11295
11309
|
/***/ ((module) => {
|
|
11296
11310
|
|
|
@@ -11326,7 +11340,7 @@ module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("zlib");
|
|
|
11326
11340
|
|
|
11327
11341
|
/***/ }),
|
|
11328
11342
|
|
|
11329
|
-
/***/
|
|
11343
|
+
/***/ 6895:
|
|
11330
11344
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {
|
|
11331
11345
|
|
|
11332
11346
|
|
|
@@ -11348,10 +11362,10 @@ var external_node_fs_ = __nccwpck_require__(3024);
|
|
|
11348
11362
|
var external_node_module_ = __nccwpck_require__(8995);
|
|
11349
11363
|
// EXTERNAL MODULE: external "node:path"
|
|
11350
11364
|
var external_node_path_ = __nccwpck_require__(6760);
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11365
|
+
// EXTERNAL MODULE: external "node:fs/promises"
|
|
11366
|
+
var promises_ = __nccwpck_require__(1455);
|
|
11367
|
+
// EXTERNAL MODULE: external "node:util"
|
|
11368
|
+
var external_node_util_ = __nccwpck_require__(7975);
|
|
11355
11369
|
;// CONCATENATED MODULE: ../../packages/cloudflared-tunnel/managed-binary.mjs
|
|
11356
11370
|
|
|
11357
11371
|
|
|
@@ -11359,7 +11373,7 @@ const external_node_util_namespaceObject = __WEBPACK_EXTERNAL_createRequire(impo
|
|
|
11359
11373
|
|
|
11360
11374
|
|
|
11361
11375
|
|
|
11362
|
-
const execFileAsync = (0,
|
|
11376
|
+
const execFileAsync = (0,external_node_util_.promisify)(external_node_child_process_.execFile);
|
|
11363
11377
|
const DEFAULT_UPDATE_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
11364
11378
|
const DEFAULT_UPDATE_TIMEOUT_MS = 30_000;
|
|
11365
11379
|
|
|
@@ -11369,7 +11383,7 @@ function parseCloudflaredVersion(output) {
|
|
|
11369
11383
|
|
|
11370
11384
|
async function readUpdateState(updateStatePath) {
|
|
11371
11385
|
try {
|
|
11372
|
-
const state = JSON.parse(await (0,
|
|
11386
|
+
const state = JSON.parse(await (0,promises_.readFile)(updateStatePath, 'utf8'));
|
|
11373
11387
|
return state && typeof state === 'object' ? state : null;
|
|
11374
11388
|
} catch {
|
|
11375
11389
|
return null;
|
|
@@ -11377,10 +11391,10 @@ async function readUpdateState(updateStatePath) {
|
|
|
11377
11391
|
}
|
|
11378
11392
|
|
|
11379
11393
|
async function writeUpdateState(updateStatePath, state) {
|
|
11380
|
-
await (0,
|
|
11394
|
+
await (0,promises_.mkdir)((0,external_node_path_.dirname)(updateStatePath), { recursive: true });
|
|
11381
11395
|
const temporaryPath = `${updateStatePath}.tmp-${process.pid}-${Date.now()}`;
|
|
11382
|
-
await (0,
|
|
11383
|
-
await (0,
|
|
11396
|
+
await (0,promises_.writeFile)(temporaryPath, `${JSON.stringify(state, null, 2)}\n`, 'utf8');
|
|
11397
|
+
await (0,promises_.rename)(temporaryPath, updateStatePath);
|
|
11384
11398
|
}
|
|
11385
11399
|
|
|
11386
11400
|
async function runVersion(binaryPath, timeoutMs, runCommand) {
|
|
@@ -11417,7 +11431,7 @@ async function probeCloudflaredLaunchSpecVersion(
|
|
|
11417
11431
|
async function installLatestToTemporaryPath({ launchSpec, binaryPath, timeoutMs, platform, runCommand }) {
|
|
11418
11432
|
const temporaryDir = (0,external_node_path_.join)((0,external_node_path_.dirname)(binaryPath), `.cloudflared-update-${process.pid}-${Date.now()}`);
|
|
11419
11433
|
const temporaryBinaryPath = (0,external_node_path_.join)(temporaryDir, (0,external_node_path_.basename)(binaryPath));
|
|
11420
|
-
await (0,
|
|
11434
|
+
await (0,promises_.mkdir)(temporaryDir, { recursive: true });
|
|
11421
11435
|
try {
|
|
11422
11436
|
await runCommand(launchSpec.command, [...launchSpec.args, 'bin', 'install', 'latest'], {
|
|
11423
11437
|
encoding: 'utf8',
|
|
@@ -11431,20 +11445,20 @@ async function installLatestToTemporaryPath({ launchSpec, binaryPath, timeoutMs,
|
|
|
11431
11445
|
|
|
11432
11446
|
if (platform === 'win32' && (0,external_node_fs_.existsSync)(binaryPath)) {
|
|
11433
11447
|
const backupPath = `${binaryPath}.previous-${process.pid}`;
|
|
11434
|
-
await (0,
|
|
11448
|
+
await (0,promises_.rename)(binaryPath, backupPath);
|
|
11435
11449
|
try {
|
|
11436
|
-
await (0,
|
|
11437
|
-
await (0,
|
|
11450
|
+
await (0,promises_.rename)(temporaryBinaryPath, binaryPath);
|
|
11451
|
+
await (0,promises_.rm)(backupPath, { force: true });
|
|
11438
11452
|
} catch (error) {
|
|
11439
|
-
await (0,
|
|
11453
|
+
await (0,promises_.rename)(backupPath, binaryPath).catch(() => undefined);
|
|
11440
11454
|
throw error;
|
|
11441
11455
|
}
|
|
11442
11456
|
} else {
|
|
11443
|
-
await (0,
|
|
11457
|
+
await (0,promises_.rename)(temporaryBinaryPath, binaryPath);
|
|
11444
11458
|
}
|
|
11445
11459
|
return version;
|
|
11446
11460
|
} finally {
|
|
11447
|
-
await (0,
|
|
11461
|
+
await (0,promises_.rm)(temporaryDir, { recursive: true, force: true });
|
|
11448
11462
|
}
|
|
11449
11463
|
}
|
|
11450
11464
|
|
|
@@ -14027,7 +14041,7 @@ function parseAccessTargetArg(argv, fail, env = process.env) {
|
|
|
14027
14041
|
/* harmony export */ });
|
|
14028
14042
|
/* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(3024);
|
|
14029
14043
|
/* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(6760);
|
|
14030
|
-
/* harmony import */ var _cloudflared_tunnel_manager_mjs__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(
|
|
14044
|
+
/* harmony import */ var _cloudflared_tunnel_manager_mjs__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(6895);
|
|
14031
14045
|
|
|
14032
14046
|
|
|
14033
14047
|
|
|
@@ -14607,7 +14621,6 @@ function createScannablePairingPayload(pairingPayload) {
|
|
|
14607
14621
|
const compactPayload = {
|
|
14608
14622
|
t: 'vp',
|
|
14609
14623
|
d: pairingPayload.daemonId,
|
|
14610
|
-
n: pairingPayload.displayName,
|
|
14611
14624
|
h: pairingPayload.canonicalHost,
|
|
14612
14625
|
p: pairingPayload.port,
|
|
14613
14626
|
c: pairingPayload.pairNonce,
|
|
@@ -14722,38 +14735,964 @@ function buildWebUiUrl(target, pairingPayload) {
|
|
|
14722
14735
|
|
|
14723
14736
|
/***/ }),
|
|
14724
14737
|
|
|
14725
|
-
/***/
|
|
14738
|
+
/***/ 9485:
|
|
14726
14739
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {
|
|
14727
14740
|
|
|
14728
|
-
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
|
14729
|
-
/* harmony export */ p: () => (/* binding */ writePairingOutput)
|
|
14730
|
-
/* harmony export */ });
|
|
14731
|
-
/* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(3024);
|
|
14732
|
-
/* harmony import */ var qrcode__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(7514);
|
|
14733
|
-
/* harmony import */ var _vibelet_pairing_connections_mjs__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(7721);
|
|
14734
14741
|
|
|
14742
|
+
// EXPORTS
|
|
14743
|
+
__nccwpck_require__.d(__webpack_exports__, {
|
|
14744
|
+
pO: () => (/* binding */ writePairingOutput)
|
|
14745
|
+
});
|
|
14746
|
+
|
|
14747
|
+
// UNUSED EXPORTS: detectTerminalImageProtocol, presentPairingQr, renderSixelQr, renderTerminalQr, tryOpenPairingImage, tryWriteTerminalQrImage
|
|
14748
|
+
|
|
14749
|
+
// EXTERNAL MODULE: external "node:fs"
|
|
14750
|
+
var external_node_fs_ = __nccwpck_require__(3024);
|
|
14751
|
+
;// CONCATENATED MODULE: external "node:process"
|
|
14752
|
+
const external_node_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:process");
|
|
14753
|
+
;// CONCATENATED MODULE: external "node:buffer"
|
|
14754
|
+
const external_node_buffer_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:buffer");
|
|
14755
|
+
// EXTERNAL MODULE: external "node:path"
|
|
14756
|
+
var external_node_path_ = __nccwpck_require__(6760);
|
|
14757
|
+
// EXTERNAL MODULE: external "node:url"
|
|
14758
|
+
var external_node_url_ = __nccwpck_require__(3136);
|
|
14759
|
+
// EXTERNAL MODULE: external "node:util"
|
|
14760
|
+
var external_node_util_ = __nccwpck_require__(7975);
|
|
14761
|
+
// EXTERNAL MODULE: external "node:child_process"
|
|
14762
|
+
var external_node_child_process_ = __nccwpck_require__(1421);
|
|
14763
|
+
// EXTERNAL MODULE: external "node:fs/promises"
|
|
14764
|
+
var promises_ = __nccwpck_require__(1455);
|
|
14765
|
+
// EXTERNAL MODULE: external "node:os"
|
|
14766
|
+
var external_node_os_ = __nccwpck_require__(8161);
|
|
14767
|
+
;// CONCATENATED MODULE: ../../node_modules/is-inside-container/node_modules/is-docker/index.js
|
|
14768
|
+
|
|
14769
|
+
|
|
14770
|
+
let isDockerCached;
|
|
14771
|
+
|
|
14772
|
+
function hasDockerEnv() {
|
|
14773
|
+
try {
|
|
14774
|
+
external_node_fs_.statSync('/.dockerenv');
|
|
14775
|
+
return true;
|
|
14776
|
+
} catch {
|
|
14777
|
+
return false;
|
|
14778
|
+
}
|
|
14779
|
+
}
|
|
14780
|
+
|
|
14781
|
+
function hasDockerCGroup() {
|
|
14782
|
+
try {
|
|
14783
|
+
return external_node_fs_.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
|
|
14784
|
+
} catch {
|
|
14785
|
+
return false;
|
|
14786
|
+
}
|
|
14787
|
+
}
|
|
14788
|
+
|
|
14789
|
+
function isDocker() {
|
|
14790
|
+
// TODO: Use `??=` when targeting Node.js 16.
|
|
14791
|
+
if (isDockerCached === undefined) {
|
|
14792
|
+
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
14793
|
+
}
|
|
14794
|
+
|
|
14795
|
+
return isDockerCached;
|
|
14796
|
+
}
|
|
14797
|
+
|
|
14798
|
+
;// CONCATENATED MODULE: ../../node_modules/is-inside-container/index.js
|
|
14799
|
+
|
|
14800
|
+
|
|
14801
|
+
|
|
14802
|
+
let cachedResult;
|
|
14803
|
+
|
|
14804
|
+
// Podman detection
|
|
14805
|
+
const hasContainerEnv = () => {
|
|
14806
|
+
try {
|
|
14807
|
+
external_node_fs_.statSync('/run/.containerenv');
|
|
14808
|
+
return true;
|
|
14809
|
+
} catch {
|
|
14810
|
+
return false;
|
|
14811
|
+
}
|
|
14812
|
+
};
|
|
14813
|
+
|
|
14814
|
+
function isInsideContainer() {
|
|
14815
|
+
// TODO: Use `??=` when targeting Node.js 16.
|
|
14816
|
+
if (cachedResult === undefined) {
|
|
14817
|
+
cachedResult = hasContainerEnv() || isDocker();
|
|
14818
|
+
}
|
|
14819
|
+
|
|
14820
|
+
return cachedResult;
|
|
14821
|
+
}
|
|
14822
|
+
|
|
14823
|
+
;// CONCATENATED MODULE: ./node_modules/is-wsl/index.js
|
|
14824
|
+
|
|
14825
|
+
|
|
14826
|
+
|
|
14827
|
+
|
|
14828
|
+
|
|
14829
|
+
const isWsl = () => {
|
|
14830
|
+
if (external_node_process_namespaceObject.platform !== 'linux') {
|
|
14831
|
+
return false;
|
|
14832
|
+
}
|
|
14833
|
+
|
|
14834
|
+
if (external_node_os_.release().toLowerCase().includes('microsoft')) {
|
|
14835
|
+
if (isInsideContainer()) {
|
|
14836
|
+
return false;
|
|
14837
|
+
}
|
|
14838
|
+
|
|
14839
|
+
return true;
|
|
14840
|
+
}
|
|
14841
|
+
|
|
14842
|
+
try {
|
|
14843
|
+
if (external_node_fs_.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')) {
|
|
14844
|
+
return !isInsideContainer();
|
|
14845
|
+
}
|
|
14846
|
+
} catch {}
|
|
14847
|
+
|
|
14848
|
+
// Fallback for custom kernels: check WSL-specific paths.
|
|
14849
|
+
if (
|
|
14850
|
+
external_node_fs_.existsSync('/proc/sys/fs/binfmt_misc/WSLInterop')
|
|
14851
|
+
|| external_node_fs_.existsSync('/run/WSL')
|
|
14852
|
+
) {
|
|
14853
|
+
return !isInsideContainer();
|
|
14854
|
+
}
|
|
14855
|
+
|
|
14856
|
+
return false;
|
|
14857
|
+
};
|
|
14858
|
+
|
|
14859
|
+
/* harmony default export */ const is_wsl = (external_node_process_namespaceObject.env.__IS_WSL_TEST__ ? isWsl : isWsl());
|
|
14860
|
+
|
|
14861
|
+
;// CONCATENATED MODULE: ./node_modules/wsl-utils/index.js
|
|
14862
|
+
|
|
14863
|
+
|
|
14864
|
+
|
|
14865
|
+
|
|
14866
|
+
const wslDrivesMountPoint = (() => {
|
|
14867
|
+
// Default value for "root" param
|
|
14868
|
+
// according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config
|
|
14869
|
+
const defaultMountPoint = '/mnt/';
|
|
14870
|
+
|
|
14871
|
+
let mountPoint;
|
|
14872
|
+
|
|
14873
|
+
return async function () {
|
|
14874
|
+
if (mountPoint) {
|
|
14875
|
+
// Return memoized mount point value
|
|
14876
|
+
return mountPoint;
|
|
14877
|
+
}
|
|
14878
|
+
|
|
14879
|
+
const configFilePath = '/etc/wsl.conf';
|
|
14880
|
+
|
|
14881
|
+
let isConfigFileExists = false;
|
|
14882
|
+
try {
|
|
14883
|
+
await promises_.access(configFilePath, promises_.constants.F_OK);
|
|
14884
|
+
isConfigFileExists = true;
|
|
14885
|
+
} catch {}
|
|
14886
|
+
|
|
14887
|
+
if (!isConfigFileExists) {
|
|
14888
|
+
return defaultMountPoint;
|
|
14889
|
+
}
|
|
14890
|
+
|
|
14891
|
+
const configContent = await promises_.readFile(configFilePath, {encoding: 'utf8'});
|
|
14892
|
+
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
14893
|
+
|
|
14894
|
+
if (!configMountPoint) {
|
|
14895
|
+
return defaultMountPoint;
|
|
14896
|
+
}
|
|
14897
|
+
|
|
14898
|
+
mountPoint = configMountPoint.groups.mountPoint.trim();
|
|
14899
|
+
mountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;
|
|
14900
|
+
|
|
14901
|
+
return mountPoint;
|
|
14902
|
+
};
|
|
14903
|
+
})();
|
|
14904
|
+
|
|
14905
|
+
const powerShellPathFromWsl = async () => {
|
|
14906
|
+
const mountPoint = await wslDrivesMountPoint();
|
|
14907
|
+
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
14908
|
+
};
|
|
14909
|
+
|
|
14910
|
+
const powerShellPath = async () => {
|
|
14911
|
+
if (is_wsl) {
|
|
14912
|
+
return powerShellPathFromWsl();
|
|
14913
|
+
}
|
|
14914
|
+
|
|
14915
|
+
return `${external_node_process_namespaceObject.env.SYSTEMROOT || external_node_process_namespaceObject.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
14916
|
+
};
|
|
14917
|
+
|
|
14918
|
+
|
|
14919
|
+
|
|
14920
|
+
;// CONCATENATED MODULE: ../../node_modules/define-lazy-prop/index.js
|
|
14921
|
+
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
14922
|
+
const define = value => Object.defineProperty(object, propertyName, {value, enumerable: true, writable: true});
|
|
14923
|
+
|
|
14924
|
+
Object.defineProperty(object, propertyName, {
|
|
14925
|
+
configurable: true,
|
|
14926
|
+
enumerable: true,
|
|
14927
|
+
get() {
|
|
14928
|
+
const result = valueGetter();
|
|
14929
|
+
define(result);
|
|
14930
|
+
return result;
|
|
14931
|
+
},
|
|
14932
|
+
set(value) {
|
|
14933
|
+
define(value);
|
|
14934
|
+
}
|
|
14935
|
+
});
|
|
14936
|
+
|
|
14937
|
+
return object;
|
|
14938
|
+
}
|
|
14939
|
+
|
|
14940
|
+
;// CONCATENATED MODULE: ../../node_modules/default-browser-id/index.js
|
|
14941
|
+
|
|
14942
|
+
|
|
14943
|
+
|
|
14944
|
+
|
|
14945
|
+
const execFileAsync = (0,external_node_util_.promisify)(external_node_child_process_.execFile);
|
|
14946
|
+
|
|
14947
|
+
async function defaultBrowserId() {
|
|
14948
|
+
if (external_node_process_namespaceObject.platform !== 'darwin') {
|
|
14949
|
+
throw new Error('macOS only');
|
|
14950
|
+
}
|
|
14951
|
+
|
|
14952
|
+
const {stdout} = await execFileAsync('defaults', ['read', 'com.apple.LaunchServices/com.apple.launchservices.secure', 'LSHandlers']);
|
|
14953
|
+
|
|
14954
|
+
// `(?!-)` is to prevent matching `LSHandlerRoleAll = "-";`.
|
|
14955
|
+
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
14956
|
+
|
|
14957
|
+
const browserId = match?.groups.id ?? 'com.apple.Safari';
|
|
14958
|
+
|
|
14959
|
+
// Correct the case for Safari's bundle identifier
|
|
14960
|
+
if (browserId === 'com.apple.safari') {
|
|
14961
|
+
return 'com.apple.Safari';
|
|
14962
|
+
}
|
|
14963
|
+
|
|
14964
|
+
return browserId;
|
|
14965
|
+
}
|
|
14966
|
+
|
|
14967
|
+
;// CONCATENATED MODULE: ../../node_modules/run-applescript/index.js
|
|
14968
|
+
|
|
14969
|
+
|
|
14970
|
+
|
|
14971
|
+
|
|
14972
|
+
const run_applescript_execFileAsync = (0,external_node_util_.promisify)(external_node_child_process_.execFile);
|
|
14973
|
+
|
|
14974
|
+
async function runAppleScript(script, {humanReadableOutput = true, signal} = {}) {
|
|
14975
|
+
if (external_node_process_namespaceObject.platform !== 'darwin') {
|
|
14976
|
+
throw new Error('macOS only');
|
|
14977
|
+
}
|
|
14978
|
+
|
|
14979
|
+
const outputArguments = humanReadableOutput ? [] : ['-ss'];
|
|
14980
|
+
|
|
14981
|
+
const execOptions = {};
|
|
14982
|
+
if (signal) {
|
|
14983
|
+
execOptions.signal = signal;
|
|
14984
|
+
}
|
|
14985
|
+
|
|
14986
|
+
const {stdout} = await run_applescript_execFileAsync('osascript', ['-e', script, outputArguments], execOptions);
|
|
14987
|
+
return stdout.trim();
|
|
14988
|
+
}
|
|
14989
|
+
|
|
14990
|
+
function runAppleScriptSync(script, {humanReadableOutput = true} = {}) {
|
|
14991
|
+
if (process.platform !== 'darwin') {
|
|
14992
|
+
throw new Error('macOS only');
|
|
14993
|
+
}
|
|
14994
|
+
|
|
14995
|
+
const outputArguments = humanReadableOutput ? [] : ['-ss'];
|
|
14996
|
+
|
|
14997
|
+
const stdout = execFileSync('osascript', ['-e', script, ...outputArguments], {
|
|
14998
|
+
encoding: 'utf8',
|
|
14999
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
15000
|
+
timeout: 500,
|
|
15001
|
+
});
|
|
15002
|
+
|
|
15003
|
+
return stdout.trim();
|
|
15004
|
+
}
|
|
15005
|
+
|
|
15006
|
+
;// CONCATENATED MODULE: ../../node_modules/bundle-name/index.js
|
|
15007
|
+
|
|
15008
|
+
|
|
15009
|
+
async function bundleName(bundleId) {
|
|
15010
|
+
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")`);
|
|
15011
|
+
}
|
|
15012
|
+
|
|
15013
|
+
;// CONCATENATED MODULE: ../../node_modules/default-browser/windows.js
|
|
15014
|
+
|
|
15015
|
+
|
|
15016
|
+
|
|
15017
|
+
const windows_execFileAsync = (0,external_node_util_.promisify)(external_node_child_process_.execFile);
|
|
15018
|
+
|
|
15019
|
+
// TODO: Fix the casing of bundle identifiers in the next major version.
|
|
15020
|
+
|
|
15021
|
+
// Windows doesn't have browser IDs in the same way macOS/Linux does so we give fake
|
|
15022
|
+
// ones that look real and match the macOS/Linux versions for cross-platform apps.
|
|
15023
|
+
const windowsBrowserProgIds = {
|
|
15024
|
+
MSEdgeHTM: {name: 'Edge', id: 'com.microsoft.edge'}, // The missing `L` is correct.
|
|
15025
|
+
MSEdgeBHTML: {name: 'Edge Beta', id: 'com.microsoft.edge.beta'},
|
|
15026
|
+
MSEdgeDHTML: {name: 'Edge Dev', id: 'com.microsoft.edge.dev'},
|
|
15027
|
+
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: {name: 'Edge', id: 'com.microsoft.edge.old'},
|
|
15028
|
+
ChromeHTML: {name: 'Chrome', id: 'com.google.chrome'},
|
|
15029
|
+
ChromeBHTML: {name: 'Chrome Beta', id: 'com.google.chrome.beta'},
|
|
15030
|
+
ChromeDHTML: {name: 'Chrome Dev', id: 'com.google.chrome.dev'},
|
|
15031
|
+
ChromiumHTM: {name: 'Chromium', id: 'org.chromium.Chromium'},
|
|
15032
|
+
BraveHTML: {name: 'Brave', id: 'com.brave.Browser'},
|
|
15033
|
+
BraveBHTML: {name: 'Brave Beta', id: 'com.brave.Browser.beta'},
|
|
15034
|
+
BraveDHTML: {name: 'Brave Dev', id: 'com.brave.Browser.dev'},
|
|
15035
|
+
BraveSSHTM: {name: 'Brave Nightly', id: 'com.brave.Browser.nightly'},
|
|
15036
|
+
FirefoxURL: {name: 'Firefox', id: 'org.mozilla.firefox'},
|
|
15037
|
+
OperaStable: {name: 'Opera', id: 'com.operasoftware.Opera'},
|
|
15038
|
+
VivaldiHTM: {name: 'Vivaldi', id: 'com.vivaldi.Vivaldi'},
|
|
15039
|
+
'IE.HTTP': {name: 'Internet Explorer', id: 'com.microsoft.ie'},
|
|
15040
|
+
};
|
|
15041
|
+
|
|
15042
|
+
const _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
|
|
15043
|
+
|
|
15044
|
+
class UnknownBrowserError extends Error {}
|
|
15045
|
+
|
|
15046
|
+
async function defaultBrowser(_execFileAsync = windows_execFileAsync) {
|
|
15047
|
+
const {stdout} = await _execFileAsync('reg', [
|
|
15048
|
+
'QUERY',
|
|
15049
|
+
' HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice',
|
|
15050
|
+
'/v',
|
|
15051
|
+
'ProgId',
|
|
15052
|
+
]);
|
|
15053
|
+
|
|
15054
|
+
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
15055
|
+
if (!match) {
|
|
15056
|
+
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
15057
|
+
}
|
|
14735
15058
|
|
|
15059
|
+
const {id} = match.groups;
|
|
14736
15060
|
|
|
15061
|
+
// Windows can append a hash suffix to ProgIds using a dot or hyphen
|
|
15062
|
+
// (e.g., `ChromeHTML.ABC123`, `FirefoxURL-6F193CCC56814779`).
|
|
15063
|
+
// Try exact match first, then try without the suffix.
|
|
15064
|
+
const dotIndex = id.lastIndexOf('.');
|
|
15065
|
+
const hyphenIndex = id.lastIndexOf('-');
|
|
15066
|
+
const baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);
|
|
15067
|
+
const baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);
|
|
15068
|
+
|
|
15069
|
+
return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? {name: id, id};
|
|
15070
|
+
}
|
|
15071
|
+
|
|
15072
|
+
;// CONCATENATED MODULE: ../../node_modules/default-browser/index.js
|
|
15073
|
+
|
|
15074
|
+
|
|
15075
|
+
|
|
15076
|
+
|
|
15077
|
+
|
|
15078
|
+
|
|
15079
|
+
|
|
15080
|
+
|
|
15081
|
+
|
|
15082
|
+
const default_browser_execFileAsync = (0,external_node_util_.promisify)(external_node_child_process_.execFile);
|
|
15083
|
+
|
|
15084
|
+
// Inlined: https://github.com/sindresorhus/titleize/blob/main/index.js
|
|
15085
|
+
const titleize = string => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, x => x.toUpperCase());
|
|
15086
|
+
|
|
15087
|
+
async function default_browser_defaultBrowser() {
|
|
15088
|
+
if (external_node_process_namespaceObject.platform === 'darwin') {
|
|
15089
|
+
const id = await defaultBrowserId();
|
|
15090
|
+
const name = await bundleName(id);
|
|
15091
|
+
return {name, id};
|
|
15092
|
+
}
|
|
15093
|
+
|
|
15094
|
+
if (external_node_process_namespaceObject.platform === 'linux') {
|
|
15095
|
+
const {stdout} = await default_browser_execFileAsync('xdg-mime', ['query', 'default', 'x-scheme-handler/http']);
|
|
15096
|
+
const id = stdout.trim();
|
|
15097
|
+
const name = titleize(id.replace(/.desktop$/, '').replace('-', ' '));
|
|
15098
|
+
return {name, id};
|
|
15099
|
+
}
|
|
15100
|
+
|
|
15101
|
+
if (external_node_process_namespaceObject.platform === 'win32') {
|
|
15102
|
+
return defaultBrowser();
|
|
15103
|
+
}
|
|
15104
|
+
|
|
15105
|
+
throw new Error('Only macOS, Linux, and Windows are supported');
|
|
15106
|
+
}
|
|
15107
|
+
|
|
15108
|
+
;// CONCATENATED MODULE: ./node_modules/open/index.js
|
|
15109
|
+
|
|
15110
|
+
|
|
15111
|
+
|
|
15112
|
+
|
|
15113
|
+
|
|
15114
|
+
|
|
15115
|
+
|
|
15116
|
+
|
|
15117
|
+
|
|
15118
|
+
|
|
15119
|
+
|
|
15120
|
+
|
|
15121
|
+
const execFile = (0,external_node_util_.promisify)(external_node_child_process_.execFile);
|
|
15122
|
+
|
|
15123
|
+
// Path to included `xdg-open`.
|
|
15124
|
+
const open_dirname = external_node_path_.dirname((0,external_node_url_.fileURLToPath)(import.meta.url));
|
|
15125
|
+
const localXdgOpenPath = external_node_path_.join(open_dirname, 'xdg-open');
|
|
15126
|
+
|
|
15127
|
+
const {platform, arch} = external_node_process_namespaceObject;
|
|
15128
|
+
|
|
15129
|
+
/**
|
|
15130
|
+
Get the default browser name in Windows from WSL.
|
|
15131
|
+
|
|
15132
|
+
@returns {Promise<string>} Browser name.
|
|
15133
|
+
*/
|
|
15134
|
+
async function getWindowsDefaultBrowserFromWsl() {
|
|
15135
|
+
const powershellPath = await powerShellPath();
|
|
15136
|
+
const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
15137
|
+
const encodedCommand = external_node_buffer_namespaceObject.Buffer.from(rawCommand, 'utf16le').toString('base64');
|
|
15138
|
+
|
|
15139
|
+
const {stdout} = await execFile(
|
|
15140
|
+
powershellPath,
|
|
15141
|
+
[
|
|
15142
|
+
'-NoProfile',
|
|
15143
|
+
'-NonInteractive',
|
|
15144
|
+
'-ExecutionPolicy',
|
|
15145
|
+
'Bypass',
|
|
15146
|
+
'-EncodedCommand',
|
|
15147
|
+
encodedCommand,
|
|
15148
|
+
],
|
|
15149
|
+
{encoding: 'utf8'},
|
|
15150
|
+
);
|
|
15151
|
+
|
|
15152
|
+
const progId = stdout.trim();
|
|
15153
|
+
|
|
15154
|
+
// Map ProgId to browser IDs
|
|
15155
|
+
const browserMap = {
|
|
15156
|
+
ChromeHTML: 'com.google.chrome',
|
|
15157
|
+
BraveHTML: 'com.brave.Browser',
|
|
15158
|
+
MSEdgeHTM: 'com.microsoft.edge',
|
|
15159
|
+
FirefoxURL: 'org.mozilla.firefox',
|
|
15160
|
+
};
|
|
15161
|
+
|
|
15162
|
+
return browserMap[progId] ? {id: browserMap[progId]} : {};
|
|
15163
|
+
}
|
|
15164
|
+
|
|
15165
|
+
const pTryEach = async (array, mapper) => {
|
|
15166
|
+
let latestError;
|
|
15167
|
+
|
|
15168
|
+
for (const item of array) {
|
|
15169
|
+
try {
|
|
15170
|
+
return await mapper(item); // eslint-disable-line no-await-in-loop
|
|
15171
|
+
} catch (error) {
|
|
15172
|
+
latestError = error;
|
|
15173
|
+
}
|
|
15174
|
+
}
|
|
15175
|
+
|
|
15176
|
+
throw latestError;
|
|
15177
|
+
};
|
|
15178
|
+
|
|
15179
|
+
// eslint-disable-next-line complexity
|
|
15180
|
+
const baseOpen = async options => {
|
|
15181
|
+
options = {
|
|
15182
|
+
wait: false,
|
|
15183
|
+
background: false,
|
|
15184
|
+
newInstance: false,
|
|
15185
|
+
allowNonzeroExitCode: false,
|
|
15186
|
+
...options,
|
|
15187
|
+
};
|
|
15188
|
+
|
|
15189
|
+
if (Array.isArray(options.app)) {
|
|
15190
|
+
return pTryEach(options.app, singleApp => baseOpen({
|
|
15191
|
+
...options,
|
|
15192
|
+
app: singleApp,
|
|
15193
|
+
}));
|
|
15194
|
+
}
|
|
15195
|
+
|
|
15196
|
+
let {name: app, arguments: appArguments = []} = options.app ?? {};
|
|
15197
|
+
appArguments = [...appArguments];
|
|
15198
|
+
|
|
15199
|
+
if (Array.isArray(app)) {
|
|
15200
|
+
return pTryEach(app, appName => baseOpen({
|
|
15201
|
+
...options,
|
|
15202
|
+
app: {
|
|
15203
|
+
name: appName,
|
|
15204
|
+
arguments: appArguments,
|
|
15205
|
+
},
|
|
15206
|
+
}));
|
|
15207
|
+
}
|
|
15208
|
+
|
|
15209
|
+
if (app === 'browser' || app === 'browserPrivate') {
|
|
15210
|
+
// IDs from default-browser for macOS and windows are the same
|
|
15211
|
+
const ids = {
|
|
15212
|
+
'com.google.chrome': 'chrome',
|
|
15213
|
+
'google-chrome.desktop': 'chrome',
|
|
15214
|
+
'com.brave.Browser': 'brave',
|
|
15215
|
+
'org.mozilla.firefox': 'firefox',
|
|
15216
|
+
'firefox.desktop': 'firefox',
|
|
15217
|
+
'com.microsoft.msedge': 'edge',
|
|
15218
|
+
'com.microsoft.edge': 'edge',
|
|
15219
|
+
'com.microsoft.edgemac': 'edge',
|
|
15220
|
+
'microsoft-edge.desktop': 'edge',
|
|
15221
|
+
};
|
|
15222
|
+
|
|
15223
|
+
// Incognito flags for each browser in `apps`.
|
|
15224
|
+
const flags = {
|
|
15225
|
+
chrome: '--incognito',
|
|
15226
|
+
brave: '--incognito',
|
|
15227
|
+
firefox: '--private-window',
|
|
15228
|
+
edge: '--inPrivate',
|
|
15229
|
+
};
|
|
15230
|
+
|
|
15231
|
+
const browser = is_wsl ? await getWindowsDefaultBrowserFromWsl() : await default_browser_defaultBrowser();
|
|
15232
|
+
if (browser.id in ids) {
|
|
15233
|
+
const browserName = ids[browser.id];
|
|
15234
|
+
|
|
15235
|
+
if (app === 'browserPrivate') {
|
|
15236
|
+
appArguments.push(flags[browserName]);
|
|
15237
|
+
}
|
|
15238
|
+
|
|
15239
|
+
return baseOpen({
|
|
15240
|
+
...options,
|
|
15241
|
+
app: {
|
|
15242
|
+
name: apps[browserName],
|
|
15243
|
+
arguments: appArguments,
|
|
15244
|
+
},
|
|
15245
|
+
});
|
|
15246
|
+
}
|
|
15247
|
+
|
|
15248
|
+
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
15249
|
+
}
|
|
15250
|
+
|
|
15251
|
+
let command;
|
|
15252
|
+
const cliArguments = [];
|
|
15253
|
+
const childProcessOptions = {};
|
|
15254
|
+
|
|
15255
|
+
if (platform === 'darwin') {
|
|
15256
|
+
command = 'open';
|
|
15257
|
+
|
|
15258
|
+
if (options.wait) {
|
|
15259
|
+
cliArguments.push('--wait-apps');
|
|
15260
|
+
}
|
|
15261
|
+
|
|
15262
|
+
if (options.background) {
|
|
15263
|
+
cliArguments.push('--background');
|
|
15264
|
+
}
|
|
15265
|
+
|
|
15266
|
+
if (options.newInstance) {
|
|
15267
|
+
cliArguments.push('--new');
|
|
15268
|
+
}
|
|
15269
|
+
|
|
15270
|
+
if (app) {
|
|
15271
|
+
cliArguments.push('-a', app);
|
|
15272
|
+
}
|
|
15273
|
+
} else if (platform === 'win32' || (is_wsl && !isInsideContainer() && !app)) {
|
|
15274
|
+
command = await powerShellPath();
|
|
15275
|
+
|
|
15276
|
+
cliArguments.push(
|
|
15277
|
+
'-NoProfile',
|
|
15278
|
+
'-NonInteractive',
|
|
15279
|
+
'-ExecutionPolicy',
|
|
15280
|
+
'Bypass',
|
|
15281
|
+
'-EncodedCommand',
|
|
15282
|
+
);
|
|
15283
|
+
|
|
15284
|
+
if (!is_wsl) {
|
|
15285
|
+
childProcessOptions.windowsVerbatimArguments = true;
|
|
15286
|
+
}
|
|
15287
|
+
|
|
15288
|
+
const encodedArguments = ['Start'];
|
|
15289
|
+
|
|
15290
|
+
if (options.wait) {
|
|
15291
|
+
encodedArguments.push('-Wait');
|
|
15292
|
+
}
|
|
15293
|
+
|
|
15294
|
+
if (app) {
|
|
15295
|
+
// Double quote with double quotes to ensure the inner quotes are passed through.
|
|
15296
|
+
// Inner quotes are delimited for PowerShell interpretation with backticks.
|
|
15297
|
+
encodedArguments.push(`"\`"${app}\`""`);
|
|
15298
|
+
if (options.target) {
|
|
15299
|
+
appArguments.push(options.target);
|
|
15300
|
+
}
|
|
15301
|
+
} else if (options.target) {
|
|
15302
|
+
encodedArguments.push(`"${options.target}"`);
|
|
15303
|
+
}
|
|
15304
|
+
|
|
15305
|
+
if (appArguments.length > 0) {
|
|
15306
|
+
appArguments = appArguments.map(argument => `"\`"${argument}\`""`);
|
|
15307
|
+
encodedArguments.push('-ArgumentList', appArguments.join(','));
|
|
15308
|
+
}
|
|
15309
|
+
|
|
15310
|
+
// Using Base64-encoded command, accepted by PowerShell, to allow special characters.
|
|
15311
|
+
options.target = external_node_buffer_namespaceObject.Buffer.from(encodedArguments.join(' '), 'utf16le').toString('base64');
|
|
15312
|
+
} else {
|
|
15313
|
+
if (app) {
|
|
15314
|
+
command = app;
|
|
15315
|
+
} else {
|
|
15316
|
+
// When bundled by Webpack, there's no actual package file path and no local `xdg-open`.
|
|
15317
|
+
const isBundled = !open_dirname || open_dirname === '/';
|
|
15318
|
+
|
|
15319
|
+
// Check if local `xdg-open` exists and is executable.
|
|
15320
|
+
let exeLocalXdgOpen = false;
|
|
15321
|
+
try {
|
|
15322
|
+
await promises_.access(localXdgOpenPath, promises_.constants.X_OK);
|
|
15323
|
+
exeLocalXdgOpen = true;
|
|
15324
|
+
} catch {}
|
|
15325
|
+
|
|
15326
|
+
const useSystemXdgOpen = external_node_process_namespaceObject.versions.electron
|
|
15327
|
+
?? (platform === 'android' || isBundled || !exeLocalXdgOpen);
|
|
15328
|
+
command = useSystemXdgOpen ? 'xdg-open' : localXdgOpenPath;
|
|
15329
|
+
}
|
|
15330
|
+
|
|
15331
|
+
if (appArguments.length > 0) {
|
|
15332
|
+
cliArguments.push(...appArguments);
|
|
15333
|
+
}
|
|
15334
|
+
|
|
15335
|
+
if (!options.wait) {
|
|
15336
|
+
// `xdg-open` will block the process unless stdio is ignored
|
|
15337
|
+
// and it's detached from the parent even if it's unref'd.
|
|
15338
|
+
childProcessOptions.stdio = 'ignore';
|
|
15339
|
+
childProcessOptions.detached = true;
|
|
15340
|
+
}
|
|
15341
|
+
}
|
|
15342
|
+
|
|
15343
|
+
if (platform === 'darwin' && appArguments.length > 0) {
|
|
15344
|
+
cliArguments.push('--args', ...appArguments);
|
|
15345
|
+
}
|
|
15346
|
+
|
|
15347
|
+
// This has to come after `--args`.
|
|
15348
|
+
if (options.target) {
|
|
15349
|
+
cliArguments.push(options.target);
|
|
15350
|
+
}
|
|
15351
|
+
|
|
15352
|
+
const subprocess = external_node_child_process_.spawn(command, cliArguments, childProcessOptions);
|
|
15353
|
+
|
|
15354
|
+
if (options.wait) {
|
|
15355
|
+
return new Promise((resolve, reject) => {
|
|
15356
|
+
subprocess.once('error', reject);
|
|
15357
|
+
|
|
15358
|
+
subprocess.once('close', exitCode => {
|
|
15359
|
+
if (!options.allowNonzeroExitCode && exitCode > 0) {
|
|
15360
|
+
reject(new Error(`Exited with code ${exitCode}`));
|
|
15361
|
+
return;
|
|
15362
|
+
}
|
|
15363
|
+
|
|
15364
|
+
resolve(subprocess);
|
|
15365
|
+
});
|
|
15366
|
+
});
|
|
15367
|
+
}
|
|
15368
|
+
|
|
15369
|
+
subprocess.unref();
|
|
15370
|
+
|
|
15371
|
+
return subprocess;
|
|
15372
|
+
};
|
|
15373
|
+
|
|
15374
|
+
const open_open = (target, options) => {
|
|
15375
|
+
if (typeof target !== 'string') {
|
|
15376
|
+
throw new TypeError('Expected a `target`');
|
|
15377
|
+
}
|
|
15378
|
+
|
|
15379
|
+
return baseOpen({
|
|
15380
|
+
...options,
|
|
15381
|
+
target,
|
|
15382
|
+
});
|
|
15383
|
+
};
|
|
15384
|
+
|
|
15385
|
+
const openApp = (name, options) => {
|
|
15386
|
+
if (typeof name !== 'string' && !Array.isArray(name)) {
|
|
15387
|
+
throw new TypeError('Expected a valid `name`');
|
|
15388
|
+
}
|
|
15389
|
+
|
|
15390
|
+
const {arguments: appArguments = []} = options ?? {};
|
|
15391
|
+
if (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {
|
|
15392
|
+
throw new TypeError('Expected `appArguments` as Array type');
|
|
15393
|
+
}
|
|
15394
|
+
|
|
15395
|
+
return baseOpen({
|
|
15396
|
+
...options,
|
|
15397
|
+
app: {
|
|
15398
|
+
name,
|
|
15399
|
+
arguments: appArguments,
|
|
15400
|
+
},
|
|
15401
|
+
});
|
|
15402
|
+
};
|
|
15403
|
+
|
|
15404
|
+
function detectArchBinary(binary) {
|
|
15405
|
+
if (typeof binary === 'string' || Array.isArray(binary)) {
|
|
15406
|
+
return binary;
|
|
15407
|
+
}
|
|
15408
|
+
|
|
15409
|
+
const {[arch]: archBinary} = binary;
|
|
15410
|
+
|
|
15411
|
+
if (!archBinary) {
|
|
15412
|
+
throw new Error(`${arch} is not supported`);
|
|
15413
|
+
}
|
|
15414
|
+
|
|
15415
|
+
return archBinary;
|
|
15416
|
+
}
|
|
15417
|
+
|
|
15418
|
+
function detectPlatformBinary({[platform]: platformBinary}, {wsl}) {
|
|
15419
|
+
if (wsl && is_wsl) {
|
|
15420
|
+
return detectArchBinary(wsl);
|
|
15421
|
+
}
|
|
15422
|
+
|
|
15423
|
+
if (!platformBinary) {
|
|
15424
|
+
throw new Error(`${platform} is not supported`);
|
|
15425
|
+
}
|
|
15426
|
+
|
|
15427
|
+
return detectArchBinary(platformBinary);
|
|
15428
|
+
}
|
|
15429
|
+
|
|
15430
|
+
const apps = {};
|
|
15431
|
+
|
|
15432
|
+
defineLazyProperty(apps, 'chrome', () => detectPlatformBinary({
|
|
15433
|
+
darwin: 'google chrome',
|
|
15434
|
+
win32: 'chrome',
|
|
15435
|
+
linux: ['google-chrome', 'google-chrome-stable', 'chromium'],
|
|
15436
|
+
}, {
|
|
15437
|
+
wsl: {
|
|
15438
|
+
ia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',
|
|
15439
|
+
x64: ['/mnt/c/Program Files/Google/Chrome/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'],
|
|
15440
|
+
},
|
|
15441
|
+
}));
|
|
15442
|
+
|
|
15443
|
+
defineLazyProperty(apps, 'brave', () => detectPlatformBinary({
|
|
15444
|
+
darwin: 'brave browser',
|
|
15445
|
+
win32: 'brave',
|
|
15446
|
+
linux: ['brave-browser', 'brave'],
|
|
15447
|
+
}, {
|
|
15448
|
+
wsl: {
|
|
15449
|
+
ia32: '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe',
|
|
15450
|
+
x64: ['/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe', '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe'],
|
|
15451
|
+
},
|
|
15452
|
+
}));
|
|
15453
|
+
|
|
15454
|
+
defineLazyProperty(apps, 'firefox', () => detectPlatformBinary({
|
|
15455
|
+
darwin: 'firefox',
|
|
15456
|
+
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
15457
|
+
linux: 'firefox',
|
|
15458
|
+
}, {
|
|
15459
|
+
wsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe',
|
|
15460
|
+
}));
|
|
15461
|
+
|
|
15462
|
+
defineLazyProperty(apps, 'edge', () => detectPlatformBinary({
|
|
15463
|
+
darwin: 'microsoft edge',
|
|
15464
|
+
win32: 'msedge',
|
|
15465
|
+
linux: ['microsoft-edge', 'microsoft-edge-dev'],
|
|
15466
|
+
}, {
|
|
15467
|
+
wsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',
|
|
15468
|
+
}));
|
|
15469
|
+
|
|
15470
|
+
defineLazyProperty(apps, 'browser', () => 'browser');
|
|
15471
|
+
|
|
15472
|
+
defineLazyProperty(apps, 'browserPrivate', () => 'browserPrivate');
|
|
15473
|
+
|
|
15474
|
+
/* harmony default export */ const node_modules_open = (open_open);
|
|
15475
|
+
|
|
15476
|
+
// EXTERNAL MODULE: ../../node_modules/qrcode/lib/index.js
|
|
15477
|
+
var lib = __nccwpck_require__(7514);
|
|
15478
|
+
// EXTERNAL MODULE: ./bin/vibelet-pairing-connections.mjs
|
|
15479
|
+
var vibelet_pairing_connections = __nccwpck_require__(7721);
|
|
15480
|
+
;// CONCATENATED MODULE: ./bin/vibelet-pairing-output.mjs
|
|
15481
|
+
|
|
15482
|
+
|
|
15483
|
+
|
|
15484
|
+
|
|
15485
|
+
|
|
15486
|
+
const TERMINAL_QR_MARGIN = 4;
|
|
15487
|
+
const SIXEL_TERMS = /^(?:mlterm|yaft|xterm-sixel)(?:-|$)/i;
|
|
15488
|
+
|
|
15489
|
+
function renderWideTerminalQr(qr) {
|
|
15490
|
+
const { data, size } = qr.modules;
|
|
15491
|
+
const white = '\x1b[47m ';
|
|
15492
|
+
const black = '\x1b[40m ';
|
|
15493
|
+
const reset = '\x1b[0m';
|
|
15494
|
+
const rows = [];
|
|
15495
|
+
|
|
15496
|
+
for (let y = -TERMINAL_QR_MARGIN; y < size + TERMINAL_QR_MARGIN; y += 1) {
|
|
15497
|
+
let row = '';
|
|
15498
|
+
for (let x = -TERMINAL_QR_MARGIN; x < size + TERMINAL_QR_MARGIN; x += 1) {
|
|
15499
|
+
const dark = x >= 0 && x < size && y >= 0 && y < size && data[y * size + x];
|
|
15500
|
+
row += dark ? black : white;
|
|
15501
|
+
}
|
|
15502
|
+
rows.push(`${row}${reset}`);
|
|
15503
|
+
}
|
|
15504
|
+
|
|
15505
|
+
return `${rows.join('\n')}\n`;
|
|
15506
|
+
}
|
|
15507
|
+
|
|
15508
|
+
async function renderTerminalQr(payload, columns = 0) {
|
|
15509
|
+
// Terminal capture benefits more from larger modules than from extra error
|
|
15510
|
+
// correction. The PNG keeps level M for printing and image import.
|
|
15511
|
+
const qr = lib.create(payload, { errorCorrectionLevel: 'L' });
|
|
15512
|
+
const wideColumns = (qr.modules.size + TERMINAL_QR_MARGIN * 2) * 2;
|
|
15513
|
+
if (columns >= wideColumns) {
|
|
15514
|
+
return renderWideTerminalQr(qr);
|
|
15515
|
+
}
|
|
15516
|
+
|
|
15517
|
+
const compactQr = await lib.toString(payload, {
|
|
15518
|
+
type: 'utf8',
|
|
15519
|
+
errorCorrectionLevel: 'L',
|
|
15520
|
+
margin: TERMINAL_QR_MARGIN,
|
|
15521
|
+
});
|
|
15522
|
+
return `\x1b[47m\x1b[30m${compactQr}\x1b[0m`;
|
|
15523
|
+
}
|
|
15524
|
+
|
|
15525
|
+
function detectTerminalImageProtocol(stdout, env = process.env) {
|
|
15526
|
+
if (!stdout.isTTY) return null;
|
|
15527
|
+
|
|
15528
|
+
const term = (env.TERM ?? '').toLowerCase();
|
|
15529
|
+
const termProgram = (env.TERM_PROGRAM ?? '').toLowerCase();
|
|
15530
|
+
if (
|
|
15531
|
+
env.KITTY_WINDOW_ID ||
|
|
15532
|
+
env.KITTY_PID ||
|
|
15533
|
+
env.GHOSTTY_RESOURCES_DIR ||
|
|
15534
|
+
env.WEZTERM_PANE ||
|
|
15535
|
+
['kitty', 'ghostty', 'warpterminal', 'wezterm', 'rio'].includes(termProgram) ||
|
|
15536
|
+
/kitty|ghostty/.test(term)
|
|
15537
|
+
) {
|
|
15538
|
+
return 'kitty';
|
|
15539
|
+
}
|
|
15540
|
+
if (termProgram === 'iterm.app' || env.LC_TERMINAL?.toLowerCase() === 'iterm2') {
|
|
15541
|
+
return 'iterm2';
|
|
15542
|
+
}
|
|
15543
|
+
if (
|
|
15544
|
+
SIXEL_TERMS.test(term) ||
|
|
15545
|
+
['mintty', 'vscode'].includes(termProgram) ||
|
|
15546
|
+
termProgram === 'konsole' ||
|
|
15547
|
+
Boolean(env.KONSOLE_VERSION)
|
|
15548
|
+
) {
|
|
15549
|
+
return 'sixel';
|
|
15550
|
+
}
|
|
15551
|
+
return null;
|
|
15552
|
+
}
|
|
15553
|
+
|
|
15554
|
+
function renderKittyPng(png) {
|
|
15555
|
+
const encoded = png.toString('base64');
|
|
15556
|
+
const chunks = encoded.match(/.{1,4096}/g) ?? [];
|
|
15557
|
+
return chunks
|
|
15558
|
+
.map((chunk, index) => {
|
|
15559
|
+
const more = index < chunks.length - 1 ? 1 : 0;
|
|
15560
|
+
const header = index === 0 ? `a=T,f=100,m=${more}` : `m=${more}`;
|
|
15561
|
+
return `\x1b_G${header};${chunk}\x1b\\`;
|
|
15562
|
+
})
|
|
15563
|
+
.join('');
|
|
15564
|
+
}
|
|
15565
|
+
|
|
15566
|
+
function renderIterm2Png(png) {
|
|
15567
|
+
return `\x1b]1337;File=inline=1;preserveAspectRatio=1:${png.toString('base64')}\x07`;
|
|
15568
|
+
}
|
|
15569
|
+
|
|
15570
|
+
function encodeSixelRuns(values) {
|
|
15571
|
+
let output = '';
|
|
15572
|
+
for (let index = 0; index < values.length; ) {
|
|
15573
|
+
let end = index + 1;
|
|
15574
|
+
while (end < values.length && values[end] === values[index]) end += 1;
|
|
15575
|
+
const count = end - index;
|
|
15576
|
+
const char = String.fromCharCode(63 + values[index]);
|
|
15577
|
+
output += count >= 4 ? `!${count}${char}` : char.repeat(count);
|
|
15578
|
+
index = end;
|
|
15579
|
+
}
|
|
15580
|
+
return output;
|
|
15581
|
+
}
|
|
15582
|
+
|
|
15583
|
+
function renderSixelQr(payload, scale = 6) {
|
|
15584
|
+
const qr = lib.create(payload, { errorCorrectionLevel: 'M' });
|
|
15585
|
+
const moduleSize = qr.modules.size;
|
|
15586
|
+
const rasterModules = moduleSize + TERMINAL_QR_MARGIN * 2;
|
|
15587
|
+
const width = rasterModules * scale;
|
|
15588
|
+
const height = rasterModules * scale;
|
|
15589
|
+
let output = `\x1bPq"1;1;${width};${height}#0;2;100;100;100#1;2;0;0;0`;
|
|
15590
|
+
|
|
15591
|
+
for (let bandY = 0; bandY < height; bandY += 6) {
|
|
15592
|
+
output += `#0!${width}~$#1`;
|
|
15593
|
+
const columns = [];
|
|
15594
|
+
for (let x = 0; x < width; x += 1) {
|
|
15595
|
+
let sixel = 0;
|
|
15596
|
+
const moduleX = Math.floor(x / scale) - TERMINAL_QR_MARGIN;
|
|
15597
|
+
for (let bit = 0; bit < 6; bit += 1) {
|
|
15598
|
+
const y = bandY + bit;
|
|
15599
|
+
const moduleY = Math.floor(y / scale) - TERMINAL_QR_MARGIN;
|
|
15600
|
+
const dark =
|
|
15601
|
+
moduleX >= 0 &&
|
|
15602
|
+
moduleX < moduleSize &&
|
|
15603
|
+
moduleY >= 0 &&
|
|
15604
|
+
moduleY < moduleSize &&
|
|
15605
|
+
qr.modules.data[moduleY * moduleSize + moduleX];
|
|
15606
|
+
if (dark) sixel |= 1 << bit;
|
|
15607
|
+
}
|
|
15608
|
+
columns.push(sixel);
|
|
15609
|
+
}
|
|
15610
|
+
output += encodeSixelRuns(columns);
|
|
15611
|
+
if (bandY + 6 < height) output += '-';
|
|
15612
|
+
}
|
|
15613
|
+
return `${output}\x1b\\`;
|
|
15614
|
+
}
|
|
15615
|
+
|
|
15616
|
+
function tryWriteTerminalQrImage(
|
|
15617
|
+
pairingQrPngPath,
|
|
15618
|
+
qrPayload,
|
|
15619
|
+
{ stdout, env = process.env, readFileSyncImpl = external_node_fs_.readFileSync },
|
|
15620
|
+
) {
|
|
15621
|
+
const protocol = detectTerminalImageProtocol(stdout, env);
|
|
15622
|
+
if (!protocol) return false;
|
|
15623
|
+
|
|
15624
|
+
try {
|
|
15625
|
+
const rendered =
|
|
15626
|
+
protocol === 'sixel'
|
|
15627
|
+
? renderSixelQr(qrPayload)
|
|
15628
|
+
: protocol === 'kitty'
|
|
15629
|
+
? renderKittyPng(readFileSyncImpl(pairingQrPngPath))
|
|
15630
|
+
: renderIterm2Png(readFileSyncImpl(pairingQrPngPath));
|
|
15631
|
+
stdout.write(rendered);
|
|
15632
|
+
stdout.write('\n');
|
|
15633
|
+
return true;
|
|
15634
|
+
} catch {
|
|
15635
|
+
return false;
|
|
15636
|
+
}
|
|
15637
|
+
}
|
|
15638
|
+
|
|
15639
|
+
async function tryOpenPairingImage(
|
|
15640
|
+
pairingQrPngPath,
|
|
15641
|
+
{ stdout, env = process.env, platform = process.platform, openImpl = node_modules_open },
|
|
15642
|
+
) {
|
|
15643
|
+
const hasDesktopSession = platform === 'darwin' || platform === 'win32' || env.DISPLAY || env.WAYLAND_DISPLAY;
|
|
15644
|
+
if (!stdout.isTTY || !hasDesktopSession) return false;
|
|
15645
|
+
|
|
15646
|
+
try {
|
|
15647
|
+
await openImpl(pairingQrPngPath, { wait: false });
|
|
15648
|
+
return true;
|
|
15649
|
+
} catch {
|
|
15650
|
+
return false;
|
|
15651
|
+
}
|
|
15652
|
+
}
|
|
15653
|
+
|
|
15654
|
+
async function presentPairingQr(
|
|
15655
|
+
pairingQrPngPath,
|
|
15656
|
+
qrPayload,
|
|
15657
|
+
{ stdout, env = process.env, platform = process.platform, openImpl = node_modules_open, readFileSyncImpl = external_node_fs_.readFileSync },
|
|
15658
|
+
) {
|
|
15659
|
+
const openedImage = await tryOpenPairingImage(pairingQrPngPath, {
|
|
15660
|
+
stdout,
|
|
15661
|
+
env,
|
|
15662
|
+
platform,
|
|
15663
|
+
openImpl,
|
|
15664
|
+
});
|
|
15665
|
+
if (openedImage) return 'opened';
|
|
15666
|
+
|
|
15667
|
+
const renderedInline = tryWriteTerminalQrImage(pairingQrPngPath, qrPayload, {
|
|
15668
|
+
stdout,
|
|
15669
|
+
env,
|
|
15670
|
+
readFileSyncImpl,
|
|
15671
|
+
});
|
|
15672
|
+
return renderedInline ? 'inline' : 'fallback';
|
|
15673
|
+
}
|
|
14737
15674
|
|
|
14738
15675
|
async function writePairingOutput(pairingPayload, { directory, pairingCodePath, pairingQrPngPath, stdout }) {
|
|
14739
|
-
const payload = JSON.stringify((0,
|
|
14740
|
-
const qrPayload = JSON.stringify((0,
|
|
14741
|
-
const deepLink = (0,
|
|
14742
|
-
(0,
|
|
14743
|
-
await
|
|
15676
|
+
const payload = JSON.stringify((0,vibelet_pairing_connections/* createCompactPairingPayload */.YP)(pairingPayload));
|
|
15677
|
+
const qrPayload = JSON.stringify((0,vibelet_pairing_connections/* createScannablePairingPayload */.u_)(pairingPayload));
|
|
15678
|
+
const deepLink = (0,vibelet_pairing_connections/* buildPairingDeepLink */.N7)(payload);
|
|
15679
|
+
(0,external_node_fs_.mkdirSync)(directory, { recursive: true });
|
|
15680
|
+
await lib.toFile(pairingQrPngPath, qrPayload, {
|
|
14744
15681
|
type: 'png',
|
|
14745
15682
|
errorCorrectionLevel: 'M',
|
|
14746
15683
|
margin: 4,
|
|
14747
15684
|
scale: 8,
|
|
14748
15685
|
});
|
|
14749
|
-
const qr = await
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
15686
|
+
const qr = await renderTerminalQr(qrPayload, stdout.columns);
|
|
15687
|
+
(0,external_node_fs_.writeFileSync)(pairingCodePath, `${payload}\n`, 'utf8');
|
|
15688
|
+
stdout.write('\nScan this QR code with the Vibelet app:\n\n');
|
|
15689
|
+
const presentation = await presentPairingQr(pairingQrPngPath, qrPayload, { stdout });
|
|
15690
|
+
if (presentation === 'opened') {
|
|
15691
|
+
stdout.write('Opened the pairing QR image in your default viewer.\n\n');
|
|
15692
|
+
} else if (presentation === 'fallback') {
|
|
15693
|
+
stdout.write(`${qr}\n`);
|
|
15694
|
+
}
|
|
15695
|
+
stdout.write(`Pairing QR image saved to:\n${pairingQrPngPath}\n`);
|
|
14757
15696
|
stdout.write(`This pairing QR expires at: ${pairingPayload.expiresAt}\n`);
|
|
14758
15697
|
stdout.write(`If this device can't scan, paste this pairing code in Vibelet:\n${payload}\n`);
|
|
14759
15698
|
stdout.write(`Pairing code saved to:\n${pairingCodePath}\n`);
|
|
@@ -15032,7 +15971,7 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
|
|
|
15032
15971
|
/* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(6760);
|
|
15033
15972
|
/* harmony import */ var node_url__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(3136);
|
|
15034
15973
|
/* harmony import */ var _vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_17__ = __nccwpck_require__(6927);
|
|
15035
|
-
/* harmony import */ var _cloudflared_tunnel_manager_mjs__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(
|
|
15974
|
+
/* harmony import */ var _cloudflared_tunnel_manager_mjs__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(6895);
|
|
15036
15975
|
/* harmony import */ var _vibelet_cloudflare_runtime_mjs__WEBPACK_IMPORTED_MODULE_7__ = __nccwpck_require__(3869);
|
|
15037
15976
|
/* harmony import */ var _vibelet_launchd_mjs__WEBPACK_IMPORTED_MODULE_13__ = __nccwpck_require__(1010);
|
|
15038
15977
|
/* harmony import */ var _linux_systemd_mjs__WEBPACK_IMPORTED_MODULE_8__ = __nccwpck_require__(4217);
|
|
@@ -15042,7 +15981,7 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
|
|
|
15042
15981
|
/* harmony import */ var _vibelet_runtime_policy_mjs__WEBPACK_IMPORTED_MODULE_12__ = __nccwpck_require__(4);
|
|
15043
15982
|
/* harmony import */ var _terminal_wrapper_mjs__WEBPACK_IMPORTED_MODULE_10__ = __nccwpck_require__(877);
|
|
15044
15983
|
/* harmony import */ var _vibelet_pairing_connections_mjs__WEBPACK_IMPORTED_MODULE_15__ = __nccwpck_require__(7721);
|
|
15045
|
-
/* harmony import */ var _vibelet_pairing_output_mjs__WEBPACK_IMPORTED_MODULE_11__ = __nccwpck_require__(
|
|
15984
|
+
/* harmony import */ var _vibelet_pairing_output_mjs__WEBPACK_IMPORTED_MODULE_11__ = __nccwpck_require__(9485);
|
|
15046
15985
|
|
|
15047
15986
|
|
|
15048
15987
|
|
|
@@ -15925,7 +16864,7 @@ function validateExplicitCleartextHosts({ hostArg, fallbackHostsArg }) {
|
|
|
15925
16864
|
}
|
|
15926
16865
|
|
|
15927
16866
|
async function printPairingQr(pairingPayload) {
|
|
15928
|
-
await (0,_vibelet_pairing_output_mjs__WEBPACK_IMPORTED_MODULE_11__/* .writePairingOutput */ .
|
|
16867
|
+
await (0,_vibelet_pairing_output_mjs__WEBPACK_IMPORTED_MODULE_11__/* .writePairingOutput */ .pO)(pairingPayload, {
|
|
15929
16868
|
directory: vibeletDir,
|
|
15930
16869
|
pairingCodePath,
|
|
15931
16870
|
pairingQrPngPath,
|