@sanity/cli 3.95.1-ui3.25.95f33c4bf6 → 3.96.1-next.0.d55a8326e3
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/lib/_chunks-cjs/cli.js +213 -202
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/lib/_chunks-cjs/loadEnv.js +23 -5
- package/lib/_chunks-cjs/loadEnv.js.map +1 -1
- package/lib/index.d.mts +11 -4
- package/lib/index.d.ts +11 -4
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +26 -7
- package/lib/index.mjs.map +1 -1
- package/package.json +11 -11
- package/templates/app-sanity-ui/src/SanityUI.tsx +4 -4
- package/templates/get-started/plugins/sanity-plugin-tutorial/GetStartedTutorial.tsx +5 -4
- package/bin/xdg-open +0 -1066
package/lib/_chunks-cjs/cli.js
CHANGED
|
@@ -79013,208 +79013,6 @@ function prompt(questions) {
|
|
|
79013
79013
|
}
|
|
79014
79014
|
prompt.Separator = inquirer.Separator;
|
|
79015
79015
|
prompt.single = (question) => prompt([{ ...question, name: "value" }]).then((answers) => answers.value);
|
|
79016
|
-
class CommandRunner {
|
|
79017
|
-
handlers;
|
|
79018
|
-
commands;
|
|
79019
|
-
commandGroups;
|
|
79020
|
-
constructor(handlers, commands = baseCommands) {
|
|
79021
|
-
this.handlers = handlers, this.commands = lodashExports.sortBy(commands, "name"), this.commandGroups = {};
|
|
79022
|
-
for (const cmd of this.commands) {
|
|
79023
|
-
const group = "group" in cmd && cmd.group || "default";
|
|
79024
|
-
this.commandGroups[group] = this.commandGroups[group] || [], this.commandGroups[group].push(cmd);
|
|
79025
|
-
}
|
|
79026
|
-
if (!handlers.outputter || !handlers.prompter)
|
|
79027
|
-
throw new Error("`prompter` and `outputter` handlers must be defined");
|
|
79028
|
-
}
|
|
79029
|
-
async runCommand(commandOrGroup, args, options2) {
|
|
79030
|
-
if (!commandOrGroup)
|
|
79031
|
-
return this.handlers.outputter.print(generateCommandsDocumentation(this.commandGroups)), Promise.resolve();
|
|
79032
|
-
const cmdArgs = lodashExports.cloneDeep(args), subCommandName = args.argsWithoutOptions[0], commandInfo = this.resolveCommand(commandOrGroup, subCommandName);
|
|
79033
|
-
if (!commandInfo)
|
|
79034
|
-
throw new Error(getNoSuchCommandText(commandOrGroup, subCommandName, this.commandGroups));
|
|
79035
|
-
const command2 = commandInfo.command;
|
|
79036
|
-
!isCommandGroup(command2) && command2.group && command2.group !== "default" && (cmdArgs.argsWithoutOptions = args.argsWithoutOptions.slice(1));
|
|
79037
|
-
const output = this.handlers.outputter, prompt2 = this.handlers.prompter, { cliConfig, ...commandOptions } = options2, apiClient = getClientWrapper(
|
|
79038
|
-
cliConfig?.config?.api || null,
|
|
79039
|
-
cliConfig?.path || (cliConfig?.version === 2 ? "sanity.json" : "sanity.cli.js")
|
|
79040
|
-
), context = {
|
|
79041
|
-
output,
|
|
79042
|
-
prompt: prompt2,
|
|
79043
|
-
apiClient,
|
|
79044
|
-
chalk: chalk__default.default,
|
|
79045
|
-
cliPackageManager,
|
|
79046
|
-
...commandOptions,
|
|
79047
|
-
commandRunner: this,
|
|
79048
|
-
...getVersionedContextParams(cliConfig)
|
|
79049
|
-
};
|
|
79050
|
-
if (isCommandGroup(command2))
|
|
79051
|
-
return context.output.print(generateCommandsDocumentation(this.commandGroups, command2.name));
|
|
79052
|
-
if (typeof command2.action != "function") {
|
|
79053
|
-
const cmdName = command2.name || commandOrGroup || "<unknown>";
|
|
79054
|
-
loadEnv.debug(`Command "${cmdName}" doesnt have a valid "action"-property, showing help`);
|
|
79055
|
-
const groupName = command2.group && command2.group !== "default" ? command2.group : null;
|
|
79056
|
-
return context.output.print(generateCommandDocumentation(command2, groupName, subCommandName));
|
|
79057
|
-
}
|
|
79058
|
-
return loadEnv.debug(`Running command "${command2.name}"`), command2.action(cmdArgs, context);
|
|
79059
|
-
}
|
|
79060
|
-
resolveCommand(commandOrGroup, subCommandName) {
|
|
79061
|
-
if (this.commandGroups[commandOrGroup] && subCommandName) {
|
|
79062
|
-
loadEnv.debug(`Found group for name "${commandOrGroup}", resolving subcommand`);
|
|
79063
|
-
const subCommand = this.resolveSubcommand(
|
|
79064
|
-
this.commandGroups[commandOrGroup],
|
|
79065
|
-
subCommandName,
|
|
79066
|
-
commandOrGroup
|
|
79067
|
-
);
|
|
79068
|
-
return loadEnv.debug(
|
|
79069
|
-
subCommand ? `Subcommand resolved to "${subCommand.commandName}"` : `Subcommand with name "${subCommandName}" not found`
|
|
79070
|
-
), subCommand;
|
|
79071
|
-
}
|
|
79072
|
-
loadEnv.debug(`No group found with name "${commandOrGroup}", looking for command`);
|
|
79073
|
-
const command2 = this.commandGroups.default.find((cmd) => cmd.name === commandOrGroup);
|
|
79074
|
-
return command2 ? (loadEnv.debug(`Found command in default group with name "${commandOrGroup}"`), {
|
|
79075
|
-
command: command2,
|
|
79076
|
-
commandName: command2.name,
|
|
79077
|
-
parentName: "default",
|
|
79078
|
-
isGroup: !1,
|
|
79079
|
-
isCommand: !0
|
|
79080
|
-
}) : (loadEnv.debug(`No default command with name "${commandOrGroup}" found, giving up`), null);
|
|
79081
|
-
}
|
|
79082
|
-
resolveSubcommand(group, subCommandName, parentGroupName) {
|
|
79083
|
-
if (!subCommandName)
|
|
79084
|
-
return null;
|
|
79085
|
-
const subCommand = group.find((cmd) => cmd.name === subCommandName);
|
|
79086
|
-
if (!subCommand)
|
|
79087
|
-
throw new Error(getNoSuchCommandText(subCommandName, parentGroupName, this.commandGroups));
|
|
79088
|
-
return {
|
|
79089
|
-
command: subCommand,
|
|
79090
|
-
commandName: subCommandName,
|
|
79091
|
-
parentName: parentGroupName,
|
|
79092
|
-
isGroup: !1,
|
|
79093
|
-
isCommand: !0
|
|
79094
|
-
};
|
|
79095
|
-
}
|
|
79096
|
-
resolveHelpForGroup() {
|
|
79097
|
-
const command2 = this.commandGroups.default.find((cmd) => cmd.name === "help");
|
|
79098
|
-
if (!command2)
|
|
79099
|
-
throw new Error("Failed to find default `help` command");
|
|
79100
|
-
return {
|
|
79101
|
-
command: command2,
|
|
79102
|
-
commandName: "help",
|
|
79103
|
-
isGroup: !1,
|
|
79104
|
-
isCommand: !0
|
|
79105
|
-
};
|
|
79106
|
-
}
|
|
79107
|
-
}
|
|
79108
|
-
function getCliRunner(commands) {
|
|
79109
|
-
return new CommandRunner(
|
|
79110
|
-
{
|
|
79111
|
-
outputter: cliOutputter,
|
|
79112
|
-
prompter: prompt
|
|
79113
|
-
},
|
|
79114
|
-
commands
|
|
79115
|
-
);
|
|
79116
|
-
}
|
|
79117
|
-
function getVersionedContextParams(cliConfig) {
|
|
79118
|
-
return cliConfig?.version === 2 ? {
|
|
79119
|
-
sanityMajorVersion: 2,
|
|
79120
|
-
cliConfig: cliConfig?.config || void 0,
|
|
79121
|
-
cliConfigPath: cliConfig?.path || void 0
|
|
79122
|
-
} : {
|
|
79123
|
-
sanityMajorVersion: 3,
|
|
79124
|
-
cliConfig: cliConfig?.config || void 0,
|
|
79125
|
-
cliConfigPath: cliConfig?.path || void 0
|
|
79126
|
-
};
|
|
79127
|
-
}
|
|
79128
|
-
function detectRuntime() {
|
|
79129
|
-
return "Deno" in globalThis ? "deno" : "Bun" in globalThis ? "bun" : "node";
|
|
79130
|
-
}
|
|
79131
|
-
async function mergeCommands(baseCommands2, corePath, options2) {
|
|
79132
|
-
if (!corePath)
|
|
79133
|
-
return baseCommands2;
|
|
79134
|
-
const { cliVersion } = options2, coreImport = getCliConfig.dynamicRequire(corePath);
|
|
79135
|
-
semver__default.default.coerce(cliVersion);
|
|
79136
|
-
const core2 = "cliProjectCommands" in coreImport ? coreImport.cliProjectCommands : coreImport;
|
|
79137
|
-
return baseCommands2.concat(core2.commands).map(addDefaultGroup).reverse().reduce(
|
|
79138
|
-
(cmds, cmd) => {
|
|
79139
|
-
const group = isCommandGroup(cmd) ? void 0 : cmd.group;
|
|
79140
|
-
return lodashExports.find(cmds, { name: cmd.name, group }) || cmds.push(cmd), cmds;
|
|
79141
|
-
},
|
|
79142
|
-
[]
|
|
79143
|
-
);
|
|
79144
|
-
}
|
|
79145
|
-
function addDefaultGroup(cmd) {
|
|
79146
|
-
return !isCommandGroup(cmd) && !cmd.group && (cmd.group = "default"), cmd;
|
|
79147
|
-
}
|
|
79148
|
-
var escapeStringRegexp, hasRequiredEscapeStringRegexp;
|
|
79149
|
-
function requireEscapeStringRegexp() {
|
|
79150
|
-
return hasRequiredEscapeStringRegexp || (hasRequiredEscapeStringRegexp = 1, escapeStringRegexp = (string) => {
|
|
79151
|
-
if (typeof string != "string")
|
|
79152
|
-
throw new TypeError("Expected a string");
|
|
79153
|
-
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
79154
|
-
}), escapeStringRegexp;
|
|
79155
|
-
}
|
|
79156
|
-
var cleanStack$1, hasRequiredCleanStack;
|
|
79157
|
-
function requireCleanStack() {
|
|
79158
|
-
if (hasRequiredCleanStack) return cleanStack$1;
|
|
79159
|
-
hasRequiredCleanStack = 1;
|
|
79160
|
-
const os2 = require$$0__default$2.default, escapeStringRegexp2 = requireEscapeStringRegexp(), extractPathRegex = /\s+at.*[(\s](.*)\)?/, pathRegex = /^(?:(?:(?:node|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/, homeDir = typeof os2.homedir > "u" ? "" : os2.homedir();
|
|
79161
|
-
return cleanStack$1 = (stack2, { pretty = !1, basePath } = {}) => {
|
|
79162
|
-
const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp2(basePath)}`, "g");
|
|
79163
|
-
return stack2.replace(/\\/g, "/").split(`
|
|
79164
|
-
`).filter((line3) => {
|
|
79165
|
-
const pathMatches = line3.match(extractPathRegex);
|
|
79166
|
-
if (pathMatches === null || !pathMatches[1])
|
|
79167
|
-
return !0;
|
|
79168
|
-
const match2 = pathMatches[1];
|
|
79169
|
-
return match2.includes(".app/Contents/Resources/electron.asar") || match2.includes(".app/Contents/Resources/default_app.asar") ? !1 : !pathRegex.test(match2);
|
|
79170
|
-
}).filter((line3) => line3.trim() !== "").map((line3) => (basePathRegex && (line3 = line3.replace(basePathRegex, "$1")), pretty && (line3 = line3.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, "~")))), line3)).join(`
|
|
79171
|
-
`);
|
|
79172
|
-
}, cleanStack$1;
|
|
79173
|
-
}
|
|
79174
|
-
var cleanStackExports = requireCleanStack(), cleanStack = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(cleanStackExports);
|
|
79175
|
-
const options = { pretty: process.platform !== "win32" };
|
|
79176
|
-
function neatStack(error2) {
|
|
79177
|
-
if (typeof error2 == "string")
|
|
79178
|
-
return chalk.red(cleanStack(error2, options));
|
|
79179
|
-
if (error2 === null || typeof error2 != "object" || typeof error2.stack != "string")
|
|
79180
|
-
return chalk.red(util$4.inspect(error2));
|
|
79181
|
-
const title = error2.toString(), stack2 = cleanStack(error2.stack, options);
|
|
79182
|
-
return stack2.startsWith(title) ? chalk.red(`${title}${chalk.dim(cleanStack(error2.stack, options).slice(title.length))}`) : chalk.red(stack2);
|
|
79183
|
-
}
|
|
79184
|
-
var minimistExports = requireMinimist(), minimist = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(minimistExports);
|
|
79185
|
-
function parseArguments(argv = process.argv) {
|
|
79186
|
-
const {
|
|
79187
|
-
_,
|
|
79188
|
-
h,
|
|
79189
|
-
help: help2,
|
|
79190
|
-
d,
|
|
79191
|
-
debug: debug2,
|
|
79192
|
-
v,
|
|
79193
|
-
version: version2,
|
|
79194
|
-
"--": extraArguments,
|
|
79195
|
-
...extOptions
|
|
79196
|
-
} = minimist(argv.slice(2), {
|
|
79197
|
-
"--": !0,
|
|
79198
|
-
boolean: ["h", "help", "d", "debug", "v", "version"],
|
|
79199
|
-
string: ["_"]
|
|
79200
|
-
}), [groupOrCommand, ...argsWithoutOptions] = _;
|
|
79201
|
-
return {
|
|
79202
|
-
groupOrCommand,
|
|
79203
|
-
argv,
|
|
79204
|
-
extOptions,
|
|
79205
|
-
argsWithoutOptions,
|
|
79206
|
-
extraArguments: extraArguments || [],
|
|
79207
|
-
// prettier-ignore
|
|
79208
|
-
coreOptions: {
|
|
79209
|
-
h,
|
|
79210
|
-
help: help2,
|
|
79211
|
-
d,
|
|
79212
|
-
debug: debug2,
|
|
79213
|
-
v,
|
|
79214
|
-
version: version2
|
|
79215
|
-
}
|
|
79216
|
-
};
|
|
79217
|
-
}
|
|
79218
79016
|
var boxen$1 = { exports: {} }, stringWidth = { exports: {} }, ansiRegex, hasRequiredAnsiRegex;
|
|
79219
79017
|
function requireAnsiRegex() {
|
|
79220
79018
|
return hasRequiredAnsiRegex || (hasRequiredAnsiRegex = 1, ansiRegex = ({ onlyFirst = !1 } = {}) => {
|
|
@@ -79540,6 +79338,219 @@ function requireBoxen() {
|
|
|
79540
79338
|
}, boxen$1.exports._borderStyles = cliBoxes2, boxen$1.exports;
|
|
79541
79339
|
}
|
|
79542
79340
|
var boxenExports = requireBoxen(), boxen = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(boxenExports);
|
|
79341
|
+
function printNewMajorVersionMessage(context) {
|
|
79342
|
+
const { chalk: chalk2 } = context, message = `${chalk2.yellow.bold(
|
|
79343
|
+
"The `sanity` package is moving to v4 on July 15 and will require Node.js 20+."
|
|
79344
|
+
)}
|
|
79345
|
+
Learn what this means for your apps at https://www.sanity.io/blog/a-major-version-bump-for-a-minor-reason`, boxedMessage = boxen(message, {
|
|
79346
|
+
padding: 1,
|
|
79347
|
+
margin: 1
|
|
79348
|
+
});
|
|
79349
|
+
context.output.print(boxedMessage);
|
|
79350
|
+
}
|
|
79351
|
+
class CommandRunner {
|
|
79352
|
+
handlers;
|
|
79353
|
+
commands;
|
|
79354
|
+
commandGroups;
|
|
79355
|
+
constructor(handlers, commands = baseCommands) {
|
|
79356
|
+
this.handlers = handlers, this.commands = lodashExports.sortBy(commands, "name"), this.commandGroups = {};
|
|
79357
|
+
for (const cmd of this.commands) {
|
|
79358
|
+
const group = "group" in cmd && cmd.group || "default";
|
|
79359
|
+
this.commandGroups[group] = this.commandGroups[group] || [], this.commandGroups[group].push(cmd);
|
|
79360
|
+
}
|
|
79361
|
+
if (!handlers.outputter || !handlers.prompter)
|
|
79362
|
+
throw new Error("`prompter` and `outputter` handlers must be defined");
|
|
79363
|
+
}
|
|
79364
|
+
// eslint-disable-next-line complexity
|
|
79365
|
+
async runCommand(commandOrGroup, args, options2) {
|
|
79366
|
+
if (!commandOrGroup)
|
|
79367
|
+
return this.handlers.outputter.print(generateCommandsDocumentation(this.commandGroups)), Promise.resolve();
|
|
79368
|
+
const cmdArgs = lodashExports.cloneDeep(args), subCommandName = args.argsWithoutOptions[0], commandInfo = this.resolveCommand(commandOrGroup, subCommandName);
|
|
79369
|
+
if (!commandInfo)
|
|
79370
|
+
throw new Error(getNoSuchCommandText(commandOrGroup, subCommandName, this.commandGroups));
|
|
79371
|
+
const command2 = commandInfo.command;
|
|
79372
|
+
!isCommandGroup(command2) && command2.group && command2.group !== "default" && (cmdArgs.argsWithoutOptions = args.argsWithoutOptions.slice(1));
|
|
79373
|
+
const output = this.handlers.outputter, prompt2 = this.handlers.prompter, { cliConfig, ...commandOptions } = options2, apiClient = getClientWrapper(
|
|
79374
|
+
cliConfig?.config?.api || null,
|
|
79375
|
+
cliConfig?.path || (cliConfig?.version === 2 ? "sanity.json" : "sanity.cli.js")
|
|
79376
|
+
), context = {
|
|
79377
|
+
output,
|
|
79378
|
+
prompt: prompt2,
|
|
79379
|
+
apiClient,
|
|
79380
|
+
chalk: chalk__default.default,
|
|
79381
|
+
cliPackageManager,
|
|
79382
|
+
...commandOptions,
|
|
79383
|
+
commandRunner: this,
|
|
79384
|
+
...getVersionedContextParams(cliConfig)
|
|
79385
|
+
};
|
|
79386
|
+
if (isCommandGroup(command2))
|
|
79387
|
+
return context.output.print(generateCommandsDocumentation(this.commandGroups, command2.name));
|
|
79388
|
+
if (typeof command2.action != "function") {
|
|
79389
|
+
const cmdName = command2.name || commandOrGroup || "<unknown>";
|
|
79390
|
+
loadEnv.debug(`Command "${cmdName}" doesnt have a valid "action"-property, showing help`);
|
|
79391
|
+
const groupName = command2.group && command2.group !== "default" ? command2.group : null;
|
|
79392
|
+
return context.output.print(generateCommandDocumentation(command2, groupName, subCommandName));
|
|
79393
|
+
}
|
|
79394
|
+
return loadEnv.debug(`Running command "${command2.name}"`), cmdArgs.extOptions["hide-major-message"] || printNewMajorVersionMessage(context), command2.action(cmdArgs, context);
|
|
79395
|
+
}
|
|
79396
|
+
resolveCommand(commandOrGroup, subCommandName) {
|
|
79397
|
+
if (this.commandGroups[commandOrGroup] && subCommandName) {
|
|
79398
|
+
loadEnv.debug(`Found group for name "${commandOrGroup}", resolving subcommand`);
|
|
79399
|
+
const subCommand = this.resolveSubcommand(
|
|
79400
|
+
this.commandGroups[commandOrGroup],
|
|
79401
|
+
subCommandName,
|
|
79402
|
+
commandOrGroup
|
|
79403
|
+
);
|
|
79404
|
+
return loadEnv.debug(
|
|
79405
|
+
subCommand ? `Subcommand resolved to "${subCommand.commandName}"` : `Subcommand with name "${subCommandName}" not found`
|
|
79406
|
+
), subCommand;
|
|
79407
|
+
}
|
|
79408
|
+
loadEnv.debug(`No group found with name "${commandOrGroup}", looking for command`);
|
|
79409
|
+
const command2 = this.commandGroups.default.find((cmd) => cmd.name === commandOrGroup);
|
|
79410
|
+
return command2 ? (loadEnv.debug(`Found command in default group with name "${commandOrGroup}"`), {
|
|
79411
|
+
command: command2,
|
|
79412
|
+
commandName: command2.name,
|
|
79413
|
+
parentName: "default",
|
|
79414
|
+
isGroup: !1,
|
|
79415
|
+
isCommand: !0
|
|
79416
|
+
}) : (loadEnv.debug(`No default command with name "${commandOrGroup}" found, giving up`), null);
|
|
79417
|
+
}
|
|
79418
|
+
resolveSubcommand(group, subCommandName, parentGroupName) {
|
|
79419
|
+
if (!subCommandName)
|
|
79420
|
+
return null;
|
|
79421
|
+
const subCommand = group.find((cmd) => cmd.name === subCommandName);
|
|
79422
|
+
if (!subCommand)
|
|
79423
|
+
throw new Error(getNoSuchCommandText(subCommandName, parentGroupName, this.commandGroups));
|
|
79424
|
+
return {
|
|
79425
|
+
command: subCommand,
|
|
79426
|
+
commandName: subCommandName,
|
|
79427
|
+
parentName: parentGroupName,
|
|
79428
|
+
isGroup: !1,
|
|
79429
|
+
isCommand: !0
|
|
79430
|
+
};
|
|
79431
|
+
}
|
|
79432
|
+
resolveHelpForGroup() {
|
|
79433
|
+
const command2 = this.commandGroups.default.find((cmd) => cmd.name === "help");
|
|
79434
|
+
if (!command2)
|
|
79435
|
+
throw new Error("Failed to find default `help` command");
|
|
79436
|
+
return {
|
|
79437
|
+
command: command2,
|
|
79438
|
+
commandName: "help",
|
|
79439
|
+
isGroup: !1,
|
|
79440
|
+
isCommand: !0
|
|
79441
|
+
};
|
|
79442
|
+
}
|
|
79443
|
+
}
|
|
79444
|
+
function getCliRunner(commands) {
|
|
79445
|
+
return new CommandRunner(
|
|
79446
|
+
{
|
|
79447
|
+
outputter: cliOutputter,
|
|
79448
|
+
prompter: prompt
|
|
79449
|
+
},
|
|
79450
|
+
commands
|
|
79451
|
+
);
|
|
79452
|
+
}
|
|
79453
|
+
function getVersionedContextParams(cliConfig) {
|
|
79454
|
+
return cliConfig?.version === 2 ? {
|
|
79455
|
+
sanityMajorVersion: 2,
|
|
79456
|
+
cliConfig: cliConfig?.config || void 0,
|
|
79457
|
+
cliConfigPath: cliConfig?.path || void 0
|
|
79458
|
+
} : {
|
|
79459
|
+
sanityMajorVersion: 3,
|
|
79460
|
+
cliConfig: cliConfig?.config || void 0,
|
|
79461
|
+
cliConfigPath: cliConfig?.path || void 0
|
|
79462
|
+
};
|
|
79463
|
+
}
|
|
79464
|
+
function detectRuntime() {
|
|
79465
|
+
return "Deno" in globalThis ? "deno" : "Bun" in globalThis ? "bun" : "node";
|
|
79466
|
+
}
|
|
79467
|
+
async function mergeCommands(baseCommands2, corePath, options2) {
|
|
79468
|
+
if (!corePath)
|
|
79469
|
+
return baseCommands2;
|
|
79470
|
+
const { cliVersion } = options2, coreImport = getCliConfig.dynamicRequire(corePath);
|
|
79471
|
+
semver__default.default.coerce(cliVersion);
|
|
79472
|
+
const core2 = "cliProjectCommands" in coreImport ? coreImport.cliProjectCommands : coreImport;
|
|
79473
|
+
return baseCommands2.concat(core2.commands).map(addDefaultGroup).reverse().reduce(
|
|
79474
|
+
(cmds, cmd) => {
|
|
79475
|
+
const group = isCommandGroup(cmd) ? void 0 : cmd.group;
|
|
79476
|
+
return lodashExports.find(cmds, { name: cmd.name, group }) || cmds.push(cmd), cmds;
|
|
79477
|
+
},
|
|
79478
|
+
[]
|
|
79479
|
+
);
|
|
79480
|
+
}
|
|
79481
|
+
function addDefaultGroup(cmd) {
|
|
79482
|
+
return !isCommandGroup(cmd) && !cmd.group && (cmd.group = "default"), cmd;
|
|
79483
|
+
}
|
|
79484
|
+
var escapeStringRegexp, hasRequiredEscapeStringRegexp;
|
|
79485
|
+
function requireEscapeStringRegexp() {
|
|
79486
|
+
return hasRequiredEscapeStringRegexp || (hasRequiredEscapeStringRegexp = 1, escapeStringRegexp = (string) => {
|
|
79487
|
+
if (typeof string != "string")
|
|
79488
|
+
throw new TypeError("Expected a string");
|
|
79489
|
+
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
79490
|
+
}), escapeStringRegexp;
|
|
79491
|
+
}
|
|
79492
|
+
var cleanStack$1, hasRequiredCleanStack;
|
|
79493
|
+
function requireCleanStack() {
|
|
79494
|
+
if (hasRequiredCleanStack) return cleanStack$1;
|
|
79495
|
+
hasRequiredCleanStack = 1;
|
|
79496
|
+
const os2 = require$$0__default$2.default, escapeStringRegexp2 = requireEscapeStringRegexp(), extractPathRegex = /\s+at.*[(\s](.*)\)?/, pathRegex = /^(?:(?:(?:node|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/, homeDir = typeof os2.homedir > "u" ? "" : os2.homedir();
|
|
79497
|
+
return cleanStack$1 = (stack2, { pretty = !1, basePath } = {}) => {
|
|
79498
|
+
const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp2(basePath)}`, "g");
|
|
79499
|
+
return stack2.replace(/\\/g, "/").split(`
|
|
79500
|
+
`).filter((line3) => {
|
|
79501
|
+
const pathMatches = line3.match(extractPathRegex);
|
|
79502
|
+
if (pathMatches === null || !pathMatches[1])
|
|
79503
|
+
return !0;
|
|
79504
|
+
const match2 = pathMatches[1];
|
|
79505
|
+
return match2.includes(".app/Contents/Resources/electron.asar") || match2.includes(".app/Contents/Resources/default_app.asar") ? !1 : !pathRegex.test(match2);
|
|
79506
|
+
}).filter((line3) => line3.trim() !== "").map((line3) => (basePathRegex && (line3 = line3.replace(basePathRegex, "$1")), pretty && (line3 = line3.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, "~")))), line3)).join(`
|
|
79507
|
+
`);
|
|
79508
|
+
}, cleanStack$1;
|
|
79509
|
+
}
|
|
79510
|
+
var cleanStackExports = requireCleanStack(), cleanStack = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(cleanStackExports);
|
|
79511
|
+
const options = { pretty: process.platform !== "win32" };
|
|
79512
|
+
function neatStack(error2) {
|
|
79513
|
+
if (typeof error2 == "string")
|
|
79514
|
+
return chalk.red(cleanStack(error2, options));
|
|
79515
|
+
if (error2 === null || typeof error2 != "object" || typeof error2.stack != "string")
|
|
79516
|
+
return chalk.red(util$4.inspect(error2));
|
|
79517
|
+
const title = error2.toString(), stack2 = cleanStack(error2.stack, options);
|
|
79518
|
+
return stack2.startsWith(title) ? chalk.red(`${title}${chalk.dim(cleanStack(error2.stack, options).slice(title.length))}`) : chalk.red(stack2);
|
|
79519
|
+
}
|
|
79520
|
+
var minimistExports = requireMinimist(), minimist = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(minimistExports);
|
|
79521
|
+
function parseArguments(argv = process.argv) {
|
|
79522
|
+
const {
|
|
79523
|
+
_,
|
|
79524
|
+
h,
|
|
79525
|
+
help: help2,
|
|
79526
|
+
d,
|
|
79527
|
+
debug: debug2,
|
|
79528
|
+
v,
|
|
79529
|
+
version: version2,
|
|
79530
|
+
"--": extraArguments,
|
|
79531
|
+
...extOptions
|
|
79532
|
+
} = minimist(argv.slice(2), {
|
|
79533
|
+
"--": !0,
|
|
79534
|
+
boolean: ["h", "help", "d", "debug", "v", "version"],
|
|
79535
|
+
string: ["_"]
|
|
79536
|
+
}), [groupOrCommand, ...argsWithoutOptions] = _;
|
|
79537
|
+
return {
|
|
79538
|
+
groupOrCommand,
|
|
79539
|
+
argv,
|
|
79540
|
+
extOptions,
|
|
79541
|
+
argsWithoutOptions,
|
|
79542
|
+
extraArguments: extraArguments || [],
|
|
79543
|
+
// prettier-ignore
|
|
79544
|
+
coreOptions: {
|
|
79545
|
+
h,
|
|
79546
|
+
help: help2,
|
|
79547
|
+
d,
|
|
79548
|
+
debug: debug2,
|
|
79549
|
+
v,
|
|
79550
|
+
version: version2
|
|
79551
|
+
}
|
|
79552
|
+
};
|
|
79553
|
+
}
|
|
79543
79554
|
const TELEMETRY_DISCLOSED_CONFIG_KEY = "telemetryDisclosed";
|
|
79544
79555
|
function telemetryDisclosure() {
|
|
79545
79556
|
const userConfig = getUserConfig();
|