chrome-webstore-upload-keys 1.1.4 → 1.1.5
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/cli.js +1 -1
- package/dist/index.js +654 -89
- package/package.json +2 -2
package/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,81 +2,6 @@
|
|
|
2
2
|
import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
|
|
3
3
|
/******/ var __webpack_modules__ = ({
|
|
4
4
|
|
|
5
|
-
/***/ 258:
|
|
6
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
7
|
-
|
|
8
|
-
var __webpack_unused_export__;
|
|
9
|
-
var spawn = (__nccwpck_require__(81).spawn);
|
|
10
|
-
|
|
11
|
-
var command;
|
|
12
|
-
|
|
13
|
-
switch(process.platform) {
|
|
14
|
-
case 'darwin':
|
|
15
|
-
command = 'open';
|
|
16
|
-
break;
|
|
17
|
-
case 'win32':
|
|
18
|
-
command = 'explorer.exe';
|
|
19
|
-
break;
|
|
20
|
-
case 'linux':
|
|
21
|
-
command = 'xdg-open';
|
|
22
|
-
break;
|
|
23
|
-
default:
|
|
24
|
-
throw new Error('Unsupported platform: ' + process.platform);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Error handling is deliberately minimal, as this function is to be easy to use for shell scripting
|
|
29
|
-
*
|
|
30
|
-
* @param url The URL to open
|
|
31
|
-
* @param callback A function with a single error argument. Optional.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
function open(url, callback) {
|
|
35
|
-
var child = spawn(command, [url]);
|
|
36
|
-
var errorText = "";
|
|
37
|
-
child.stderr.setEncoding('utf8');
|
|
38
|
-
child.stderr.on('data', function (data) {
|
|
39
|
-
errorText += data;
|
|
40
|
-
});
|
|
41
|
-
child.stderr.on('end', function () {
|
|
42
|
-
if (errorText.length > 0) {
|
|
43
|
-
var error = new Error(errorText);
|
|
44
|
-
if (callback) {
|
|
45
|
-
callback(error);
|
|
46
|
-
} else {
|
|
47
|
-
throw error;
|
|
48
|
-
}
|
|
49
|
-
} else if (callback) {
|
|
50
|
-
callback(error);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @param fields Common fields are: "subject", "body".
|
|
57
|
-
* Some email apps let you specify arbitrary headers here.
|
|
58
|
-
* @param recipientsSeparator Default is ",". Use ";" for Outlook.
|
|
59
|
-
*/
|
|
60
|
-
function mailto(recipients, fields, recipientsSeparator, callback) {
|
|
61
|
-
recipientsSeparator = recipientsSeparator || ",";
|
|
62
|
-
|
|
63
|
-
var url = "mailto:"+recipients.join(recipientsSeparator);
|
|
64
|
-
Object.keys(fields).forEach(function (key, index) {
|
|
65
|
-
if (index === 0) {
|
|
66
|
-
url += "?";
|
|
67
|
-
} else {
|
|
68
|
-
url += "&";
|
|
69
|
-
}
|
|
70
|
-
url += key + "=" + encodeURIComponent(fields[key]);
|
|
71
|
-
});
|
|
72
|
-
open(url, callback);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
exports.b = open;
|
|
76
|
-
__webpack_unused_export__ = mailto;
|
|
77
|
-
|
|
78
|
-
/***/ }),
|
|
79
|
-
|
|
80
5
|
/***/ 23:
|
|
81
6
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
82
7
|
|
|
@@ -207,17 +132,17 @@ module.exports = { cursor, scroll, erase, beep };
|
|
|
207
132
|
|
|
208
133
|
/***/ }),
|
|
209
134
|
|
|
210
|
-
/***/
|
|
135
|
+
/***/ 849:
|
|
211
136
|
/***/ ((module) => {
|
|
212
137
|
|
|
213
|
-
module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("
|
|
138
|
+
module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:http");
|
|
214
139
|
|
|
215
140
|
/***/ }),
|
|
216
141
|
|
|
217
|
-
/***/
|
|
142
|
+
/***/ 612:
|
|
218
143
|
/***/ ((module) => {
|
|
219
144
|
|
|
220
|
-
module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:
|
|
145
|
+
module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:os");
|
|
221
146
|
|
|
222
147
|
/***/ }),
|
|
223
148
|
|
|
@@ -242,9 +167,9 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
|
|
|
242
167
|
/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(742);
|
|
243
168
|
/* harmony import */ var node_http__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(849);
|
|
244
169
|
/* harmony import */ var _clack_prompts__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(881);
|
|
245
|
-
/* harmony import */ var
|
|
246
|
-
/* harmony import */ var
|
|
247
|
-
/* harmony import */ var
|
|
170
|
+
/* harmony import */ var open__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(842);
|
|
171
|
+
/* harmony import */ var get_port__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(213);
|
|
172
|
+
/* harmony import */ var p_defer__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(50);
|
|
248
173
|
|
|
249
174
|
|
|
250
175
|
|
|
@@ -256,8 +181,8 @@ if (typeof fetch !== 'function') {
|
|
|
256
181
|
throw new TypeError('This script requires Node.js 18.0 or newer because it relies on the global `fetch` function.');
|
|
257
182
|
}
|
|
258
183
|
|
|
259
|
-
const approvalCode = (0,
|
|
260
|
-
const port = await (0,
|
|
184
|
+
const approvalCode = (0,p_defer__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)();
|
|
185
|
+
const port = await (0,get_port__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)();
|
|
261
186
|
const localhost = '127.0.0.1';
|
|
262
187
|
|
|
263
188
|
// TODO: Remove after https://github.com/natemoo-re/clack/issues/181
|
|
@@ -372,7 +297,7 @@ await tasks([
|
|
|
372
297
|
async task() {
|
|
373
298
|
const instructions = 'Complete the process in the browser. Follow its steps and warnings (this is your own personal app)';
|
|
374
299
|
if (group.open) {
|
|
375
|
-
await (0,
|
|
300
|
+
await (0,open__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .ZP)(getLoginUrl(group.clientId));
|
|
376
301
|
return instructions;
|
|
377
302
|
}
|
|
378
303
|
|
|
@@ -529,7 +454,7 @@ ${e.gray(d)} ${r}
|
|
|
529
454
|
|
|
530
455
|
/***/ }),
|
|
531
456
|
|
|
532
|
-
/***/
|
|
457
|
+
/***/ 213:
|
|
533
458
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {
|
|
534
459
|
|
|
535
460
|
|
|
@@ -542,8 +467,8 @@ __nccwpck_require__.d(__webpack_exports__, {
|
|
|
542
467
|
|
|
543
468
|
;// CONCATENATED MODULE: external "node:net"
|
|
544
469
|
const external_node_net_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:net");
|
|
545
|
-
|
|
546
|
-
|
|
470
|
+
// EXTERNAL MODULE: external "node:os"
|
|
471
|
+
var external_node_os_ = __nccwpck_require__(612);
|
|
547
472
|
;// CONCATENATED MODULE: ./node_modules/get-port/index.js
|
|
548
473
|
|
|
549
474
|
|
|
@@ -571,7 +496,7 @@ const maxPort = 65_535;
|
|
|
571
496
|
let timeout;
|
|
572
497
|
|
|
573
498
|
const getLocalHosts = () => {
|
|
574
|
-
const interfaces =
|
|
499
|
+
const interfaces = external_node_os_.networkInterfaces();
|
|
575
500
|
|
|
576
501
|
// Add undefined value for createServer function to use default host,
|
|
577
502
|
// and default IPv4 host in case createServer defaults to IPv6.
|
|
@@ -727,6 +652,646 @@ function portNumbers(from, to) {
|
|
|
727
652
|
}
|
|
728
653
|
|
|
729
654
|
|
|
655
|
+
/***/ }),
|
|
656
|
+
|
|
657
|
+
/***/ 842:
|
|
658
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
// EXPORTS
|
|
662
|
+
__nccwpck_require__.d(__webpack_exports__, {
|
|
663
|
+
"ZP": () => (/* binding */ node_modules_open)
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
// UNUSED EXPORTS: apps, openApp
|
|
667
|
+
|
|
668
|
+
// EXTERNAL MODULE: external "node:process"
|
|
669
|
+
var external_node_process_ = __nccwpck_require__(742);
|
|
670
|
+
;// CONCATENATED MODULE: external "node:buffer"
|
|
671
|
+
const external_node_buffer_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:buffer");
|
|
672
|
+
;// CONCATENATED MODULE: external "node:path"
|
|
673
|
+
const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path");
|
|
674
|
+
;// CONCATENATED MODULE: external "node:url"
|
|
675
|
+
const external_node_url_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:url");
|
|
676
|
+
;// CONCATENATED MODULE: external "node:child_process"
|
|
677
|
+
const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process");
|
|
678
|
+
;// CONCATENATED MODULE: external "node:fs/promises"
|
|
679
|
+
const promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs/promises");
|
|
680
|
+
// EXTERNAL MODULE: external "node:os"
|
|
681
|
+
var external_node_os_ = __nccwpck_require__(612);
|
|
682
|
+
;// CONCATENATED MODULE: external "node:fs"
|
|
683
|
+
const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs");
|
|
684
|
+
;// CONCATENATED MODULE: ./node_modules/is-inside-container/node_modules/is-docker/index.js
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
let isDockerCached;
|
|
688
|
+
|
|
689
|
+
function hasDockerEnv() {
|
|
690
|
+
try {
|
|
691
|
+
external_node_fs_namespaceObject.statSync('/.dockerenv');
|
|
692
|
+
return true;
|
|
693
|
+
} catch {
|
|
694
|
+
return false;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
function hasDockerCGroup() {
|
|
699
|
+
try {
|
|
700
|
+
return external_node_fs_namespaceObject.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
|
|
701
|
+
} catch {
|
|
702
|
+
return false;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
function isDocker() {
|
|
707
|
+
// TODO: Use `??=` when targeting Node.js 16.
|
|
708
|
+
if (isDockerCached === undefined) {
|
|
709
|
+
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
return isDockerCached;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
;// CONCATENATED MODULE: ./node_modules/is-inside-container/index.js
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
let cachedResult;
|
|
720
|
+
|
|
721
|
+
// Podman detection
|
|
722
|
+
const hasContainerEnv = () => {
|
|
723
|
+
try {
|
|
724
|
+
external_node_fs_namespaceObject.statSync('/run/.containerenv');
|
|
725
|
+
return true;
|
|
726
|
+
} catch {
|
|
727
|
+
return false;
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
function isInsideContainer() {
|
|
732
|
+
// TODO: Use `??=` when targeting Node.js 16.
|
|
733
|
+
if (cachedResult === undefined) {
|
|
734
|
+
cachedResult = hasContainerEnv() || isDocker();
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
return cachedResult;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
;// CONCATENATED MODULE: ./node_modules/open/node_modules/is-wsl/index.js
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
const isWsl = () => {
|
|
747
|
+
if (external_node_process_.platform !== 'linux') {
|
|
748
|
+
return false;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
if (external_node_os_.release().toLowerCase().includes('microsoft')) {
|
|
752
|
+
if (isInsideContainer()) {
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
return true;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
try {
|
|
760
|
+
return external_node_fs_namespaceObject.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')
|
|
761
|
+
? !isInsideContainer() : false;
|
|
762
|
+
} catch {
|
|
763
|
+
return false;
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
/* harmony default export */ const is_wsl = (external_node_process_.env.__IS_WSL_TEST__ ? isWsl : isWsl());
|
|
768
|
+
|
|
769
|
+
;// CONCATENATED MODULE: ./node_modules/define-lazy-prop/index.js
|
|
770
|
+
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
771
|
+
const define = value => Object.defineProperty(object, propertyName, {value, enumerable: true, writable: true});
|
|
772
|
+
|
|
773
|
+
Object.defineProperty(object, propertyName, {
|
|
774
|
+
configurable: true,
|
|
775
|
+
enumerable: true,
|
|
776
|
+
get() {
|
|
777
|
+
const result = valueGetter();
|
|
778
|
+
define(result);
|
|
779
|
+
return result;
|
|
780
|
+
},
|
|
781
|
+
set(value) {
|
|
782
|
+
define(value);
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
|
|
786
|
+
return object;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
;// CONCATENATED MODULE: external "node:util"
|
|
790
|
+
const external_node_util_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:util");
|
|
791
|
+
;// CONCATENATED MODULE: ./node_modules/default-browser-id/index.js
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
const execFileAsync = (0,external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
|
|
797
|
+
|
|
798
|
+
async function defaultBrowserId() {
|
|
799
|
+
if (external_node_process_.platform !== 'darwin') {
|
|
800
|
+
throw new Error('macOS only');
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
const {stdout} = await execFileAsync('defaults', ['read', 'com.apple.LaunchServices/com.apple.launchservices.secure', 'LSHandlers']);
|
|
804
|
+
|
|
805
|
+
// `(?!-)` is to prevent matching `LSHandlerRoleAll = "-";`.
|
|
806
|
+
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
807
|
+
|
|
808
|
+
return match?.groups.id ?? 'com.apple.Safari';
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
;// CONCATENATED MODULE: ./node_modules/run-applescript/index.js
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
const run_applescript_execFileAsync = (0,external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
|
|
817
|
+
|
|
818
|
+
async function runAppleScript(script, {humanReadableOutput = true} = {}) {
|
|
819
|
+
if (external_node_process_.platform !== 'darwin') {
|
|
820
|
+
throw new Error('macOS only');
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
const outputArguments = humanReadableOutput ? [] : ['-ss'];
|
|
824
|
+
|
|
825
|
+
const {stdout} = await run_applescript_execFileAsync('osascript', ['-e', script, outputArguments]);
|
|
826
|
+
return stdout.trim();
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
function runAppleScriptSync(script, {humanReadableOutput = true} = {}) {
|
|
830
|
+
if (process.platform !== 'darwin') {
|
|
831
|
+
throw new Error('macOS only');
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
const outputArguments = humanReadableOutput ? [] : ['-ss'];
|
|
835
|
+
|
|
836
|
+
const stdout = execFileSync('osascript', ['-e', script, ...outputArguments], {
|
|
837
|
+
encoding: 'utf8',
|
|
838
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
839
|
+
timeout: 500,
|
|
840
|
+
});
|
|
841
|
+
|
|
842
|
+
return stdout.trim();
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
;// CONCATENATED MODULE: ./node_modules/bundle-name/index.js
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
async function bundleName(bundleId) {
|
|
849
|
+
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")`);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
;// CONCATENATED MODULE: ./node_modules/default-browser/windows.js
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
const windows_execFileAsync = (0,external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
|
|
857
|
+
|
|
858
|
+
// Windows doesn't have browser IDs in the same way macOS/Linux does so we give fake
|
|
859
|
+
// ones that look real and match the macOS/Linux versions for cross-platform apps.
|
|
860
|
+
const windowsBrowserProgIds = {
|
|
861
|
+
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: {name: 'Edge', id: 'com.microsoft.edge.old'},
|
|
862
|
+
MSEdgeDHTML: {name: 'Edge', id: 'com.microsoft.edge'}, // On macOS, it's "com.microsoft.edgemac"
|
|
863
|
+
MSEdgeHTM: {name: 'Edge', id: 'com.microsoft.edge'}, // Newer Edge/Win10 releases
|
|
864
|
+
'IE.HTTP': {name: 'Internet Explorer', id: 'com.microsoft.ie'},
|
|
865
|
+
FirefoxURL: {name: 'Firefox', id: 'org.mozilla.firefox'},
|
|
866
|
+
ChromeHTML: {name: 'Chrome', id: 'com.google.chrome'},
|
|
867
|
+
BraveHTML: {name: 'Brave', id: 'com.brave.Browser'},
|
|
868
|
+
BraveBHTML: {name: 'Brave Beta', id: 'com.brave.Browser.beta'},
|
|
869
|
+
BraveSSHTM: {name: 'Brave Nightly', id: 'com.brave.Browser.nightly'},
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
class UnknownBrowserError extends Error {}
|
|
873
|
+
|
|
874
|
+
async function defaultBrowser(_execFileAsync = windows_execFileAsync) {
|
|
875
|
+
const {stdout} = await _execFileAsync('reg', [
|
|
876
|
+
'QUERY',
|
|
877
|
+
' HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice',
|
|
878
|
+
'/v',
|
|
879
|
+
'ProgId',
|
|
880
|
+
]);
|
|
881
|
+
|
|
882
|
+
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
883
|
+
if (!match) {
|
|
884
|
+
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
const {id} = match.groups;
|
|
888
|
+
|
|
889
|
+
const browser = windowsBrowserProgIds[id];
|
|
890
|
+
if (!browser) {
|
|
891
|
+
throw new UnknownBrowserError(`Unknown browser ID: ${id}`);
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
return browser;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
;// CONCATENATED MODULE: ./node_modules/default-browser/index.js
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
const default_browser_execFileAsync = (0,external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
|
|
906
|
+
|
|
907
|
+
// Inlined: https://github.com/sindresorhus/titleize/blob/main/index.js
|
|
908
|
+
const titleize = string => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, x => x.toUpperCase());
|
|
909
|
+
|
|
910
|
+
async function default_browser_defaultBrowser() {
|
|
911
|
+
if (external_node_process_.platform === 'darwin') {
|
|
912
|
+
const id = await defaultBrowserId();
|
|
913
|
+
const name = await bundleName(id);
|
|
914
|
+
return {name, id};
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
if (external_node_process_.platform === 'linux') {
|
|
918
|
+
const {stdout} = await default_browser_execFileAsync('xdg-mime', ['query', 'default', 'x-scheme-handler/http']);
|
|
919
|
+
const id = stdout.trim();
|
|
920
|
+
const name = titleize(id.replace(/.desktop$/, '').replace('-', ' '));
|
|
921
|
+
return {name, id};
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
if (external_node_process_.platform === 'win32') {
|
|
925
|
+
return defaultBrowser();
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
throw new Error('Only macOS, Linux, and Windows are supported');
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
;// CONCATENATED MODULE: ./node_modules/open/index.js
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
// Path to included `xdg-open`.
|
|
944
|
+
const open_dirname = external_node_path_namespaceObject.dirname((0,external_node_url_namespaceObject.fileURLToPath)(import.meta.url));
|
|
945
|
+
const localXdgOpenPath = external_node_path_namespaceObject.join(open_dirname, 'xdg-open');
|
|
946
|
+
|
|
947
|
+
const {platform, arch} = external_node_process_;
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
Get the mount point for fixed drives in WSL.
|
|
951
|
+
|
|
952
|
+
@inner
|
|
953
|
+
@returns {string} The mount point.
|
|
954
|
+
*/
|
|
955
|
+
const getWslDrivesMountPoint = (() => {
|
|
956
|
+
// Default value for "root" param
|
|
957
|
+
// according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config
|
|
958
|
+
const defaultMountPoint = '/mnt/';
|
|
959
|
+
|
|
960
|
+
let mountPoint;
|
|
961
|
+
|
|
962
|
+
return async function () {
|
|
963
|
+
if (mountPoint) {
|
|
964
|
+
// Return memoized mount point value
|
|
965
|
+
return mountPoint;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
const configFilePath = '/etc/wsl.conf';
|
|
969
|
+
|
|
970
|
+
let isConfigFileExists = false;
|
|
971
|
+
try {
|
|
972
|
+
await promises_namespaceObject.access(configFilePath, promises_namespaceObject.constants.F_OK);
|
|
973
|
+
isConfigFileExists = true;
|
|
974
|
+
} catch {}
|
|
975
|
+
|
|
976
|
+
if (!isConfigFileExists) {
|
|
977
|
+
return defaultMountPoint;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
const configContent = await promises_namespaceObject.readFile(configFilePath, {encoding: 'utf8'});
|
|
981
|
+
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
982
|
+
|
|
983
|
+
if (!configMountPoint) {
|
|
984
|
+
return defaultMountPoint;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
mountPoint = configMountPoint.groups.mountPoint.trim();
|
|
988
|
+
mountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;
|
|
989
|
+
|
|
990
|
+
return mountPoint;
|
|
991
|
+
};
|
|
992
|
+
})();
|
|
993
|
+
|
|
994
|
+
const pTryEach = async (array, mapper) => {
|
|
995
|
+
let latestError;
|
|
996
|
+
|
|
997
|
+
for (const item of array) {
|
|
998
|
+
try {
|
|
999
|
+
return await mapper(item); // eslint-disable-line no-await-in-loop
|
|
1000
|
+
} catch (error) {
|
|
1001
|
+
latestError = error;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
throw latestError;
|
|
1006
|
+
};
|
|
1007
|
+
|
|
1008
|
+
const baseOpen = async options => {
|
|
1009
|
+
options = {
|
|
1010
|
+
wait: false,
|
|
1011
|
+
background: false,
|
|
1012
|
+
newInstance: false,
|
|
1013
|
+
allowNonzeroExitCode: false,
|
|
1014
|
+
...options,
|
|
1015
|
+
};
|
|
1016
|
+
|
|
1017
|
+
if (Array.isArray(options.app)) {
|
|
1018
|
+
return pTryEach(options.app, singleApp => baseOpen({
|
|
1019
|
+
...options,
|
|
1020
|
+
app: singleApp,
|
|
1021
|
+
}));
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
let {name: app, arguments: appArguments = []} = options.app ?? {};
|
|
1025
|
+
appArguments = [...appArguments];
|
|
1026
|
+
|
|
1027
|
+
if (Array.isArray(app)) {
|
|
1028
|
+
return pTryEach(app, appName => baseOpen({
|
|
1029
|
+
...options,
|
|
1030
|
+
app: {
|
|
1031
|
+
name: appName,
|
|
1032
|
+
arguments: appArguments,
|
|
1033
|
+
},
|
|
1034
|
+
}));
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
if (app === 'browser' || app === 'browserPrivate') {
|
|
1038
|
+
// IDs from default-browser for macOS and windows are the same
|
|
1039
|
+
const ids = {
|
|
1040
|
+
'com.google.chrome': 'chrome',
|
|
1041
|
+
'google-chrome.desktop': 'chrome',
|
|
1042
|
+
'org.mozilla.firefox': 'firefox',
|
|
1043
|
+
'firefox.desktop': 'firefox',
|
|
1044
|
+
'com.microsoft.msedge': 'edge',
|
|
1045
|
+
'com.microsoft.edge': 'edge',
|
|
1046
|
+
'microsoft-edge.desktop': 'edge',
|
|
1047
|
+
};
|
|
1048
|
+
|
|
1049
|
+
// Incognito flags for each browser in `apps`.
|
|
1050
|
+
const flags = {
|
|
1051
|
+
chrome: '--incognito',
|
|
1052
|
+
firefox: '--private-window',
|
|
1053
|
+
edge: '--inPrivate',
|
|
1054
|
+
};
|
|
1055
|
+
|
|
1056
|
+
const browser = await default_browser_defaultBrowser();
|
|
1057
|
+
if (browser.id in ids) {
|
|
1058
|
+
const browserName = ids[browser.id];
|
|
1059
|
+
|
|
1060
|
+
if (app === 'browserPrivate') {
|
|
1061
|
+
appArguments.push(flags[browserName]);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
return baseOpen({
|
|
1065
|
+
...options,
|
|
1066
|
+
app: {
|
|
1067
|
+
name: apps[browserName],
|
|
1068
|
+
arguments: appArguments,
|
|
1069
|
+
},
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
let command;
|
|
1077
|
+
const cliArguments = [];
|
|
1078
|
+
const childProcessOptions = {};
|
|
1079
|
+
|
|
1080
|
+
if (platform === 'darwin') {
|
|
1081
|
+
command = 'open';
|
|
1082
|
+
|
|
1083
|
+
if (options.wait) {
|
|
1084
|
+
cliArguments.push('--wait-apps');
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
if (options.background) {
|
|
1088
|
+
cliArguments.push('--background');
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
if (options.newInstance) {
|
|
1092
|
+
cliArguments.push('--new');
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
if (app) {
|
|
1096
|
+
cliArguments.push('-a', app);
|
|
1097
|
+
}
|
|
1098
|
+
} else if (platform === 'win32' || (is_wsl && !isInsideContainer() && !app)) {
|
|
1099
|
+
const mountPoint = await getWslDrivesMountPoint();
|
|
1100
|
+
|
|
1101
|
+
command = is_wsl
|
|
1102
|
+
? `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`
|
|
1103
|
+
: `${external_node_process_.env.SYSTEMROOT || external_node_process_.env.windir || 'C:\\Windows'}\\System32\\WindowsPowerShell\\v1.0\\powershell`;
|
|
1104
|
+
|
|
1105
|
+
cliArguments.push(
|
|
1106
|
+
'-NoProfile',
|
|
1107
|
+
'-NonInteractive',
|
|
1108
|
+
'-ExecutionPolicy',
|
|
1109
|
+
'Bypass',
|
|
1110
|
+
'-EncodedCommand',
|
|
1111
|
+
);
|
|
1112
|
+
|
|
1113
|
+
if (!is_wsl) {
|
|
1114
|
+
childProcessOptions.windowsVerbatimArguments = true;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
const encodedArguments = ['Start'];
|
|
1118
|
+
|
|
1119
|
+
if (options.wait) {
|
|
1120
|
+
encodedArguments.push('-Wait');
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
if (app) {
|
|
1124
|
+
// Double quote with double quotes to ensure the inner quotes are passed through.
|
|
1125
|
+
// Inner quotes are delimited for PowerShell interpretation with backticks.
|
|
1126
|
+
encodedArguments.push(`"\`"${app}\`""`);
|
|
1127
|
+
if (options.target) {
|
|
1128
|
+
appArguments.push(options.target);
|
|
1129
|
+
}
|
|
1130
|
+
} else if (options.target) {
|
|
1131
|
+
encodedArguments.push(`"${options.target}"`);
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
if (appArguments.length > 0) {
|
|
1135
|
+
appArguments = appArguments.map(argument => `"\`"${argument}\`""`);
|
|
1136
|
+
encodedArguments.push('-ArgumentList', appArguments.join(','));
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
// Using Base64-encoded command, accepted by PowerShell, to allow special characters.
|
|
1140
|
+
options.target = external_node_buffer_namespaceObject.Buffer.from(encodedArguments.join(' '), 'utf16le').toString('base64');
|
|
1141
|
+
} else {
|
|
1142
|
+
if (app) {
|
|
1143
|
+
command = app;
|
|
1144
|
+
} else {
|
|
1145
|
+
// When bundled by Webpack, there's no actual package file path and no local `xdg-open`.
|
|
1146
|
+
const isBundled = !open_dirname || open_dirname === '/';
|
|
1147
|
+
|
|
1148
|
+
// Check if local `xdg-open` exists and is executable.
|
|
1149
|
+
let exeLocalXdgOpen = false;
|
|
1150
|
+
try {
|
|
1151
|
+
await promises_namespaceObject.access(localXdgOpenPath, promises_namespaceObject.constants.X_OK);
|
|
1152
|
+
exeLocalXdgOpen = true;
|
|
1153
|
+
} catch {}
|
|
1154
|
+
|
|
1155
|
+
const useSystemXdgOpen = external_node_process_.versions.electron
|
|
1156
|
+
?? (platform === 'android' || isBundled || !exeLocalXdgOpen);
|
|
1157
|
+
command = useSystemXdgOpen ? 'xdg-open' : localXdgOpenPath;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
if (appArguments.length > 0) {
|
|
1161
|
+
cliArguments.push(...appArguments);
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
if (!options.wait) {
|
|
1165
|
+
// `xdg-open` will block the process unless stdio is ignored
|
|
1166
|
+
// and it's detached from the parent even if it's unref'd.
|
|
1167
|
+
childProcessOptions.stdio = 'ignore';
|
|
1168
|
+
childProcessOptions.detached = true;
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
if (platform === 'darwin' && appArguments.length > 0) {
|
|
1173
|
+
cliArguments.push('--args', ...appArguments);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
// This has to come after `--args`.
|
|
1177
|
+
if (options.target) {
|
|
1178
|
+
cliArguments.push(options.target);
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
const subprocess = external_node_child_process_namespaceObject.spawn(command, cliArguments, childProcessOptions);
|
|
1182
|
+
|
|
1183
|
+
if (options.wait) {
|
|
1184
|
+
return new Promise((resolve, reject) => {
|
|
1185
|
+
subprocess.once('error', reject);
|
|
1186
|
+
|
|
1187
|
+
subprocess.once('close', exitCode => {
|
|
1188
|
+
if (!options.allowNonzeroExitCode && exitCode > 0) {
|
|
1189
|
+
reject(new Error(`Exited with code ${exitCode}`));
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
resolve(subprocess);
|
|
1194
|
+
});
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
subprocess.unref();
|
|
1199
|
+
|
|
1200
|
+
return subprocess;
|
|
1201
|
+
};
|
|
1202
|
+
|
|
1203
|
+
const open_open = (target, options) => {
|
|
1204
|
+
if (typeof target !== 'string') {
|
|
1205
|
+
throw new TypeError('Expected a `target`');
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
return baseOpen({
|
|
1209
|
+
...options,
|
|
1210
|
+
target,
|
|
1211
|
+
});
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1214
|
+
const openApp = (name, options) => {
|
|
1215
|
+
if (typeof name !== 'string') {
|
|
1216
|
+
throw new TypeError('Expected a `name`');
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
const {arguments: appArguments = []} = options ?? {};
|
|
1220
|
+
if (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {
|
|
1221
|
+
throw new TypeError('Expected `appArguments` as Array type');
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
return baseOpen({
|
|
1225
|
+
...options,
|
|
1226
|
+
app: {
|
|
1227
|
+
name,
|
|
1228
|
+
arguments: appArguments,
|
|
1229
|
+
},
|
|
1230
|
+
});
|
|
1231
|
+
};
|
|
1232
|
+
|
|
1233
|
+
function detectArchBinary(binary) {
|
|
1234
|
+
if (typeof binary === 'string' || Array.isArray(binary)) {
|
|
1235
|
+
return binary;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
const {[arch]: archBinary} = binary;
|
|
1239
|
+
|
|
1240
|
+
if (!archBinary) {
|
|
1241
|
+
throw new Error(`${arch} is not supported`);
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
return archBinary;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
function detectPlatformBinary({[platform]: platformBinary}, {wsl}) {
|
|
1248
|
+
if (wsl && is_wsl) {
|
|
1249
|
+
return detectArchBinary(wsl);
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
if (!platformBinary) {
|
|
1253
|
+
throw new Error(`${platform} is not supported`);
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
return detectArchBinary(platformBinary);
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
const apps = {};
|
|
1260
|
+
|
|
1261
|
+
defineLazyProperty(apps, 'chrome', () => detectPlatformBinary({
|
|
1262
|
+
darwin: 'google chrome',
|
|
1263
|
+
win32: 'chrome',
|
|
1264
|
+
linux: ['google-chrome', 'google-chrome-stable', 'chromium'],
|
|
1265
|
+
}, {
|
|
1266
|
+
wsl: {
|
|
1267
|
+
ia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',
|
|
1268
|
+
x64: ['/mnt/c/Program Files/Google/Chrome/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'],
|
|
1269
|
+
},
|
|
1270
|
+
}));
|
|
1271
|
+
|
|
1272
|
+
defineLazyProperty(apps, 'firefox', () => detectPlatformBinary({
|
|
1273
|
+
darwin: 'firefox',
|
|
1274
|
+
win32: 'C:\\Program Files\\Mozilla Firefox\\firefox.exe',
|
|
1275
|
+
linux: 'firefox',
|
|
1276
|
+
}, {
|
|
1277
|
+
wsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe',
|
|
1278
|
+
}));
|
|
1279
|
+
|
|
1280
|
+
defineLazyProperty(apps, 'edge', () => detectPlatformBinary({
|
|
1281
|
+
darwin: 'microsoft edge',
|
|
1282
|
+
win32: 'msedge',
|
|
1283
|
+
linux: ['microsoft-edge', 'microsoft-edge-dev'],
|
|
1284
|
+
}, {
|
|
1285
|
+
wsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',
|
|
1286
|
+
}));
|
|
1287
|
+
|
|
1288
|
+
defineLazyProperty(apps, 'browser', () => 'browser');
|
|
1289
|
+
|
|
1290
|
+
defineLazyProperty(apps, 'browserPrivate', () => 'browserPrivate');
|
|
1291
|
+
|
|
1292
|
+
/* harmony default export */ const node_modules_open = (open_open);
|
|
1293
|
+
|
|
1294
|
+
|
|
730
1295
|
/***/ }),
|
|
731
1296
|
|
|
732
1297
|
/***/ 50:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrome-webstore-upload-keys",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "CLI tool to generate OAuth keys for the Chrome Web Store",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chrome",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@clack/prompts": "^0.7.0",
|
|
30
30
|
"@vercel/ncc": "^0.38.1",
|
|
31
31
|
"get-port": "^7.0.0",
|
|
32
|
-
"
|
|
32
|
+
"open": "^10.0.3",
|
|
33
33
|
"p-defer": "^4.0.0",
|
|
34
34
|
"xo": "^0.56.0"
|
|
35
35
|
},
|