@heybox/hb-sdk 0.3.3 → 0.4.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.
Files changed (35) hide show
  1. package/README.md +63 -28
  2. package/dist/cli-chunks/browser-RAy8e8cV.cjs +635 -0
  3. package/dist/cli-chunks/create-D1j9UnM7.cjs +1376 -0
  4. package/dist/cli-chunks/deploy-CknDDoS_.cjs +3730 -0
  5. package/dist/cli-chunks/dev-BS9h09yG.cjs +955 -0
  6. package/dist/cli-chunks/doctor-WTl1HCW0.cjs +186 -0
  7. package/dist/cli-chunks/index-io4h3kr-.cjs +13348 -0
  8. package/dist/cli-chunks/index-yjJgBEBF.cjs +64023 -0
  9. package/dist/cli-chunks/login-B-A53Sta.cjs +193 -0
  10. package/dist/cli-chunks/session-CMBN3o9z.cjs +3040 -0
  11. package/dist/cli.cjs +19 -77707
  12. package/dist/devtools/mock-host/index.html +62 -2
  13. package/dist/devtools/mock-host/main.js +3246 -20
  14. package/dist/index.cjs.js +20 -0
  15. package/dist/index.esm.js +20 -0
  16. package/dist/miniapp-publish.cjs.js +2810 -4
  17. package/dist/miniapp-publish.esm.js +2809 -4
  18. package/dist/protocol.cjs.js +15 -0
  19. package/dist/protocol.esm.js +15 -1
  20. package/dist/templates/vue3-vite-ts/README.md.ejs +2 -2
  21. package/dist/vite.cjs.js +2814 -14
  22. package/dist/vite.esm.js +2814 -14
  23. package/package.json +6 -1
  24. package/skill/SKILL.md +19 -13
  25. package/skill/references/api-protocol.md +7 -2
  26. package/skill/references/api-root.md +24 -13
  27. package/skill/references/cli.md +335 -104
  28. package/skill/scripts/sync-references.mjs +17 -1
  29. package/skill/skill.json +4 -4
  30. package/types/index.d.ts +1 -1
  31. package/types/miniapp-manifest/schema.d.ts +2 -1
  32. package/types/miniapp-publish/index.d.ts +2 -1
  33. package/types/modules/viewport/index.d.ts +33 -0
  34. package/types/protocol/capabilities.d.ts +17 -2
  35. package/types/protocol.d.ts +2 -2
