sandbox 2.0.4 → 2.1.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.
|
@@ -622,8 +622,8 @@ var require_effects = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/c
|
|
|
622
622
|
* with a command line, and again, to mock `stdout` and `stderr` it if we want to test it.
|
|
623
623
|
*/
|
|
624
624
|
var Exit = class {
|
|
625
|
-
constructor(config) {
|
|
626
|
-
this.config = config;
|
|
625
|
+
constructor(config$1) {
|
|
626
|
+
this.config = config$1;
|
|
627
627
|
}
|
|
628
628
|
run() {
|
|
629
629
|
this.output()(this.config.message);
|
|
@@ -867,65 +867,65 @@ var require_flag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
|
|
|
867
867
|
displayName: "true/false",
|
|
868
868
|
defaultValue: () => false
|
|
869
869
|
};
|
|
870
|
-
function fullFlag(config) {
|
|
870
|
+
function fullFlag(config$1) {
|
|
871
871
|
var _a;
|
|
872
|
-
const decoder = (0, type_1$2.extendType)(exports.boolean, config.type);
|
|
872
|
+
const decoder = (0, type_1$2.extendType)(exports.boolean, config$1.type);
|
|
873
873
|
return {
|
|
874
|
-
description: (_a = config.description) !== null && _a !== void 0 ? _a : config.type.description,
|
|
874
|
+
description: (_a = config$1.description) !== null && _a !== void 0 ? _a : config$1.type.description,
|
|
875
875
|
helpTopics() {
|
|
876
876
|
var _a$1, _b;
|
|
877
|
-
let usage = `--${config.long}`;
|
|
878
|
-
if (config.short) usage += `, -${config.short}`;
|
|
877
|
+
let usage = `--${config$1.long}`;
|
|
878
|
+
if (config$1.short) usage += `, -${config$1.short}`;
|
|
879
879
|
const defaults = [];
|
|
880
|
-
if (config.env) {
|
|
881
|
-
const env$2 = process.env[config.env] === void 0 ? "" : `=${chalk_1$6.default.italic(process.env[config.env])}`;
|
|
882
|
-
defaults.push(`env: ${config.env}${env$2}`);
|
|
880
|
+
if (config$1.env) {
|
|
881
|
+
const env$2 = process.env[config$1.env] === void 0 ? "" : `=${chalk_1$6.default.italic(process.env[config$1.env])}`;
|
|
882
|
+
defaults.push(`env: ${config$1.env}${env$2}`);
|
|
883
883
|
}
|
|
884
|
-
if (config.defaultValue) try {
|
|
885
|
-
const defaultValue = config.defaultValue();
|
|
886
|
-
if (config.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$6.default.italic(defaultValue)}`);
|
|
884
|
+
if (config$1.defaultValue) try {
|
|
885
|
+
const defaultValue = config$1.defaultValue();
|
|
886
|
+
if (config$1.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$6.default.italic(defaultValue)}`);
|
|
887
887
|
else defaults.push("optional");
|
|
888
888
|
} catch (e) {}
|
|
889
|
-
else if (config.type.defaultValue) try {
|
|
890
|
-
const defaultValue = config.type.defaultValue();
|
|
891
|
-
if (config.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$6.default.italic(defaultValue)}`);
|
|
889
|
+
else if (config$1.type.defaultValue) try {
|
|
890
|
+
const defaultValue = config$1.type.defaultValue();
|
|
891
|
+
if (config$1.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$6.default.italic(defaultValue)}`);
|
|
892
892
|
else defaults.push("optional");
|
|
893
893
|
} catch (e) {}
|
|
894
|
-
else if (config.onMissing || config.type.onMissing) defaults.push("optional");
|
|
894
|
+
else if (config$1.onMissing || config$1.type.onMissing) defaults.push("optional");
|
|
895
895
|
return [{
|
|
896
896
|
category: "flags",
|
|
897
897
|
usage,
|
|
898
898
|
defaults,
|
|
899
|
-
description: (_b = (_a$1 = config.description) !== null && _a$1 !== void 0 ? _a$1 : config.type.description) !== null && _b !== void 0 ? _b : "self explanatory"
|
|
899
|
+
description: (_b = (_a$1 = config$1.description) !== null && _a$1 !== void 0 ? _a$1 : config$1.type.description) !== null && _b !== void 0 ? _b : "self explanatory"
|
|
900
900
|
}];
|
|
901
901
|
},
|
|
902
902
|
register(opts) {
|
|
903
|
-
opts.forceFlagLongNames.add(config.long);
|
|
904
|
-
if (config.short) opts.forceFlagShortNames.add(config.short);
|
|
903
|
+
opts.forceFlagLongNames.add(config$1.long);
|
|
904
|
+
if (config$1.short) opts.forceFlagShortNames.add(config$1.short);
|
|
905
905
|
},
|
|
906
906
|
async parse({ nodes, visitedNodes }) {
|
|
907
907
|
var _a$1, _b;
|
|
908
908
|
const options = (0, findOption_1$3.findOption)(nodes, {
|
|
909
|
-
longNames: [config.long],
|
|
910
|
-
shortNames: config.short ? [config.short] : []
|
|
909
|
+
longNames: [config$1.long],
|
|
910
|
+
shortNames: config$1.short ? [config$1.short] : []
|
|
911
911
|
}).filter((x) => !visitedNodes.has(x));
|
|
912
912
|
options.forEach((opt) => visitedNodes.add(opt));
|
|
913
913
|
if (options.length > 1) return Result$10.err({ errors: [{
|
|
914
914
|
nodes: options,
|
|
915
915
|
message: `Expected 1 occurence, got ${options.length}`
|
|
916
916
|
}] });
|
|
917
|
-
const valueFromEnv = config.env ? process.env[config.env] : void 0;
|
|
918
|
-
const onMissingFn = config.onMissing || config.type.onMissing;
|
|
917
|
+
const valueFromEnv = config$1.env ? process.env[config$1.env] : void 0;
|
|
918
|
+
const onMissingFn = config$1.onMissing || config$1.type.onMissing;
|
|
919
919
|
let rawValue;
|
|
920
920
|
let envPrefix = "";
|
|
921
921
|
if (options.length === 0 && valueFromEnv !== void 0) {
|
|
922
922
|
rawValue = valueFromEnv;
|
|
923
|
-
envPrefix = `env[${chalk_1$6.default.italic(config.env)}]: `;
|
|
924
|
-
} else if (options.length === 0 && config.defaultValue) try {
|
|
925
|
-
const defaultValue = config.defaultValue();
|
|
923
|
+
envPrefix = `env[${chalk_1$6.default.italic(config$1.env)}]: `;
|
|
924
|
+
} else if (options.length === 0 && config$1.defaultValue) try {
|
|
925
|
+
const defaultValue = config$1.defaultValue();
|
|
926
926
|
return Result$10.ok(defaultValue);
|
|
927
927
|
} catch (e) {
|
|
928
|
-
const message = `Default value not found for '--${config.long}': ${e.message}`;
|
|
928
|
+
const message = `Default value not found for '--${config$1.long}': ${e.message}`;
|
|
929
929
|
return Result$10.err({ errors: [{
|
|
930
930
|
message,
|
|
931
931
|
nodes: []
|
|
@@ -935,17 +935,17 @@ var require_flag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
|
|
|
935
935
|
const missingValue = await onMissingFn();
|
|
936
936
|
return Result$10.ok(missingValue);
|
|
937
937
|
} catch (e) {
|
|
938
|
-
const message = `Failed to get missing value for '--${config.long}': ${e.message}`;
|
|
938
|
+
const message = `Failed to get missing value for '--${config$1.long}': ${e.message}`;
|
|
939
939
|
return Result$10.err({ errors: [{
|
|
940
940
|
message,
|
|
941
941
|
nodes: []
|
|
942
942
|
}] });
|
|
943
943
|
}
|
|
944
|
-
else if (options.length === 0 && config.type.defaultValue) try {
|
|
945
|
-
const defaultValue = config.type.defaultValue();
|
|
944
|
+
else if (options.length === 0 && config$1.type.defaultValue) try {
|
|
945
|
+
const defaultValue = config$1.type.defaultValue();
|
|
946
946
|
return Result$10.ok(defaultValue);
|
|
947
947
|
} catch (e) {
|
|
948
|
-
const message = `Default value not found for '--${config.long}': ${e.message}`;
|
|
948
|
+
const message = `Default value not found for '--${config$1.long}': ${e.message}`;
|
|
949
949
|
return Result$10.err({ errors: [{
|
|
950
950
|
message,
|
|
951
951
|
nodes: []
|
|
@@ -954,7 +954,7 @@ var require_flag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
|
|
|
954
954
|
else if (options.length === 1) rawValue = (_b = (_a$1 = options[0].value) === null || _a$1 === void 0 ? void 0 : _a$1.node.raw) !== null && _b !== void 0 ? _b : "true";
|
|
955
955
|
else return Result$10.err({ errors: [{
|
|
956
956
|
nodes: [],
|
|
957
|
-
message: `No value provided for --${config.long}`
|
|
957
|
+
message: `No value provided for --${config$1.long}`
|
|
958
958
|
}] });
|
|
959
959
|
const decoded = await Result$10.safeAsync(decoder.from(rawValue));
|
|
960
960
|
if (Result$10.isErr(decoded)) return Result$10.err({ errors: [{
|
|
@@ -965,10 +965,10 @@ var require_flag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
|
|
|
965
965
|
}
|
|
966
966
|
};
|
|
967
967
|
}
|
|
968
|
-
function flag(config) {
|
|
968
|
+
function flag(config$1) {
|
|
969
969
|
return fullFlag({
|
|
970
970
|
type: types_1$4.boolean,
|
|
971
|
-
...config
|
|
971
|
+
...config$1
|
|
972
972
|
});
|
|
973
973
|
}
|
|
974
974
|
}) });
|
|
@@ -1146,24 +1146,24 @@ var require_positional = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
|
|
|
1146
1146
|
const chalk_1$5 = __importDefault$8((init_source(), __toCommonJS$3(source_exports)));
|
|
1147
1147
|
const Result$8 = __importStar$8(require_Result());
|
|
1148
1148
|
const types_1$2 = require_types();
|
|
1149
|
-
function fullPositional(config) {
|
|
1149
|
+
function fullPositional(config$1) {
|
|
1150
1150
|
var _a, _b, _c;
|
|
1151
|
-
const displayName = (_b = (_a = config.displayName) !== null && _a !== void 0 ? _a : config.type.displayName) !== null && _b !== void 0 ? _b : "arg";
|
|
1151
|
+
const displayName = (_b = (_a = config$1.displayName) !== null && _a !== void 0 ? _a : config$1.type.displayName) !== null && _b !== void 0 ? _b : "arg";
|
|
1152
1152
|
return {
|
|
1153
|
-
description: (_c = config.description) !== null && _c !== void 0 ? _c : config.type.description,
|
|
1153
|
+
description: (_c = config$1.description) !== null && _c !== void 0 ? _c : config$1.type.description,
|
|
1154
1154
|
helpTopics() {
|
|
1155
1155
|
var _a$1, _b$1, _c$1, _d;
|
|
1156
1156
|
const defaults = [];
|
|
1157
|
-
const defaultValueFn = (_a$1 = config.defaultValue) !== null && _a$1 !== void 0 ? _a$1 : config.type.defaultValue;
|
|
1157
|
+
const defaultValueFn = (_a$1 = config$1.defaultValue) !== null && _a$1 !== void 0 ? _a$1 : config$1.type.defaultValue;
|
|
1158
1158
|
if (defaultValueFn) try {
|
|
1159
1159
|
const defaultValue = defaultValueFn();
|
|
1160
|
-
if ((_b$1 = config.defaultValueIsSerializable) !== null && _b$1 !== void 0 ? _b$1 : config.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$5.default.italic(defaultValue)}`);
|
|
1160
|
+
if ((_b$1 = config$1.defaultValueIsSerializable) !== null && _b$1 !== void 0 ? _b$1 : config$1.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$5.default.italic(defaultValue)}`);
|
|
1161
1161
|
else defaults.push("optional");
|
|
1162
1162
|
} catch (e) {}
|
|
1163
1163
|
return [{
|
|
1164
1164
|
category: "arguments",
|
|
1165
1165
|
usage: defaults.length > 0 ? `[${displayName}]` : `<${displayName}>`,
|
|
1166
|
-
description: (_d = (_c$1 = config.description) !== null && _c$1 !== void 0 ? _c$1 : config.type.description) !== null && _d !== void 0 ? _d : "self explanatory",
|
|
1166
|
+
description: (_d = (_c$1 = config$1.description) !== null && _c$1 !== void 0 ? _c$1 : config$1.type.description) !== null && _d !== void 0 ? _d : "self explanatory",
|
|
1167
1167
|
defaults
|
|
1168
1168
|
}];
|
|
1169
1169
|
},
|
|
@@ -1171,7 +1171,7 @@ var require_positional = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
|
|
|
1171
1171
|
async parse({ nodes, visitedNodes }) {
|
|
1172
1172
|
var _a$1;
|
|
1173
1173
|
const positionals = nodes.filter((node) => node.type === "positionalArgument" && !visitedNodes.has(node));
|
|
1174
|
-
const defaultValueFn = (_a$1 = config.defaultValue) !== null && _a$1 !== void 0 ? _a$1 : config.type.defaultValue;
|
|
1174
|
+
const defaultValueFn = (_a$1 = config$1.defaultValue) !== null && _a$1 !== void 0 ? _a$1 : config$1.type.defaultValue;
|
|
1175
1175
|
const positional$1 = positionals[0];
|
|
1176
1176
|
if (!positional$1) {
|
|
1177
1177
|
if (defaultValueFn) return Result$8.ok(defaultValueFn());
|
|
@@ -1181,7 +1181,7 @@ var require_positional = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
|
|
|
1181
1181
|
}] });
|
|
1182
1182
|
}
|
|
1183
1183
|
visitedNodes.add(positional$1);
|
|
1184
|
-
const decoded = await Result$8.safeAsync(config.type.from(positional$1.raw));
|
|
1184
|
+
const decoded = await Result$8.safeAsync(config$1.type.from(positional$1.raw));
|
|
1185
1185
|
if (Result$8.isErr(decoded)) return Result$8.err({ errors: [{
|
|
1186
1186
|
nodes: [positional$1],
|
|
1187
1187
|
message: decoded.error.message
|
|
@@ -1190,10 +1190,10 @@ var require_positional = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
|
|
|
1190
1190
|
}
|
|
1191
1191
|
};
|
|
1192
1192
|
}
|
|
1193
|
-
function positional(config) {
|
|
1193
|
+
function positional(config$1) {
|
|
1194
1194
|
return fullPositional({
|
|
1195
1195
|
type: types_1$2.string,
|
|
1196
|
-
...config
|
|
1196
|
+
...config$1
|
|
1197
1197
|
});
|
|
1198
1198
|
}
|
|
1199
1199
|
}) });
|
|
@@ -1255,13 +1255,13 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1255
1255
|
/**
|
|
1256
1256
|
* Combine multiple `command`s into one
|
|
1257
1257
|
*/
|
|
1258
|
-
function subcommands$2(config) {
|
|
1259
|
-
const circuitbreaker = (0, circuitbreaker_1$1.createCircuitBreaker)(!!config.version);
|
|
1258
|
+
function subcommands$2(config$1) {
|
|
1259
|
+
const circuitbreaker = (0, circuitbreaker_1$1.createCircuitBreaker)(!!config$1.version);
|
|
1260
1260
|
const subcommand = (0, positional_1$1.positional)({
|
|
1261
1261
|
displayName: "subcommand",
|
|
1262
|
-
description: `one of ${Object.keys(config.cmds).join(", ")}`,
|
|
1262
|
+
description: `one of ${Object.keys(config$1.cmds).join(", ")}`,
|
|
1263
1263
|
type: { async from(str) {
|
|
1264
|
-
const commands = Object.entries(config.cmds).map(([name, cmd$1]) => {
|
|
1264
|
+
const commands = Object.entries(config$1.cmds).map(([name, cmd$1]) => {
|
|
1265
1265
|
var _a;
|
|
1266
1266
|
return {
|
|
1267
1267
|
cmdName: name,
|
|
@@ -1281,7 +1281,7 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1281
1281
|
});
|
|
1282
1282
|
function normalizeContext(context) {
|
|
1283
1283
|
var _a;
|
|
1284
|
-
if (((_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.length) === 0) context.hotPath.push(config.name);
|
|
1284
|
+
if (((_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.length) === 0) context.hotPath.push(config$1.name);
|
|
1285
1285
|
if (!context.nodes.some((n) => !context.visitedNodes.has(n))) context.nodes.push({
|
|
1286
1286
|
type: "longOption",
|
|
1287
1287
|
index: 0,
|
|
@@ -1290,14 +1290,14 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1290
1290
|
});
|
|
1291
1291
|
}
|
|
1292
1292
|
return {
|
|
1293
|
-
version: config.version,
|
|
1294
|
-
description: config.description,
|
|
1295
|
-
name: config.name,
|
|
1293
|
+
version: config$1.version,
|
|
1294
|
+
description: config$1.description,
|
|
1295
|
+
name: config$1.name,
|
|
1296
1296
|
handler: (value) => {
|
|
1297
|
-
return config.cmds[value.command].handler(value.args);
|
|
1297
|
+
return config$1.cmds[value.command].handler(value.args);
|
|
1298
1298
|
},
|
|
1299
1299
|
register(opts) {
|
|
1300
|
-
for (const cmd of Object.values(config.cmds)) cmd.register(opts);
|
|
1300
|
+
for (const cmd of Object.values(config$1.cmds)) cmd.register(opts);
|
|
1301
1301
|
circuitbreaker.register(opts);
|
|
1302
1302
|
},
|
|
1303
1303
|
printHelp(context) {
|
|
@@ -1305,12 +1305,12 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1305
1305
|
const lines = [];
|
|
1306
1306
|
const argsSoFar = (_b = (_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : "cli";
|
|
1307
1307
|
lines.push(chalk_1$4.default.bold(argsSoFar + chalk_1$4.default.italic(" <subcommand>")));
|
|
1308
|
-
if (config.description) lines.push(chalk_1$4.default.dim("> ") + config.description);
|
|
1308
|
+
if (config$1.description) lines.push(chalk_1$4.default.dim("> ") + config$1.description);
|
|
1309
1309
|
lines.push("");
|
|
1310
1310
|
lines.push(`where ${chalk_1$4.default.italic("<subcommand>")} can be one of:`);
|
|
1311
1311
|
lines.push("");
|
|
1312
|
-
for (const key of Object.keys(config.cmds)) {
|
|
1313
|
-
const cmd = config.cmds[key];
|
|
1312
|
+
for (const key of Object.keys(config$1.cmds)) {
|
|
1313
|
+
const cmd = config$1.cmds[key];
|
|
1314
1314
|
let description = (_c = cmd.description) !== null && _c !== void 0 ? _c : "";
|
|
1315
1315
|
description = description && ` - ${description} `;
|
|
1316
1316
|
if ((_d = cmd.aliases) === null || _d === void 0 ? void 0 : _d.length) {
|
|
@@ -1335,7 +1335,7 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1335
1335
|
partialValue: {}
|
|
1336
1336
|
});
|
|
1337
1337
|
(_a = context.hotPath) === null || _a === void 0 || _a.push(parsed.value);
|
|
1338
|
-
const parsedCommand = await config.cmds[parsed.value].parse(context);
|
|
1338
|
+
const parsedCommand = await config$1.cmds[parsed.value].parse(context);
|
|
1339
1339
|
if (Result$7.isErr(parsedCommand)) return Result$7.err({
|
|
1340
1340
|
errors: parsedCommand.error.errors,
|
|
1341
1341
|
partialValue: {
|
|
@@ -1361,7 +1361,7 @@ var require_subcommands = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
1361
1361
|
});
|
|
1362
1362
|
}
|
|
1363
1363
|
(_a = context.hotPath) === null || _a === void 0 || _a.push(parsedSubcommand.value);
|
|
1364
|
-
const commandRun = await config.cmds[parsedSubcommand.value].run(context);
|
|
1364
|
+
const commandRun = await config$1.cmds[parsedSubcommand.value].run(context);
|
|
1365
1365
|
if (Result$7.isOk(commandRun)) return Result$7.ok({
|
|
1366
1366
|
command: parsedSubcommand.value,
|
|
1367
1367
|
value: commandRun.value
|
|
@@ -1545,17 +1545,17 @@ var require_command = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/c
|
|
|
1545
1545
|
* A combination of multiple flags, options and arguments
|
|
1546
1546
|
* with a common name and a handler that expects them as input.
|
|
1547
1547
|
*/
|
|
1548
|
-
function command(config) {
|
|
1549
|
-
const argEntries = (0, utils_1$2.entries)(config.args);
|
|
1550
|
-
const circuitbreaker = (0, circuitbreaker_1.createCircuitBreaker)(!!config.version);
|
|
1548
|
+
function command(config$1) {
|
|
1549
|
+
const argEntries = (0, utils_1$2.entries)(config$1.args);
|
|
1550
|
+
const circuitbreaker = (0, circuitbreaker_1.createCircuitBreaker)(!!config$1.version);
|
|
1551
1551
|
return {
|
|
1552
|
-
name: config.name,
|
|
1553
|
-
aliases: config.aliases,
|
|
1554
|
-
handler: config.handler,
|
|
1555
|
-
description: config.description,
|
|
1556
|
-
version: config.version,
|
|
1552
|
+
name: config$1.name,
|
|
1553
|
+
aliases: config$1.aliases,
|
|
1554
|
+
handler: config$1.handler,
|
|
1555
|
+
description: config$1.description,
|
|
1556
|
+
version: config$1.version,
|
|
1557
1557
|
helpTopics() {
|
|
1558
|
-
return (0, utils_1$2.flatMap)(Object.values(config.args).concat([circuitbreaker]), (x) => {
|
|
1558
|
+
return (0, utils_1$2.flatMap)(Object.values(config$1.args).concat([circuitbreaker]), (x) => {
|
|
1559
1559
|
var _a, _b;
|
|
1560
1560
|
return (_b = (_a = x.helpTopics) === null || _a === void 0 ? void 0 : _a.call(x)) !== null && _b !== void 0 ? _b : [];
|
|
1561
1561
|
});
|
|
@@ -1564,11 +1564,11 @@ var require_command = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/c
|
|
|
1564
1564
|
var _a, _b;
|
|
1565
1565
|
const lines = [];
|
|
1566
1566
|
let name = (_b = (_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : "";
|
|
1567
|
-
if (!name) name = config.name;
|
|
1567
|
+
if (!name) name = config$1.name;
|
|
1568
1568
|
name = chalk_1$3.default.bold(name);
|
|
1569
|
-
if (config.version) name += ` ${chalk_1$3.default.dim(config.version)}`;
|
|
1569
|
+
if (config$1.version) name += ` ${chalk_1$3.default.dim(config$1.version)}`;
|
|
1570
1570
|
lines.push(name);
|
|
1571
|
-
if (config.description) lines.push(chalk_1$3.default.dim("> ") + config.description);
|
|
1571
|
+
if (config$1.description) lines.push(chalk_1$3.default.dim("> ") + config$1.description);
|
|
1572
1572
|
const usageBreakdown = (0, utils_1$2.groupBy)(this.helpTopics(), (x) => x.category);
|
|
1573
1573
|
for (const [category, helpTopics] of (0, utils_1$2.entries)(usageBreakdown)) {
|
|
1574
1574
|
lines.push("");
|
|
@@ -1593,7 +1593,7 @@ var require_command = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/c
|
|
|
1593
1593
|
},
|
|
1594
1594
|
async parse(context) {
|
|
1595
1595
|
var _a;
|
|
1596
|
-
if (((_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.length) === 0) context.hotPath.push(config.name);
|
|
1596
|
+
if (((_a = context.hotPath) === null || _a === void 0 ? void 0 : _a.length) === 0) context.hotPath.push(config$1.name);
|
|
1597
1597
|
const resultObject = {};
|
|
1598
1598
|
const errors = [];
|
|
1599
1599
|
for (const [argName, arg] of argEntries) {
|
|
@@ -1684,47 +1684,47 @@ var require_option = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cm
|
|
|
1684
1684
|
const Result$5 = __importStar$5(require_Result());
|
|
1685
1685
|
const findOption_1$2 = require_findOption();
|
|
1686
1686
|
const types_1$1 = require_types();
|
|
1687
|
-
function fullOption(config) {
|
|
1687
|
+
function fullOption(config$1) {
|
|
1688
1688
|
var _a;
|
|
1689
1689
|
return {
|
|
1690
|
-
description: (_a = config.description) !== null && _a !== void 0 ? _a : config.type.description,
|
|
1690
|
+
description: (_a = config$1.description) !== null && _a !== void 0 ? _a : config$1.type.description,
|
|
1691
1691
|
helpTopics() {
|
|
1692
1692
|
var _a$1, _b, _c;
|
|
1693
|
-
const displayName = (_a$1 = config.type.displayName) !== null && _a$1 !== void 0 ? _a$1 : "value";
|
|
1694
|
-
let usage = `--${config.long}`;
|
|
1695
|
-
if (config.short) usage += `, -${config.short}`;
|
|
1693
|
+
const displayName = (_a$1 = config$1.type.displayName) !== null && _a$1 !== void 0 ? _a$1 : "value";
|
|
1694
|
+
let usage = `--${config$1.long}`;
|
|
1695
|
+
if (config$1.short) usage += `, -${config$1.short}`;
|
|
1696
1696
|
usage += ` <${displayName}>`;
|
|
1697
1697
|
const defaults = [];
|
|
1698
|
-
if (config.env) {
|
|
1699
|
-
const env$2 = process.env[config.env] === void 0 ? "" : `=${chalk_1$2.default.italic(process.env[config.env])}`;
|
|
1700
|
-
defaults.push(`env: ${config.env}${env$2}`);
|
|
1698
|
+
if (config$1.env) {
|
|
1699
|
+
const env$2 = process.env[config$1.env] === void 0 ? "" : `=${chalk_1$2.default.italic(process.env[config$1.env])}`;
|
|
1700
|
+
defaults.push(`env: ${config$1.env}${env$2}`);
|
|
1701
1701
|
}
|
|
1702
|
-
if (config.defaultValue) try {
|
|
1703
|
-
const defaultValue = config.defaultValue();
|
|
1704
|
-
if (config.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$2.default.italic(defaultValue)}`);
|
|
1702
|
+
if (config$1.defaultValue) try {
|
|
1703
|
+
const defaultValue = config$1.defaultValue();
|
|
1704
|
+
if (config$1.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$2.default.italic(defaultValue)}`);
|
|
1705
1705
|
else defaults.push("optional");
|
|
1706
1706
|
} catch (e) {}
|
|
1707
|
-
else if (config.type.defaultValue) try {
|
|
1708
|
-
const defaultValue = config.type.defaultValue();
|
|
1709
|
-
if (config.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$2.default.italic(defaultValue)}`);
|
|
1707
|
+
else if (config$1.type.defaultValue) try {
|
|
1708
|
+
const defaultValue = config$1.type.defaultValue();
|
|
1709
|
+
if (config$1.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1$2.default.italic(defaultValue)}`);
|
|
1710
1710
|
else defaults.push("optional");
|
|
1711
1711
|
} catch (e) {}
|
|
1712
|
-
else if (config.onMissing || config.type.onMissing) defaults.push("optional");
|
|
1712
|
+
else if (config$1.onMissing || config$1.type.onMissing) defaults.push("optional");
|
|
1713
1713
|
return [{
|
|
1714
1714
|
category: "options",
|
|
1715
1715
|
usage,
|
|
1716
1716
|
defaults,
|
|
1717
|
-
description: (_c = (_b = config.description) !== null && _b !== void 0 ? _b : config.type.description) !== null && _c !== void 0 ? _c : "self explanatory"
|
|
1717
|
+
description: (_c = (_b = config$1.description) !== null && _b !== void 0 ? _b : config$1.type.description) !== null && _c !== void 0 ? _c : "self explanatory"
|
|
1718
1718
|
}];
|
|
1719
1719
|
},
|
|
1720
1720
|
register(opts) {
|
|
1721
|
-
opts.forceOptionLongNames.add(config.long);
|
|
1722
|
-
if (config.short) opts.forceOptionShortNames.add(config.short);
|
|
1721
|
+
opts.forceOptionLongNames.add(config$1.long);
|
|
1722
|
+
if (config$1.short) opts.forceOptionShortNames.add(config$1.short);
|
|
1723
1723
|
},
|
|
1724
1724
|
async parse({ nodes, visitedNodes }) {
|
|
1725
1725
|
const options = (0, findOption_1$2.findOption)(nodes, {
|
|
1726
|
-
longNames: [config.long],
|
|
1727
|
-
shortNames: config.short ? [config.short] : []
|
|
1726
|
+
longNames: [config$1.long],
|
|
1727
|
+
shortNames: config$1.short ? [config$1.short] : []
|
|
1728
1728
|
}).filter((x) => !visitedNodes.has(x));
|
|
1729
1729
|
options.forEach((opt) => visitedNodes.add(opt));
|
|
1730
1730
|
if (options.length > 1) {
|
|
@@ -1734,21 +1734,21 @@ var require_option = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cm
|
|
|
1734
1734
|
};
|
|
1735
1735
|
return Result$5.err({ errors: [error] });
|
|
1736
1736
|
}
|
|
1737
|
-
const valueFromEnv = config.env ? process.env[config.env] : void 0;
|
|
1738
|
-
const defaultValueFn = config.defaultValue || config.type.defaultValue;
|
|
1739
|
-
const onMissingFn = config.onMissing || config.type.onMissing;
|
|
1737
|
+
const valueFromEnv = config$1.env ? process.env[config$1.env] : void 0;
|
|
1738
|
+
const defaultValueFn = config$1.defaultValue || config$1.type.defaultValue;
|
|
1739
|
+
const onMissingFn = config$1.onMissing || config$1.type.onMissing;
|
|
1740
1740
|
const option$1 = options[0];
|
|
1741
1741
|
let rawValue;
|
|
1742
1742
|
let envPrefix = "";
|
|
1743
1743
|
if (option$1 === null || option$1 === void 0 ? void 0 : option$1.value) rawValue = option$1.value.node.raw;
|
|
1744
1744
|
else if (valueFromEnv !== void 0) {
|
|
1745
1745
|
rawValue = valueFromEnv;
|
|
1746
|
-
envPrefix = `env[${chalk_1$2.default.italic(config.env)}]: `;
|
|
1746
|
+
envPrefix = `env[${chalk_1$2.default.italic(config$1.env)}]: `;
|
|
1747
1747
|
} else if (defaultValueFn) try {
|
|
1748
1748
|
const defaultValue = defaultValueFn();
|
|
1749
1749
|
return Result$5.ok(defaultValue);
|
|
1750
1750
|
} catch (e) {
|
|
1751
|
-
const message = `Default value not found for '--${config.long}': ${e.message}`;
|
|
1751
|
+
const message = `Default value not found for '--${config$1.long}': ${e.message}`;
|
|
1752
1752
|
return Result$5.err({ errors: [{
|
|
1753
1753
|
nodes: [],
|
|
1754
1754
|
message
|
|
@@ -1758,20 +1758,20 @@ var require_option = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cm
|
|
|
1758
1758
|
const missingValue = await onMissingFn();
|
|
1759
1759
|
return Result$5.ok(missingValue);
|
|
1760
1760
|
} catch (e) {
|
|
1761
|
-
const message = `Failed to get missing value for '--${config.long}': ${e.message}`;
|
|
1761
|
+
const message = `Failed to get missing value for '--${config$1.long}': ${e.message}`;
|
|
1762
1762
|
return Result$5.err({ errors: [{
|
|
1763
1763
|
nodes: [],
|
|
1764
1764
|
message
|
|
1765
1765
|
}] });
|
|
1766
1766
|
}
|
|
1767
1767
|
else {
|
|
1768
|
-
const raw = (option$1 === null || option$1 === void 0 ? void 0 : option$1.type) === "shortOption" ? `-${option$1 === null || option$1 === void 0 ? void 0 : option$1.key}` : `--${config.long}`;
|
|
1768
|
+
const raw = (option$1 === null || option$1 === void 0 ? void 0 : option$1.type) === "shortOption" ? `-${option$1 === null || option$1 === void 0 ? void 0 : option$1.key}` : `--${config$1.long}`;
|
|
1769
1769
|
return Result$5.err({ errors: [{
|
|
1770
1770
|
nodes: options,
|
|
1771
1771
|
message: `No value provided for ${raw}`
|
|
1772
1772
|
}] });
|
|
1773
1773
|
}
|
|
1774
|
-
const decoded = await Result$5.safeAsync(config.type.from(rawValue));
|
|
1774
|
+
const decoded = await Result$5.safeAsync(config$1.type.from(rawValue));
|
|
1775
1775
|
if (Result$5.isErr(decoded)) return Result$5.err({ errors: [{
|
|
1776
1776
|
nodes: options,
|
|
1777
1777
|
message: envPrefix + decoded.error.message
|
|
@@ -1780,10 +1780,10 @@ var require_option = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cm
|
|
|
1780
1780
|
}
|
|
1781
1781
|
};
|
|
1782
1782
|
}
|
|
1783
|
-
function option(config) {
|
|
1783
|
+
function option(config$1) {
|
|
1784
1784
|
return fullOption({
|
|
1785
1785
|
type: types_1$1.string,
|
|
1786
|
-
...config
|
|
1786
|
+
...config$1
|
|
1787
1787
|
});
|
|
1788
1788
|
}
|
|
1789
1789
|
}) });
|
|
@@ -2255,15 +2255,15 @@ var require_restPositionals = /* @__PURE__ */ __commonJS$1({ "../../node_modules
|
|
|
2255
2255
|
* Works best when it is the last item on the `command` construct, to be
|
|
2256
2256
|
* used like the `...rest` operator in JS and TypeScript.
|
|
2257
2257
|
*/
|
|
2258
|
-
function fullRestPositionals(config) {
|
|
2258
|
+
function fullRestPositionals(config$1) {
|
|
2259
2259
|
return {
|
|
2260
2260
|
helpTopics() {
|
|
2261
2261
|
var _a, _b, _c, _d;
|
|
2262
2262
|
return [{
|
|
2263
|
-
usage: `[...${(_b = (_a = config.displayName) !== null && _a !== void 0 ? _a : config.type.displayName) !== null && _b !== void 0 ? _b : "arg"}]`,
|
|
2263
|
+
usage: `[...${(_b = (_a = config$1.displayName) !== null && _a !== void 0 ? _a : config$1.type.displayName) !== null && _b !== void 0 ? _b : "arg"}]`,
|
|
2264
2264
|
category: "arguments",
|
|
2265
2265
|
defaults: [],
|
|
2266
|
-
description: (_d = (_c = config.description) !== null && _c !== void 0 ? _c : config.type.description) !== null && _d !== void 0 ? _d : ""
|
|
2266
|
+
description: (_d = (_c = config$1.description) !== null && _c !== void 0 ? _c : config$1.type.description) !== null && _d !== void 0 ? _d : ""
|
|
2267
2267
|
}];
|
|
2268
2268
|
},
|
|
2269
2269
|
register(_opts) {},
|
|
@@ -2273,7 +2273,7 @@ var require_restPositionals = /* @__PURE__ */ __commonJS$1({ "../../node_modules
|
|
|
2273
2273
|
const errors = [];
|
|
2274
2274
|
for (const positional$1 of positionals) {
|
|
2275
2275
|
visitedNodes.add(positional$1);
|
|
2276
|
-
const decoded = await Result$4.safeAsync(config.type.from(positional$1.raw));
|
|
2276
|
+
const decoded = await Result$4.safeAsync(config$1.type.from(positional$1.raw));
|
|
2277
2277
|
if (Result$4.isOk(decoded)) results.push(decoded.value);
|
|
2278
2278
|
else errors.push({
|
|
2279
2279
|
nodes: [positional$1],
|
|
@@ -2285,10 +2285,10 @@ var require_restPositionals = /* @__PURE__ */ __commonJS$1({ "../../node_modules
|
|
|
2285
2285
|
}
|
|
2286
2286
|
};
|
|
2287
2287
|
}
|
|
2288
|
-
function restPositionals(config) {
|
|
2288
|
+
function restPositionals(config$1) {
|
|
2289
2289
|
return fullRestPositionals({
|
|
2290
2290
|
type: types_1.string,
|
|
2291
|
-
...config
|
|
2291
|
+
...config$1
|
|
2292
2292
|
});
|
|
2293
2293
|
}
|
|
2294
2294
|
}) });
|
|
@@ -2346,28 +2346,28 @@ var require_multiflag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
|
|
|
2346
2346
|
* Like `option`, but can accept multiple options, and expects a decoder from a list of strings.
|
|
2347
2347
|
* An error will highlight all option occurences.
|
|
2348
2348
|
*/
|
|
2349
|
-
function multiflag(config) {
|
|
2349
|
+
function multiflag(config$1) {
|
|
2350
2350
|
return {
|
|
2351
2351
|
helpTopics() {
|
|
2352
2352
|
var _a;
|
|
2353
|
-
let usage = `--${config.long}`;
|
|
2354
|
-
if (config.short) usage += `, -${config.short}`;
|
|
2353
|
+
let usage = `--${config$1.long}`;
|
|
2354
|
+
if (config$1.short) usage += `, -${config$1.short}`;
|
|
2355
2355
|
return [{
|
|
2356
2356
|
category: "flags",
|
|
2357
2357
|
usage,
|
|
2358
2358
|
defaults: [],
|
|
2359
|
-
description: (_a = config.description) !== null && _a !== void 0 ? _a : "self explanatory"
|
|
2359
|
+
description: (_a = config$1.description) !== null && _a !== void 0 ? _a : "self explanatory"
|
|
2360
2360
|
}];
|
|
2361
2361
|
},
|
|
2362
2362
|
register(opts) {
|
|
2363
|
-
opts.forceFlagLongNames.add(config.long);
|
|
2364
|
-
if (config.short) opts.forceFlagShortNames.add(config.short);
|
|
2363
|
+
opts.forceFlagLongNames.add(config$1.long);
|
|
2364
|
+
if (config$1.short) opts.forceFlagShortNames.add(config$1.short);
|
|
2365
2365
|
},
|
|
2366
2366
|
async parse({ nodes, visitedNodes }) {
|
|
2367
2367
|
var _a, _b;
|
|
2368
2368
|
const options = (0, findOption_1$1.findOption)(nodes, {
|
|
2369
|
-
longNames: [config.long],
|
|
2370
|
-
shortNames: config.short ? [config.short] : []
|
|
2369
|
+
longNames: [config$1.long],
|
|
2370
|
+
shortNames: config$1.short ? [config$1.short] : []
|
|
2371
2371
|
}).filter((x) => !visitedNodes.has(x));
|
|
2372
2372
|
for (const option$1 of options) visitedNodes.add(option$1);
|
|
2373
2373
|
const optionValues = [];
|
|
@@ -2381,7 +2381,7 @@ var require_multiflag = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
|
|
|
2381
2381
|
else optionValues.push(decoded.value);
|
|
2382
2382
|
}
|
|
2383
2383
|
if (errors.length > 0) return Result$3.err({ errors });
|
|
2384
|
-
const multiDecoded = await Result$3.safeAsync(config.type.from(optionValues));
|
|
2384
|
+
const multiDecoded = await Result$3.safeAsync(config$1.type.from(optionValues));
|
|
2385
2385
|
if (Result$3.isErr(multiDecoded)) return Result$3.err({ errors: [{
|
|
2386
2386
|
nodes: options,
|
|
2387
2387
|
message: multiDecoded.error.message
|
|
@@ -2448,49 +2448,49 @@ var require_multioption = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
2448
2448
|
* Like `option`, but can accept multiple options, and expects a decoder from a list of strings.
|
|
2449
2449
|
* An error will highlight all option occurences.
|
|
2450
2450
|
*/
|
|
2451
|
-
function multioption(config) {
|
|
2451
|
+
function multioption(config$1) {
|
|
2452
2452
|
return {
|
|
2453
2453
|
helpTopics() {
|
|
2454
2454
|
var _a, _b;
|
|
2455
|
-
const displayName = (_a = config.type.displayName) !== null && _a !== void 0 ? _a : "value";
|
|
2456
|
-
let usage = `--${config.long} <${displayName}>`;
|
|
2457
|
-
if (config.short) usage += `, -${config.short}=<${displayName}>`;
|
|
2455
|
+
const displayName = (_a = config$1.type.displayName) !== null && _a !== void 0 ? _a : "value";
|
|
2456
|
+
let usage = `--${config$1.long} <${displayName}>`;
|
|
2457
|
+
if (config$1.short) usage += `, -${config$1.short}=<${displayName}>`;
|
|
2458
2458
|
const defaults = [];
|
|
2459
|
-
if (config.defaultValue) try {
|
|
2460
|
-
const defaultValue = config.defaultValue();
|
|
2461
|
-
if (config.defaultValueIsSerializable) defaults.push(`default: ${chalk_1.default.italic(defaultValue)}`);
|
|
2459
|
+
if (config$1.defaultValue) try {
|
|
2460
|
+
const defaultValue = config$1.defaultValue();
|
|
2461
|
+
if (config$1.defaultValueIsSerializable) defaults.push(`default: ${chalk_1.default.italic(defaultValue)}`);
|
|
2462
2462
|
else defaults.push("[...optional]");
|
|
2463
2463
|
} catch (e) {}
|
|
2464
|
-
else if (config.type.defaultValue) try {
|
|
2465
|
-
const defaultValue = config.type.defaultValue();
|
|
2466
|
-
if (config.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1.default.italic(defaultValue)}`);
|
|
2464
|
+
else if (config$1.type.defaultValue) try {
|
|
2465
|
+
const defaultValue = config$1.type.defaultValue();
|
|
2466
|
+
if (config$1.type.defaultValueIsSerializable) defaults.push(`default: ${chalk_1.default.italic(defaultValue)}`);
|
|
2467
2467
|
else defaults.push("[...optional]");
|
|
2468
2468
|
} catch (e) {}
|
|
2469
|
-
else if (config.onMissing || config.type.onMissing) defaults.push("[...optional]");
|
|
2469
|
+
else if (config$1.onMissing || config$1.type.onMissing) defaults.push("[...optional]");
|
|
2470
2470
|
return [{
|
|
2471
2471
|
category: "options",
|
|
2472
2472
|
usage,
|
|
2473
2473
|
defaults,
|
|
2474
|
-
description: (_b = config.description) !== null && _b !== void 0 ? _b : "self explanatory"
|
|
2474
|
+
description: (_b = config$1.description) !== null && _b !== void 0 ? _b : "self explanatory"
|
|
2475
2475
|
}];
|
|
2476
2476
|
},
|
|
2477
2477
|
register(opts) {
|
|
2478
|
-
opts.forceOptionLongNames.add(config.long);
|
|
2479
|
-
if (config.short) opts.forceOptionShortNames.add(config.short);
|
|
2478
|
+
opts.forceOptionLongNames.add(config$1.long);
|
|
2479
|
+
if (config$1.short) opts.forceOptionShortNames.add(config$1.short);
|
|
2480
2480
|
},
|
|
2481
2481
|
async parse({ nodes, visitedNodes }) {
|
|
2482
2482
|
var _a;
|
|
2483
2483
|
const options = (0, findOption_1.findOption)(nodes, {
|
|
2484
|
-
longNames: [config.long],
|
|
2485
|
-
shortNames: config.short ? [config.short] : []
|
|
2484
|
+
longNames: [config$1.long],
|
|
2485
|
+
shortNames: config$1.short ? [config$1.short] : []
|
|
2486
2486
|
}).filter((x) => !visitedNodes.has(x));
|
|
2487
|
-
const defaultValueFn = config.defaultValue || config.type.defaultValue;
|
|
2488
|
-
const onMissingFn = config.onMissing || config.type.onMissing;
|
|
2487
|
+
const defaultValueFn = config$1.defaultValue || config$1.type.defaultValue;
|
|
2488
|
+
const onMissingFn = config$1.onMissing || config$1.type.onMissing;
|
|
2489
2489
|
if (options.length === 0 && defaultValueFn) try {
|
|
2490
2490
|
const defaultValue = defaultValueFn();
|
|
2491
2491
|
return Result$2.ok(defaultValue);
|
|
2492
2492
|
} catch (e) {
|
|
2493
|
-
const message = `Failed to resolve default value for '--${config.long}': ${e.message}`;
|
|
2493
|
+
const message = `Failed to resolve default value for '--${config$1.long}': ${e.message}`;
|
|
2494
2494
|
return Result$2.err({ errors: [{
|
|
2495
2495
|
nodes: [],
|
|
2496
2496
|
message
|
|
@@ -2500,7 +2500,7 @@ var require_multioption = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
2500
2500
|
const missingValue = await onMissingFn();
|
|
2501
2501
|
return Result$2.ok(missingValue);
|
|
2502
2502
|
} catch (e) {
|
|
2503
|
-
const message = `Failed to get missing value for '--${config.long}': ${e.message}`;
|
|
2503
|
+
const message = `Failed to get missing value for '--${config$1.long}': ${e.message}`;
|
|
2504
2504
|
return Result$2.err({ errors: [{
|
|
2505
2505
|
nodes: [],
|
|
2506
2506
|
message
|
|
@@ -2523,7 +2523,7 @@ var require_multioption = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
2523
2523
|
message: "Expected to get a value, found a flag"
|
|
2524
2524
|
});
|
|
2525
2525
|
if (errors.length > 0) return Result$2.err({ errors });
|
|
2526
|
-
const multiDecoded = await Result$2.safeAsync(config.type.from(optionValues));
|
|
2526
|
+
const multiDecoded = await Result$2.safeAsync(config$1.type.from(optionValues));
|
|
2527
2527
|
if (Result$2.isErr(multiDecoded)) return Result$2.err({ errors: [{
|
|
2528
2528
|
nodes: options,
|
|
2529
2529
|
message: multiDecoded.error.message
|
|
@@ -2671,15 +2671,15 @@ var require_rest = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-
|
|
|
2671
2671
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2672
2672
|
exports.rest = rest;
|
|
2673
2673
|
const Result = __importStar(require_Result());
|
|
2674
|
-
function rest(config) {
|
|
2674
|
+
function rest(config$1) {
|
|
2675
2675
|
return {
|
|
2676
2676
|
helpTopics() {
|
|
2677
2677
|
var _a, _b;
|
|
2678
2678
|
return [{
|
|
2679
|
-
usage: `[...${(_a = config === null || config === void 0 ? void 0 : config.displayName) !== null && _a !== void 0 ? _a : "arg"}]`,
|
|
2679
|
+
usage: `[...${(_a = config$1 === null || config$1 === void 0 ? void 0 : config$1.displayName) !== null && _a !== void 0 ? _a : "arg"}]`,
|
|
2680
2680
|
category: "arguments",
|
|
2681
2681
|
defaults: [],
|
|
2682
|
-
description: (_b = config === null || config === void 0 ? void 0 : config.description) !== null && _b !== void 0 ? _b : "catches the rest of the values"
|
|
2682
|
+
description: (_b = config$1 === null || config$1 === void 0 ? void 0 : config$1.description) !== null && _b !== void 0 ? _b : "catches the rest of the values"
|
|
2683
2683
|
}];
|
|
2684
2684
|
},
|
|
2685
2685
|
register() {},
|
|
@@ -2874,11 +2874,11 @@ var require_cjs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-t
|
|
|
2874
2874
|
|
|
2875
2875
|
//#endregion
|
|
2876
2876
|
//#region src/args/runtime.ts
|
|
2877
|
-
var import_cjs$
|
|
2878
|
-
const runtime = import_cjs$
|
|
2877
|
+
var import_cjs$22 = /* @__PURE__ */ __toESM(require_cjs());
|
|
2878
|
+
const runtime = import_cjs$22.option({
|
|
2879
2879
|
long: "runtime",
|
|
2880
2880
|
type: {
|
|
2881
|
-
...import_cjs$
|
|
2881
|
+
...import_cjs$22.oneOf([
|
|
2882
2882
|
"node22",
|
|
2883
2883
|
"node24",
|
|
2884
2884
|
"python3.13"
|
|
@@ -3010,9 +3010,9 @@ var require_ms = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ms@2.1
|
|
|
3010
3010
|
|
|
3011
3011
|
//#endregion
|
|
3012
3012
|
//#region src/types/duration.ts
|
|
3013
|
-
var import_cjs$
|
|
3013
|
+
var import_cjs$21 = require_cjs();
|
|
3014
3014
|
init_source();
|
|
3015
|
-
const Duration = (0, import_cjs$
|
|
3015
|
+
const Duration = (0, import_cjs$21.extendType)(import_cjs$21.string, {
|
|
3016
3016
|
displayName: "num UNIT",
|
|
3017
3017
|
description: "A duration, e.g. 5m, 10s, 1h",
|
|
3018
3018
|
async from(string$1) {
|
|
@@ -3028,8 +3028,8 @@ const Duration = (0, import_cjs$19.extendType)(import_cjs$19.string, {
|
|
|
3028
3028
|
|
|
3029
3029
|
//#endregion
|
|
3030
3030
|
//#region src/args/timeout.ts
|
|
3031
|
-
var import_cjs$
|
|
3032
|
-
const timeout = import_cjs$
|
|
3031
|
+
var import_cjs$20 = /* @__PURE__ */ __toESM(require_cjs());
|
|
3032
|
+
const timeout = import_cjs$20.option({
|
|
3033
3033
|
long: "timeout",
|
|
3034
3034
|
type: Duration,
|
|
3035
3035
|
description: "The maximum duration a sandbox can run for. Example: 5m, 1h",
|
|
@@ -6802,10 +6802,10 @@ function _usingCtx() {
|
|
|
6802
6802
|
|
|
6803
6803
|
//#endregion
|
|
6804
6804
|
//#region src/commands/login.ts
|
|
6805
|
-
var import_cjs$
|
|
6805
|
+
var import_cjs$19 = /* @__PURE__ */ __toESM(require_cjs());
|
|
6806
6806
|
init_source();
|
|
6807
6807
|
const debug$5 = createDebugger("sandbox:login");
|
|
6808
|
-
const login = import_cjs$
|
|
6808
|
+
const login = import_cjs$19.command({
|
|
6809
6809
|
name: "login",
|
|
6810
6810
|
description: "Log in to the Sandbox CLI",
|
|
6811
6811
|
args: {},
|
|
@@ -7010,15 +7010,15 @@ var require_dist = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/@ver
|
|
|
7010
7010
|
|
|
7011
7011
|
//#endregion
|
|
7012
7012
|
//#region src/args/auth.ts
|
|
7013
|
-
var import_cjs$
|
|
7013
|
+
var import_cjs$18 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7014
7014
|
init_source();
|
|
7015
7015
|
var import_dist = require_dist();
|
|
7016
7016
|
const debug$4 = createDebugger("sandbox:args:auth");
|
|
7017
|
-
const token = import_cjs$
|
|
7017
|
+
const token = import_cjs$18.option({
|
|
7018
7018
|
long: "token",
|
|
7019
7019
|
description: "A Vercel authentication token. If not provided, will use the token stored in your system from `VERCEL_AUTH_TOKEN` or will start a log in process.",
|
|
7020
7020
|
type: {
|
|
7021
|
-
...import_cjs$
|
|
7021
|
+
...import_cjs$18.string,
|
|
7022
7022
|
displayName: "pat_or_oidc",
|
|
7023
7023
|
defaultValueIsSerializable: false,
|
|
7024
7024
|
onMissing: async () => {
|
|
@@ -7184,29 +7184,29 @@ async function inferFromToken(token$1, requestedTeam) {
|
|
|
7184
7184
|
|
|
7185
7185
|
//#endregion
|
|
7186
7186
|
//#region src/args/scope.ts
|
|
7187
|
-
var import_cjs$
|
|
7187
|
+
var import_cjs$17 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7188
7188
|
init_source();
|
|
7189
|
-
const project = import_cjs$
|
|
7189
|
+
const project = import_cjs$17.option({
|
|
7190
7190
|
long: "project",
|
|
7191
7191
|
type: {
|
|
7192
|
-
...import_cjs$
|
|
7192
|
+
...import_cjs$17.optional(import_cjs$17.string),
|
|
7193
7193
|
displayName: "my-project"
|
|
7194
7194
|
},
|
|
7195
7195
|
description: "The project name or ID to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN."
|
|
7196
7196
|
});
|
|
7197
7197
|
/** Parser for the `--team` option. */
|
|
7198
|
-
const teamParser = import_cjs$
|
|
7198
|
+
const teamParser = import_cjs$17.option({
|
|
7199
7199
|
long: "team",
|
|
7200
7200
|
type: {
|
|
7201
|
-
...import_cjs$
|
|
7201
|
+
...import_cjs$17.optional(import_cjs$17.string),
|
|
7202
7202
|
displayName: "my-team"
|
|
7203
7203
|
}
|
|
7204
7204
|
});
|
|
7205
7205
|
/** Parser for the `--scope` option. */
|
|
7206
|
-
const scopeParser = import_cjs$
|
|
7206
|
+
const scopeParser = import_cjs$17.option({
|
|
7207
7207
|
long: "scope",
|
|
7208
7208
|
type: {
|
|
7209
|
-
...import_cjs$
|
|
7209
|
+
...import_cjs$17.optional(import_cjs$17.string),
|
|
7210
7210
|
displayName: "my-team"
|
|
7211
7211
|
},
|
|
7212
7212
|
description: "The scope/team to associate with the command. Can be inferred from VERCEL_OIDC_TOKEN. [alias: --team]"
|
|
@@ -7292,7 +7292,7 @@ const scope = {
|
|
|
7292
7292
|
|
|
7293
7293
|
//#endregion
|
|
7294
7294
|
//#region package.json
|
|
7295
|
-
var version = "2.0
|
|
7295
|
+
var version = "2.1.0";
|
|
7296
7296
|
|
|
7297
7297
|
//#endregion
|
|
7298
7298
|
//#region src/error.ts
|
|
@@ -7381,9 +7381,9 @@ async function writeResponseToTemp({ response, text }) {
|
|
|
7381
7381
|
|
|
7382
7382
|
//#endregion
|
|
7383
7383
|
//#region src/args/snapshot-id.ts
|
|
7384
|
-
var import_cjs$
|
|
7384
|
+
var import_cjs$16 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7385
7385
|
init_source();
|
|
7386
|
-
const snapshotId = import_cjs$
|
|
7386
|
+
const snapshotId = import_cjs$16.extendType(import_cjs$16.string, {
|
|
7387
7387
|
displayName: "snapshot_id",
|
|
7388
7388
|
description: "The ID of the snapshot",
|
|
7389
7389
|
async from(s$1) {
|
|
@@ -7392,20 +7392,99 @@ const snapshotId = import_cjs$14.extendType(import_cjs$14.string, {
|
|
|
7392
7392
|
}
|
|
7393
7393
|
});
|
|
7394
7394
|
|
|
7395
|
+
//#endregion
|
|
7396
|
+
//#region src/args/network-policy.ts
|
|
7397
|
+
var import_cjs$15 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7398
|
+
init_source();
|
|
7399
|
+
const networkPolicyMode = import_cjs$15.extendType(import_cjs$15.string, {
|
|
7400
|
+
displayName: "MODE",
|
|
7401
|
+
async from(value) {
|
|
7402
|
+
const validModes = [
|
|
7403
|
+
"internet-access",
|
|
7404
|
+
"no-access",
|
|
7405
|
+
"restricted"
|
|
7406
|
+
];
|
|
7407
|
+
if (!validModes.includes(value)) throw new Error([`Invalid network policy mode: ${value}.`, `${source_default.bold("hint:")} Valid modes are: ${validModes.join(", ")}`].join("\n"));
|
|
7408
|
+
return value;
|
|
7409
|
+
}
|
|
7410
|
+
});
|
|
7411
|
+
const networkPolicy = import_cjs$15.option({
|
|
7412
|
+
long: "network-policy",
|
|
7413
|
+
description: `Network policy mode: "internet-access", "no-access", or "restricted"
|
|
7414
|
+
|
|
7415
|
+
internet-access: sandbox can access any website/domain
|
|
7416
|
+
no-access: sandbox has no network access
|
|
7417
|
+
restricted: sandbox can only access websites and domains explicitly allowed`,
|
|
7418
|
+
type: import_cjs$15.optional(networkPolicyMode)
|
|
7419
|
+
});
|
|
7420
|
+
const allowedDomains = import_cjs$15.multioption({
|
|
7421
|
+
long: "allowed-domain",
|
|
7422
|
+
description: `Domain to allow traffic to (requires --network-policy=restricted)
|
|
7423
|
+
|
|
7424
|
+
Supports "*" for wildcards for a segment (e.g. '*.vercel.com', 'www.*.com')
|
|
7425
|
+
If used as the first segment, will match any subdomain.`,
|
|
7426
|
+
type: import_cjs$15.array(import_cjs$15.string)
|
|
7427
|
+
});
|
|
7428
|
+
const allowedCIDRs = import_cjs$15.multioption({
|
|
7429
|
+
long: "allowed-cidr",
|
|
7430
|
+
description: `CIDR to allow traffic to (requires --network-policy=restricted)
|
|
7431
|
+
|
|
7432
|
+
Takes precedence over 'allowed-domain'.
|
|
7433
|
+
`,
|
|
7434
|
+
type: import_cjs$15.array(import_cjs$15.string)
|
|
7435
|
+
});
|
|
7436
|
+
const deniedCIDRs = import_cjs$15.multioption({
|
|
7437
|
+
long: "denied-cidr",
|
|
7438
|
+
description: `CIDR to deny traffic to (requires --network-policy=restricted)
|
|
7439
|
+
|
|
7440
|
+
Takes precedence over allowed domains/CIDRs.`,
|
|
7441
|
+
type: import_cjs$15.array(import_cjs$15.string)
|
|
7442
|
+
});
|
|
7443
|
+
const networkPolicyArgs = {
|
|
7444
|
+
networkPolicy,
|
|
7445
|
+
allowedDomains,
|
|
7446
|
+
allowedCIDRs,
|
|
7447
|
+
deniedCIDRs
|
|
7448
|
+
};
|
|
7449
|
+
|
|
7450
|
+
//#endregion
|
|
7451
|
+
//#region src/util/network-policy.ts
|
|
7452
|
+
init_source();
|
|
7453
|
+
/**
|
|
7454
|
+
* Builds a NetworkPolicy from CLI arguments (optional mode for create).
|
|
7455
|
+
*/
|
|
7456
|
+
function buildNetworkPolicy(args$4) {
|
|
7457
|
+
const { networkPolicy: networkPolicy$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 } = args$4;
|
|
7458
|
+
if (!networkPolicy$1 || networkPolicy$1 !== "restricted") {
|
|
7459
|
+
if (allowedDomains$1.length > 0 || allowedCIDRs$1.length > 0 || deniedCIDRs$1.length > 0) throw new Error(["Network policy options require --network-policy to be set to restricted.", `${source_default.bold("hint:")} Use --network-policy=restricted to allow/deny specific domains or CIDRs.`].join("\n"));
|
|
7460
|
+
}
|
|
7461
|
+
switch (networkPolicy$1) {
|
|
7462
|
+
case void 0:
|
|
7463
|
+
case "internet-access": return { type: "internet-access" };
|
|
7464
|
+
case "no-access": return { type: "no-access" };
|
|
7465
|
+
case "restricted": return {
|
|
7466
|
+
type: "restricted",
|
|
7467
|
+
allowedDomains: allowedDomains$1.length > 0 ? allowedDomains$1 : void 0,
|
|
7468
|
+
allowedCIDRs: allowedCIDRs$1.length > 0 ? allowedCIDRs$1 : void 0,
|
|
7469
|
+
deniedCIDRs: deniedCIDRs$1.length > 0 ? deniedCIDRs$1 : void 0
|
|
7470
|
+
};
|
|
7471
|
+
}
|
|
7472
|
+
}
|
|
7473
|
+
|
|
7395
7474
|
//#endregion
|
|
7396
7475
|
//#region src/commands/create.ts
|
|
7397
|
-
var import_cjs$
|
|
7476
|
+
var import_cjs$14 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7398
7477
|
var import_ms$1 = /* @__PURE__ */ __toESM(require_ms());
|
|
7399
7478
|
init_source();
|
|
7400
7479
|
const args$3 = {
|
|
7401
7480
|
scope,
|
|
7402
7481
|
runtime,
|
|
7403
7482
|
timeout,
|
|
7404
|
-
ports: import_cjs$
|
|
7483
|
+
ports: import_cjs$14.multioption({
|
|
7405
7484
|
long: "publish-port",
|
|
7406
7485
|
short: "p",
|
|
7407
7486
|
description: "Publish sandbox port(s) to DOMAIN.vercel.run",
|
|
7408
|
-
type: import_cjs$
|
|
7487
|
+
type: import_cjs$14.array(import_cjs$14.extendType(import_cjs$14.number, {
|
|
7409
7488
|
displayName: "PORT",
|
|
7410
7489
|
async from(number) {
|
|
7411
7490
|
if (number < 1024 || number > 65535) throw new Error([
|
|
@@ -7417,22 +7496,29 @@ const args$3 = {
|
|
|
7417
7496
|
}
|
|
7418
7497
|
}))
|
|
7419
7498
|
}),
|
|
7420
|
-
silent: import_cjs$
|
|
7499
|
+
silent: import_cjs$14.flag({
|
|
7421
7500
|
long: "silent",
|
|
7422
7501
|
description: "Don't write sandbox ID to stdout"
|
|
7423
7502
|
}),
|
|
7424
|
-
snapshot: import_cjs$
|
|
7503
|
+
snapshot: import_cjs$14.option({
|
|
7425
7504
|
long: "snapshot",
|
|
7426
7505
|
short: "s",
|
|
7427
7506
|
description: "Start the sandbox from a snapshot ID",
|
|
7428
|
-
type: import_cjs$
|
|
7429
|
-
})
|
|
7507
|
+
type: import_cjs$14.optional(snapshotId)
|
|
7508
|
+
}),
|
|
7509
|
+
...networkPolicyArgs
|
|
7430
7510
|
};
|
|
7431
|
-
const create = import_cjs$
|
|
7511
|
+
const create = import_cjs$14.command({
|
|
7432
7512
|
name: "create",
|
|
7433
7513
|
description: "Create a sandbox in the specified account and project.",
|
|
7434
7514
|
args: args$3,
|
|
7435
|
-
async handler({ ports, scope: scope$1, runtime: runtime$1, timeout: timeout$1, silent, snapshot: snapshot$1 }) {
|
|
7515
|
+
async handler({ ports, scope: scope$1, runtime: runtime$1, timeout: timeout$1, silent, snapshot: snapshot$1, networkPolicy: networkPolicyMode$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 }) {
|
|
7516
|
+
const networkPolicy$1 = buildNetworkPolicy({
|
|
7517
|
+
networkPolicy: networkPolicyMode$1,
|
|
7518
|
+
allowedDomains: allowedDomains$1,
|
|
7519
|
+
allowedCIDRs: allowedCIDRs$1,
|
|
7520
|
+
deniedCIDRs: deniedCIDRs$1
|
|
7521
|
+
});
|
|
7436
7522
|
const spinner = silent ? void 0 : ora("Creating sandbox...").start();
|
|
7437
7523
|
const sandbox = snapshot$1 ? await sandboxClient.create({
|
|
7438
7524
|
source: {
|
|
@@ -7444,6 +7530,7 @@ const create = import_cjs$13.command({
|
|
|
7444
7530
|
token: scope$1.token,
|
|
7445
7531
|
ports,
|
|
7446
7532
|
timeout: (0, import_ms$1.default)(timeout$1),
|
|
7533
|
+
networkPolicy: networkPolicy$1,
|
|
7447
7534
|
__interactive: true
|
|
7448
7535
|
}) : await sandboxClient.create({
|
|
7449
7536
|
teamId: scope$1.team,
|
|
@@ -7452,6 +7539,7 @@ const create = import_cjs$13.command({
|
|
|
7452
7539
|
ports,
|
|
7453
7540
|
runtime: runtime$1,
|
|
7454
7541
|
timeout: (0, import_ms$1.default)(timeout$1),
|
|
7542
|
+
networkPolicy: networkPolicy$1,
|
|
7455
7543
|
__interactive: true
|
|
7456
7544
|
});
|
|
7457
7545
|
spinner?.stop();
|
|
@@ -7485,9 +7573,9 @@ const create = import_cjs$13.command({
|
|
|
7485
7573
|
|
|
7486
7574
|
//#endregion
|
|
7487
7575
|
//#region src/args/sandbox-id.ts
|
|
7488
|
-
var import_cjs$
|
|
7576
|
+
var import_cjs$13 = /* @__PURE__ */ __toESM(require_cjs());
|
|
7489
7577
|
init_source();
|
|
7490
|
-
const sandboxId = import_cjs$
|
|
7578
|
+
const sandboxId = import_cjs$13.extendType(import_cjs$13.string, {
|
|
7491
7579
|
displayName: "sandbox_id",
|
|
7492
7580
|
description: "The ID of the sandbox to execute the command in",
|
|
7493
7581
|
async from(s$1) {
|
|
@@ -11479,9 +11567,9 @@ function getStderrStream() {
|
|
|
11479
11567
|
|
|
11480
11568
|
//#endregion
|
|
11481
11569
|
//#region src/args/key-value-pair.ts
|
|
11482
|
-
var import_cjs$
|
|
11570
|
+
var import_cjs$12 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11483
11571
|
init_source();
|
|
11484
|
-
const KeyValuePair = import_cjs$
|
|
11572
|
+
const KeyValuePair = import_cjs$12.extendType(import_cjs$12.string, {
|
|
11485
11573
|
displayName: "key=value",
|
|
11486
11574
|
async from(input) {
|
|
11487
11575
|
if (!input.includes("=")) return {
|
|
@@ -11495,7 +11583,7 @@ const KeyValuePair = import_cjs$11.extendType(import_cjs$11.string, {
|
|
|
11495
11583
|
};
|
|
11496
11584
|
}
|
|
11497
11585
|
});
|
|
11498
|
-
const ObjectFromKeyValue = import_cjs$
|
|
11586
|
+
const ObjectFromKeyValue = import_cjs$12.extendType(import_cjs$12.array(KeyValuePair), { async from(input) {
|
|
11499
11587
|
const obj = Object.create(null);
|
|
11500
11588
|
const missingVars = [];
|
|
11501
11589
|
for (const { key, value } of input) if (value === void 0) missingVars.push(key);
|
|
@@ -11509,34 +11597,34 @@ const ObjectFromKeyValue = import_cjs$11.extendType(import_cjs$11.array(KeyValue
|
|
|
11509
11597
|
|
|
11510
11598
|
//#endregion
|
|
11511
11599
|
//#region src/commands/exec.ts
|
|
11512
|
-
var import_cjs$
|
|
11600
|
+
var import_cjs$11 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11513
11601
|
init_source();
|
|
11514
11602
|
const args$2 = {
|
|
11515
11603
|
scope,
|
|
11516
|
-
sandbox: import_cjs$
|
|
11517
|
-
asSudo: import_cjs$
|
|
11604
|
+
sandbox: import_cjs$11.positional({ type: sandboxId }),
|
|
11605
|
+
asSudo: import_cjs$11.flag({
|
|
11518
11606
|
long: "sudo",
|
|
11519
11607
|
description: "Give extended privileges to the command."
|
|
11520
11608
|
}),
|
|
11521
|
-
command: import_cjs$
|
|
11609
|
+
command: import_cjs$11.positional({
|
|
11522
11610
|
displayName: "command",
|
|
11523
11611
|
description: "The executable to invoke"
|
|
11524
11612
|
}),
|
|
11525
|
-
args: import_cjs$
|
|
11613
|
+
args: import_cjs$11.rest({
|
|
11526
11614
|
displayName: "args",
|
|
11527
11615
|
description: "arguments to pass to the command"
|
|
11528
11616
|
}),
|
|
11529
|
-
cwd: import_cjs$
|
|
11617
|
+
cwd: import_cjs$11.option({
|
|
11530
11618
|
long: "workdir",
|
|
11531
11619
|
short: "w",
|
|
11532
11620
|
description: "The working directory to run the command in",
|
|
11533
|
-
type: import_cjs$
|
|
11621
|
+
type: import_cjs$11.optional(import_cjs$11.string)
|
|
11534
11622
|
}),
|
|
11535
|
-
interactive: import_cjs$
|
|
11623
|
+
interactive: import_cjs$11.flag({
|
|
11536
11624
|
long: "interactive",
|
|
11537
11625
|
short: "i",
|
|
11538
11626
|
description: "Run the command in a secure interactive shell",
|
|
11539
|
-
type: import_cjs$
|
|
11627
|
+
type: import_cjs$11.extendType(import_cjs$11.boolean, {
|
|
11540
11628
|
defaultValue() {
|
|
11541
11629
|
return false;
|
|
11542
11630
|
},
|
|
@@ -11546,23 +11634,23 @@ const args$2 = {
|
|
|
11546
11634
|
}
|
|
11547
11635
|
})
|
|
11548
11636
|
}),
|
|
11549
|
-
skipExtendingTimeout: import_cjs$
|
|
11637
|
+
skipExtendingTimeout: import_cjs$11.flag({
|
|
11550
11638
|
long: "no-extend-timeout",
|
|
11551
11639
|
description: "Do not extend the sandbox timeout while running an interactive command. Only affects interactive executions."
|
|
11552
11640
|
}),
|
|
11553
|
-
envVars: import_cjs$
|
|
11641
|
+
envVars: import_cjs$11.multioption({
|
|
11554
11642
|
long: "env",
|
|
11555
11643
|
short: "e",
|
|
11556
11644
|
type: ObjectFromKeyValue,
|
|
11557
11645
|
description: "Environment variables to set for the command"
|
|
11558
11646
|
}),
|
|
11559
|
-
tty: import_cjs$
|
|
11647
|
+
tty: import_cjs$11.flag({
|
|
11560
11648
|
long: "tty",
|
|
11561
11649
|
short: "t",
|
|
11562
11650
|
description: "Allocate a tty for an interactive command. This is a no-op."
|
|
11563
11651
|
})
|
|
11564
11652
|
};
|
|
11565
|
-
const exec = import_cjs$
|
|
11653
|
+
const exec = import_cjs$11.command({
|
|
11566
11654
|
name: "exec",
|
|
11567
11655
|
description: "Execute a command in an existing sandbox",
|
|
11568
11656
|
args: args$2,
|
|
@@ -11617,16 +11705,16 @@ function omit(obj, ...keys) {
|
|
|
11617
11705
|
|
|
11618
11706
|
//#endregion
|
|
11619
11707
|
//#region src/commands/run.ts
|
|
11620
|
-
var import_cjs$
|
|
11708
|
+
var import_cjs$10 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11621
11709
|
const args$1 = {
|
|
11622
11710
|
...args$3,
|
|
11623
11711
|
...omit(args$2, "sandbox"),
|
|
11624
|
-
removeAfterUse: import_cjs$
|
|
11712
|
+
removeAfterUse: import_cjs$10.flag({
|
|
11625
11713
|
long: "rm",
|
|
11626
11714
|
description: "Automatically remove the sandbox when the command exits."
|
|
11627
11715
|
})
|
|
11628
11716
|
};
|
|
11629
|
-
const run = import_cjs$
|
|
11717
|
+
const run = import_cjs$10.command({
|
|
11630
11718
|
name: "run",
|
|
11631
11719
|
description: "Create and run a command in a sandbox",
|
|
11632
11720
|
args: args$1,
|
|
@@ -11642,7 +11730,7 @@ const run = import_cjs$9.command({
|
|
|
11642
11730
|
}
|
|
11643
11731
|
}
|
|
11644
11732
|
});
|
|
11645
|
-
const sh = import_cjs$
|
|
11733
|
+
const sh = import_cjs$10.command({
|
|
11646
11734
|
name: "sh",
|
|
11647
11735
|
description: "Create a sandbox and run an interactive shell.",
|
|
11648
11736
|
aliases: ["shell"],
|
|
@@ -11659,15 +11747,15 @@ const sh = import_cjs$9.command({
|
|
|
11659
11747
|
|
|
11660
11748
|
//#endregion
|
|
11661
11749
|
//#region src/commands/list.ts
|
|
11662
|
-
var import_cjs$
|
|
11750
|
+
var import_cjs$9 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11663
11751
|
init_source();
|
|
11664
|
-
const list = import_cjs$
|
|
11752
|
+
const list = import_cjs$9.command({
|
|
11665
11753
|
name: "list",
|
|
11666
11754
|
aliases: ["ls"],
|
|
11667
11755
|
description: "List all sandboxes for the specified account and project.",
|
|
11668
11756
|
args: {
|
|
11669
11757
|
scope,
|
|
11670
|
-
all: import_cjs$
|
|
11758
|
+
all: import_cjs$9.flag({
|
|
11671
11759
|
long: "all",
|
|
11672
11760
|
short: "a",
|
|
11673
11761
|
description: "Show all sandboxes (default shows just running)"
|
|
@@ -11725,8 +11813,8 @@ const SandboxStatusColor = new Map([
|
|
|
11725
11813
|
|
|
11726
11814
|
//#endregion
|
|
11727
11815
|
//#region src/commands/ssh.ts
|
|
11728
|
-
var import_cjs$
|
|
11729
|
-
const ssh = import_cjs$
|
|
11816
|
+
var import_cjs$8 = /* @__PURE__ */ __toESM(require_cjs());
|
|
11817
|
+
const ssh = import_cjs$8.command({
|
|
11730
11818
|
name: "ssh",
|
|
11731
11819
|
description: "Start an interactive shell in an existing sandbox",
|
|
11732
11820
|
args: omit(args$2, "command", "args", "interactive", "tty"),
|
|
@@ -14026,18 +14114,18 @@ var Listr = class {
|
|
|
14026
14114
|
|
|
14027
14115
|
//#endregion
|
|
14028
14116
|
//#region src/commands/stop.ts
|
|
14029
|
-
var import_cjs$
|
|
14030
|
-
const stop = import_cjs$
|
|
14117
|
+
var import_cjs$7 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14118
|
+
const stop = import_cjs$7.command({
|
|
14031
14119
|
name: "stop",
|
|
14032
14120
|
aliases: ["rm", "remove"],
|
|
14033
14121
|
description: "Stop one or more running sandboxes",
|
|
14034
14122
|
args: {
|
|
14035
14123
|
scope,
|
|
14036
|
-
sandboxId: import_cjs$
|
|
14124
|
+
sandboxId: import_cjs$7.positional({
|
|
14037
14125
|
type: sandboxId,
|
|
14038
14126
|
description: "a sandbox ID to stop"
|
|
14039
14127
|
}),
|
|
14040
|
-
sandboxIds: import_cjs$
|
|
14128
|
+
sandboxIds: import_cjs$7.restPositionals({
|
|
14041
14129
|
type: sandboxId,
|
|
14042
14130
|
description: "more sandboxes to stop"
|
|
14043
14131
|
})
|
|
@@ -14110,10 +14198,10 @@ var require_fs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/cmd-ts
|
|
|
14110
14198
|
|
|
14111
14199
|
//#endregion
|
|
14112
14200
|
//#region src/commands/cp.ts
|
|
14113
|
-
var import_cjs$
|
|
14201
|
+
var import_cjs$6 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14114
14202
|
var import_fs = /* @__PURE__ */ __toESM(require_fs());
|
|
14115
14203
|
init_source();
|
|
14116
|
-
const localOrRemote = import_cjs$
|
|
14204
|
+
const localOrRemote = import_cjs$6.extendType(import_cjs$6.string, { async from(input) {
|
|
14117
14205
|
const parts = input.split(":");
|
|
14118
14206
|
if (parts.length === 2) {
|
|
14119
14207
|
const [id, path$1] = parts;
|
|
@@ -14133,18 +14221,18 @@ const localOrRemote = import_cjs$5.extendType(import_cjs$5.string, { async from(
|
|
|
14133
14221
|
file: await import_fs.File.from(input)
|
|
14134
14222
|
};
|
|
14135
14223
|
} });
|
|
14136
|
-
const cp = import_cjs$
|
|
14224
|
+
const cp = import_cjs$6.command({
|
|
14137
14225
|
name: "copy",
|
|
14138
14226
|
description: "Copy files between your local filesystem and a remote sandbox",
|
|
14139
14227
|
aliases: ["cp"],
|
|
14140
14228
|
args: {
|
|
14141
14229
|
scope,
|
|
14142
|
-
source: import_cjs$
|
|
14230
|
+
source: import_cjs$6.positional({
|
|
14143
14231
|
displayName: `SANDBOX_ID:PATH`,
|
|
14144
14232
|
description: `The source file to copy from local file system, or or a sandbox_id:path from a remote sandbox`,
|
|
14145
14233
|
type: localOrRemote
|
|
14146
14234
|
}),
|
|
14147
|
-
dest: import_cjs$
|
|
14235
|
+
dest: import_cjs$6.positional({
|
|
14148
14236
|
displayName: `SANDBOX_ID:PATH`,
|
|
14149
14237
|
description: `The destination file to copy to local file system, or or a sandbox_id:path to a remote sandbox`,
|
|
14150
14238
|
type: localOrRemote
|
|
@@ -14186,10 +14274,10 @@ const cp = import_cjs$5.command({
|
|
|
14186
14274
|
|
|
14187
14275
|
//#endregion
|
|
14188
14276
|
//#region src/commands/logout.ts
|
|
14189
|
-
var import_cjs$
|
|
14277
|
+
var import_cjs$5 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14190
14278
|
init_source();
|
|
14191
14279
|
const debug = createDebugger("sandbox:logout");
|
|
14192
|
-
const logout = import_cjs$
|
|
14280
|
+
const logout = import_cjs$5.command({
|
|
14193
14281
|
name: "logout",
|
|
14194
14282
|
description: "Log out of the Sandbox CLI",
|
|
14195
14283
|
args: {},
|
|
@@ -14208,21 +14296,21 @@ const logout = import_cjs$4.command({
|
|
|
14208
14296
|
|
|
14209
14297
|
//#endregion
|
|
14210
14298
|
//#region src/commands/snapshot.ts
|
|
14211
|
-
var import_cjs$
|
|
14299
|
+
var import_cjs$4 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14212
14300
|
init_source();
|
|
14213
14301
|
const args = {
|
|
14214
14302
|
scope,
|
|
14215
|
-
stop: import_cjs$
|
|
14303
|
+
stop: import_cjs$4.flag({
|
|
14216
14304
|
long: "stop",
|
|
14217
14305
|
description: "Confirm that the sandbox will be stopped when snapshotting"
|
|
14218
14306
|
}),
|
|
14219
|
-
silent: import_cjs$
|
|
14307
|
+
silent: import_cjs$4.flag({
|
|
14220
14308
|
long: "silent",
|
|
14221
14309
|
description: "Don't write snapshot ID to stdout"
|
|
14222
14310
|
}),
|
|
14223
|
-
sandbox: import_cjs$
|
|
14311
|
+
sandbox: import_cjs$4.positional({ type: sandboxId })
|
|
14224
14312
|
};
|
|
14225
|
-
const snapshot = import_cjs$
|
|
14313
|
+
const snapshot = import_cjs$4.command({
|
|
14226
14314
|
name: "snapshot",
|
|
14227
14315
|
description: "Take a snapshot of the filesystem of a sandbox",
|
|
14228
14316
|
args,
|
|
@@ -14256,10 +14344,10 @@ const snapshot = import_cjs$3.command({
|
|
|
14256
14344
|
|
|
14257
14345
|
//#endregion
|
|
14258
14346
|
//#region src/commands/snapshots.ts
|
|
14259
|
-
var import_cjs$
|
|
14260
|
-
var import_cjs$
|
|
14347
|
+
var import_cjs$2 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14348
|
+
var import_cjs$3 = require_cjs();
|
|
14261
14349
|
init_source();
|
|
14262
|
-
const list$1 = import_cjs$
|
|
14350
|
+
const list$1 = import_cjs$2.command({
|
|
14263
14351
|
name: "list",
|
|
14264
14352
|
aliases: ["ls"],
|
|
14265
14353
|
description: "List snapshots for the specified account and project.",
|
|
@@ -14298,17 +14386,17 @@ const list$1 = import_cjs$1.command({
|
|
|
14298
14386
|
}));
|
|
14299
14387
|
}
|
|
14300
14388
|
});
|
|
14301
|
-
const remove = import_cjs$
|
|
14389
|
+
const remove = import_cjs$2.command({
|
|
14302
14390
|
name: "delete",
|
|
14303
14391
|
aliases: ["rm", "remove"],
|
|
14304
14392
|
description: "Delete one or more snapshots.",
|
|
14305
14393
|
args: {
|
|
14306
14394
|
scope,
|
|
14307
|
-
snapshotId: import_cjs$
|
|
14395
|
+
snapshotId: import_cjs$2.positional({
|
|
14308
14396
|
type: snapshotId,
|
|
14309
14397
|
description: "snapshot ID to delete"
|
|
14310
14398
|
}),
|
|
14311
|
-
snapshotIds: import_cjs$
|
|
14399
|
+
snapshotIds: import_cjs$2.restPositionals({
|
|
14312
14400
|
type: snapshotId,
|
|
14313
14401
|
description: "More snapshots IDs to delete"
|
|
14314
14402
|
})
|
|
@@ -14331,7 +14419,7 @@ const remove = import_cjs$1.command({
|
|
|
14331
14419
|
}), { concurrent: true }).run();
|
|
14332
14420
|
}
|
|
14333
14421
|
});
|
|
14334
|
-
const snapshots = (0, import_cjs$
|
|
14422
|
+
const snapshots = (0, import_cjs$3.subcommands)({
|
|
14335
14423
|
name: "snapshots",
|
|
14336
14424
|
description: "Manage sandbox snapshots",
|
|
14337
14425
|
cmds: {
|
|
@@ -14345,6 +14433,62 @@ const SnapshotStatusColor = new Map([
|
|
|
14345
14433
|
["failed", source_default.red]
|
|
14346
14434
|
]);
|
|
14347
14435
|
|
|
14436
|
+
//#endregion
|
|
14437
|
+
//#region src/commands/config.ts
|
|
14438
|
+
var import_cjs$1 = /* @__PURE__ */ __toESM(require_cjs());
|
|
14439
|
+
init_source();
|
|
14440
|
+
const networkPolicyCommand = import_cjs$1.command({
|
|
14441
|
+
name: "network-policy",
|
|
14442
|
+
description: `Update the network policy of a sandbox
|
|
14443
|
+
|
|
14444
|
+
This is a full update, fully overriding the pre-existing configuration.`,
|
|
14445
|
+
args: {
|
|
14446
|
+
scope,
|
|
14447
|
+
sandbox: import_cjs$1.positional({ type: sandboxId }),
|
|
14448
|
+
...networkPolicyArgs
|
|
14449
|
+
},
|
|
14450
|
+
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, sandbox: sandboxId$1, networkPolicy: networkPolicyMode$1, allowedDomains: allowedDomains$1, allowedCIDRs: allowedCIDRs$1, deniedCIDRs: deniedCIDRs$1 }) {
|
|
14451
|
+
if (networkPolicyMode$1 === void 0) throw new Error(`Network policy mode must be set.`);
|
|
14452
|
+
const networkPolicy$1 = buildNetworkPolicy({
|
|
14453
|
+
networkPolicy: networkPolicyMode$1,
|
|
14454
|
+
allowedDomains: allowedDomains$1,
|
|
14455
|
+
allowedCIDRs: allowedCIDRs$1,
|
|
14456
|
+
deniedCIDRs: deniedCIDRs$1
|
|
14457
|
+
});
|
|
14458
|
+
const sandbox = typeof sandboxId$1 !== "string" ? sandboxId$1 : await sandboxClient.get({
|
|
14459
|
+
sandboxId: sandboxId$1,
|
|
14460
|
+
projectId: project$1,
|
|
14461
|
+
teamId: team$1,
|
|
14462
|
+
token: token$1
|
|
14463
|
+
});
|
|
14464
|
+
if (!["pending", "running"].includes(sandbox.status)) {
|
|
14465
|
+
console.error([
|
|
14466
|
+
`Sandbox ${sandbox.sandboxId} is not available (status: ${sandbox.status}).`,
|
|
14467
|
+
`${source_default.bold("hint:")} Only 'pending' or 'running' sandboxes can execute commands.`,
|
|
14468
|
+
"├▶ Use `sandbox list` to check sandbox status.",
|
|
14469
|
+
"╰▶ Use `sandbox create` to create a new sandbox."
|
|
14470
|
+
].join("\n"));
|
|
14471
|
+
process.exitCode = 1;
|
|
14472
|
+
return;
|
|
14473
|
+
}
|
|
14474
|
+
const spinner = ora("Updating network policy...").start();
|
|
14475
|
+
try {
|
|
14476
|
+
await sandbox.updateNetworkPolicy(networkPolicy$1);
|
|
14477
|
+
spinner.stop();
|
|
14478
|
+
process.stderr.write("✅ Network policy updated for sandbox " + source_default.cyan(sandbox.sandboxId) + "\n");
|
|
14479
|
+
process.stderr.write(source_default.dim(" ╰ ") + "mode: " + source_default.cyan(networkPolicy$1.type) + "\n");
|
|
14480
|
+
} catch (error) {
|
|
14481
|
+
spinner.stop();
|
|
14482
|
+
throw error;
|
|
14483
|
+
}
|
|
14484
|
+
}
|
|
14485
|
+
});
|
|
14486
|
+
const config = import_cjs$1.subcommands({
|
|
14487
|
+
name: "config",
|
|
14488
|
+
description: "Update a sandbox configuration",
|
|
14489
|
+
cmds: { "network-policy": networkPolicyCommand }
|
|
14490
|
+
});
|
|
14491
|
+
|
|
14348
14492
|
//#endregion
|
|
14349
14493
|
//#region src/app.ts
|
|
14350
14494
|
var import_cjs = require_cjs();
|
|
@@ -14355,6 +14499,7 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
14355
14499
|
cmds: {
|
|
14356
14500
|
list,
|
|
14357
14501
|
create,
|
|
14502
|
+
config,
|
|
14358
14503
|
copy: cp,
|
|
14359
14504
|
exec,
|
|
14360
14505
|
ssh,
|
|
@@ -14372,4 +14517,4 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
14372
14517
|
|
|
14373
14518
|
//#endregion
|
|
14374
14519
|
export { StyledError as n, require_cjs as r, app as t };
|
|
14375
|
-
//# sourceMappingURL=app-
|
|
14520
|
+
//# sourceMappingURL=app-DtmaeGtx.mjs.map
|