@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.
- package/LICENSE +202 -0
- package/README.md +38 -0
- package/changes.json +38 -0
- package/dist/chunks/chunk-2DLBVZWU.js +197 -0
- package/dist/chunks/chunk-2HSQ7YUK.js +93 -0
- package/dist/chunks/chunk-2IQTNMUG.js +86 -0
- package/dist/chunks/chunk-3FRG2XGZ.js +466 -0
- package/dist/chunks/chunk-3KMKI2FP.js +34 -0
- package/dist/chunks/chunk-3XFFP2BA.js +110 -0
- package/dist/chunks/chunk-4S3Y3ATR.js +5383 -0
- package/dist/chunks/chunk-7EHTK7LP.js +359 -0
- package/dist/chunks/chunk-7YHZDJ4G.js +116 -0
- package/dist/chunks/chunk-A3NYPUKZ.js +17 -0
- package/dist/chunks/chunk-AA7QEJFB.js +5204 -0
- package/dist/chunks/chunk-AHU7WNL2.js +24 -0
- package/dist/chunks/chunk-AKQZ7KG3.js +4172 -0
- package/dist/chunks/chunk-AQLVWVEN.js +39155 -0
- package/dist/chunks/chunk-BQ3DXZNT.js +968 -0
- package/dist/chunks/chunk-E65JE2CC.js +102 -0
- package/dist/chunks/chunk-EKPSCRJZ.js +26 -0
- package/dist/chunks/chunk-EOZFDJSY.js +18 -0
- package/dist/chunks/chunk-FDJURQMQ.js +4676 -0
- package/dist/chunks/chunk-FLKHKWZV.js +1854 -0
- package/dist/chunks/chunk-G6BUEBF5.js +192 -0
- package/dist/chunks/chunk-GBNIO3KP.js +771 -0
- package/dist/chunks/chunk-GGP5R3FU.js +129 -0
- package/dist/chunks/chunk-H5XJSH37.js +91 -0
- package/dist/chunks/chunk-IB5L4LKZ.js +1082 -0
- package/dist/chunks/chunk-IE7MNZ56.js +149 -0
- package/dist/chunks/chunk-IK7DLK2T.js +16112 -0
- package/dist/chunks/chunk-IUGPWINM.js +104 -0
- package/dist/chunks/chunk-J7HDA5GH.js +54 -0
- package/dist/chunks/chunk-JLYZNGYY.js +293 -0
- package/dist/chunks/chunk-JQ4NA5MX.js +250 -0
- package/dist/chunks/chunk-LL26LVRR.js +81 -0
- package/dist/chunks/chunk-LW5ZNGW7.js +127 -0
- package/dist/chunks/chunk-LWBSOTJP.js +1772 -0
- package/dist/chunks/chunk-MBGJBHYD.js +388 -0
- package/dist/chunks/chunk-NUKAG3YM.js +168 -0
- package/dist/chunks/chunk-O7I4ZOCC.js +58 -0
- package/dist/chunks/chunk-OWR3XNE3.js +48 -0
- package/dist/chunks/chunk-P3SKP5WM.js +27 -0
- package/dist/chunks/chunk-P4I4DMEU.js +342 -0
- package/dist/chunks/chunk-P5Q6F5IA.js +107 -0
- package/dist/chunks/chunk-PMSMUMUO.js +30 -0
- package/dist/chunks/chunk-QXRJ52T4.js +2977 -0
- package/dist/chunks/chunk-RQXPRFRM.js +90 -0
- package/dist/chunks/chunk-S7KYDPEM.js +1564 -0
- package/dist/chunks/chunk-SGGLJFUZ.js +68 -0
- package/dist/chunks/chunk-SOTR4CXR.js +34 -0
- package/dist/chunks/chunk-TEVP63TU.js +1717 -0
- package/dist/chunks/chunk-TNBMKNET.js +323 -0
- package/dist/chunks/chunk-TZ2YI2VH.js +87 -0
- package/dist/chunks/chunk-U6XOC6E4.js +903 -0
- package/dist/chunks/chunk-V5P25P7F.js +22 -0
- package/dist/chunks/chunk-WQ5CUZWR.js +333 -0
- package/dist/chunks/chunk-WU2BPWRP.js +12237 -0
- package/dist/chunks/chunk-XPKWKPWA.js +44 -0
- package/dist/chunks/chunk-XR53KVJD.js +33 -0
- package/dist/chunks/chunk-Y4JJYHUG.js +16 -0
- package/dist/chunks/chunk-YPQSDAEW.js +29 -0
- package/dist/chunks/chunk-ZB2UO4V2.js +135 -0
- package/dist/chunks/chunk-ZLCMHY2G.js +1528 -0
- package/dist/chunks/compile-vercel-config-XU3YY2CZ.js +32 -0
- package/dist/chunks/delete-EJ2V7KQO.js +144 -0
- package/dist/chunks/disable-BKRFMX4U.js +122 -0
- package/dist/chunks/discard-4WF34DXK.js +118 -0
- package/dist/chunks/edit-FQE7JGU3.js +509 -0
- package/dist/chunks/emit-flags-datafiles-QYKPNWPX.js +17 -0
- package/dist/chunks/enable-VCNMX63U.js +122 -0
- package/dist/chunks/export-3KNVJCQR.js +133 -0
- package/dist/chunks/list-43XQCGKH.js +382 -0
- package/dist/chunks/list-DUL6PHUR.js +394 -0
- package/dist/chunks/publish-CF7GVZK3.js +128 -0
- package/dist/chunks/query-KWKO7VWO.js +954 -0
- package/dist/chunks/reorder-GU65YMIN.js +259 -0
- package/dist/chunks/restore-Q7ENGWVJ.js +158 -0
- package/dist/chunks/routes-Q5CWG44T.js +20 -0
- package/dist/chunks/schema-PJKLO2K2.js +176 -0
- package/dist/chunks/stamp-RTPE2EBB.js +15 -0
- package/dist/chunks/types-563KUQRV.js +108 -0
- package/dist/chunks/update-route-version-E3V47KNI.js +13 -0
- package/dist/commands/build/index.js +1597 -0
- package/dist/commands/deploy/index.js +1711 -0
- package/dist/commands/dev/builder-worker.cjs +95 -0
- package/dist/commands/dev/index.js +20810 -0
- package/dist/commands/env/index.js +2154 -0
- package/dist/commands/link/index.js +225 -0
- package/dist/commands/list/index.js +528 -0
- package/dist/commands-bulk.js +29627 -0
- package/dist/get-latest-worker.cjs +272 -0
- package/dist/help.js +14 -0
- package/dist/index.js +24274 -0
- package/dist/vc.js +36 -0
- package/dist/version.mjs +1 -0
- package/package.json +254 -0
|
@@ -0,0 +1,22 @@
|
|
|
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_source
|
|
9
|
+
} from "./chunk-S7KYDPEM.js";
|
|
10
|
+
import {
|
|
11
|
+
__toESM
|
|
12
|
+
} from "./chunk-TZ2YI2VH.js";
|
|
13
|
+
|
|
14
|
+
// src/util/output/highlight.ts
|
|
15
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
16
|
+
function highlight(text) {
|
|
17
|
+
return import_chalk.default.bold.underline(text);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
highlight
|
|
22
|
+
};
|
|
@@ -0,0 +1,333 @@
|
|
|
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
|
+
getUpdateCommand
|
|
9
|
+
} from "./chunk-H5XJSH37.js";
|
|
10
|
+
import {
|
|
11
|
+
login
|
|
12
|
+
} from "./chunk-AKQZ7KG3.js";
|
|
13
|
+
import {
|
|
14
|
+
loginCommand
|
|
15
|
+
} from "./chunk-AA7QEJFB.js";
|
|
16
|
+
import {
|
|
17
|
+
help
|
|
18
|
+
} from "./chunk-JQ4NA5MX.js";
|
|
19
|
+
import {
|
|
20
|
+
outputActionRequired
|
|
21
|
+
} from "./chunk-AQLVWVEN.js";
|
|
22
|
+
import {
|
|
23
|
+
TelemetryClient
|
|
24
|
+
} from "./chunk-P4I4DMEU.js";
|
|
25
|
+
import {
|
|
26
|
+
getFlagsSpecification,
|
|
27
|
+
packageName,
|
|
28
|
+
parseArguments,
|
|
29
|
+
printError,
|
|
30
|
+
require_strip_ansi
|
|
31
|
+
} from "./chunk-ZLCMHY2G.js";
|
|
32
|
+
import {
|
|
33
|
+
output_manager_default
|
|
34
|
+
} from "./chunk-FDJURQMQ.js";
|
|
35
|
+
import {
|
|
36
|
+
require_source
|
|
37
|
+
} from "./chunk-S7KYDPEM.js";
|
|
38
|
+
import {
|
|
39
|
+
__commonJS,
|
|
40
|
+
__toESM
|
|
41
|
+
} from "./chunk-TZ2YI2VH.js";
|
|
42
|
+
|
|
43
|
+
// ../../node_modules/.pnpm/jaro-winkler@0.2.8/node_modules/jaro-winkler/index.js
|
|
44
|
+
var require_jaro_winkler = __commonJS({
|
|
45
|
+
"../../node_modules/.pnpm/jaro-winkler@0.2.8/node_modules/jaro-winkler/index.js"(exports, module) {
|
|
46
|
+
(function(root) {
|
|
47
|
+
"use strict";
|
|
48
|
+
function extend(a, b) {
|
|
49
|
+
for (var property in b) {
|
|
50
|
+
if (b.hasOwnProperty(property)) {
|
|
51
|
+
a[property] = b[property];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return a;
|
|
55
|
+
}
|
|
56
|
+
function distance2(s1, s2, options) {
|
|
57
|
+
var m = 0;
|
|
58
|
+
var defaults = { caseSensitive: true };
|
|
59
|
+
var settings = extend(defaults, options);
|
|
60
|
+
var i;
|
|
61
|
+
var j;
|
|
62
|
+
if (s1.length === 0 || s2.length === 0) {
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
if (!settings.caseSensitive) {
|
|
66
|
+
s1 = s1.toUpperCase();
|
|
67
|
+
s2 = s2.toUpperCase();
|
|
68
|
+
}
|
|
69
|
+
if (s1 === s2) {
|
|
70
|
+
return 1;
|
|
71
|
+
}
|
|
72
|
+
var range = Math.floor(Math.max(s1.length, s2.length) / 2) - 1;
|
|
73
|
+
var s1Matches = new Array(s1.length);
|
|
74
|
+
var s2Matches = new Array(s2.length);
|
|
75
|
+
for (i = 0; i < s1.length; i++) {
|
|
76
|
+
var low = i >= range ? i - range : 0;
|
|
77
|
+
var high = i + range <= s2.length - 1 ? i + range : s2.length - 1;
|
|
78
|
+
for (j = low; j <= high; j++) {
|
|
79
|
+
if (s1Matches[i] !== true && s2Matches[j] !== true && s1[i] === s2[j]) {
|
|
80
|
+
++m;
|
|
81
|
+
s1Matches[i] = s2Matches[j] = true;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (m === 0) {
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
var k = 0;
|
|
90
|
+
var numTrans = 0;
|
|
91
|
+
for (i = 0; i < s1.length; i++) {
|
|
92
|
+
if (s1Matches[i] === true) {
|
|
93
|
+
for (j = k; j < s2.length; j++) {
|
|
94
|
+
if (s2Matches[j] === true) {
|
|
95
|
+
k = j + 1;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (s1[i] !== s2[j]) {
|
|
100
|
+
++numTrans;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
var weight = (m / s1.length + m / s2.length + (m - numTrans / 2) / m) / 3;
|
|
105
|
+
var l = 0;
|
|
106
|
+
var p = 0.1;
|
|
107
|
+
if (weight > 0.7) {
|
|
108
|
+
while (s1[l] === s2[l] && l < 4) {
|
|
109
|
+
++l;
|
|
110
|
+
}
|
|
111
|
+
weight = weight + l * p * (1 - weight);
|
|
112
|
+
}
|
|
113
|
+
return weight;
|
|
114
|
+
}
|
|
115
|
+
if (typeof define === "function" && define.amd) {
|
|
116
|
+
define([], function() {
|
|
117
|
+
return distance2;
|
|
118
|
+
});
|
|
119
|
+
} else if (typeof exports === "object") {
|
|
120
|
+
module.exports = distance2;
|
|
121
|
+
} else {
|
|
122
|
+
root.distance = distance2;
|
|
123
|
+
}
|
|
124
|
+
})(exports);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// src/util/upgrade.ts
|
|
129
|
+
import { spawn } from "child_process";
|
|
130
|
+
async function executeUpgrade() {
|
|
131
|
+
const updateCommand = await getUpdateCommand();
|
|
132
|
+
const [command, ...args] = updateCommand.split(" ");
|
|
133
|
+
output_manager_default.log(`Upgrading Vercel CLI...`);
|
|
134
|
+
output_manager_default.debug(`Executing: ${updateCommand}`);
|
|
135
|
+
return new Promise((resolve) => {
|
|
136
|
+
const stdout = [];
|
|
137
|
+
const stderr = [];
|
|
138
|
+
const upgradeProcess = spawn(command, args, {
|
|
139
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
140
|
+
shell: false
|
|
141
|
+
});
|
|
142
|
+
upgradeProcess.stdout?.on("data", (data) => {
|
|
143
|
+
stdout.push(data);
|
|
144
|
+
});
|
|
145
|
+
upgradeProcess.stderr?.on("data", (data) => {
|
|
146
|
+
stderr.push(data);
|
|
147
|
+
});
|
|
148
|
+
upgradeProcess.on("error", (err) => {
|
|
149
|
+
output_manager_default.error(`Failed to execute upgrade command: ${err.message}`);
|
|
150
|
+
output_manager_default.log(`You can try running the command manually: ${updateCommand}`);
|
|
151
|
+
resolve(1);
|
|
152
|
+
});
|
|
153
|
+
upgradeProcess.on("close", (code) => {
|
|
154
|
+
if (code === 0) {
|
|
155
|
+
output_manager_default.success("Vercel CLI has been upgraded successfully!");
|
|
156
|
+
} else {
|
|
157
|
+
const stdoutStr = Buffer.concat(stdout).toString();
|
|
158
|
+
const stderrStr = Buffer.concat(stderr).toString();
|
|
159
|
+
if (stdoutStr) {
|
|
160
|
+
output_manager_default.print(stdoutStr);
|
|
161
|
+
}
|
|
162
|
+
if (stderrStr) {
|
|
163
|
+
output_manager_default.print(stderrStr);
|
|
164
|
+
}
|
|
165
|
+
output_manager_default.error(`Upgrade failed with exit code ${code ?? "unknown"}`);
|
|
166
|
+
output_manager_default.log(
|
|
167
|
+
`You can try running the command manually: ${updateCommand}`
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
resolve(code ?? 1);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// src/commands/login/index.ts
|
|
176
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
177
|
+
|
|
178
|
+
// src/util/telemetry/commands/login/index.ts
|
|
179
|
+
var LoginTelemetryClient = class extends TelemetryClient {
|
|
180
|
+
/**
|
|
181
|
+
* Tracks the state of the login process.
|
|
182
|
+
* - `started` when the user initiates the login process.
|
|
183
|
+
* - `canceled` when the user cancels the login process.
|
|
184
|
+
* - `error` when the user encounters an error during the login process.
|
|
185
|
+
* - `success` when the user successfully logs in.
|
|
186
|
+
*/
|
|
187
|
+
trackState(...args) {
|
|
188
|
+
this.trackLoginState(...args);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// src/commands/login/index.ts
|
|
193
|
+
async function login2(client, options) {
|
|
194
|
+
let parsedArgs = null;
|
|
195
|
+
const flagsSpecification = getFlagsSpecification(loginCommand.options);
|
|
196
|
+
const telemetry = new LoginTelemetryClient({
|
|
197
|
+
opts: {
|
|
198
|
+
store: client.telemetryEventStore
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
try {
|
|
202
|
+
if (options.shouldParseArgs) {
|
|
203
|
+
parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
|
|
204
|
+
}
|
|
205
|
+
} catch (error) {
|
|
206
|
+
printError(error);
|
|
207
|
+
return 1;
|
|
208
|
+
}
|
|
209
|
+
if (parsedArgs?.flags["--help"]) {
|
|
210
|
+
telemetry.trackCliFlagHelp("login");
|
|
211
|
+
output_manager_default.print(help(loginCommand, { columns: client.stderr.columns }));
|
|
212
|
+
return 0;
|
|
213
|
+
}
|
|
214
|
+
if (parsedArgs?.flags["--token"]) {
|
|
215
|
+
output_manager_default.error('`--token` may not be used with the "login" command');
|
|
216
|
+
return 2;
|
|
217
|
+
}
|
|
218
|
+
if (options.shouldParseArgs && parsedArgs) {
|
|
219
|
+
const obsoleteFlags = Object.keys(parsedArgs.flags).filter((flag) => {
|
|
220
|
+
const flagKey = flag.replace("--", "");
|
|
221
|
+
const option = loginCommand.options.find((o) => o.name === flagKey);
|
|
222
|
+
if (!option || typeof option === "number")
|
|
223
|
+
return;
|
|
224
|
+
return "deprecated" in option && option.deprecated;
|
|
225
|
+
});
|
|
226
|
+
if (obsoleteFlags.length) {
|
|
227
|
+
const flags = obsoleteFlags.map((f) => import_chalk.default.bold(f)).join(", ");
|
|
228
|
+
output_manager_default.warn(`The following flags are deprecated: ${flags}`);
|
|
229
|
+
}
|
|
230
|
+
const obsoleteArguments = parsedArgs.args.slice(1);
|
|
231
|
+
if (obsoleteArguments.length) {
|
|
232
|
+
const args = obsoleteArguments.map((a) => import_chalk.default.bold(a)).join(", ");
|
|
233
|
+
output_manager_default.warn(`The following arguments are deprecated: ${args}`);
|
|
234
|
+
}
|
|
235
|
+
if (obsoleteArguments.length || obsoleteFlags.length) {
|
|
236
|
+
output_manager_default.print(
|
|
237
|
+
`Read more in our ${output_manager_default.link("changelog", "https://vercel.com/changelog/new-vercel-cli-login-flow")}.
|
|
238
|
+
`
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (client.nonInteractive && options.shouldParseArgs && parsedArgs && parsedArgs.args.slice(1).length === 0) {
|
|
243
|
+
const loginCmd = `${packageName} login`;
|
|
244
|
+
const message = `You must run the following command to log in: \`${loginCmd}\`. Run it without --non-interactive to complete sign-in in your browser.`;
|
|
245
|
+
output_manager_default.print(`${message}
|
|
246
|
+
`);
|
|
247
|
+
outputActionRequired(
|
|
248
|
+
client,
|
|
249
|
+
{
|
|
250
|
+
status: "action_required",
|
|
251
|
+
reason: "login_required",
|
|
252
|
+
action: "login_required",
|
|
253
|
+
message,
|
|
254
|
+
hint: `Run this command to log in: ${loginCmd}`,
|
|
255
|
+
verification_uri: "https://vercel.com/login",
|
|
256
|
+
next: [{ command: loginCmd, when: "to log in" }]
|
|
257
|
+
},
|
|
258
|
+
1
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
telemetry.trackState("started");
|
|
262
|
+
return await login(client, telemetry);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// src/util/output/box.ts
|
|
266
|
+
var import_chalk2 = __toESM(require_source(), 1);
|
|
267
|
+
var import_strip_ansi = __toESM(require_strip_ansi(), 1);
|
|
268
|
+
var border = ["\u2500", "\u256D", "\u256E", "\u2502", "\u2502", "\u2570", "\u256F"];
|
|
269
|
+
var nothing = ["\u2500", "", "", "", "", "", ""];
|
|
270
|
+
function box(message, {
|
|
271
|
+
borderColor,
|
|
272
|
+
padding = 1,
|
|
273
|
+
textAlignment = "center",
|
|
274
|
+
terminalColumns: cols = process.stdout.columns || process.env.COLUMNS && parseInt(process.env.COLUMNS, 10) || 80
|
|
275
|
+
} = {}) {
|
|
276
|
+
const lines = message.split(/\r?\n/).map((line) => [line, (0, import_strip_ansi.default)(line).length]);
|
|
277
|
+
const maxLine = lines.reduce((p, [, len]) => Math.max(p, len), 0);
|
|
278
|
+
const borderColorFn = borderColor && import_chalk2.default[borderColor] || import_chalk2.default.yellow;
|
|
279
|
+
const clampedSidePadding = Math.max(1, padding * 3);
|
|
280
|
+
const narrowMode = maxLine + 2 + clampedSidePadding * 2 > cols;
|
|
281
|
+
const sidePadding = narrowMode ? 0 : clampedSidePadding;
|
|
282
|
+
const innerWidth = Math.min(maxLine + sidePadding * 2, cols);
|
|
283
|
+
const [hr, topLeft, topRight, left, right, bottomLeft, bottomRight] = narrowMode ? nothing : border;
|
|
284
|
+
const spacerRow = narrowMode ? "\n".repeat(padding) : `${borderColorFn(`${left}${" ".repeat(innerWidth)}${right}`)}
|
|
285
|
+
`.repeat(
|
|
286
|
+
padding
|
|
287
|
+
);
|
|
288
|
+
const renderLine = ([line, len]) => {
|
|
289
|
+
let leftPadding = 0;
|
|
290
|
+
let rightPadding = 0;
|
|
291
|
+
if (!narrowMode) {
|
|
292
|
+
leftPadding = sidePadding;
|
|
293
|
+
rightPadding = sidePadding;
|
|
294
|
+
if (textAlignment === "center") {
|
|
295
|
+
leftPadding += Math.floor((maxLine - len) / 2);
|
|
296
|
+
rightPadding += maxLine - len - leftPadding + sidePadding;
|
|
297
|
+
} else if (textAlignment === "right") {
|
|
298
|
+
leftPadding += maxLine - len;
|
|
299
|
+
} else if (textAlignment === "left") {
|
|
300
|
+
rightPadding += maxLine - len;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return borderColorFn(left) + " ".repeat(leftPadding) + line + " ".repeat(rightPadding) + borderColorFn(right);
|
|
304
|
+
};
|
|
305
|
+
return borderColorFn(`${topLeft}${hr.repeat(innerWidth)}${topRight}`) + "\n" + spacerRow + lines.map(renderLine).join("\n") + "\n" + spacerRow + borderColorFn(`${bottomLeft}${hr.repeat(innerWidth)}${bottomRight}`);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// src/util/did-you-mean.ts
|
|
309
|
+
var import_jaro_winkler = __toESM(require_jaro_winkler(), 1);
|
|
310
|
+
var did_you_mean_default = didYouMean;
|
|
311
|
+
function didYouMean(input, list, threshold = 0.5) {
|
|
312
|
+
const rated = list.map((item) => [dashAwareDistance(input, item), item]);
|
|
313
|
+
const found = rated.filter((item) => item[0] > threshold);
|
|
314
|
+
if (found.length) {
|
|
315
|
+
const highestRated = found.reduce((accu, curr) => {
|
|
316
|
+
return accu[0] > curr[0] ? accu : curr;
|
|
317
|
+
});
|
|
318
|
+
return highestRated[1];
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
function dashAwareDistance(word, dashWord) {
|
|
322
|
+
const fullDistance = (0, import_jaro_winkler.default)(word, dashWord);
|
|
323
|
+
const distances = dashWord.split("-").map((w) => (0, import_jaro_winkler.default)(w, word));
|
|
324
|
+
const meanDistance = distances.reduce((accu, curr) => accu + curr) / distances.length;
|
|
325
|
+
return fullDistance > meanDistance ? fullDistance : meanDistance;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export {
|
|
329
|
+
did_you_mean_default,
|
|
330
|
+
executeUpgrade,
|
|
331
|
+
login2 as login,
|
|
332
|
+
box
|
|
333
|
+
};
|