komodo-cli 2.0.3 → 2.0.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.
@@ -0,0 +1,531 @@
1
+ import "./chunk-4VNS5WPM.js";
2
+
3
+ // ../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js
4
+ import process6 from "process";
5
+ import { Buffer } from "buffer";
6
+ import path from "path";
7
+ import { fileURLToPath } from "url";
8
+ import { promisify as promisify5 } from "util";
9
+ import childProcess from "child_process";
10
+ import fs5, { constants as fsConstants2 } from "fs/promises";
11
+
12
+ // ../../node_modules/.pnpm/wsl-utils@0.1.0/node_modules/wsl-utils/index.js
13
+ import process2 from "process";
14
+ import fs4, { constants as fsConstants } from "fs/promises";
15
+
16
+ // ../../node_modules/.pnpm/is-wsl@3.1.0/node_modules/is-wsl/index.js
17
+ import process from "process";
18
+ import os from "os";
19
+ import fs3 from "fs";
20
+
21
+ // ../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
22
+ import fs2 from "fs";
23
+
24
+ // ../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
25
+ import fs from "fs";
26
+ var isDockerCached;
27
+ function hasDockerEnv() {
28
+ try {
29
+ fs.statSync("/.dockerenv");
30
+ return true;
31
+ } catch {
32
+ return false;
33
+ }
34
+ }
35
+ function hasDockerCGroup() {
36
+ try {
37
+ return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
38
+ } catch {
39
+ return false;
40
+ }
41
+ }
42
+ function isDocker() {
43
+ if (isDockerCached === void 0) {
44
+ isDockerCached = hasDockerEnv() || hasDockerCGroup();
45
+ }
46
+ return isDockerCached;
47
+ }
48
+
49
+ // ../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
50
+ var cachedResult;
51
+ var hasContainerEnv = () => {
52
+ try {
53
+ fs2.statSync("/run/.containerenv");
54
+ return true;
55
+ } catch {
56
+ return false;
57
+ }
58
+ };
59
+ function isInsideContainer() {
60
+ if (cachedResult === void 0) {
61
+ cachedResult = hasContainerEnv() || isDocker();
62
+ }
63
+ return cachedResult;
64
+ }
65
+
66
+ // ../../node_modules/.pnpm/is-wsl@3.1.0/node_modules/is-wsl/index.js
67
+ var isWsl = () => {
68
+ if (process.platform !== "linux") {
69
+ return false;
70
+ }
71
+ if (os.release().toLowerCase().includes("microsoft")) {
72
+ if (isInsideContainer()) {
73
+ return false;
74
+ }
75
+ return true;
76
+ }
77
+ try {
78
+ return fs3.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isInsideContainer() : false;
79
+ } catch {
80
+ return false;
81
+ }
82
+ };
83
+ var is_wsl_default = process.env.__IS_WSL_TEST__ ? isWsl : isWsl();
84
+
85
+ // ../../node_modules/.pnpm/wsl-utils@0.1.0/node_modules/wsl-utils/index.js
86
+ var wslDrivesMountPoint = /* @__PURE__ */ (() => {
87
+ const defaultMountPoint = "/mnt/";
88
+ let mountPoint;
89
+ return async function() {
90
+ if (mountPoint) {
91
+ return mountPoint;
92
+ }
93
+ const configFilePath = "/etc/wsl.conf";
94
+ let isConfigFileExists = false;
95
+ try {
96
+ await fs4.access(configFilePath, fsConstants.F_OK);
97
+ isConfigFileExists = true;
98
+ } catch {
99
+ }
100
+ if (!isConfigFileExists) {
101
+ return defaultMountPoint;
102
+ }
103
+ const configContent = await fs4.readFile(configFilePath, { encoding: "utf8" });
104
+ const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
105
+ if (!configMountPoint) {
106
+ return defaultMountPoint;
107
+ }
108
+ mountPoint = configMountPoint.groups.mountPoint.trim();
109
+ mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
110
+ return mountPoint;
111
+ };
112
+ })();
113
+ var powerShellPathFromWsl = async () => {
114
+ const mountPoint = await wslDrivesMountPoint();
115
+ return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
116
+ };
117
+ var powerShellPath = async () => {
118
+ if (is_wsl_default) {
119
+ return powerShellPathFromWsl();
120
+ }
121
+ return `${process2.env.SYSTEMROOT || process2.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
122
+ };
123
+
124
+ // ../../node_modules/.pnpm/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
125
+ function defineLazyProperty(object, propertyName, valueGetter) {
126
+ const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
127
+ Object.defineProperty(object, propertyName, {
128
+ configurable: true,
129
+ enumerable: true,
130
+ get() {
131
+ const result = valueGetter();
132
+ define(result);
133
+ return result;
134
+ },
135
+ set(value) {
136
+ define(value);
137
+ }
138
+ });
139
+ return object;
140
+ }
141
+
142
+ // ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/index.js
143
+ import { promisify as promisify4 } from "util";
144
+ import process5 from "process";
145
+ import { execFile as execFile4 } from "child_process";
146
+
147
+ // ../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
148
+ import { promisify } from "util";
149
+ import process3 from "process";
150
+ import { execFile } from "child_process";
151
+ var execFileAsync = promisify(execFile);
152
+ async function defaultBrowserId() {
153
+ if (process3.platform !== "darwin") {
154
+ throw new Error("macOS only");
155
+ }
156
+ const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
157
+ const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
158
+ const browserId = match?.groups.id ?? "com.apple.Safari";
159
+ if (browserId === "com.apple.safari") {
160
+ return "com.apple.Safari";
161
+ }
162
+ return browserId;
163
+ }
164
+
165
+ // ../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js
166
+ import process4 from "process";
167
+ import { promisify as promisify2 } from "util";
168
+ import { execFile as execFile2, execFileSync } from "child_process";
169
+ var execFileAsync2 = promisify2(execFile2);
170
+ async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
171
+ if (process4.platform !== "darwin") {
172
+ throw new Error("macOS only");
173
+ }
174
+ const outputArguments = humanReadableOutput ? [] : ["-ss"];
175
+ const execOptions = {};
176
+ if (signal) {
177
+ execOptions.signal = signal;
178
+ }
179
+ const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
180
+ return stdout.trim();
181
+ }
182
+
183
+ // ../../node_modules/.pnpm/bundle-name@4.1.0/node_modules/bundle-name/index.js
184
+ async function bundleName(bundleId) {
185
+ return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
186
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
187
+ }
188
+
189
+ // ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/windows.js
190
+ import { promisify as promisify3 } from "util";
191
+ import { execFile as execFile3 } from "child_process";
192
+ var execFileAsync3 = promisify3(execFile3);
193
+ var windowsBrowserProgIds = {
194
+ MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
195
+ // The missing `L` is correct.
196
+ MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
197
+ MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
198
+ AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
199
+ ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
200
+ ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
201
+ ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
202
+ ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
203
+ BraveHTML: { name: "Brave", id: "com.brave.Browser" },
204
+ BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
205
+ BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
206
+ BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
207
+ FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
208
+ OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
209
+ VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
210
+ "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
211
+ };
212
+ var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
213
+ var UnknownBrowserError = class extends Error {
214
+ };
215
+ async function defaultBrowser(_execFileAsync = execFileAsync3) {
216
+ const { stdout } = await _execFileAsync("reg", [
217
+ "QUERY",
218
+ " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
219
+ "/v",
220
+ "ProgId"
221
+ ]);
222
+ const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
223
+ if (!match) {
224
+ throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
225
+ }
226
+ const { id } = match.groups;
227
+ const browser = windowsBrowserProgIds[id];
228
+ if (!browser) {
229
+ throw new UnknownBrowserError(`Unknown browser ID: ${id}`);
230
+ }
231
+ return browser;
232
+ }
233
+
234
+ // ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/index.js
235
+ var execFileAsync4 = promisify4(execFile4);
236
+ var titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
237
+ async function defaultBrowser2() {
238
+ if (process5.platform === "darwin") {
239
+ const id = await defaultBrowserId();
240
+ const name = await bundleName(id);
241
+ return { name, id };
242
+ }
243
+ if (process5.platform === "linux") {
244
+ const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
245
+ const id = stdout.trim();
246
+ const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
247
+ return { name, id };
248
+ }
249
+ if (process5.platform === "win32") {
250
+ return defaultBrowser();
251
+ }
252
+ throw new Error("Only macOS, Linux, and Windows are supported");
253
+ }
254
+
255
+ // ../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js
256
+ var execFile5 = promisify5(childProcess.execFile);
257
+ var __dirname = path.dirname(fileURLToPath(import.meta.url));
258
+ var localXdgOpenPath = path.join(__dirname, "xdg-open");
259
+ var { platform, arch } = process6;
260
+ async function getWindowsDefaultBrowserFromWsl() {
261
+ const powershellPath = await powerShellPath();
262
+ const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
263
+ const encodedCommand = Buffer.from(rawCommand, "utf16le").toString("base64");
264
+ const { stdout } = await execFile5(
265
+ powershellPath,
266
+ [
267
+ "-NoProfile",
268
+ "-NonInteractive",
269
+ "-ExecutionPolicy",
270
+ "Bypass",
271
+ "-EncodedCommand",
272
+ encodedCommand
273
+ ],
274
+ { encoding: "utf8" }
275
+ );
276
+ const progId = stdout.trim();
277
+ const browserMap = {
278
+ ChromeHTML: "com.google.chrome",
279
+ BraveHTML: "com.brave.Browser",
280
+ MSEdgeHTM: "com.microsoft.edge",
281
+ FirefoxURL: "org.mozilla.firefox"
282
+ };
283
+ return browserMap[progId] ? { id: browserMap[progId] } : {};
284
+ }
285
+ var pTryEach = async (array, mapper) => {
286
+ let latestError;
287
+ for (const item of array) {
288
+ try {
289
+ return await mapper(item);
290
+ } catch (error) {
291
+ latestError = error;
292
+ }
293
+ }
294
+ throw latestError;
295
+ };
296
+ var baseOpen = async (options) => {
297
+ options = {
298
+ wait: false,
299
+ background: false,
300
+ newInstance: false,
301
+ allowNonzeroExitCode: false,
302
+ ...options
303
+ };
304
+ if (Array.isArray(options.app)) {
305
+ return pTryEach(options.app, (singleApp) => baseOpen({
306
+ ...options,
307
+ app: singleApp
308
+ }));
309
+ }
310
+ let { name: app, arguments: appArguments = [] } = options.app ?? {};
311
+ appArguments = [...appArguments];
312
+ if (Array.isArray(app)) {
313
+ return pTryEach(app, (appName) => baseOpen({
314
+ ...options,
315
+ app: {
316
+ name: appName,
317
+ arguments: appArguments
318
+ }
319
+ }));
320
+ }
321
+ if (app === "browser" || app === "browserPrivate") {
322
+ const ids = {
323
+ "com.google.chrome": "chrome",
324
+ "google-chrome.desktop": "chrome",
325
+ "com.brave.Browser": "brave",
326
+ "org.mozilla.firefox": "firefox",
327
+ "firefox.desktop": "firefox",
328
+ "com.microsoft.msedge": "edge",
329
+ "com.microsoft.edge": "edge",
330
+ "com.microsoft.edgemac": "edge",
331
+ "microsoft-edge.desktop": "edge"
332
+ };
333
+ const flags = {
334
+ chrome: "--incognito",
335
+ brave: "--incognito",
336
+ firefox: "--private-window",
337
+ edge: "--inPrivate"
338
+ };
339
+ const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
340
+ if (browser.id in ids) {
341
+ const browserName = ids[browser.id];
342
+ if (app === "browserPrivate") {
343
+ appArguments.push(flags[browserName]);
344
+ }
345
+ return baseOpen({
346
+ ...options,
347
+ app: {
348
+ name: apps[browserName],
349
+ arguments: appArguments
350
+ }
351
+ });
352
+ }
353
+ throw new Error(`${browser.name} is not supported as a default browser`);
354
+ }
355
+ let command;
356
+ const cliArguments = [];
357
+ const childProcessOptions = {};
358
+ if (platform === "darwin") {
359
+ command = "open";
360
+ if (options.wait) {
361
+ cliArguments.push("--wait-apps");
362
+ }
363
+ if (options.background) {
364
+ cliArguments.push("--background");
365
+ }
366
+ if (options.newInstance) {
367
+ cliArguments.push("--new");
368
+ }
369
+ if (app) {
370
+ cliArguments.push("-a", app);
371
+ }
372
+ } else if (platform === "win32" || is_wsl_default && !isInsideContainer() && !app) {
373
+ command = await powerShellPath();
374
+ cliArguments.push(
375
+ "-NoProfile",
376
+ "-NonInteractive",
377
+ "-ExecutionPolicy",
378
+ "Bypass",
379
+ "-EncodedCommand"
380
+ );
381
+ if (!is_wsl_default) {
382
+ childProcessOptions.windowsVerbatimArguments = true;
383
+ }
384
+ const encodedArguments = ["Start"];
385
+ if (options.wait) {
386
+ encodedArguments.push("-Wait");
387
+ }
388
+ if (app) {
389
+ encodedArguments.push(`"\`"${app}\`""`);
390
+ if (options.target) {
391
+ appArguments.push(options.target);
392
+ }
393
+ } else if (options.target) {
394
+ encodedArguments.push(`"${options.target}"`);
395
+ }
396
+ if (appArguments.length > 0) {
397
+ appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
398
+ encodedArguments.push("-ArgumentList", appArguments.join(","));
399
+ }
400
+ options.target = Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
401
+ } else {
402
+ if (app) {
403
+ command = app;
404
+ } else {
405
+ const isBundled = !__dirname || __dirname === "/";
406
+ let exeLocalXdgOpen = false;
407
+ try {
408
+ await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
409
+ exeLocalXdgOpen = true;
410
+ } catch {
411
+ }
412
+ const useSystemXdgOpen = process6.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
413
+ command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
414
+ }
415
+ if (appArguments.length > 0) {
416
+ cliArguments.push(...appArguments);
417
+ }
418
+ if (!options.wait) {
419
+ childProcessOptions.stdio = "ignore";
420
+ childProcessOptions.detached = true;
421
+ }
422
+ }
423
+ if (platform === "darwin" && appArguments.length > 0) {
424
+ cliArguments.push("--args", ...appArguments);
425
+ }
426
+ if (options.target) {
427
+ cliArguments.push(options.target);
428
+ }
429
+ const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
430
+ if (options.wait) {
431
+ return new Promise((resolve, reject) => {
432
+ subprocess.once("error", reject);
433
+ subprocess.once("close", (exitCode) => {
434
+ if (!options.allowNonzeroExitCode && exitCode > 0) {
435
+ reject(new Error(`Exited with code ${exitCode}`));
436
+ return;
437
+ }
438
+ resolve(subprocess);
439
+ });
440
+ });
441
+ }
442
+ subprocess.unref();
443
+ return subprocess;
444
+ };
445
+ var open = (target, options) => {
446
+ if (typeof target !== "string") {
447
+ throw new TypeError("Expected a `target`");
448
+ }
449
+ return baseOpen({
450
+ ...options,
451
+ target
452
+ });
453
+ };
454
+ var openApp = (name, options) => {
455
+ if (typeof name !== "string" && !Array.isArray(name)) {
456
+ throw new TypeError("Expected a valid `name`");
457
+ }
458
+ const { arguments: appArguments = [] } = options ?? {};
459
+ if (appArguments !== void 0 && appArguments !== null && !Array.isArray(appArguments)) {
460
+ throw new TypeError("Expected `appArguments` as Array type");
461
+ }
462
+ return baseOpen({
463
+ ...options,
464
+ app: {
465
+ name,
466
+ arguments: appArguments
467
+ }
468
+ });
469
+ };
470
+ function detectArchBinary(binary) {
471
+ if (typeof binary === "string" || Array.isArray(binary)) {
472
+ return binary;
473
+ }
474
+ const { [arch]: archBinary } = binary;
475
+ if (!archBinary) {
476
+ throw new Error(`${arch} is not supported`);
477
+ }
478
+ return archBinary;
479
+ }
480
+ function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
481
+ if (wsl && is_wsl_default) {
482
+ return detectArchBinary(wsl);
483
+ }
484
+ if (!platformBinary) {
485
+ throw new Error(`${platform} is not supported`);
486
+ }
487
+ return detectArchBinary(platformBinary);
488
+ }
489
+ var apps = {};
490
+ defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
491
+ darwin: "google chrome",
492
+ win32: "chrome",
493
+ linux: ["google-chrome", "google-chrome-stable", "chromium"]
494
+ }, {
495
+ wsl: {
496
+ ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
497
+ x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
498
+ }
499
+ }));
500
+ defineLazyProperty(apps, "brave", () => detectPlatformBinary({
501
+ darwin: "brave browser",
502
+ win32: "brave",
503
+ linux: ["brave-browser", "brave"]
504
+ }, {
505
+ wsl: {
506
+ ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
507
+ x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
508
+ }
509
+ }));
510
+ defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
511
+ darwin: "firefox",
512
+ win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
513
+ linux: "firefox"
514
+ }, {
515
+ wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
516
+ }));
517
+ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
518
+ darwin: "microsoft edge",
519
+ win32: "msedge",
520
+ linux: ["microsoft-edge", "microsoft-edge-dev"]
521
+ }, {
522
+ wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
523
+ }));
524
+ defineLazyProperty(apps, "browser", () => "browser");
525
+ defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
526
+ var open_default = open;
527
+ export {
528
+ apps,
529
+ open_default as default,
530
+ openApp
531
+ };
@@ -1,13 +1,15 @@
1
1
  import {
2
2
  Komodo,
3
- __commonJS,
4
- __require,
5
- __toESM,
6
3
  analyzeHealth,
7
4
  detectConflicts,
8
5
  getInstalledPackages,
9
6
  loadState
10
- } from "./chunk-C77HMN7C.js";
7
+ } from "./chunk-OKNQJIFU.js";
8
+ import {
9
+ __commonJS,
10
+ __require,
11
+ __toESM
12
+ } from "./chunk-4VNS5WPM.js";
11
13
 
12
14
  // ../../node_modules/.pnpm/reusify@1.1.0/node_modules/reusify/reusify.js
13
15
  var require_reusify = __commonJS({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "komodo-cli",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "The simple way to set up your project. Just say what you want to build.",
5
5
  "type": "module",
6
6
  "bin": {