@depup/vercel 50.32.5-depup.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 (96) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +38 -0
  3. package/changes.json +38 -0
  4. package/dist/chunks/chunk-2DLBVZWU.js +197 -0
  5. package/dist/chunks/chunk-2HSQ7YUK.js +93 -0
  6. package/dist/chunks/chunk-2IQTNMUG.js +86 -0
  7. package/dist/chunks/chunk-3FRG2XGZ.js +466 -0
  8. package/dist/chunks/chunk-3KMKI2FP.js +34 -0
  9. package/dist/chunks/chunk-3XFFP2BA.js +110 -0
  10. package/dist/chunks/chunk-4S3Y3ATR.js +5383 -0
  11. package/dist/chunks/chunk-7EHTK7LP.js +359 -0
  12. package/dist/chunks/chunk-7YHZDJ4G.js +116 -0
  13. package/dist/chunks/chunk-A3NYPUKZ.js +17 -0
  14. package/dist/chunks/chunk-AA7QEJFB.js +5204 -0
  15. package/dist/chunks/chunk-AHU7WNL2.js +24 -0
  16. package/dist/chunks/chunk-AKQZ7KG3.js +4172 -0
  17. package/dist/chunks/chunk-AQLVWVEN.js +39155 -0
  18. package/dist/chunks/chunk-BQ3DXZNT.js +968 -0
  19. package/dist/chunks/chunk-E65JE2CC.js +102 -0
  20. package/dist/chunks/chunk-EKPSCRJZ.js +26 -0
  21. package/dist/chunks/chunk-EOZFDJSY.js +18 -0
  22. package/dist/chunks/chunk-FDJURQMQ.js +4676 -0
  23. package/dist/chunks/chunk-FLKHKWZV.js +1854 -0
  24. package/dist/chunks/chunk-G6BUEBF5.js +192 -0
  25. package/dist/chunks/chunk-GBNIO3KP.js +771 -0
  26. package/dist/chunks/chunk-GGP5R3FU.js +129 -0
  27. package/dist/chunks/chunk-H5XJSH37.js +91 -0
  28. package/dist/chunks/chunk-IB5L4LKZ.js +1082 -0
  29. package/dist/chunks/chunk-IE7MNZ56.js +149 -0
  30. package/dist/chunks/chunk-IK7DLK2T.js +16112 -0
  31. package/dist/chunks/chunk-IUGPWINM.js +104 -0
  32. package/dist/chunks/chunk-J7HDA5GH.js +54 -0
  33. package/dist/chunks/chunk-JLYZNGYY.js +293 -0
  34. package/dist/chunks/chunk-JQ4NA5MX.js +250 -0
  35. package/dist/chunks/chunk-LL26LVRR.js +81 -0
  36. package/dist/chunks/chunk-LW5ZNGW7.js +127 -0
  37. package/dist/chunks/chunk-LWBSOTJP.js +1772 -0
  38. package/dist/chunks/chunk-MBGJBHYD.js +388 -0
  39. package/dist/chunks/chunk-NUKAG3YM.js +168 -0
  40. package/dist/chunks/chunk-O7I4ZOCC.js +58 -0
  41. package/dist/chunks/chunk-OWR3XNE3.js +48 -0
  42. package/dist/chunks/chunk-P3SKP5WM.js +27 -0
  43. package/dist/chunks/chunk-P4I4DMEU.js +342 -0
  44. package/dist/chunks/chunk-P5Q6F5IA.js +107 -0
  45. package/dist/chunks/chunk-PMSMUMUO.js +30 -0
  46. package/dist/chunks/chunk-QXRJ52T4.js +2977 -0
  47. package/dist/chunks/chunk-RQXPRFRM.js +90 -0
  48. package/dist/chunks/chunk-S7KYDPEM.js +1564 -0
  49. package/dist/chunks/chunk-SGGLJFUZ.js +68 -0
  50. package/dist/chunks/chunk-SOTR4CXR.js +34 -0
  51. package/dist/chunks/chunk-TEVP63TU.js +1717 -0
  52. package/dist/chunks/chunk-TNBMKNET.js +323 -0
  53. package/dist/chunks/chunk-TZ2YI2VH.js +87 -0
  54. package/dist/chunks/chunk-U6XOC6E4.js +903 -0
  55. package/dist/chunks/chunk-V5P25P7F.js +22 -0
  56. package/dist/chunks/chunk-WQ5CUZWR.js +333 -0
  57. package/dist/chunks/chunk-WU2BPWRP.js +12237 -0
  58. package/dist/chunks/chunk-XPKWKPWA.js +44 -0
  59. package/dist/chunks/chunk-XR53KVJD.js +33 -0
  60. package/dist/chunks/chunk-Y4JJYHUG.js +16 -0
  61. package/dist/chunks/chunk-YPQSDAEW.js +29 -0
  62. package/dist/chunks/chunk-ZB2UO4V2.js +135 -0
  63. package/dist/chunks/chunk-ZLCMHY2G.js +1528 -0
  64. package/dist/chunks/compile-vercel-config-XU3YY2CZ.js +32 -0
  65. package/dist/chunks/delete-EJ2V7KQO.js +144 -0
  66. package/dist/chunks/disable-BKRFMX4U.js +122 -0
  67. package/dist/chunks/discard-4WF34DXK.js +118 -0
  68. package/dist/chunks/edit-FQE7JGU3.js +509 -0
  69. package/dist/chunks/emit-flags-datafiles-QYKPNWPX.js +17 -0
  70. package/dist/chunks/enable-VCNMX63U.js +122 -0
  71. package/dist/chunks/export-3KNVJCQR.js +133 -0
  72. package/dist/chunks/list-43XQCGKH.js +382 -0
  73. package/dist/chunks/list-DUL6PHUR.js +394 -0
  74. package/dist/chunks/publish-CF7GVZK3.js +128 -0
  75. package/dist/chunks/query-KWKO7VWO.js +954 -0
  76. package/dist/chunks/reorder-GU65YMIN.js +259 -0
  77. package/dist/chunks/restore-Q7ENGWVJ.js +158 -0
  78. package/dist/chunks/routes-Q5CWG44T.js +20 -0
  79. package/dist/chunks/schema-PJKLO2K2.js +176 -0
  80. package/dist/chunks/stamp-RTPE2EBB.js +15 -0
  81. package/dist/chunks/types-563KUQRV.js +108 -0
  82. package/dist/chunks/update-route-version-E3V47KNI.js +13 -0
  83. package/dist/commands/build/index.js +1597 -0
  84. package/dist/commands/deploy/index.js +1711 -0
  85. package/dist/commands/dev/builder-worker.cjs +95 -0
  86. package/dist/commands/dev/index.js +20810 -0
  87. package/dist/commands/env/index.js +2154 -0
  88. package/dist/commands/link/index.js +225 -0
  89. package/dist/commands/list/index.js +528 -0
  90. package/dist/commands-bulk.js +29627 -0
  91. package/dist/get-latest-worker.cjs +272 -0
  92. package/dist/help.js +14 -0
  93. package/dist/index.js +24274 -0
  94. package/dist/vc.js +36 -0
  95. package/dist/version.mjs +1 -0
  96. package/package.json +254 -0
