diff --git a/dist/index.js b/dist/index.js index 6a4a77b6..0118eb54 100644 --- a/dist/index.js +++ b/dist/index.js @@ -78899,7 +78899,7 @@ var import_process = require("process"); var import_fs = require("fs"); var core = __toESM(require_core()); -// node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs +// node_modules/.pnpm/zod@3.23.5/node_modules/zod/lib/index.mjs var util; (function(util4) { util4.assertEqual = (val) => val; @@ -79049,7 +79049,7 @@ var ZodIssueCode = util.arrayToEnum([ "not_multiple_of", "not_finite" ]); -var ZodError = class extends Error { +var ZodError = class _ZodError extends Error { constructor(issues) { super(); this.issues = []; @@ -79107,6 +79107,11 @@ var ZodError = class extends Error { processError(this); return fieldErrors; } + static assert(value) { + if (!(value instanceof _ZodError)) { + throw new Error(`Not a ZodError: ${value}`); + } + } toString() { return this.message; } @@ -79246,6 +79251,13 @@ var makeIssue = (params) => { ...issueData, path: fullPath }; + if (issueData.message !== void 0) { + return { + ...issueData, + path: fullPath, + message: issueData.message + }; + } let errorMessage = ""; const maps = errorMaps.filter((m) => !!m).slice().reverse(); for (const map of maps) { @@ -79254,10 +79266,11 @@ var makeIssue = (params) => { return { ...issueData, path: fullPath, - message: issueData.message || errorMessage + message: errorMessage }; }; function addIssueToContext(ctx, issueData) { + const overrideMap = getErrorMap(); const issue = makeIssue({ issueData, data: ctx.data, @@ -79265,8 +79278,8 @@ function addIssueToContext(ctx, issueData) { errorMaps: [ ctx.common.contextualErrorMap, ctx.schemaErrorMap, - getErrorMap(), - errorMap + overrideMap, + overrideMap === errorMap ? void 0 : errorMap // then global default map ].filter((x) => !!x) }); @@ -79298,9 +79311,11 @@ var ParseStatus = class _ParseStatus { static async mergeObjectAsync(status, pairs) { const syncPairs = []; for (const pair of pairs) { + const key = await pair.key; + const value = await pair.value; syncPairs.push({ - key: await pair.key, - value: await pair.value + key, + value }); } return _ParseStatus.mergeObjectSync(status, syncPairs); @@ -79333,11 +79348,29 @@ var isAborted = (x) => x.status === "aborted"; var isDirty = (x) => x.status === "dirty"; var isValid = (x) => x.status === "valid"; var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise; +function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) + throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) + throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} +function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") + throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) + throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) + throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; +} var errorUtil; (function(errorUtil2) { errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {}; errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message; })(errorUtil || (errorUtil = {})); +var _ZodEnum_cache; +var _ZodNativeEnum_cache; var ParseInputLazyPath = class { constructor(parent, value, path4, key) { this._cachedPath = []; @@ -79386,12 +79419,17 @@ function processCreateParams(params) { if (errorMap2) return { errorMap: errorMap2, description }; const customMap = (iss, ctx) => { - if (iss.code !== "invalid_type") - return { message: ctx.defaultError }; + var _a2, _b2; + const { message } = params; + if (iss.code === "invalid_enum_value") { + return { message: message !== null && message !== void 0 ? message : ctx.defaultError }; + } if (typeof ctx.data === "undefined") { - return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError }; + return { message: (_a2 = message !== null && message !== void 0 ? message : required_error) !== null && _a2 !== void 0 ? _a2 : ctx.defaultError }; } - return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError }; + if (iss.code !== "invalid_type") + return { message: ctx.defaultError }; + return { message: (_b2 = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b2 !== void 0 ? _b2 : ctx.defaultError }; }; return { errorMap: customMap, description }; } @@ -79639,35 +79677,40 @@ var ZodType = class { } }; var cuidRegex = /^c[^\s-]{8,}$/i; -var cuid2Regex = /^[a-z][a-z0-9]*$/; +var cuid2Regex = /^[0-9a-z]+$/; var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/; var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i; -var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i; +var nanoidRegex = /^[a-z0-9_-]{21}$/i; +var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/; +var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i; var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`; var emojiRegex; -var ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/; +var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/; var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/; -var datetimeRegex = (args) => { +var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/; +var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`; +var dateRegex = new RegExp(`^${dateRegexSource}$`); +function timeRegexSource(args) { + let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`; if (args.precision) { - if (args.offset) { - return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`); - } else { - return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`); - } - } else if (args.precision === 0) { - if (args.offset) { - return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`); - } else { - return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`); - } - } else { - if (args.offset) { - return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`); - } else { - return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`); - } + regex = `${regex}\\.\\d{${args.precision}}`; + } else if (args.precision == null) { + regex = `${regex}(\\.\\d+)?`; } -}; + return regex; +} +function timeRegex(args) { + return new RegExp(`^${timeRegexSource(args)}$`); +} +function datetimeRegex(args) { + let regex = `${dateRegexSource}T${timeRegexSource(args)}`; + const opts = []; + opts.push(args.local ? `Z?` : `Z`); + if (args.offset) + opts.push(`([+-]\\d{2}:?\\d{2})`); + regex = `${regex}(${opts.join("|")})`; + return new RegExp(`^${regex}$`); +} function isValidIP(ip, version3) { if ((version3 === "v4" || !version3) && ipv4Regex.test(ip)) { return true; @@ -79685,15 +79728,11 @@ var ZodString = class _ZodString extends ZodType { const parsedType = this._getType(input); if (parsedType !== ZodParsedType.string) { const ctx2 = this._getOrReturnCtx(input); - addIssueToContext( - ctx2, - { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.string, - received: ctx2.parsedType - } - // - ); + addIssueToContext(ctx2, { + code: ZodIssueCode.invalid_type, + expected: ZodParsedType.string, + received: ctx2.parsedType + }); return INVALID; } const status = new ParseStatus(); @@ -79784,6 +79823,16 @@ var ZodString = class _ZodString extends ZodType { }); status.dirty(); } + } else if (check.kind === "nanoid") { + if (!nanoidRegex.test(input.data)) { + ctx = this._getOrReturnCtx(input, ctx); + addIssueToContext(ctx, { + validation: "nanoid", + code: ZodIssueCode.invalid_string, + message: check.message + }); + status.dirty(); + } } else if (check.kind === "cuid") { if (!cuidRegex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); @@ -79885,6 +79934,38 @@ var ZodString = class _ZodString extends ZodType { }); status.dirty(); } + } else if (check.kind === "date") { + const regex = dateRegex; + if (!regex.test(input.data)) { + ctx = this._getOrReturnCtx(input, ctx); + addIssueToContext(ctx, { + code: ZodIssueCode.invalid_string, + validation: "date", + message: check.message + }); + status.dirty(); + } + } else if (check.kind === "time") { + const regex = timeRegex(check); + if (!regex.test(input.data)) { + ctx = this._getOrReturnCtx(input, ctx); + addIssueToContext(ctx, { + code: ZodIssueCode.invalid_string, + validation: "time", + message: check.message + }); + status.dirty(); + } + } else if (check.kind === "duration") { + if (!durationRegex.test(input.data)) { + ctx = this._getOrReturnCtx(input, ctx); + addIssueToContext(ctx, { + validation: "duration", + code: ZodIssueCode.invalid_string, + message: check.message + }); + status.dirty(); + } } else if (check.kind === "ip") { if (!isValidIP(input.data, check.version)) { ctx = this._getOrReturnCtx(input, ctx); @@ -79895,6 +79976,16 @@ var ZodString = class _ZodString extends ZodType { }); status.dirty(); } + } else if (check.kind === "base64") { + if (!base64Regex.test(input.data)) { + ctx = this._getOrReturnCtx(input, ctx); + addIssueToContext(ctx, { + validation: "base64", + code: ZodIssueCode.invalid_string, + message: check.message + }); + status.dirty(); + } } else { util.assertNever(check); } @@ -79926,6 +80017,9 @@ var ZodString = class _ZodString extends ZodType { uuid(message) { return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) }); } + nanoid(message) { + return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) }); + } cuid(message) { return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) }); } @@ -79935,16 +80029,20 @@ var ZodString = class _ZodString extends ZodType { ulid(message) { return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) }); } + base64(message) { + return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) }); + } ip(options2) { return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options2) }); } datetime(options2) { - var _a2; + var _a2, _b2; if (typeof options2 === "string") { return this._addCheck({ kind: "datetime", precision: null, offset: false, + local: false, message: options2 }); } @@ -79952,9 +80050,30 @@ var ZodString = class _ZodString extends ZodType { kind: "datetime", precision: typeof (options2 === null || options2 === void 0 ? void 0 : options2.precision) === "undefined" ? null : options2 === null || options2 === void 0 ? void 0 : options2.precision, offset: (_a2 = options2 === null || options2 === void 0 ? void 0 : options2.offset) !== null && _a2 !== void 0 ? _a2 : false, + local: (_b2 = options2 === null || options2 === void 0 ? void 0 : options2.local) !== null && _b2 !== void 0 ? _b2 : false, ...errorUtil.errToObj(options2 === null || options2 === void 0 ? void 0 : options2.message) }); } + date(message) { + return this._addCheck({ kind: "date", message }); + } + time(options2) { + if (typeof options2 === "string") { + return this._addCheck({ + kind: "time", + precision: null, + message: options2 + }); + } + return this._addCheck({ + kind: "time", + precision: typeof (options2 === null || options2 === void 0 ? void 0 : options2.precision) === "undefined" ? null : options2 === null || options2 === void 0 ? void 0 : options2.precision, + ...errorUtil.errToObj(options2 === null || options2 === void 0 ? void 0 : options2.message) + }); + } + duration(message) { + return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) }); + } regex(regex, message) { return this._addCheck({ kind: "regex", @@ -80033,6 +80152,15 @@ var ZodString = class _ZodString extends ZodType { get isDatetime() { return !!this._def.checks.find((ch) => ch.kind === "datetime"); } + get isDate() { + return !!this._def.checks.find((ch) => ch.kind === "date"); + } + get isTime() { + return !!this._def.checks.find((ch) => ch.kind === "time"); + } + get isDuration() { + return !!this._def.checks.find((ch) => ch.kind === "duration"); + } get isEmail() { return !!this._def.checks.find((ch) => ch.kind === "email"); } @@ -80045,6 +80173,9 @@ var ZodString = class _ZodString extends ZodType { get isUUID() { return !!this._def.checks.find((ch) => ch.kind === "uuid"); } + get isNANOID() { + return !!this._def.checks.find((ch) => ch.kind === "nanoid"); + } get isCUID() { return !!this._def.checks.find((ch) => ch.kind === "cuid"); } @@ -80057,6 +80188,9 @@ var ZodString = class _ZodString extends ZodType { get isIP() { return !!this._def.checks.find((ch) => ch.kind === "ip"); } + get isBase64() { + return !!this._def.checks.find((ch) => ch.kind === "base64"); + } get minLength() { let min = null; for (const ch of this._def.checks) { @@ -80970,9 +81104,10 @@ var ZodObject = class _ZodObject extends ZodType { const syncPairs = []; for (const pair of pairs) { const key = await pair.key; + const value = await pair.value; syncPairs.push({ key, - value: await pair.value, + value, alwaysSet: pair.alwaysSet }); } @@ -81323,15 +81458,25 @@ var getDiscriminator = (type3) => { } else if (type3 instanceof ZodEnum) { return type3.options; } else if (type3 instanceof ZodNativeEnum) { - return Object.keys(type3.enum); + return util.objectValues(type3.enum); } else if (type3 instanceof ZodDefault) { return getDiscriminator(type3._def.innerType); } else if (type3 instanceof ZodUndefined) { return [void 0]; } else if (type3 instanceof ZodNull) { return [null]; + } else if (type3 instanceof ZodOptional) { + return [void 0, ...getDiscriminator(type3.unwrap())]; + } else if (type3 instanceof ZodNullable) { + return [null, ...getDiscriminator(type3.unwrap())]; + } else if (type3 instanceof ZodBranded) { + return getDiscriminator(type3.unwrap()); + } else if (type3 instanceof ZodReadonly) { + return getDiscriminator(type3.unwrap()); + } else if (type3 instanceof ZodCatch) { + return getDiscriminator(type3._def.innerType); } else { - return null; + return []; } }; var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType { @@ -81391,7 +81536,7 @@ var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType { const optionsMap = /* @__PURE__ */ new Map(); for (const type3 of options2) { const discriminatorValues = getDiscriminator(type3.shape[discriminator]); - if (!discriminatorValues) { + if (!discriminatorValues.length) { throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`); } for (const value of discriminatorValues) { @@ -81591,7 +81736,8 @@ var ZodRecord = class _ZodRecord extends ZodType { for (const key in ctx.data) { pairs.push({ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)), - value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)) + value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)), + alwaysSet: key in ctx.data }); } if (ctx.common.async) { @@ -81935,6 +82081,10 @@ function createZodEnum(values, params) { }); } var ZodEnum = class _ZodEnum extends ZodType { + constructor() { + super(...arguments); + _ZodEnum_cache.set(this, void 0); + } _parse(input) { if (typeof input.data !== "string") { const ctx = this._getOrReturnCtx(input); @@ -81946,7 +82096,10 @@ var ZodEnum = class _ZodEnum extends ZodType { }); return INVALID; } - if (this._def.values.indexOf(input.data) === -1) { + if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) { + __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f"); + } + if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) { const ctx = this._getOrReturnCtx(input); const expectedValues = this._def.values; addIssueToContext(ctx, { @@ -81982,15 +82135,26 @@ var ZodEnum = class _ZodEnum extends ZodType { } return enumValues; } - extract(values) { - return _ZodEnum.create(values); + extract(values, newDef = this._def) { + return _ZodEnum.create(values, { + ...this._def, + ...newDef + }); } - exclude(values) { - return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt))); + exclude(values, newDef = this._def) { + return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), { + ...this._def, + ...newDef + }); } }; +_ZodEnum_cache = /* @__PURE__ */ new WeakMap(); ZodEnum.create = createZodEnum; var ZodNativeEnum = class extends ZodType { + constructor() { + super(...arguments); + _ZodNativeEnum_cache.set(this, void 0); + } _parse(input) { const nativeEnumValues = util.getValidEnumValues(this._def.values); const ctx = this._getOrReturnCtx(input); @@ -82003,7 +82167,10 @@ var ZodNativeEnum = class extends ZodType { }); return INVALID; } - if (nativeEnumValues.indexOf(input.data) === -1) { + if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) { + __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f"); + } + if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) { const expectedValues = util.objectValues(nativeEnumValues); addIssueToContext(ctx, { received: ctx.data, @@ -82018,6 +82185,7 @@ var ZodNativeEnum = class extends ZodType { return this._def.values; } }; +_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap(); ZodNativeEnum.create = (values, params) => { return new ZodNativeEnum({ values, @@ -82081,26 +82249,38 @@ var ZodEffects = class extends ZodType { checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx); if (effect.type === "preprocess") { const processed = effect.transform(ctx.data, checkCtx); - if (ctx.common.issues.length) { - return { - status: "dirty", - value: ctx.data - }; - } if (ctx.common.async) { - return Promise.resolve(processed).then((processed2) => { - return this._def.schema._parseAsync({ + return Promise.resolve(processed).then(async (processed2) => { + if (status.value === "aborted") + return INVALID; + const result = await this._def.schema._parseAsync({ data: processed2, path: ctx.path, parent: ctx }); + if (result.status === "aborted") + return INVALID; + if (result.status === "dirty") + return DIRTY(result.value); + if (status.value === "dirty") + return DIRTY(result.value); + return result; }); } else { - return this._def.schema._parseSync({ + if (status.value === "aborted") + return INVALID; + const result = this._def.schema._parseSync({ data: processed, path: ctx.path, parent: ctx }); + if (result.status === "aborted") + return INVALID; + if (result.status === "dirty") + return DIRTY(result.value); + if (status.value === "dirty") + return DIRTY(result.value); + return result; } } if (effect.type === "refinement") { @@ -82394,6 +82574,9 @@ var ZodReadonly = class extends ZodType { } return result; } + unwrap() { + return this._def.innerType; + } }; ZodReadonly.create = (type3, params) => { return new ZodReadonly({ @@ -82599,10 +82782,17 @@ var inferOptions = (inputs) => { manifestPath = "pixi.toml"; } else if ((0, import_fs.existsSync)("pyproject.toml")) { const fileContent = (0, import_fs.readFileSync)("pyproject.toml", "utf-8"); - const parsedContent = (0, import_toml.parse)(fileContent); - if (parsedContent.tool && parsedContent.tool.pixi) { - core.debug("The tool.pixi table found so using pyproject.toml as manifest file."); - manifestPath = "pyproject.toml"; + console.log(fileContent); + try { + const parsedContent = (0, import_toml.parse)(fileContent); + console.log(parsedContent); + if (parsedContent.tool && parsedContent.tool.pixi) { + core.debug("The tool.pixi table found so using pyproject.toml as manifest file."); + manifestPath = "pyproject.toml"; + } + } catch (e) { + console.error(e); + throw new Error("Failed to parse pyproject.toml"); } } else { if (runInstall) { diff --git a/dist/post.js b/dist/post.js index 027cc8d0..62d50ca5 100644 --- a/dist/post.js +++ b/dist/post.js @@ -6258,7 +6258,7 @@ var import_process = require("process"); var import_fs = require("fs"); var core = __toESM(require_core()); -// node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs +// node_modules/.pnpm/zod@3.23.5/node_modules/zod/lib/index.mjs var util; (function(util2) { util2.assertEqual = (val) => val; @@ -6408,7 +6408,7 @@ var ZodIssueCode = util.arrayToEnum([ "not_multiple_of", "not_finite" ]); -var ZodError = class extends Error { +var ZodError = class _ZodError extends Error { constructor(issues) { super(); this.issues = []; @@ -6466,6 +6466,11 @@ var ZodError = class extends Error { processError(this); return fieldErrors; } + static assert(value) { + if (!(value instanceof _ZodError)) { + throw new Error(`Not a ZodError: ${value}`); + } + } toString() { return this.message; } @@ -6605,6 +6610,13 @@ var makeIssue = (params) => { ...issueData, path: fullPath }; + if (issueData.message !== void 0) { + return { + ...issueData, + path: fullPath, + message: issueData.message + }; + } let errorMessage = ""; const maps = errorMaps.filter((m) => !!m).slice().reverse(); for (const map of maps) { @@ -6613,10 +6625,11 @@ var makeIssue = (params) => { return { ...issueData, path: fullPath, - message: issueData.message || errorMessage + message: errorMessage }; }; function addIssueToContext(ctx, issueData) { + const overrideMap = getErrorMap(); const issue = makeIssue({ issueData, data: ctx.data, @@ -6624,8 +6637,8 @@ function addIssueToContext(ctx, issueData) { errorMaps: [ ctx.common.contextualErrorMap, ctx.schemaErrorMap, - getErrorMap(), - errorMap + overrideMap, + overrideMap === errorMap ? void 0 : errorMap // then global default map ].filter((x) => !!x) }); @@ -6657,9 +6670,11 @@ var ParseStatus = class _ParseStatus { static async mergeObjectAsync(status, pairs) { const syncPairs = []; for (const pair of pairs) { + const key = await pair.key; + const value = await pair.value; syncPairs.push({ - key: await pair.key, - value: await pair.value + key, + value }); } return _ParseStatus.mergeObjectSync(status, syncPairs); @@ -6692,11 +6707,29 @@ var isAborted = (x) => x.status === "aborted"; var isDirty = (x) => x.status === "dirty"; var isValid = (x) => x.status === "valid"; var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise; +function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) + throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) + throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} +function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") + throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) + throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) + throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; +} var errorUtil; (function(errorUtil2) { errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {}; errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message; })(errorUtil || (errorUtil = {})); +var _ZodEnum_cache; +var _ZodNativeEnum_cache; var ParseInputLazyPath = class { constructor(parent, value, path3, key) { this._cachedPath = []; @@ -6745,12 +6778,17 @@ function processCreateParams(params) { if (errorMap2) return { errorMap: errorMap2, description }; const customMap = (iss, ctx) => { - if (iss.code !== "invalid_type") - return { message: ctx.defaultError }; + var _a, _b; + const { message } = params; + if (iss.code === "invalid_enum_value") { + return { message: message !== null && message !== void 0 ? message : ctx.defaultError }; + } if (typeof ctx.data === "undefined") { - return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError }; + return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError }; } - return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError }; + if (iss.code !== "invalid_type") + return { message: ctx.defaultError }; + return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError }; }; return { errorMap: customMap, description }; } @@ -6998,35 +7036,40 @@ var ZodType = class { } }; var cuidRegex = /^c[^\s-]{8,}$/i; -var cuid2Regex = /^[a-z][a-z0-9]*$/; +var cuid2Regex = /^[0-9a-z]+$/; var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/; var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i; -var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i; +var nanoidRegex = /^[a-z0-9_-]{21}$/i; +var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/; +var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i; var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`; var emojiRegex; -var ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/; +var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/; var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/; -var datetimeRegex = (args) => { +var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/; +var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`; +var dateRegex = new RegExp(`^${dateRegexSource}$`); +function timeRegexSource(args) { + let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`; if (args.precision) { - if (args.offset) { - return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`); - } else { - return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`); - } - } else if (args.precision === 0) { - if (args.offset) { - return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`); - } else { - return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`); - } - } else { - if (args.offset) { - return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`); - } else { - return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`); - } + regex = `${regex}\\.\\d{${args.precision}}`; + } else if (args.precision == null) { + regex = `${regex}(\\.\\d+)?`; } -}; + return regex; +} +function timeRegex(args) { + return new RegExp(`^${timeRegexSource(args)}$`); +} +function datetimeRegex(args) { + let regex = `${dateRegexSource}T${timeRegexSource(args)}`; + const opts = []; + opts.push(args.local ? `Z?` : `Z`); + if (args.offset) + opts.push(`([+-]\\d{2}:?\\d{2})`); + regex = `${regex}(${opts.join("|")})`; + return new RegExp(`^${regex}$`); +} function isValidIP(ip, version2) { if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) { return true; @@ -7044,15 +7087,11 @@ var ZodString = class _ZodString extends ZodType { const parsedType = this._getType(input); if (parsedType !== ZodParsedType.string) { const ctx2 = this._getOrReturnCtx(input); - addIssueToContext( - ctx2, - { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.string, - received: ctx2.parsedType - } - // - ); + addIssueToContext(ctx2, { + code: ZodIssueCode.invalid_type, + expected: ZodParsedType.string, + received: ctx2.parsedType + }); return INVALID; } const status = new ParseStatus(); @@ -7143,6 +7182,16 @@ var ZodString = class _ZodString extends ZodType { }); status.dirty(); } + } else if (check.kind === "nanoid") { + if (!nanoidRegex.test(input.data)) { + ctx = this._getOrReturnCtx(input, ctx); + addIssueToContext(ctx, { + validation: "nanoid", + code: ZodIssueCode.invalid_string, + message: check.message + }); + status.dirty(); + } } else if (check.kind === "cuid") { if (!cuidRegex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); @@ -7244,6 +7293,38 @@ var ZodString = class _ZodString extends ZodType { }); status.dirty(); } + } else if (check.kind === "date") { + const regex = dateRegex; + if (!regex.test(input.data)) { + ctx = this._getOrReturnCtx(input, ctx); + addIssueToContext(ctx, { + code: ZodIssueCode.invalid_string, + validation: "date", + message: check.message + }); + status.dirty(); + } + } else if (check.kind === "time") { + const regex = timeRegex(check); + if (!regex.test(input.data)) { + ctx = this._getOrReturnCtx(input, ctx); + addIssueToContext(ctx, { + code: ZodIssueCode.invalid_string, + validation: "time", + message: check.message + }); + status.dirty(); + } + } else if (check.kind === "duration") { + if (!durationRegex.test(input.data)) { + ctx = this._getOrReturnCtx(input, ctx); + addIssueToContext(ctx, { + validation: "duration", + code: ZodIssueCode.invalid_string, + message: check.message + }); + status.dirty(); + } } else if (check.kind === "ip") { if (!isValidIP(input.data, check.version)) { ctx = this._getOrReturnCtx(input, ctx); @@ -7254,6 +7335,16 @@ var ZodString = class _ZodString extends ZodType { }); status.dirty(); } + } else if (check.kind === "base64") { + if (!base64Regex.test(input.data)) { + ctx = this._getOrReturnCtx(input, ctx); + addIssueToContext(ctx, { + validation: "base64", + code: ZodIssueCode.invalid_string, + message: check.message + }); + status.dirty(); + } } else { util.assertNever(check); } @@ -7285,6 +7376,9 @@ var ZodString = class _ZodString extends ZodType { uuid(message) { return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) }); } + nanoid(message) { + return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) }); + } cuid(message) { return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) }); } @@ -7294,16 +7388,20 @@ var ZodString = class _ZodString extends ZodType { ulid(message) { return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) }); } + base64(message) { + return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) }); + } ip(options2) { return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options2) }); } datetime(options2) { - var _a; + var _a, _b; if (typeof options2 === "string") { return this._addCheck({ kind: "datetime", precision: null, offset: false, + local: false, message: options2 }); } @@ -7311,9 +7409,30 @@ var ZodString = class _ZodString extends ZodType { kind: "datetime", precision: typeof (options2 === null || options2 === void 0 ? void 0 : options2.precision) === "undefined" ? null : options2 === null || options2 === void 0 ? void 0 : options2.precision, offset: (_a = options2 === null || options2 === void 0 ? void 0 : options2.offset) !== null && _a !== void 0 ? _a : false, + local: (_b = options2 === null || options2 === void 0 ? void 0 : options2.local) !== null && _b !== void 0 ? _b : false, + ...errorUtil.errToObj(options2 === null || options2 === void 0 ? void 0 : options2.message) + }); + } + date(message) { + return this._addCheck({ kind: "date", message }); + } + time(options2) { + if (typeof options2 === "string") { + return this._addCheck({ + kind: "time", + precision: null, + message: options2 + }); + } + return this._addCheck({ + kind: "time", + precision: typeof (options2 === null || options2 === void 0 ? void 0 : options2.precision) === "undefined" ? null : options2 === null || options2 === void 0 ? void 0 : options2.precision, ...errorUtil.errToObj(options2 === null || options2 === void 0 ? void 0 : options2.message) }); } + duration(message) { + return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) }); + } regex(regex, message) { return this._addCheck({ kind: "regex", @@ -7392,6 +7511,15 @@ var ZodString = class _ZodString extends ZodType { get isDatetime() { return !!this._def.checks.find((ch) => ch.kind === "datetime"); } + get isDate() { + return !!this._def.checks.find((ch) => ch.kind === "date"); + } + get isTime() { + return !!this._def.checks.find((ch) => ch.kind === "time"); + } + get isDuration() { + return !!this._def.checks.find((ch) => ch.kind === "duration"); + } get isEmail() { return !!this._def.checks.find((ch) => ch.kind === "email"); } @@ -7404,6 +7532,9 @@ var ZodString = class _ZodString extends ZodType { get isUUID() { return !!this._def.checks.find((ch) => ch.kind === "uuid"); } + get isNANOID() { + return !!this._def.checks.find((ch) => ch.kind === "nanoid"); + } get isCUID() { return !!this._def.checks.find((ch) => ch.kind === "cuid"); } @@ -7416,6 +7547,9 @@ var ZodString = class _ZodString extends ZodType { get isIP() { return !!this._def.checks.find((ch) => ch.kind === "ip"); } + get isBase64() { + return !!this._def.checks.find((ch) => ch.kind === "base64"); + } get minLength() { let min = null; for (const ch of this._def.checks) { @@ -8329,9 +8463,10 @@ var ZodObject = class _ZodObject extends ZodType { const syncPairs = []; for (const pair of pairs) { const key = await pair.key; + const value = await pair.value; syncPairs.push({ key, - value: await pair.value, + value, alwaysSet: pair.alwaysSet }); } @@ -8682,15 +8817,25 @@ var getDiscriminator = (type) => { } else if (type instanceof ZodEnum) { return type.options; } else if (type instanceof ZodNativeEnum) { - return Object.keys(type.enum); + return util.objectValues(type.enum); } else if (type instanceof ZodDefault) { return getDiscriminator(type._def.innerType); } else if (type instanceof ZodUndefined) { return [void 0]; } else if (type instanceof ZodNull) { return [null]; + } else if (type instanceof ZodOptional) { + return [void 0, ...getDiscriminator(type.unwrap())]; + } else if (type instanceof ZodNullable) { + return [null, ...getDiscriminator(type.unwrap())]; + } else if (type instanceof ZodBranded) { + return getDiscriminator(type.unwrap()); + } else if (type instanceof ZodReadonly) { + return getDiscriminator(type.unwrap()); + } else if (type instanceof ZodCatch) { + return getDiscriminator(type._def.innerType); } else { - return null; + return []; } }; var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType { @@ -8750,7 +8895,7 @@ var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType { const optionsMap = /* @__PURE__ */ new Map(); for (const type of options2) { const discriminatorValues = getDiscriminator(type.shape[discriminator]); - if (!discriminatorValues) { + if (!discriminatorValues.length) { throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`); } for (const value of discriminatorValues) { @@ -8950,7 +9095,8 @@ var ZodRecord = class _ZodRecord extends ZodType { for (const key in ctx.data) { pairs.push({ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)), - value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)) + value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)), + alwaysSet: key in ctx.data }); } if (ctx.common.async) { @@ -9294,6 +9440,10 @@ function createZodEnum(values, params) { }); } var ZodEnum = class _ZodEnum extends ZodType { + constructor() { + super(...arguments); + _ZodEnum_cache.set(this, void 0); + } _parse(input) { if (typeof input.data !== "string") { const ctx = this._getOrReturnCtx(input); @@ -9305,7 +9455,10 @@ var ZodEnum = class _ZodEnum extends ZodType { }); return INVALID; } - if (this._def.values.indexOf(input.data) === -1) { + if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) { + __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f"); + } + if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) { const ctx = this._getOrReturnCtx(input); const expectedValues = this._def.values; addIssueToContext(ctx, { @@ -9341,15 +9494,26 @@ var ZodEnum = class _ZodEnum extends ZodType { } return enumValues; } - extract(values) { - return _ZodEnum.create(values); + extract(values, newDef = this._def) { + return _ZodEnum.create(values, { + ...this._def, + ...newDef + }); } - exclude(values) { - return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt))); + exclude(values, newDef = this._def) { + return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), { + ...this._def, + ...newDef + }); } }; +_ZodEnum_cache = /* @__PURE__ */ new WeakMap(); ZodEnum.create = createZodEnum; var ZodNativeEnum = class extends ZodType { + constructor() { + super(...arguments); + _ZodNativeEnum_cache.set(this, void 0); + } _parse(input) { const nativeEnumValues = util.getValidEnumValues(this._def.values); const ctx = this._getOrReturnCtx(input); @@ -9362,7 +9526,10 @@ var ZodNativeEnum = class extends ZodType { }); return INVALID; } - if (nativeEnumValues.indexOf(input.data) === -1) { + if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) { + __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f"); + } + if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) { const expectedValues = util.objectValues(nativeEnumValues); addIssueToContext(ctx, { received: ctx.data, @@ -9377,6 +9544,7 @@ var ZodNativeEnum = class extends ZodType { return this._def.values; } }; +_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap(); ZodNativeEnum.create = (values, params) => { return new ZodNativeEnum({ values, @@ -9440,26 +9608,38 @@ var ZodEffects = class extends ZodType { checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx); if (effect.type === "preprocess") { const processed = effect.transform(ctx.data, checkCtx); - if (ctx.common.issues.length) { - return { - status: "dirty", - value: ctx.data - }; - } if (ctx.common.async) { - return Promise.resolve(processed).then((processed2) => { - return this._def.schema._parseAsync({ + return Promise.resolve(processed).then(async (processed2) => { + if (status.value === "aborted") + return INVALID; + const result = await this._def.schema._parseAsync({ data: processed2, path: ctx.path, parent: ctx }); + if (result.status === "aborted") + return INVALID; + if (result.status === "dirty") + return DIRTY(result.value); + if (status.value === "dirty") + return DIRTY(result.value); + return result; }); } else { - return this._def.schema._parseSync({ + if (status.value === "aborted") + return INVALID; + const result = this._def.schema._parseSync({ data: processed, path: ctx.path, parent: ctx }); + if (result.status === "aborted") + return INVALID; + if (result.status === "dirty") + return DIRTY(result.value); + if (status.value === "dirty") + return DIRTY(result.value); + return result; } } if (effect.type === "refinement") { @@ -9753,6 +9933,9 @@ var ZodReadonly = class extends ZodType { } return result; } + unwrap() { + return this._def.innerType; + } }; ZodReadonly.create = (type, params) => { return new ZodReadonly({ @@ -9958,10 +10141,17 @@ var inferOptions = (inputs) => { manifestPath = "pixi.toml"; } else if ((0, import_fs.existsSync)("pyproject.toml")) { const fileContent = (0, import_fs.readFileSync)("pyproject.toml", "utf-8"); - const parsedContent = (0, import_toml.parse)(fileContent); - if (parsedContent.tool && parsedContent.tool.pixi) { - core.debug("The tool.pixi table found so using pyproject.toml as manifest file."); - manifestPath = "pyproject.toml"; + console.log(fileContent); + try { + const parsedContent = (0, import_toml.parse)(fileContent); + console.log(parsedContent); + if (parsedContent.tool && parsedContent.tool.pixi) { + core.debug("The tool.pixi table found so using pyproject.toml as manifest file."); + manifestPath = "pyproject.toml"; + } + } catch (e) { + console.error(e); + throw new Error("Failed to parse pyproject.toml"); } } else { if (runInstall) { diff --git a/src/options.ts b/src/options.ts index 17f094d8..5c915cb1 100644 --- a/src/options.ts +++ b/src/options.ts @@ -209,11 +209,18 @@ const inferOptions = (inputs: Inputs): Options => { manifestPath = 'pixi.toml' } else if (existsSync('pyproject.toml')) { const fileContent = readFileSync('pyproject.toml', 'utf-8') - const parsedContent = parse(fileContent) - // only use pyproject.toml if [tool.pixi] is present - if (parsedContent.tool && parsedContent.tool.pixi) { - core.debug('The tool.pixi table found so using pyproject.toml as manifest file.') - manifestPath = 'pyproject.toml' + console.log(fileContent) + try { + const parsedContent = parse(fileContent) + console.log(parsedContent) + // only use pyproject.toml if [tool.pixi] is present + if (parsedContent.tool && parsedContent.tool.pixi) { + core.debug('The tool.pixi table found so using pyproject.toml as manifest file.') + manifestPath = 'pyproject.toml' + } + } catch (e) { + console.error(e) + throw new Error('Failed to parse pyproject.toml') } } else { if (runInstall) {