@sanity/cli 3.100.0-next.0-662eadf9f0-202507141225 → 3.100.0-next.0-72545ccee1-202507141252
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 +203 -213
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/package.json +4 -4
package/lib/_chunks-cjs/cli.js
CHANGED
@@ -79458,6 +79458,209 @@ function prompt(questions) {
|
|
79458
79458
|
}
|
79459
79459
|
prompt.Separator = inquirer.Separator;
|
79460
79460
|
prompt.single = (question) => prompt([{ ...question, name: "value" }]).then((answers) => answers.value);
|
79461
|
+
class CommandRunner {
|
79462
|
+
handlers;
|
79463
|
+
commands;
|
79464
|
+
commandGroups;
|
79465
|
+
constructor(handlers, commands = baseCommands) {
|
79466
|
+
this.handlers = handlers, this.commands = lodashExports.sortBy(commands, "name"), this.commandGroups = {};
|
79467
|
+
for (const cmd of this.commands) {
|
79468
|
+
const group = "group" in cmd && cmd.group || "default";
|
79469
|
+
this.commandGroups[group] = this.commandGroups[group] || [], this.commandGroups[group].push(cmd);
|
79470
|
+
}
|
79471
|
+
if (!handlers.outputter || !handlers.prompter)
|
79472
|
+
throw new Error("`prompter` and `outputter` handlers must be defined");
|
79473
|
+
}
|
79474
|
+
// eslint-disable-next-line complexity
|
79475
|
+
async runCommand(commandOrGroup, args, options2) {
|
79476
|
+
if (!commandOrGroup)
|
79477
|
+
return this.handlers.outputter.print(generateCommandsDocumentation(this.commandGroups)), Promise.resolve();
|
79478
|
+
const cmdArgs = lodashExports.cloneDeep(args), subCommandName = args.argsWithoutOptions[0], commandInfo = this.resolveCommand(commandOrGroup, subCommandName);
|
79479
|
+
if (!commandInfo)
|
79480
|
+
throw new Error(getNoSuchCommandText(commandOrGroup, subCommandName, this.commandGroups));
|
79481
|
+
const command2 = commandInfo.command;
|
79482
|
+
!isCommandGroup(command2) && command2.group && command2.group !== "default" && (cmdArgs.argsWithoutOptions = args.argsWithoutOptions.slice(1));
|
79483
|
+
const output = this.handlers.outputter, prompt2 = this.handlers.prompter, { cliConfig, ...commandOptions } = options2, apiClient = getClientWrapper(
|
79484
|
+
cliConfig?.config?.api || null,
|
79485
|
+
cliConfig?.path || (cliConfig?.version === 2 ? "sanity.json" : "sanity.cli.js")
|
79486
|
+
), context = {
|
79487
|
+
output,
|
79488
|
+
prompt: prompt2,
|
79489
|
+
apiClient,
|
79490
|
+
chalk: chalk__default.default,
|
79491
|
+
cliPackageManager,
|
79492
|
+
...commandOptions,
|
79493
|
+
commandRunner: this,
|
79494
|
+
...getVersionedContextParams(cliConfig)
|
79495
|
+
};
|
79496
|
+
if (isCommandGroup(command2))
|
79497
|
+
return context.output.print(generateCommandsDocumentation(this.commandGroups, command2.name));
|
79498
|
+
if (typeof command2.action != "function") {
|
79499
|
+
const cmdName = command2.name || commandOrGroup || "<unknown>";
|
79500
|
+
loadEnv.debug(`Command "${cmdName}" doesnt have a valid "action"-property, showing help`);
|
79501
|
+
const groupName = command2.group && command2.group !== "default" ? command2.group : null;
|
79502
|
+
return context.output.print(generateCommandDocumentation(command2, groupName, subCommandName));
|
79503
|
+
}
|
79504
|
+
return loadEnv.debug(`Running command "${command2.name}"`), command2.action(cmdArgs, context);
|
79505
|
+
}
|
79506
|
+
resolveCommand(commandOrGroup, subCommandName) {
|
79507
|
+
if (this.commandGroups[commandOrGroup] && subCommandName) {
|
79508
|
+
loadEnv.debug(`Found group for name "${commandOrGroup}", resolving subcommand`);
|
79509
|
+
const subCommand = this.resolveSubcommand(
|
79510
|
+
this.commandGroups[commandOrGroup],
|
79511
|
+
subCommandName,
|
79512
|
+
commandOrGroup
|
79513
|
+
);
|
79514
|
+
return loadEnv.debug(
|
79515
|
+
subCommand ? `Subcommand resolved to "${subCommand.commandName}"` : `Subcommand with name "${subCommandName}" not found`
|
79516
|
+
), subCommand;
|
79517
|
+
}
|
79518
|
+
loadEnv.debug(`No group found with name "${commandOrGroup}", looking for command`);
|
79519
|
+
const command2 = this.commandGroups.default.find((cmd) => cmd.name === commandOrGroup);
|
79520
|
+
return command2 ? (loadEnv.debug(`Found command in default group with name "${commandOrGroup}"`), {
|
79521
|
+
command: command2,
|
79522
|
+
commandName: command2.name,
|
79523
|
+
parentName: "default",
|
79524
|
+
isGroup: !1,
|
79525
|
+
isCommand: !0
|
79526
|
+
}) : (loadEnv.debug(`No default command with name "${commandOrGroup}" found, giving up`), null);
|
79527
|
+
}
|
79528
|
+
resolveSubcommand(group, subCommandName, parentGroupName) {
|
79529
|
+
if (!subCommandName)
|
79530
|
+
return null;
|
79531
|
+
const subCommand = group.find((cmd) => cmd.name === subCommandName);
|
79532
|
+
if (!subCommand)
|
79533
|
+
throw new Error(getNoSuchCommandText(subCommandName, parentGroupName, this.commandGroups));
|
79534
|
+
return {
|
79535
|
+
command: subCommand,
|
79536
|
+
commandName: subCommandName,
|
79537
|
+
parentName: parentGroupName,
|
79538
|
+
isGroup: !1,
|
79539
|
+
isCommand: !0
|
79540
|
+
};
|
79541
|
+
}
|
79542
|
+
resolveHelpForGroup() {
|
79543
|
+
const command2 = this.commandGroups.default.find((cmd) => cmd.name === "help");
|
79544
|
+
if (!command2)
|
79545
|
+
throw new Error("Failed to find default `help` command");
|
79546
|
+
return {
|
79547
|
+
command: command2,
|
79548
|
+
commandName: "help",
|
79549
|
+
isGroup: !1,
|
79550
|
+
isCommand: !0
|
79551
|
+
};
|
79552
|
+
}
|
79553
|
+
}
|
79554
|
+
function getCliRunner(commands) {
|
79555
|
+
return new CommandRunner(
|
79556
|
+
{
|
79557
|
+
outputter: cliOutputter,
|
79558
|
+
prompter: prompt
|
79559
|
+
},
|
79560
|
+
commands
|
79561
|
+
);
|
79562
|
+
}
|
79563
|
+
function getVersionedContextParams(cliConfig) {
|
79564
|
+
return cliConfig?.version === 2 ? {
|
79565
|
+
sanityMajorVersion: 2,
|
79566
|
+
cliConfig: cliConfig?.config || void 0,
|
79567
|
+
cliConfigPath: cliConfig?.path || void 0
|
79568
|
+
} : {
|
79569
|
+
sanityMajorVersion: 3,
|
79570
|
+
cliConfig: cliConfig?.config || void 0,
|
79571
|
+
cliConfigPath: cliConfig?.path || void 0
|
79572
|
+
};
|
79573
|
+
}
|
79574
|
+
function detectRuntime() {
|
79575
|
+
return "Deno" in globalThis ? "deno" : "Bun" in globalThis ? "bun" : "node";
|
79576
|
+
}
|
79577
|
+
async function mergeCommands(baseCommands2, corePath, options2) {
|
79578
|
+
if (!corePath)
|
79579
|
+
return baseCommands2;
|
79580
|
+
const { cliVersion } = options2, coreImport = getCliConfig.dynamicRequire(corePath);
|
79581
|
+
semver__default.default.coerce(cliVersion);
|
79582
|
+
const core2 = "cliProjectCommands" in coreImport ? coreImport.cliProjectCommands : coreImport;
|
79583
|
+
return baseCommands2.concat(core2.commands).map(addDefaultGroup).reverse().reduce(
|
79584
|
+
(cmds, cmd) => {
|
79585
|
+
const group = isCommandGroup(cmd) ? void 0 : cmd.group;
|
79586
|
+
return lodashExports.find(cmds, { name: cmd.name, group }) || cmds.push(cmd), cmds;
|
79587
|
+
},
|
79588
|
+
[]
|
79589
|
+
);
|
79590
|
+
}
|
79591
|
+
function addDefaultGroup(cmd) {
|
79592
|
+
return !isCommandGroup(cmd) && !cmd.group && (cmd.group = "default"), cmd;
|
79593
|
+
}
|
79594
|
+
var escapeStringRegexp, hasRequiredEscapeStringRegexp;
|
79595
|
+
function requireEscapeStringRegexp() {
|
79596
|
+
return hasRequiredEscapeStringRegexp || (hasRequiredEscapeStringRegexp = 1, escapeStringRegexp = (string) => {
|
79597
|
+
if (typeof string != "string")
|
79598
|
+
throw new TypeError("Expected a string");
|
79599
|
+
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
79600
|
+
}), escapeStringRegexp;
|
79601
|
+
}
|
79602
|
+
var cleanStack$1, hasRequiredCleanStack;
|
79603
|
+
function requireCleanStack() {
|
79604
|
+
if (hasRequiredCleanStack) return cleanStack$1;
|
79605
|
+
hasRequiredCleanStack = 1;
|
79606
|
+
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();
|
79607
|
+
return cleanStack$1 = (stack2, { pretty = !1, basePath } = {}) => {
|
79608
|
+
const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp2(basePath)}`, "g");
|
79609
|
+
return stack2.replace(/\\/g, "/").split(`
|
79610
|
+
`).filter((line3) => {
|
79611
|
+
const pathMatches = line3.match(extractPathRegex);
|
79612
|
+
if (pathMatches === null || !pathMatches[1])
|
79613
|
+
return !0;
|
79614
|
+
const match2 = pathMatches[1];
|
79615
|
+
return match2.includes(".app/Contents/Resources/electron.asar") || match2.includes(".app/Contents/Resources/default_app.asar") ? !1 : !pathRegex.test(match2);
|
79616
|
+
}).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(`
|
79617
|
+
`);
|
79618
|
+
}, cleanStack$1;
|
79619
|
+
}
|
79620
|
+
var cleanStackExports = requireCleanStack(), cleanStack = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(cleanStackExports);
|
79621
|
+
const options = { pretty: process.platform !== "win32" };
|
79622
|
+
function neatStack(error2) {
|
79623
|
+
if (typeof error2 == "string")
|
79624
|
+
return chalk.red(cleanStack(error2, options));
|
79625
|
+
if (error2 === null || typeof error2 != "object" || typeof error2.stack != "string")
|
79626
|
+
return chalk.red(util$4.inspect(error2));
|
79627
|
+
const title = error2.toString(), stack2 = cleanStack(error2.stack, options);
|
79628
|
+
return stack2.startsWith(title) ? chalk.red(`${title}${chalk.dim(cleanStack(error2.stack, options).slice(title.length))}`) : chalk.red(stack2);
|
79629
|
+
}
|
79630
|
+
var minimistExports = requireMinimist(), minimist = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(minimistExports);
|
79631
|
+
function parseArguments(argv = process.argv) {
|
79632
|
+
const {
|
79633
|
+
_,
|
79634
|
+
h,
|
79635
|
+
help: help2,
|
79636
|
+
d,
|
79637
|
+
debug: debug2,
|
79638
|
+
v,
|
79639
|
+
version: version2,
|
79640
|
+
"--": extraArguments,
|
79641
|
+
...extOptions
|
79642
|
+
} = minimist(argv.slice(2), {
|
79643
|
+
"--": !0,
|
79644
|
+
boolean: ["h", "help", "d", "debug", "v", "version"],
|
79645
|
+
string: ["_"]
|
79646
|
+
}), [groupOrCommand, ...argsWithoutOptions] = _;
|
79647
|
+
return {
|
79648
|
+
groupOrCommand,
|
79649
|
+
argv,
|
79650
|
+
extOptions,
|
79651
|
+
argsWithoutOptions,
|
79652
|
+
extraArguments: extraArguments || [],
|
79653
|
+
// prettier-ignore
|
79654
|
+
coreOptions: {
|
79655
|
+
h,
|
79656
|
+
help: help2,
|
79657
|
+
d,
|
79658
|
+
debug: debug2,
|
79659
|
+
v,
|
79660
|
+
version: version2
|
79661
|
+
}
|
79662
|
+
};
|
79663
|
+
}
|
79461
79664
|
var boxen$1 = { exports: {} }, stringWidth = { exports: {} }, ansiRegex, hasRequiredAnsiRegex;
|
79462
79665
|
function requireAnsiRegex() {
|
79463
79666
|
return hasRequiredAnsiRegex || (hasRequiredAnsiRegex = 1, ansiRegex = ({ onlyFirst = !1 } = {}) => {
|
@@ -79783,219 +79986,6 @@ function requireBoxen() {
|
|
79783
79986
|
}, boxen$1.exports._borderStyles = cliBoxes2, boxen$1.exports;
|
79784
79987
|
}
|
79785
79988
|
var boxenExports = requireBoxen(), boxen = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(boxenExports);
|
79786
|
-
function printNewMajorVersionMessage(context) {
|
79787
|
-
const { chalk: chalk2 } = context, message = `${chalk2.yellow.bold(
|
79788
|
-
"The `sanity` package is moving to v4 on July 15 and will require Node.js 20+."
|
79789
|
-
)}
|
79790
|
-
Learn what this means for your apps at https://www.sanity.io/blog/a-major-version-bump-for-a-minor-reason`, boxedMessage = boxen(message, {
|
79791
|
-
padding: 1,
|
79792
|
-
margin: 1
|
79793
|
-
});
|
79794
|
-
console.warn(boxedMessage);
|
79795
|
-
}
|
79796
|
-
class CommandRunner {
|
79797
|
-
handlers;
|
79798
|
-
commands;
|
79799
|
-
commandGroups;
|
79800
|
-
constructor(handlers, commands = baseCommands) {
|
79801
|
-
this.handlers = handlers, this.commands = lodashExports.sortBy(commands, "name"), this.commandGroups = {};
|
79802
|
-
for (const cmd of this.commands) {
|
79803
|
-
const group = "group" in cmd && cmd.group || "default";
|
79804
|
-
this.commandGroups[group] = this.commandGroups[group] || [], this.commandGroups[group].push(cmd);
|
79805
|
-
}
|
79806
|
-
if (!handlers.outputter || !handlers.prompter)
|
79807
|
-
throw new Error("`prompter` and `outputter` handlers must be defined");
|
79808
|
-
}
|
79809
|
-
// eslint-disable-next-line complexity
|
79810
|
-
async runCommand(commandOrGroup, args, options2) {
|
79811
|
-
if (!commandOrGroup)
|
79812
|
-
return this.handlers.outputter.print(generateCommandsDocumentation(this.commandGroups)), Promise.resolve();
|
79813
|
-
const cmdArgs = lodashExports.cloneDeep(args), subCommandName = args.argsWithoutOptions[0], commandInfo = this.resolveCommand(commandOrGroup, subCommandName);
|
79814
|
-
if (!commandInfo)
|
79815
|
-
throw new Error(getNoSuchCommandText(commandOrGroup, subCommandName, this.commandGroups));
|
79816
|
-
const command2 = commandInfo.command;
|
79817
|
-
!isCommandGroup(command2) && command2.group && command2.group !== "default" && (cmdArgs.argsWithoutOptions = args.argsWithoutOptions.slice(1));
|
79818
|
-
const output = this.handlers.outputter, prompt2 = this.handlers.prompter, { cliConfig, ...commandOptions } = options2, apiClient = getClientWrapper(
|
79819
|
-
cliConfig?.config?.api || null,
|
79820
|
-
cliConfig?.path || (cliConfig?.version === 2 ? "sanity.json" : "sanity.cli.js")
|
79821
|
-
), context = {
|
79822
|
-
output,
|
79823
|
-
prompt: prompt2,
|
79824
|
-
apiClient,
|
79825
|
-
chalk: chalk__default.default,
|
79826
|
-
cliPackageManager,
|
79827
|
-
...commandOptions,
|
79828
|
-
commandRunner: this,
|
79829
|
-
...getVersionedContextParams(cliConfig)
|
79830
|
-
};
|
79831
|
-
if (isCommandGroup(command2))
|
79832
|
-
return context.output.print(generateCommandsDocumentation(this.commandGroups, command2.name));
|
79833
|
-
if (typeof command2.action != "function") {
|
79834
|
-
const cmdName = command2.name || commandOrGroup || "<unknown>";
|
79835
|
-
loadEnv.debug(`Command "${cmdName}" doesnt have a valid "action"-property, showing help`);
|
79836
|
-
const groupName = command2.group && command2.group !== "default" ? command2.group : null;
|
79837
|
-
return context.output.print(generateCommandDocumentation(command2, groupName, subCommandName));
|
79838
|
-
}
|
79839
|
-
return loadEnv.debug(`Running command "${command2.name}"`), cmdArgs.extOptions["hide-major-message"] || printNewMajorVersionMessage(context), command2.action(cmdArgs, context);
|
79840
|
-
}
|
79841
|
-
resolveCommand(commandOrGroup, subCommandName) {
|
79842
|
-
if (this.commandGroups[commandOrGroup] && subCommandName) {
|
79843
|
-
loadEnv.debug(`Found group for name "${commandOrGroup}", resolving subcommand`);
|
79844
|
-
const subCommand = this.resolveSubcommand(
|
79845
|
-
this.commandGroups[commandOrGroup],
|
79846
|
-
subCommandName,
|
79847
|
-
commandOrGroup
|
79848
|
-
);
|
79849
|
-
return loadEnv.debug(
|
79850
|
-
subCommand ? `Subcommand resolved to "${subCommand.commandName}"` : `Subcommand with name "${subCommandName}" not found`
|
79851
|
-
), subCommand;
|
79852
|
-
}
|
79853
|
-
loadEnv.debug(`No group found with name "${commandOrGroup}", looking for command`);
|
79854
|
-
const command2 = this.commandGroups.default.find((cmd) => cmd.name === commandOrGroup);
|
79855
|
-
return command2 ? (loadEnv.debug(`Found command in default group with name "${commandOrGroup}"`), {
|
79856
|
-
command: command2,
|
79857
|
-
commandName: command2.name,
|
79858
|
-
parentName: "default",
|
79859
|
-
isGroup: !1,
|
79860
|
-
isCommand: !0
|
79861
|
-
}) : (loadEnv.debug(`No default command with name "${commandOrGroup}" found, giving up`), null);
|
79862
|
-
}
|
79863
|
-
resolveSubcommand(group, subCommandName, parentGroupName) {
|
79864
|
-
if (!subCommandName)
|
79865
|
-
return null;
|
79866
|
-
const subCommand = group.find((cmd) => cmd.name === subCommandName);
|
79867
|
-
if (!subCommand)
|
79868
|
-
throw new Error(getNoSuchCommandText(subCommandName, parentGroupName, this.commandGroups));
|
79869
|
-
return {
|
79870
|
-
command: subCommand,
|
79871
|
-
commandName: subCommandName,
|
79872
|
-
parentName: parentGroupName,
|
79873
|
-
isGroup: !1,
|
79874
|
-
isCommand: !0
|
79875
|
-
};
|
79876
|
-
}
|
79877
|
-
resolveHelpForGroup() {
|
79878
|
-
const command2 = this.commandGroups.default.find((cmd) => cmd.name === "help");
|
79879
|
-
if (!command2)
|
79880
|
-
throw new Error("Failed to find default `help` command");
|
79881
|
-
return {
|
79882
|
-
command: command2,
|
79883
|
-
commandName: "help",
|
79884
|
-
isGroup: !1,
|
79885
|
-
isCommand: !0
|
79886
|
-
};
|
79887
|
-
}
|
79888
|
-
}
|
79889
|
-
function getCliRunner(commands) {
|
79890
|
-
return new CommandRunner(
|
79891
|
-
{
|
79892
|
-
outputter: cliOutputter,
|
79893
|
-
prompter: prompt
|
79894
|
-
},
|
79895
|
-
commands
|
79896
|
-
);
|
79897
|
-
}
|
79898
|
-
function getVersionedContextParams(cliConfig) {
|
79899
|
-
return cliConfig?.version === 2 ? {
|
79900
|
-
sanityMajorVersion: 2,
|
79901
|
-
cliConfig: cliConfig?.config || void 0,
|
79902
|
-
cliConfigPath: cliConfig?.path || void 0
|
79903
|
-
} : {
|
79904
|
-
sanityMajorVersion: 3,
|
79905
|
-
cliConfig: cliConfig?.config || void 0,
|
79906
|
-
cliConfigPath: cliConfig?.path || void 0
|
79907
|
-
};
|
79908
|
-
}
|
79909
|
-
function detectRuntime() {
|
79910
|
-
return "Deno" in globalThis ? "deno" : "Bun" in globalThis ? "bun" : "node";
|
79911
|
-
}
|
79912
|
-
async function mergeCommands(baseCommands2, corePath, options2) {
|
79913
|
-
if (!corePath)
|
79914
|
-
return baseCommands2;
|
79915
|
-
const { cliVersion } = options2, coreImport = getCliConfig.dynamicRequire(corePath);
|
79916
|
-
semver__default.default.coerce(cliVersion);
|
79917
|
-
const core2 = "cliProjectCommands" in coreImport ? coreImport.cliProjectCommands : coreImport;
|
79918
|
-
return baseCommands2.concat(core2.commands).map(addDefaultGroup).reverse().reduce(
|
79919
|
-
(cmds, cmd) => {
|
79920
|
-
const group = isCommandGroup(cmd) ? void 0 : cmd.group;
|
79921
|
-
return lodashExports.find(cmds, { name: cmd.name, group }) || cmds.push(cmd), cmds;
|
79922
|
-
},
|
79923
|
-
[]
|
79924
|
-
);
|
79925
|
-
}
|
79926
|
-
function addDefaultGroup(cmd) {
|
79927
|
-
return !isCommandGroup(cmd) && !cmd.group && (cmd.group = "default"), cmd;
|
79928
|
-
}
|
79929
|
-
var escapeStringRegexp, hasRequiredEscapeStringRegexp;
|
79930
|
-
function requireEscapeStringRegexp() {
|
79931
|
-
return hasRequiredEscapeStringRegexp || (hasRequiredEscapeStringRegexp = 1, escapeStringRegexp = (string) => {
|
79932
|
-
if (typeof string != "string")
|
79933
|
-
throw new TypeError("Expected a string");
|
79934
|
-
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
79935
|
-
}), escapeStringRegexp;
|
79936
|
-
}
|
79937
|
-
var cleanStack$1, hasRequiredCleanStack;
|
79938
|
-
function requireCleanStack() {
|
79939
|
-
if (hasRequiredCleanStack) return cleanStack$1;
|
79940
|
-
hasRequiredCleanStack = 1;
|
79941
|
-
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();
|
79942
|
-
return cleanStack$1 = (stack2, { pretty = !1, basePath } = {}) => {
|
79943
|
-
const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp2(basePath)}`, "g");
|
79944
|
-
return stack2.replace(/\\/g, "/").split(`
|
79945
|
-
`).filter((line3) => {
|
79946
|
-
const pathMatches = line3.match(extractPathRegex);
|
79947
|
-
if (pathMatches === null || !pathMatches[1])
|
79948
|
-
return !0;
|
79949
|
-
const match2 = pathMatches[1];
|
79950
|
-
return match2.includes(".app/Contents/Resources/electron.asar") || match2.includes(".app/Contents/Resources/default_app.asar") ? !1 : !pathRegex.test(match2);
|
79951
|
-
}).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(`
|
79952
|
-
`);
|
79953
|
-
}, cleanStack$1;
|
79954
|
-
}
|
79955
|
-
var cleanStackExports = requireCleanStack(), cleanStack = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(cleanStackExports);
|
79956
|
-
const options = { pretty: process.platform !== "win32" };
|
79957
|
-
function neatStack(error2) {
|
79958
|
-
if (typeof error2 == "string")
|
79959
|
-
return chalk.red(cleanStack(error2, options));
|
79960
|
-
if (error2 === null || typeof error2 != "object" || typeof error2.stack != "string")
|
79961
|
-
return chalk.red(util$4.inspect(error2));
|
79962
|
-
const title = error2.toString(), stack2 = cleanStack(error2.stack, options);
|
79963
|
-
return stack2.startsWith(title) ? chalk.red(`${title}${chalk.dim(cleanStack(error2.stack, options).slice(title.length))}`) : chalk.red(stack2);
|
79964
|
-
}
|
79965
|
-
var minimistExports = requireMinimist(), minimist = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(minimistExports);
|
79966
|
-
function parseArguments(argv = process.argv) {
|
79967
|
-
const {
|
79968
|
-
_,
|
79969
|
-
h,
|
79970
|
-
help: help2,
|
79971
|
-
d,
|
79972
|
-
debug: debug2,
|
79973
|
-
v,
|
79974
|
-
version: version2,
|
79975
|
-
"--": extraArguments,
|
79976
|
-
...extOptions
|
79977
|
-
} = minimist(argv.slice(2), {
|
79978
|
-
"--": !0,
|
79979
|
-
boolean: ["h", "help", "d", "debug", "v", "version"],
|
79980
|
-
string: ["_"]
|
79981
|
-
}), [groupOrCommand, ...argsWithoutOptions] = _;
|
79982
|
-
return {
|
79983
|
-
groupOrCommand,
|
79984
|
-
argv,
|
79985
|
-
extOptions,
|
79986
|
-
argsWithoutOptions,
|
79987
|
-
extraArguments: extraArguments || [],
|
79988
|
-
// prettier-ignore
|
79989
|
-
coreOptions: {
|
79990
|
-
h,
|
79991
|
-
help: help2,
|
79992
|
-
d,
|
79993
|
-
debug: debug2,
|
79994
|
-
v,
|
79995
|
-
version: version2
|
79996
|
-
}
|
79997
|
-
};
|
79998
|
-
}
|
79999
79989
|
const TELEMETRY_DISCLOSED_CONFIG_KEY = "telemetryDisclosed";
|
80000
79990
|
function telemetryDisclosure() {
|
80001
79991
|
const userConfig = getUserConfig();
|