@@ -0,0 +1,635 @@
1
+ 'use strict';
2
+
3
+ var process = require('node:process');
4
+ var node_buffer = require('node:buffer');
5
+ var path = require('node:path');
6
+ var node_url = require('node:url');
7
+ var node_util = require('node:util');
8
+ var childProcess = require('node:child_process');
9
+ var fs$1 = require('node:fs/promises');
10
+ var os = require('node:os');
11
+ var fs = require('node:fs');
12
+
13
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
14
+ let isDockerCached;
15
+
16
+ function hasDockerEnv() {
17
+ try {
18
+ fs.statSync('/.dockerenv');
19
+ return true;
20
+ } catch {
21
+ return false;
22
+ }
23
+ }
24
+
25
+ function hasDockerCGroup() {
26
+ try {
27
+ return fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
28
+ } catch {
29
+ return false;
30
+ }
31
+ }
32
+
33
+ function isDocker() {
34
+ // TODO: Use `??=` when targeting Node.js 16.
35
+ if (isDockerCached === undefined) {
36
+ isDockerCached = hasDockerEnv() || hasDockerCGroup();
37
+ }
38
+
39
+ return isDockerCached;
40
+ }
41
+
42
+ let cachedResult;
43
+
44
+ // Podman detection
45
+ const hasContainerEnv = () => {
46
+ try {
47
+ fs.statSync('/run/.containerenv');
48
+ return true;
49
+ } catch {
50
+ return false;
51
+ }
52
+ };
53
+
54
+ function isInsideContainer() {
55
+ // TODO: Use `??=` when targeting Node.js 16.
56
+ if (cachedResult === undefined) {
57
+ cachedResult = hasContainerEnv() || isDocker();
58
+ }
59
+
60
+ return cachedResult;
61
+ }
62
+
63
+ const isWsl = () => {
64
+ if (process.platform !== 'linux') {
65
+ return false;
66
+ }
67
+
68
+ if (os.release().toLowerCase().includes('microsoft')) {
69
+ if (isInsideContainer()) {
70
+ return false;
71
+ }
72
+
73
+ return true;
74
+ }
75
+
76
+ try {
77
+ if (fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')) {
78
+ return !isInsideContainer();
79
+ }
80
+ } catch {}
81
+
82
+ // Fallback for custom kernels: check WSL-specific paths.
83
+ if (
84
+ fs.existsSync('/proc/sys/fs/binfmt_misc/WSLInterop')
85
+ || fs.existsSync('/run/WSL')
86
+ ) {
87
+ return !isInsideContainer();
88
+ }
89
+
90
+ return false;
91
+ };
92
+
93
+ var isWsl$1 = process.env.__IS_WSL_TEST__ ? isWsl : isWsl();
94
+
95
+ const wslDrivesMountPoint = (() => {
96
+ // Default value for "root" param
97
+ // according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config
98
+ const defaultMountPoint = '/mnt/';
99
+
100
+ let mountPoint;
101
+
102
+ return async function () {
103
+ if (mountPoint) {
104
+ // Return memoized mount point value
105
+ return mountPoint;
106
+ }
107
+
108
+ const configFilePath = '/etc/wsl.conf';
109
+
110
+ let isConfigFileExists = false;
111
+ try {
112
+ await fs$1.access(configFilePath, fs$1.constants.F_OK);
113
+ isConfigFileExists = true;
114
+ } catch {}
115
+
116
+ if (!isConfigFileExists) {
117
+ return defaultMountPoint;
118
+ }
119
+
120
+ const configContent = await fs$1.readFile(configFilePath, {encoding: 'utf8'});
121
+ const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
122
+
123
+ if (!configMountPoint) {
124
+ return defaultMountPoint;
125
+ }
126
+
127
+ mountPoint = configMountPoint.groups.mountPoint.trim();
128
+ mountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;
129
+
130
+ return mountPoint;
131
+ };
132
+ })();
133
+
134
+ const powerShellPathFromWsl = async () => {
135
+ const mountPoint = await wslDrivesMountPoint();
136
+ return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
137
+ };
138
+
139
+ const powerShellPath = async () => {
140
+ if (isWsl$1) {
141
+ return powerShellPathFromWsl();
142
+ }
143
+
144
+ return `${process.env.SYSTEMROOT || process.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
145
+ };
146
+
147
+ function defineLazyProperty(object, propertyName, valueGetter) {
148
+ const define = value => Object.defineProperty(object, propertyName, {value, enumerable: true, writable: true});
149
+
150
+ Object.defineProperty(object, propertyName, {
151
+ configurable: true,
152
+ enumerable: true,
153
+ get() {
154
+ const result = valueGetter();
155
+ define(result);
156
+ return result;
157
+ },
158
+ set(value) {
159
+ define(value);
160
+ }
161
+ });
162
+
163
+ return object;
164
+ }
165
+
166
+ const execFileAsync$3 = node_util.promisify(childProcess.execFile);
167
+
168
+ async function defaultBrowserId() {
169
+ if (process.platform !== 'darwin') {
170
+ throw new Error('macOS only');
171
+ }
172
+
173
+ const {stdout} = await execFileAsync$3('defaults', ['read', 'com.apple.LaunchServices/com.apple.launchservices.secure', 'LSHandlers']);
174
+
175
+ // `(?!-)` is to prevent matching `LSHandlerRoleAll = "-";`.
176
+ const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
177
+
178
+ const browserId = match?.groups.id ?? 'com.apple.Safari';
179
+
180
+ // Correct the case for Safari's bundle identifier
181
+ if (browserId === 'com.apple.safari') {
182
+ return 'com.apple.Safari';
183
+ }
184
+
185
+ return browserId;
186
+ }
187
+
188
+ const execFileAsync$2 = node_util.promisify(childProcess.execFile);
189
+
190
+ async function runAppleScript(script, {humanReadableOutput = true, signal} = {}) {
191
+ if (process.platform !== 'darwin') {
192
+ throw new Error('macOS only');
193
+ }
194
+
195
+ const outputArguments = humanReadableOutput ? [] : ['-ss'];
196
+
197
+ const execOptions = {};
198
+ if (signal) {
199
+ execOptions.signal = signal;
200
+ }
201
+
202
+ const {stdout} = await execFileAsync$2('osascript', ['-e', script, outputArguments], execOptions);
203
+ return stdout.trim();
204
+ }
205
+
206
+ async function bundleName(bundleId) {
207
+ 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")`);
208
+ }
209
+
210
+ const execFileAsync$1 = node_util.promisify(childProcess.execFile);
211
+
212
+ // TODO: Fix the casing of bundle identifiers in the next major version.
213
+
214
+ // Windows doesn't have browser IDs in the same way macOS/Linux does so we give fake
215
+ // ones that look real and match the macOS/Linux versions for cross-platform apps.
216
+ const windowsBrowserProgIds = {
217
+ MSEdgeHTM: {name: 'Edge', id: 'com.microsoft.edge'}, // The missing `L` is correct.
218
+ MSEdgeBHTML: {name: 'Edge Beta', id: 'com.microsoft.edge.beta'},
219
+ MSEdgeDHTML: {name: 'Edge Dev', id: 'com.microsoft.edge.dev'},
220
+ AppXq0fevzme2pys62n3e0fbqa7peapykr8v: {name: 'Edge', id: 'com.microsoft.edge.old'},
221
+ ChromeHTML: {name: 'Chrome', id: 'com.google.chrome'},
222
+ ChromeBHTML: {name: 'Chrome Beta', id: 'com.google.chrome.beta'},
223
+ ChromeDHTML: {name: 'Chrome Dev', id: 'com.google.chrome.dev'},
224
+ ChromiumHTM: {name: 'Chromium', id: 'org.chromium.Chromium'},
225
+ BraveHTML: {name: 'Brave', id: 'com.brave.Browser'},
226
+ BraveBHTML: {name: 'Brave Beta', id: 'com.brave.Browser.beta'},
227
+ BraveDHTML: {name: 'Brave Dev', id: 'com.brave.Browser.dev'},
228
+ BraveSSHTM: {name: 'Brave Nightly', id: 'com.brave.Browser.nightly'},
229
+ FirefoxURL: {name: 'Firefox', id: 'org.mozilla.firefox'},
230
+ OperaStable: {name: 'Opera', id: 'com.operasoftware.Opera'},
231
+ VivaldiHTM: {name: 'Vivaldi', id: 'com.vivaldi.Vivaldi'},
232
+ 'IE.HTTP': {name: 'Internet Explorer', id: 'com.microsoft.ie'},
233
+ };
234
+
235
+ new Map(Object.entries(windowsBrowserProgIds));
236
+
237
+ class UnknownBrowserError extends Error {}
238
+
239
+ async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
240
+ const {stdout} = await _execFileAsync('reg', [
241
+ 'QUERY',
242
+ ' HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice',
243
+ '/v',
244
+ 'ProgId',
245
+ ]);
246
+
247
+ const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
248
+ if (!match) {
249
+ throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
250
+ }
251
+
252
+ const {id} = match.groups;
253
+
254
+ // Windows can append a hash suffix to ProgIds using a dot or hyphen
255
+ // (e.g., `ChromeHTML.ABC123`, `FirefoxURL-6F193CCC56814779`).
256
+ // Try exact match first, then try without the suffix.
257
+ const dotIndex = id.lastIndexOf('.');
258
+ const hyphenIndex = id.lastIndexOf('-');
259
+ const baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);
260
+ const baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);
261
+
262
+ return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? {name: id, id};
263
+ }
264
+
265
+ const execFileAsync = node_util.promisify(childProcess.execFile);
266
+
267
+ // Inlined: https://github.com/sindresorhus/titleize/blob/main/index.js
268
+ const titleize = string => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, x => x.toUpperCase());
269
+
270
+ async function defaultBrowser() {
271
+ if (process.platform === 'darwin') {
272
+ const id = await defaultBrowserId();
273
+ const name = await bundleName(id);
274
+ return {name, id};
275
+ }
276
+
277
+ if (process.platform === 'linux') {
278
+ const {stdout} = await execFileAsync('xdg-mime', ['query', 'default', 'x-scheme-handler/http']);
279
+ const id = stdout.trim();
280
+ const name = titleize(id.replace(/.desktop$/, '').replace('-', ' '));
281
+ return {name, id};
282
+ }
283
+
284
+ if (process.platform === 'win32') {
285
+ return defaultBrowser$1();
286
+ }
287
+
288
+ throw new Error('Only macOS, Linux, and Windows are supported');
289
+ }
290
+
291
+ const execFile = node_util.promisify(childProcess.execFile);
292
+
293
+ // Path to included `xdg-open`.
294
+ const __dirname$1 = path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/browser-RAy8e8cV.cjs', document.baseURI).href))));
295
+ const localXdgOpenPath = path.join(__dirname$1, 'xdg-open');
296
+
297
+ const {platform, arch} = process;
298
+
299
+ /**
300
+ Get the default browser name in Windows from WSL.
301
+
302
+ @returns {Promise<string>} Browser name.
303
+ */
304
+ async function getWindowsDefaultBrowserFromWsl() {
305
+ const powershellPath = await powerShellPath();
306
+ const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
307
+ const encodedCommand = node_buffer.Buffer.from(rawCommand, 'utf16le').toString('base64');
308
+
309
+ const {stdout} = await execFile(
310
+ powershellPath,
311
+ [
312
+ '-NoProfile',
313
+ '-NonInteractive',
314
+ '-ExecutionPolicy',
315
+ 'Bypass',
316
+ '-EncodedCommand',
317
+ encodedCommand,
318
+ ],
319
+ {encoding: 'utf8'},
320
+ );
321
+
322
+ const progId = stdout.trim();
323
+
324
+ // Map ProgId to browser IDs
325
+ const browserMap = {
326
+ ChromeHTML: 'com.google.chrome',
327
+ BraveHTML: 'com.brave.Browser',
328
+ MSEdgeHTM: 'com.microsoft.edge',
329
+ FirefoxURL: 'org.mozilla.firefox',
330
+ };
331
+
332
+ return browserMap[progId] ? {id: browserMap[progId]} : {};
333
+ }
334
+
335
+ const pTryEach = async (array, mapper) => {
336
+ let latestError;
337
+
338
+ for (const item of array) {
339
+ try {
340
+ return await mapper(item); // eslint-disable-line no-await-in-loop
341
+ } catch (error) {
342
+ latestError = error;
343
+ }
344
+ }
345
+
346
+ throw latestError;
347
+ };
348
+
349
+ // eslint-disable-next-line complexity
350
+ const baseOpen = async options => {
351
+ options = {
352
+ wait: false,
353
+ background: false,
354
+ newInstance: false,
355
+ allowNonzeroExitCode: false,
356
+ ...options,
357
+ };
358
+
359
+ if (Array.isArray(options.app)) {
360
+ return pTryEach(options.app, singleApp => baseOpen({
361
+ ...options,
362
+ app: singleApp,
363
+ }));
364
+ }
365
+
366
+ let {name: app, arguments: appArguments = []} = options.app ?? {};
367
+ appArguments = [...appArguments];
368
+
369
+ if (Array.isArray(app)) {
370
+ return pTryEach(app, appName => baseOpen({
371
+ ...options,
372
+ app: {
373
+ name: appName,
374
+ arguments: appArguments,
375
+ },
376
+ }));
377
+ }
378
+
379
+ if (app === 'browser' || app === 'browserPrivate') {
380
+ // IDs from default-browser for macOS and windows are the same
381
+ const ids = {
382
+ 'com.google.chrome': 'chrome',
383
+ 'google-chrome.desktop': 'chrome',
384
+ 'com.brave.Browser': 'brave',
385
+ 'org.mozilla.firefox': 'firefox',
386
+ 'firefox.desktop': 'firefox',
387
+ 'com.microsoft.msedge': 'edge',
388
+ 'com.microsoft.edge': 'edge',
389
+ 'com.microsoft.edgemac': 'edge',
390
+ 'microsoft-edge.desktop': 'edge',
391
+ };
392
+
393
+ // Incognito flags for each browser in `apps`.
394
+ const flags = {
395
+ chrome: '--incognito',
396
+ brave: '--incognito',
397
+ firefox: '--private-window',
398
+ edge: '--inPrivate',
399
+ };
400
+
401
+ const browser = isWsl$1 ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser();
402
+ if (browser.id in ids) {
403
+ const browserName = ids[browser.id];
404
+
405
+ if (app === 'browserPrivate') {
406
+ appArguments.push(flags[browserName]);
407
+ }
408
+
409
+ return baseOpen({
410
+ ...options,
411
+ app: {
412
+ name: apps[browserName],
413
+ arguments: appArguments,
414
+ },
415
+ });
416
+ }
417
+
418
+ throw new Error(`${browser.name} is not supported as a default browser`);
419
+ }
420
+
421
+ let command;
422
+ const cliArguments = [];
423
+ const childProcessOptions = {};
424
+
425
+ if (platform === 'darwin') {
426
+ command = 'open';
427
+
428
+ if (options.wait) {
429
+ cliArguments.push('--wait-apps');
430
+ }
431
+
432
+ if (options.background) {
433
+ cliArguments.push('--background');
434
+ }
435
+
436
+ if (options.newInstance) {
437
+ cliArguments.push('--new');
438
+ }
439
+
440
+ if (app) {
441
+ cliArguments.push('-a', app);
442
+ }
443
+ } else if (platform === 'win32' || (isWsl$1 && !isInsideContainer() && !app)) {
444
+ command = await powerShellPath();
445
+
446
+ cliArguments.push(
447
+ '-NoProfile',
448
+ '-NonInteractive',
449
+ '-ExecutionPolicy',
450
+ 'Bypass',
451
+ '-EncodedCommand',
452
+ );
453
+
454
+ if (!isWsl$1) {
455
+ childProcessOptions.windowsVerbatimArguments = true;
456
+ }
457
+
458
+ const encodedArguments = ['Start'];
459
+
460
+ if (options.wait) {
461
+ encodedArguments.push('-Wait');
462
+ }
463
+
464
+ if (app) {
465
+ // Double quote with double quotes to ensure the inner quotes are passed through.
466
+ // Inner quotes are delimited for PowerShell interpretation with backticks.
467
+ encodedArguments.push(`"\`"${app}\`""`);
468
+ if (options.target) {
469
+ appArguments.push(options.target);
470
+ }
471
+ } else if (options.target) {
472
+ encodedArguments.push(`"${options.target}"`);
473
+ }
474
+
475
+ if (appArguments.length > 0) {
476
+ appArguments = appArguments.map(argument => `"\`"${argument}\`""`);
477
+ encodedArguments.push('-ArgumentList', appArguments.join(','));
478
+ }
479
+
480
+ // Using Base64-encoded command, accepted by PowerShell, to allow special characters.
481
+ options.target = node_buffer.Buffer.from(encodedArguments.join(' '), 'utf16le').toString('base64');
482
+ } else {
483
+ if (app) {
484
+ command = app;
485
+ } else {
486
+ // When bundled by Webpack, there's no actual package file path and no local `xdg-open`.
487
+ const isBundled = !__dirname$1 || __dirname$1 === '/';
488
+
489
+ // Check if local `xdg-open` exists and is executable.
490
+ let exeLocalXdgOpen = false;
491
+ try {
492
+ await fs$1.access(localXdgOpenPath, fs$1.constants.X_OK);
493
+ exeLocalXdgOpen = true;
494
+ } catch {}
495
+
496
+ const useSystemXdgOpen = process.versions.electron
497
+ ?? (platform === 'android' || isBundled || !exeLocalXdgOpen);
498
+ command = useSystemXdgOpen ? 'xdg-open' : localXdgOpenPath;
499
+ }
500
+
501
+ if (appArguments.length > 0) {
502
+ cliArguments.push(...appArguments);
503
+ }
504
+
505
+ if (!options.wait) {
506
+ // `xdg-open` will block the process unless stdio is ignored
507
+ // and it's detached from the parent even if it's unref'd.
508
+ childProcessOptions.stdio = 'ignore';
509
+ childProcessOptions.detached = true;
510
+ }
511
+ }
512
+
513
+ if (platform === 'darwin' && appArguments.length > 0) {
514
+ cliArguments.push('--args', ...appArguments);
515
+ }
516
+
517
+ // This has to come after `--args`.
518
+ if (options.target) {
519
+ cliArguments.push(options.target);
520
+ }
521
+
522
+ const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
523
+
524
+ if (options.wait) {
525
+ return new Promise((resolve, reject) => {
526
+ subprocess.once('error', reject);
527
+
528
+ subprocess.once('close', exitCode => {
529
+ if (!options.allowNonzeroExitCode && exitCode > 0) {
530
+ reject(new Error(`Exited with code ${exitCode}`));
531
+ return;
532
+ }
533
+
534
+ resolve(subprocess);
535
+ });
536
+ });
537
+ }
538
+
539
+ subprocess.unref();
540
+
541
+ return subprocess;
542
+ };
543
+
544
+ const open = (target, options) => {
545
+ if (typeof target !== 'string') {
546
+ throw new TypeError('Expected a `target`');
547
+ }
548
+
549
+ return baseOpen({
550
+ ...options,
551
+ target,
552
+ });
553
+ };
554
+
555
+ function detectArchBinary(binary) {
556
+ if (typeof binary === 'string' || Array.isArray(binary)) {
557
+ return binary;
558
+ }
559
+
560
+ const {[arch]: archBinary} = binary;
561
+
562
+ if (!archBinary) {
563
+ throw new Error(`${arch} is not supported`);
564
+ }
565
+
566
+ return archBinary;
567
+ }
568
+
569
+ function detectPlatformBinary({[platform]: platformBinary}, {wsl}) {
570
+ if (wsl && isWsl$1) {
571
+ return detectArchBinary(wsl);
572
+ }
573
+
574
+ if (!platformBinary) {
575
+ throw new Error(`${platform} is not supported`);
576
+ }
577
+
578
+ return detectArchBinary(platformBinary);
579
+ }
580
+
581
+ const apps = {};
582
+
583
+ defineLazyProperty(apps, 'chrome', () => detectPlatformBinary({
584
+ darwin: 'google chrome',
585
+ win32: 'chrome',
586
+ linux: ['google-chrome', 'google-chrome-stable', 'chromium'],
587
+ }, {
588
+ wsl: {
589
+ ia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',
590
+ x64: ['/mnt/c/Program Files/Google/Chrome/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'],
591
+ },
592
+ }));
593
+
594
+ defineLazyProperty(apps, 'brave', () => detectPlatformBinary({
595
+ darwin: 'brave browser',
596
+ win32: 'brave',
597
+ linux: ['brave-browser', 'brave'],
598
+ }, {
599
+ wsl: {
600
+ ia32: '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe',
601
+ x64: ['/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe', '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe'],
602
+ },
603
+ }));
604
+
605
+ defineLazyProperty(apps, 'firefox', () => detectPlatformBinary({
606
+ darwin: 'firefox',
607
+ win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
608
+ linux: 'firefox',
609
+ }, {
610
+ wsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe',
611
+ }));
612
+
613
+ defineLazyProperty(apps, 'edge', () => detectPlatformBinary({
614
+ darwin: 'microsoft edge',
615
+ win32: 'msedge',
616
+ linux: ['microsoft-edge', 'microsoft-edge-dev'],
617
+ }, {
618
+ wsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',
619
+ }));
620
+
621
+ defineLazyProperty(apps, 'browser', () => 'browser');
622
+
623
+ defineLazyProperty(apps, 'browserPrivate', () => 'browserPrivate');
624
+
625
+ async function openExternalUrl(url) {
626
+ try {
627
+ await open(url);
628
+ return true;
629
+ }
630
+ catch {
631
+ return false;
632
+ }
633
+ }
634
+
635
+ exports.openExternalUrl = openExternalUrl;