@@ -0,0 +1,104 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import {
8
+ require_once
9
+ } from "./chunk-AQLVWVEN.js";
10
+ import {
11
+ __commonJS
12
+ } from "./chunk-TZ2YI2VH.js";
13
+
14
+ // ../../node_modules/.pnpm/end-of-stream@1.4.1/node_modules/end-of-stream/index.js
15
+ var require_end_of_stream = __commonJS({
16
+ "../../node_modules/.pnpm/end-of-stream@1.4.1/node_modules/end-of-stream/index.js"(exports, module) {
17
+ var once = require_once();
18
+ var noop = function() {
19
+ };
20
+ var isRequest = function(stream) {
21
+ return stream.setHeader && typeof stream.abort === "function";
22
+ };
23
+ var isChildProcess = function(stream) {
24
+ return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3;
25
+ };
26
+ var eos = function(stream, opts, callback) {
27
+ if (typeof opts === "function")
28
+ return eos(stream, null, opts);
29
+ if (!opts)
30
+ opts = {};
31
+ callback = once(callback || noop);
32
+ var ws = stream._writableState;
33
+ var rs = stream._readableState;
34
+ var readable = opts.readable || opts.readable !== false && stream.readable;
35
+ var writable = opts.writable || opts.writable !== false && stream.writable;
36
+ var onlegacyfinish = function() {
37
+ if (!stream.writable)
38
+ onfinish();
39
+ };
40
+ var onfinish = function() {
41
+ writable = false;
42
+ if (!readable)
43
+ callback.call(stream);
44
+ };
45
+ var onend = function() {
46
+ readable = false;
47
+ if (!writable)
48
+ callback.call(stream);
49
+ };
50
+ var onexit = function(exitCode) {
51
+ callback.call(stream, exitCode ? new Error("exited with error code: " + exitCode) : null);
52
+ };
53
+ var onerror = function(err) {
54
+ callback.call(stream, err);
55
+ };
56
+ var onclose = function() {
57
+ if (readable && !(rs && rs.ended))
58
+ return callback.call(stream, new Error("premature close"));
59
+ if (writable && !(ws && ws.ended))
60
+ return callback.call(stream, new Error("premature close"));
61
+ };
62
+ var onrequest = function() {
63
+ stream.req.on("finish", onfinish);
64
+ };
65
+ if (isRequest(stream)) {
66
+ stream.on("complete", onfinish);
67
+ stream.on("abort", onclose);
68
+ if (stream.req)
69
+ onrequest();
70
+ else
71
+ stream.on("request", onrequest);
72
+ } else if (writable && !ws) {
73
+ stream.on("end", onlegacyfinish);
74
+ stream.on("close", onlegacyfinish);
75
+ }
76
+ if (isChildProcess(stream))
77
+ stream.on("exit", onexit);
78
+ stream.on("end", onend);
79
+ stream.on("finish", onfinish);
80
+ if (opts.error !== false)
81
+ stream.on("error", onerror);
82
+ stream.on("close", onclose);
83
+ return function() {
84
+ stream.removeListener("complete", onfinish);
85
+ stream.removeListener("abort", onclose);
86
+ stream.removeListener("request", onrequest);
87
+ if (stream.req)
88
+ stream.req.removeListener("finish", onfinish);
89
+ stream.removeListener("end", onlegacyfinish);
90
+ stream.removeListener("close", onlegacyfinish);
91
+ stream.removeListener("finish", onfinish);
92
+ stream.removeListener("exit", onexit);
93
+ stream.removeListener("end", onend);
94
+ stream.removeListener("error", onerror);
95
+ stream.removeListener("close", onclose);
96
+ };
97
+ };
98
+ module.exports = eos;
99
+ }
100
+ });
101
+
102
+ export {
103
+ require_end_of_stream
104
+ };
@@ -0,0 +1,54 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import {
8
+ STANDARD_ENVIRONMENTS
9
+ } from "./chunk-AQLVWVEN.js";
10
+ import {
11
+ getCommandName,
12
+ require_lib
13
+ } from "./chunk-ZLCMHY2G.js";
14
+ import {
15
+ output_manager_default
16
+ } from "./chunk-FDJURQMQ.js";
17
+ import {
18
+ require_source
19
+ } from "./chunk-S7KYDPEM.js";
20
+ import {
21
+ __toESM
22
+ } from "./chunk-TZ2YI2VH.js";
23
+
24
+ // src/util/target/format-environment.ts
25
+ var import_chalk = __toESM(require_source(), 1);
26
+ var import_title = __toESM(require_lib(), 1);
27
+ function formatEnvironment(orgSlug, projectSlug, environment) {
28
+ const projectUrl = `https://vercel.com/${orgSlug}/${projectSlug}`;
29
+ const boldName = import_chalk.default.bold(
30
+ STANDARD_ENVIRONMENTS.includes(environment.slug) ? (0, import_title.default)(environment.slug) : environment.slug
31
+ );
32
+ return output_manager_default.link(
33
+ boldName,
34
+ `${projectUrl}/settings/environments/${environment.slug}`,
35
+ { fallback: () => boldName, color: false }
36
+ );
37
+ }
38
+
39
+ // src/util/validate-ls-args.ts
40
+ var import_chalk2 = __toESM(require_source(), 1);
41
+ function validateLsArgs(options) {
42
+ const { commandName, args, maxArgs = 0, exitCode = 1, usageString } = options;
43
+ if (args.length > maxArgs) {
44
+ const usage = usageString || getCommandName(commandName);
45
+ output_manager_default.error(`Invalid number of arguments. Usage: ${import_chalk2.default.cyan(usage)}`);
46
+ return exitCode;
47
+ }
48
+ return 0;
49
+ }
50
+
51
+ export {
52
+ formatEnvironment,
53
+ validateLsArgs
54
+ };
@@ -0,0 +1,293 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import {
8
+ require_dist
9
+ } from "./chunk-FDJURQMQ.js";
10
+ import {
11
+ __commonJS,
12
+ __require,
13
+ __toESM
14
+ } from "./chunk-TZ2YI2VH.js";
15
+
16
+ // ../../node_modules/.pnpm/@next+env@11.1.2/node_modules/@next/env/dist/index.js
17
+ var require_dist2 = __commonJS({
18
+ "../../node_modules/.pnpm/@next+env@11.1.2/node_modules/@next/env/dist/index.js"(exports, module) {
19
+ module.exports = function(n, r) {
20
+ "use strict";
21
+ var e = {};
22
+ function __webpack_require__(r2) {
23
+ if (e[r2]) {
24
+ return e[r2].exports;
25
+ }
26
+ var t = e[r2] = { i: r2, l: false, exports: {} };
27
+ n[r2].call(t.exports, t, t.exports, __webpack_require__);
28
+ t.l = true;
29
+ return t.exports;
30
+ }
31
+ __webpack_require__.ab = __dirname + "/";
32
+ function startup() {
33
+ return __webpack_require__(903);
34
+ }
35
+ r(__webpack_require__);
36
+ return startup();
37
+ }({ 148: function(n) {
38
+ "use strict";
39
+ var r = function(n2) {
40
+ var r2 = n2.ignoreProcessEnv ? {} : process.env;
41
+ var e = function(t2) {
42
+ var o2 = t2.match(/(.?\${?(?:[a-zA-Z0-9_]+)?}?)/g) || [];
43
+ return o2.reduce(function(t3, o3) {
44
+ var c2 = /(.?)\${?([a-zA-Z0-9_]+)?}?/g.exec(o3);
45
+ var s = c2[1];
46
+ var i, f;
47
+ if (s === "\\") {
48
+ f = c2[0];
49
+ i = f.replace("\\$", "$");
50
+ } else {
51
+ var p = c2[2];
52
+ f = c2[0].substring(s.length);
53
+ i = r2.hasOwnProperty(p) ? r2[p] : n2.parsed[p] || "";
54
+ i = e(i);
55
+ }
56
+ return t3.replace(f, i);
57
+ }, t2);
58
+ };
59
+ for (var t in n2.parsed) {
60
+ var o = r2.hasOwnProperty(t) ? r2[t] : n2.parsed[t];
61
+ n2.parsed[t] = e(o);
62
+ }
63
+ for (var c in n2.parsed) {
64
+ r2[c] = n2.parsed[c];
65
+ }
66
+ return n2;
67
+ };
68
+ n.exports = r;
69
+ }, 548: function(n, r, e) {
70
+ const t = e(747);
71
+ const o = e(622);
72
+ function log(n2) {
73
+ console.log(`[dotenv][DEBUG] ${n2}`);
74
+ }
75
+ const c = "\n";
76
+ const s = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/;
77
+ const i = /\\n/g;
78
+ const f = /\n|\r|\r\n/;
79
+ function parse(n2, r2) {
80
+ const e2 = Boolean(r2 && r2.debug);
81
+ const t2 = {};
82
+ n2.toString().split(f).forEach(function(n3, r3) {
83
+ const o2 = n3.match(s);
84
+ if (o2 != null) {
85
+ const n4 = o2[1];
86
+ let r4 = o2[2] || "";
87
+ const e3 = r4.length - 1;
88
+ const s2 = r4[0] === '"' && r4[e3] === '"';
89
+ const f2 = r4[0] === "'" && r4[e3] === "'";
90
+ if (f2 || s2) {
91
+ r4 = r4.substring(1, e3);
92
+ if (s2) {
93
+ r4 = r4.replace(i, c);
94
+ }
95
+ } else {
96
+ r4 = r4.trim();
97
+ }
98
+ t2[n4] = r4;
99
+ } else if (e2) {
100
+ log(`did not match key and value when parsing line ${r3 + 1}: ${n3}`);
101
+ }
102
+ });
103
+ return t2;
104
+ }
105
+ function config(n2) {
106
+ let r2 = o.resolve(process.cwd(), ".env");
107
+ let e2 = "utf8";
108
+ let c2 = false;
109
+ if (n2) {
110
+ if (n2.path != null) {
111
+ r2 = n2.path;
112
+ }
113
+ if (n2.encoding != null) {
114
+ e2 = n2.encoding;
115
+ }
116
+ if (n2.debug != null) {
117
+ c2 = true;
118
+ }
119
+ }
120
+ try {
121
+ const n3 = parse(t.readFileSync(r2, { encoding: e2 }), { debug: c2 });
122
+ Object.keys(n3).forEach(function(r3) {
123
+ if (!Object.prototype.hasOwnProperty.call(process.env, r3)) {
124
+ process.env[r3] = n3[r3];
125
+ } else if (c2) {
126
+ log(`"${r3}" is already defined in \`process.env\` and will not be overwritten`);
127
+ }
128
+ });
129
+ return { parsed: n3 };
130
+ } catch (n3) {
131
+ return { error: n3 };
132
+ }
133
+ }
134
+ n.exports.config = config;
135
+ n.exports.parse = parse;
136
+ }, 622: function(n) {
137
+ n.exports = __require("path");
138
+ }, 747: function(n) {
139
+ n.exports = __require("fs");
140
+ }, 903: function(n, r, e) {
141
+ "use strict";
142
+ e.r(r);
143
+ e.d(r, "processEnv", function() {
144
+ return processEnv;
145
+ });
146
+ e.d(r, "loadEnvConfig", function() {
147
+ return loadEnvConfig;
148
+ });
149
+ var t = e(747);
150
+ var o = e.n(t);
151
+ var c = e(622);
152
+ var s = e.n(c);
153
+ var i = e(548);
154
+ var f = e.n(i);
155
+ var p = e(148);
156
+ var u = e.n(p);
157
+ let a = void 0;
158
+ let d = [];
159
+ function processEnv(n2, r2, e2 = console) {
160
+ var t2;
161
+ if (process.env.__NEXT_PROCESSED_ENV || n2.length === 0) {
162
+ return process.env;
163
+ }
164
+ process.env.__NEXT_PROCESSED_ENV = "true";
165
+ const o2 = Object.assign({}, process.env);
166
+ const s2 = {};
167
+ for (const f2 of n2) {
168
+ try {
169
+ let n3 = {};
170
+ n3.parsed = i.parse(f2.contents);
171
+ n3 = u()(n3);
172
+ if (n3.parsed) {
173
+ e2.info(`Loaded env from ${c.join(r2 || "", f2.path)}`);
174
+ }
175
+ for (const r3 of Object.keys(n3.parsed || {})) {
176
+ if (typeof s2[r3] === "undefined" && typeof o2[r3] === "undefined") {
177
+ s2[r3] = (t2 = n3.parsed) === null || t2 === void 0 ? void 0 : t2[r3];
178
+ }
179
+ }
180
+ } catch (n3) {
181
+ e2.error(`Failed to load env from ${c.join(r2 || "", f2.path)}`, n3);
182
+ }
183
+ }
184
+ return Object.assign(process.env, s2);
185
+ }
186
+ function loadEnvConfig(n2, r2, e2 = console) {
187
+ if (a)
188
+ return { combinedEnv: a, loadedEnvFiles: d };
189
+ const o2 = process.env.NODE_ENV === "test";
190
+ const s2 = o2 ? "test" : r2 ? "development" : "production";
191
+ const i2 = [`.env.${s2}.local`, s2 !== "test" && `.env.local`, `.env.${s2}`, ".env"].filter(Boolean);
192
+ for (const r3 of i2) {
193
+ const o3 = c.join(n2, r3);
194
+ try {
195
+ const n3 = t.statSync(o3);
196
+ if (!n3.isFile()) {
197
+ continue;
198
+ }
199
+ const c2 = t.readFileSync(o3, "utf8");
200
+ d.push({ path: r3, contents: c2 });
201
+ } catch (n3) {
202
+ if (n3.code !== "ENOENT") {
203
+ e2.error(`Failed to load env from ${r3}`, n3);
204
+ }
205
+ }
206
+ }
207
+ a = processEnv(d, n2, e2);
208
+ return { combinedEnv: a, loadedEnvFiles: d };
209
+ }
210
+ } }, function(n) {
211
+ "use strict";
212
+ !function() {
213
+ n.r = function(n2) {
214
+ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
215
+ Object.defineProperty(n2, Symbol.toStringTag, { value: "Module" });
216
+ }
217
+ Object.defineProperty(n2, "__esModule", { value: true });
218
+ };
219
+ }();
220
+ !function() {
221
+ n.n = function(r) {
222
+ var e = r && r.__esModule ? function getDefault() {
223
+ return r["default"];
224
+ } : function getModuleExports() {
225
+ return r;
226
+ };
227
+ n.d(e, "a", e);
228
+ return e;
229
+ };
230
+ }();
231
+ !function() {
232
+ var r = Object.prototype.hasOwnProperty;
233
+ n.d = function(n2, e, t) {
234
+ if (!r.call(n2, e)) {
235
+ Object.defineProperty(n2, e, { enumerable: true, get: t });
236
+ }
237
+ };
238
+ }();
239
+ });
240
+ }
241
+ });
242
+
243
+ // src/util/get-invalid-subcommand.ts
244
+ function getInvalidSubcommand(config) {
245
+ return `Please specify a valid subcommand: ${Object.keys(config).join(
246
+ " | "
247
+ )}`;
248
+ }
249
+
250
+ // src/util/input/read-standard-input.ts
251
+ async function readStandardInput(stdin) {
252
+ return new Promise((resolve) => {
253
+ setTimeout(() => resolve(""), 500);
254
+ if (stdin.isTTY) {
255
+ resolve("");
256
+ } else {
257
+ stdin.setEncoding("utf8");
258
+ stdin.once("data", resolve);
259
+ }
260
+ });
261
+ }
262
+
263
+ // src/util/target/get-custom-environments.ts
264
+ var import_error_utils = __toESM(require_dist(), 1);
265
+ async function getCustomEnvironments(client, projectId) {
266
+ try {
267
+ const res = await client.fetch(
268
+ `/projects/${encodeURIComponent(projectId)}/custom-environments`,
269
+ { method: "GET" }
270
+ );
271
+ return res.environments;
272
+ } catch (error) {
273
+ if ((0, import_error_utils.isObject)(error) && error.status === 404) {
274
+ return [];
275
+ }
276
+ throw error;
277
+ }
278
+ }
279
+ function pickCustomEnvironment(customEnvironments, customEnvironmentSlugOrId) {
280
+ if (!customEnvironmentSlugOrId)
281
+ return void 0;
282
+ return customEnvironments.find(
283
+ ({ slug, id }) => slug === customEnvironmentSlugOrId || id === customEnvironmentSlugOrId
284
+ );
285
+ }
286
+
287
+ export {
288
+ getInvalidSubcommand,
289
+ readStandardInput,
290
+ getCustomEnvironments,
291
+ pickCustomEnvironment,
292
+ require_dist2 as require_dist
293
+ };
@@ -0,0 +1,250 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import {
8
+ require_dist
9
+ } from "./chunk-P4I4DMEU.js";
10
+ import {
11
+ noBorderChars,
12
+ require_cli_table3
13
+ } from "./chunk-LWBSOTJP.js";
14
+ import {
15
+ globalCommandOptions
16
+ } from "./chunk-ZLCMHY2G.js";
17
+ import {
18
+ require_source
19
+ } from "./chunk-S7KYDPEM.js";
20
+ import {
21
+ __toESM
22
+ } from "./chunk-TZ2YI2VH.js";
23
+
24
+ // src/commands/help.ts
25
+ var import_chalk = __toESM(require_source(), 1);
26
+ var import_constants = __toESM(require_dist(), 1);
27
+ var import_cli_table3 = __toESM(require_cli_table3(), 1);
28
+ var INDENT = " ".repeat(2);
29
+ var NEWLINE = "\n";
30
+ var tableOptions = {
31
+ chars: noBorderChars,
32
+ style: {
33
+ "padding-left": 0,
34
+ "padding-right": 0
35
+ }
36
+ };
37
+ function wordWrap(text, maxWidth) {
38
+ const _tableOptions = Object.assign({}, tableOptions, {
39
+ colWidths: [maxWidth],
40
+ style: {
41
+ "padding-left": INDENT.length
42
+ }
43
+ });
44
+ const table = new import_cli_table3.default(_tableOptions);
45
+ table.push([
46
+ {
47
+ content: text,
48
+ wordWrap: true
49
+ }
50
+ ]);
51
+ return table.toString();
52
+ }
53
+ function lineToString(line) {
54
+ let string = "";
55
+ for (let i = 0; i < line.length; i++) {
56
+ if (i === line.length - 1) {
57
+ string += line[i];
58
+ } else {
59
+ const curr = line[i];
60
+ const next = line[i + 1];
61
+ string += curr;
62
+ if (curr.trim() !== "" && next.trim() !== "") {
63
+ string += " ";
64
+ }
65
+ }
66
+ }
67
+ return string;
68
+ }
69
+ function outputArrayToString(outputArray) {
70
+ return outputArray.filter((line) => line !== null).join(NEWLINE);
71
+ }
72
+ function buildCommandSynopsisLine(command, parent) {
73
+ const line = [INDENT, import_constants.LOGO, import_chalk.default.bold(import_constants.NAME)];
74
+ if (parent) {
75
+ line.push(import_chalk.default.bold(parent.name));
76
+ }
77
+ line.push(import_chalk.default.bold(command.name));
78
+ const args = command.arguments.slice(0);
79
+ if (args.length === 0 && command.subcommands && command.subcommands.length > 0) {
80
+ args.push({
81
+ name: "command",
82
+ required: !command.subcommands.some((subcommand) => subcommand.default)
83
+ });
84
+ }
85
+ if (args.length > 0) {
86
+ for (const argument of args) {
87
+ let { name } = argument;
88
+ if (argument.multiple) {
89
+ name += " ...";
90
+ }
91
+ line.push(argument.required ? name : `[${name}]`);
92
+ }
93
+ }
94
+ if (command.options.length > 0) {
95
+ line.push("[options]");
96
+ }
97
+ line.push(NEWLINE);
98
+ return lineToString(line);
99
+ }
100
+ function buildCommandOptionLines(commandOptions, options, sectionTitle) {
101
+ const filteredCommandOptions = commandOptions.filter(
102
+ (option) => !option.deprecated && option.description !== void 0
103
+ );
104
+ if (filteredCommandOptions.length === 0) {
105
+ return null;
106
+ }
107
+ filteredCommandOptions.sort(
108
+ (a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0
109
+ );
110
+ let maxWidthOfUnwrappedColumns = 0;
111
+ const rows = [];
112
+ for (const option of filteredCommandOptions) {
113
+ const shorthandCell = option.shorthand ? `${INDENT}-${option.shorthand},` : "";
114
+ let longhandCell = `${INDENT}--${option.name}`;
115
+ if (option.argument) {
116
+ longhandCell += ` <${option.argument}>`;
117
+ }
118
+ longhandCell += INDENT;
119
+ const widthOfUnwrappedColumns = shorthandCell.length + longhandCell.length;
120
+ maxWidthOfUnwrappedColumns = Math.max(
121
+ widthOfUnwrappedColumns,
122
+ maxWidthOfUnwrappedColumns
123
+ );
124
+ rows.push([
125
+ shorthandCell,
126
+ longhandCell,
127
+ {
128
+ content: option.description,
129
+ wordWrap: true
130
+ }
131
+ ]);
132
+ }
133
+ const finalColumnWidth = options.columns - maxWidthOfUnwrappedColumns;
134
+ const table = new import_cli_table3.default(
135
+ Object.assign({}, tableOptions, {
136
+ colWidths: [null, null, finalColumnWidth]
137
+ })
138
+ );
139
+ table.push(...rows);
140
+ return [
141
+ `${INDENT}${import_chalk.default.dim(sectionTitle)}:`,
142
+ NEWLINE,
143
+ NEWLINE,
144
+ table.toString(),
145
+ NEWLINE,
146
+ NEWLINE
147
+ ].join("");
148
+ }
149
+ function buildSubcommandLines(subcommands, options) {
150
+ if (!subcommands) {
151
+ return null;
152
+ }
153
+ let maxWidthOfUnwrappedColumns = 0;
154
+ const rows = [];
155
+ for (const command of subcommands) {
156
+ if (command.hidden) {
157
+ continue;
158
+ }
159
+ const nameCell = `${INDENT}${command.name}`;
160
+ let argsCell = INDENT;
161
+ argsCell += command.arguments.map((arg) => {
162
+ return arg.required ? arg.name : `[${arg.name}]`;
163
+ }).join(" ");
164
+ argsCell += INDENT;
165
+ const widthOfUnwrappedColumns = nameCell.length + argsCell.length;
166
+ maxWidthOfUnwrappedColumns = Math.max(
167
+ widthOfUnwrappedColumns,
168
+ maxWidthOfUnwrappedColumns
169
+ );
170
+ rows.push([
171
+ nameCell,
172
+ argsCell,
173
+ {
174
+ content: command.default ? `${command.description} ${import_chalk.default.bold("(default)")}` : command.description,
175
+ wordWrap: true
176
+ }
177
+ ]);
178
+ }
179
+ const rightMargin = INDENT.repeat(4).length;
180
+ const finalColumnWidth = options.columns - maxWidthOfUnwrappedColumns - rightMargin;
181
+ const table = new import_cli_table3.default(
182
+ Object.assign({}, tableOptions, {
183
+ colWidths: [null, null, finalColumnWidth]
184
+ })
185
+ );
186
+ if (rows.length === 0) {
187
+ return null;
188
+ }
189
+ table.push(...rows);
190
+ return [
191
+ `${INDENT}${import_chalk.default.dim("Commands")}:`,
192
+ NEWLINE,
193
+ NEWLINE,
194
+ table.toString(),
195
+ NEWLINE,
196
+ NEWLINE
197
+ ].join("");
198
+ }
199
+ function buildCommandExampleLines(command) {
200
+ if (!command.examples?.length) {
201
+ return null;
202
+ }
203
+ const outputArray = [`${INDENT}${import_chalk.default.dim("Examples:")}`, ""];
204
+ for (const example of command.examples) {
205
+ const nameLine = [INDENT];
206
+ nameLine.push(import_chalk.default.gray("-"));
207
+ nameLine.push(example.name);
208
+ outputArray.push(lineToString(nameLine));
209
+ outputArray.push("");
210
+ const buildValueLine = (value) => {
211
+ return lineToString([INDENT, INDENT, import_chalk.default.cyan(`$ ${value}`)]);
212
+ };
213
+ if (Array.isArray(example.value)) {
214
+ for (const line of example.value) {
215
+ outputArray.push(buildValueLine(line));
216
+ }
217
+ } else {
218
+ outputArray.push(buildValueLine(example.value));
219
+ }
220
+ outputArray.push("");
221
+ }
222
+ return outputArrayToString(outputArray);
223
+ }
224
+ function buildDescriptionLine(command, options) {
225
+ const wrappingText = wordWrap(command.description, options.columns);
226
+ return `${wrappingText}${NEWLINE}`;
227
+ }
228
+ function buildHelpOutput(command, options) {
229
+ const outputArray = [
230
+ "",
231
+ buildCommandSynopsisLine(command, options.parent),
232
+ buildDescriptionLine(command, options),
233
+ buildSubcommandLines(command.subcommands, options),
234
+ buildCommandOptionLines(command.options, options, "Options"),
235
+ buildCommandOptionLines(globalCommandOptions, options, "Global Options"),
236
+ buildCommandExampleLines(command),
237
+ ""
238
+ ];
239
+ return outputArrayToString(outputArray);
240
+ }
241
+ function help(command, options) {
242
+ return buildHelpOutput(command, {
243
+ ...options,
244
+ columns: options.columns ?? 80
245
+ });
246
+ }
247
+
248
+ export {
249
+ help
250
+ };