@tscircuit/cli 0.1.1839 → 0.1.1841

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/main.js CHANGED
@@ -124297,12 +124297,12 @@ var require_FlateStream = __commonJS((exports2) => {
124297
124297
  if ((b3 = str.getByte()) === -1) {
124298
124298
  throw new Error("Bad block header in flate stream");
124299
124299
  }
124300
- var check = b3;
124300
+ var check2 = b3;
124301
124301
  if ((b3 = str.getByte()) === -1) {
124302
124302
  throw new Error("Bad block header in flate stream");
124303
124303
  }
124304
- check |= b3 << 8;
124305
- if (check !== (~blockLen & 65535) && (blockLen !== 0 || check !== 0)) {
124304
+ check2 |= b3 << 8;
124305
+ if (check2 !== (~blockLen & 65535) && (blockLen !== 0 || check2 !== 0)) {
124306
124306
  throw new Error("Bad uncompressed block length in flate stream");
124307
124307
  }
124308
124308
  this.codeBuf = 0;
@@ -135252,7 +135252,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
135252
135252
  // lib/getVersion.ts
135253
135253
  import { createRequire as createRequire2 } from "node:module";
135254
135254
  // package.json
135255
- var version = "0.1.1838";
135255
+ var version = "0.1.1840";
135256
135256
  var package_default = {
135257
135257
  name: "@tscircuit/cli",
135258
135258
  version,
@@ -135268,6 +135268,7 @@ var package_default = {
135268
135268
  "@tscircuit/circuit-json-placement-analysis": "^0.0.6",
135269
135269
  "@tscircuit/circuit-json-routing-analysis": "^0.0.6",
135270
135270
  "@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#bb0b41d80c9714695b498e182c2a558f1e0ceb2d",
135271
+ "@tscircuit/circuit-json-util": "^0.0.105",
135271
135272
  "@tscircuit/eval": "^0.0.1016",
135272
135273
  "@tscircuit/fake-snippets": "^0.0.182",
135273
135274
  "@tscircuit/file-server": "^0.0.32",
@@ -147337,16 +147338,28 @@ function analyzeCircuitJson(circuitJson) {
147337
147338
  const hasWarningType = typeof item.warning_type === "string";
147338
147339
  const isTypedError = typeof t === "string" && t.endsWith("_error");
147339
147340
  const isTypedWarning = typeof t === "string" && t.endsWith("_warning");
147340
- if (hasErrorType || isTypedError) {
147341
- errors.push(item);
147342
- continue;
147343
- }
147344
147341
  if (hasWarningType || isTypedWarning) {
147345
147342
  warnings.push(item);
147343
+ continue;
147344
+ }
147345
+ if (hasErrorType || isTypedError) {
147346
+ errors.push(item);
147346
147347
  }
147347
147348
  }
147348
147349
  return { errors, warnings };
147349
147350
  }
147351
+ function formatCircuitJsonDiagnostics({
147352
+ errors,
147353
+ warnings
147354
+ }) {
147355
+ const lines = [`Errors: ${errors.length}`, `Warnings: ${warnings.length}`];
147356
+ for (const issue of [...errors, ...warnings]) {
147357
+ const issueType = issue.warning_type ?? issue.error_type ?? issue.type ?? "unknown_issue";
147358
+ lines.push(`- ${issueType}: ${issue.message ?? ""}`);
147359
+ }
147360
+ return lines.join(`
147361
+ `);
147362
+ }
147350
147363
 
147351
147364
  // lib/shared/generate-circuit-json.tsx
147352
147365
  import fs27 from "node:fs";
@@ -147608,9 +147621,10 @@ var EMPTY_IGNORE_COUNTS = () => ({
147608
147621
  pin_specification: 0,
147609
147622
  placement: 0,
147610
147623
  routing: 0,
147624
+ source: 0,
147611
147625
  unknown: 0
147612
147626
  });
147613
- var normalizeCategory = (category) => category === "netlist" || category === "pin_specification" || category === "placement" || category === "routing" ? category : "unknown";
147627
+ var normalizeCategory = (category) => category === "netlist" || category === "pin_specification" || category === "placement" || category === "routing" || category === "source" ? category : "unknown";
147614
147628
  var categorizeIssue = (issue) => normalizeCategory(categorizeErrorOrWarning(issue));
147615
147629
  var shouldIgnoreCategory = (category, ignoreOptions) => {
147616
147630
  switch (category) {
@@ -147671,6 +147685,7 @@ var formatIgnoredDrcCounts = (counts2) => [
147671
147685
  ["pin_specification", counts2.pin_specification],
147672
147686
  ["placement", counts2.placement],
147673
147687
  ["routing", counts2.routing],
147688
+ ["source", counts2.source],
147674
147689
  ["unknown", counts2.unknown]
147675
147690
  ].filter(([, count]) => count > 0).map(([category, count]) => `${category}: ${count}`).join(", ");
147676
147691
 
@@ -152428,6 +152443,7 @@ var registerBuild = (program2) => {
152428
152443
  pin_specification: 0,
152429
152444
  placement: 0,
152430
152445
  routing: 0,
152446
+ source: 0,
152431
152447
  unknown: 0
152432
152448
  };
152433
152449
  const staticFileReferences = [];
@@ -155358,8 +155374,24 @@ var registerCheckPlacement = (program2) => {
155358
155374
  };
155359
155375
 
155360
155376
  // cli/check/register.ts
155377
+ var check = async (file) => {
155378
+ const resolvedInputFilePath = await resolveCheckInputFilePath(file);
155379
+ const circuitJson = await getCircuitJsonForCheck({
155380
+ filePath: resolvedInputFilePath,
155381
+ platformConfig: {},
155382
+ allowPrebuiltCircuitJson: true
155383
+ });
155384
+ return formatCircuitJsonDiagnostics(analyzeCircuitJson(circuitJson));
155385
+ };
155361
155386
  var registerCheck = (program2) => {
155362
- program2.command("check").description("Partially build and validate circuit artifacts");
155387
+ program2.command("check").description("Partially build and validate circuit artifacts").argument("[file]", "Path to the entry file").action(async (file) => {
155388
+ try {
155389
+ console.log(await check(file));
155390
+ } catch (error) {
155391
+ console.error(error instanceof Error ? error.message : String(error));
155392
+ process.exit(1);
155393
+ }
155394
+ });
155363
155395
  };
155364
155396
 
155365
155397
  // node_modules/@tscircuit/circuit-json-routing-analysis/dist/index.js
@@ -162764,10 +162796,10 @@ Error generating stack: ` + x22.message + `
162764
162796
  var tag = node.tag;
162765
162797
  if ((tag === 0 || tag === 11 || tag === 15) && node.flags & 16384 && (tag = node.updateQueue, tag !== null && (tag = tag.stores, tag !== null)))
162766
162798
  for (var i3 = 0;i3 < tag.length; i3++) {
162767
- var check = tag[i3], getSnapshot = check.getSnapshot;
162768
- check = check.value;
162799
+ var check2 = tag[i3], getSnapshot = check2.getSnapshot;
162800
+ check2 = check2.value;
162769
162801
  try {
162770
- if (!objectIs(getSnapshot(), check))
162802
+ if (!objectIs(getSnapshot(), check2))
162771
162803
  return false;
162772
162804
  } catch (error2) {
162773
162805
  return false;
@@ -170804,10 +170836,10 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
170804
170836
  var tag = node.tag;
170805
170837
  if ((tag === 0 || tag === 11 || tag === 15) && node.flags & 16384 && (tag = node.updateQueue, tag !== null && (tag = tag.stores, tag !== null)))
170806
170838
  for (var i3 = 0;i3 < tag.length; i3++) {
170807
- var check = tag[i3], getSnapshot = check.getSnapshot;
170808
- check = check.value;
170839
+ var check2 = tag[i3], getSnapshot = check2.getSnapshot;
170840
+ check2 = check2.value;
170809
170841
  try {
170810
- if (!objectIs(getSnapshot(), check))
170842
+ if (!objectIs(getSnapshot(), check2))
170811
170843
  return false;
170812
170844
  } catch (error2) {
170813
170845
  return false;
@@ -217794,7 +217826,7 @@ var ZodType = class {
217794
217826
  const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
217795
217827
  return handleResult(ctx, result);
217796
217828
  }
217797
- refine(check, message) {
217829
+ refine(check2, message) {
217798
217830
  const getIssueProperties = (val) => {
217799
217831
  if (typeof message === "string" || typeof message === "undefined") {
217800
217832
  return { message };
@@ -217805,7 +217837,7 @@ var ZodType = class {
217805
217837
  }
217806
217838
  };
217807
217839
  return this._refinement((val, ctx) => {
217808
- const result = check(val);
217840
+ const result = check2(val);
217809
217841
  const setError = () => ctx.addIssue({
217810
217842
  code: ZodIssueCode.custom,
217811
217843
  ...getIssueProperties(val)
@@ -217828,9 +217860,9 @@ var ZodType = class {
217828
217860
  }
217829
217861
  });
217830
217862
  }
217831
- refinement(check, refinementData) {
217863
+ refinement(check2, refinementData) {
217832
217864
  return this._refinement((val, ctx) => {
217833
- if (!check(val)) {
217865
+ if (!check2(val)) {
217834
217866
  ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
217835
217867
  return false;
217836
217868
  } else {
@@ -218052,70 +218084,70 @@ var ZodString = class _ZodString extends ZodType {
218052
218084
  }
218053
218085
  const status = new ParseStatus;
218054
218086
  let ctx = undefined;
218055
- for (const check of this._def.checks) {
218056
- if (check.kind === "min") {
218057
- if (input.data.length < check.value) {
218087
+ for (const check2 of this._def.checks) {
218088
+ if (check2.kind === "min") {
218089
+ if (input.data.length < check2.value) {
218058
218090
  ctx = this._getOrReturnCtx(input, ctx);
218059
218091
  addIssueToContext(ctx, {
218060
218092
  code: ZodIssueCode.too_small,
218061
- minimum: check.value,
218093
+ minimum: check2.value,
218062
218094
  type: "string",
218063
218095
  inclusive: true,
218064
218096
  exact: false,
218065
- message: check.message
218097
+ message: check2.message
218066
218098
  });
218067
218099
  status.dirty();
218068
218100
  }
218069
- } else if (check.kind === "max") {
218070
- if (input.data.length > check.value) {
218101
+ } else if (check2.kind === "max") {
218102
+ if (input.data.length > check2.value) {
218071
218103
  ctx = this._getOrReturnCtx(input, ctx);
218072
218104
  addIssueToContext(ctx, {
218073
218105
  code: ZodIssueCode.too_big,
218074
- maximum: check.value,
218106
+ maximum: check2.value,
218075
218107
  type: "string",
218076
218108
  inclusive: true,
218077
218109
  exact: false,
218078
- message: check.message
218110
+ message: check2.message
218079
218111
  });
218080
218112
  status.dirty();
218081
218113
  }
218082
- } else if (check.kind === "length") {
218083
- const tooBig = input.data.length > check.value;
218084
- const tooSmall = input.data.length < check.value;
218114
+ } else if (check2.kind === "length") {
218115
+ const tooBig = input.data.length > check2.value;
218116
+ const tooSmall = input.data.length < check2.value;
218085
218117
  if (tooBig || tooSmall) {
218086
218118
  ctx = this._getOrReturnCtx(input, ctx);
218087
218119
  if (tooBig) {
218088
218120
  addIssueToContext(ctx, {
218089
218121
  code: ZodIssueCode.too_big,
218090
- maximum: check.value,
218122
+ maximum: check2.value,
218091
218123
  type: "string",
218092
218124
  inclusive: true,
218093
218125
  exact: true,
218094
- message: check.message
218126
+ message: check2.message
218095
218127
  });
218096
218128
  } else if (tooSmall) {
218097
218129
  addIssueToContext(ctx, {
218098
218130
  code: ZodIssueCode.too_small,
218099
- minimum: check.value,
218131
+ minimum: check2.value,
218100
218132
  type: "string",
218101
218133
  inclusive: true,
218102
218134
  exact: true,
218103
- message: check.message
218135
+ message: check2.message
218104
218136
  });
218105
218137
  }
218106
218138
  status.dirty();
218107
218139
  }
218108
- } else if (check.kind === "email") {
218140
+ } else if (check2.kind === "email") {
218109
218141
  if (!emailRegex.test(input.data)) {
218110
218142
  ctx = this._getOrReturnCtx(input, ctx);
218111
218143
  addIssueToContext(ctx, {
218112
218144
  validation: "email",
218113
218145
  code: ZodIssueCode.invalid_string,
218114
- message: check.message
218146
+ message: check2.message
218115
218147
  });
218116
218148
  status.dirty();
218117
218149
  }
218118
- } else if (check.kind === "emoji") {
218150
+ } else if (check2.kind === "emoji") {
218119
218151
  if (!emojiRegex) {
218120
218152
  emojiRegex = new RegExp(_emojiRegex, "u");
218121
218153
  }
@@ -218124,61 +218156,61 @@ var ZodString = class _ZodString extends ZodType {
218124
218156
  addIssueToContext(ctx, {
218125
218157
  validation: "emoji",
218126
218158
  code: ZodIssueCode.invalid_string,
218127
- message: check.message
218159
+ message: check2.message
218128
218160
  });
218129
218161
  status.dirty();
218130
218162
  }
218131
- } else if (check.kind === "uuid") {
218163
+ } else if (check2.kind === "uuid") {
218132
218164
  if (!uuidRegex.test(input.data)) {
218133
218165
  ctx = this._getOrReturnCtx(input, ctx);
218134
218166
  addIssueToContext(ctx, {
218135
218167
  validation: "uuid",
218136
218168
  code: ZodIssueCode.invalid_string,
218137
- message: check.message
218169
+ message: check2.message
218138
218170
  });
218139
218171
  status.dirty();
218140
218172
  }
218141
- } else if (check.kind === "nanoid") {
218173
+ } else if (check2.kind === "nanoid") {
218142
218174
  if (!nanoidRegex.test(input.data)) {
218143
218175
  ctx = this._getOrReturnCtx(input, ctx);
218144
218176
  addIssueToContext(ctx, {
218145
218177
  validation: "nanoid",
218146
218178
  code: ZodIssueCode.invalid_string,
218147
- message: check.message
218179
+ message: check2.message
218148
218180
  });
218149
218181
  status.dirty();
218150
218182
  }
218151
- } else if (check.kind === "cuid") {
218183
+ } else if (check2.kind === "cuid") {
218152
218184
  if (!cuidRegex.test(input.data)) {
218153
218185
  ctx = this._getOrReturnCtx(input, ctx);
218154
218186
  addIssueToContext(ctx, {
218155
218187
  validation: "cuid",
218156
218188
  code: ZodIssueCode.invalid_string,
218157
- message: check.message
218189
+ message: check2.message
218158
218190
  });
218159
218191
  status.dirty();
218160
218192
  }
218161
- } else if (check.kind === "cuid2") {
218193
+ } else if (check2.kind === "cuid2") {
218162
218194
  if (!cuid2Regex.test(input.data)) {
218163
218195
  ctx = this._getOrReturnCtx(input, ctx);
218164
218196
  addIssueToContext(ctx, {
218165
218197
  validation: "cuid2",
218166
218198
  code: ZodIssueCode.invalid_string,
218167
- message: check.message
218199
+ message: check2.message
218168
218200
  });
218169
218201
  status.dirty();
218170
218202
  }
218171
- } else if (check.kind === "ulid") {
218203
+ } else if (check2.kind === "ulid") {
218172
218204
  if (!ulidRegex.test(input.data)) {
218173
218205
  ctx = this._getOrReturnCtx(input, ctx);
218174
218206
  addIssueToContext(ctx, {
218175
218207
  validation: "ulid",
218176
218208
  code: ZodIssueCode.invalid_string,
218177
- message: check.message
218209
+ message: check2.message
218178
218210
  });
218179
218211
  status.dirty();
218180
218212
  }
218181
- } else if (check.kind === "url") {
218213
+ } else if (check2.kind === "url") {
218182
218214
  try {
218183
218215
  new URL(input.data);
218184
218216
  } catch {
@@ -218186,153 +218218,153 @@ var ZodString = class _ZodString extends ZodType {
218186
218218
  addIssueToContext(ctx, {
218187
218219
  validation: "url",
218188
218220
  code: ZodIssueCode.invalid_string,
218189
- message: check.message
218221
+ message: check2.message
218190
218222
  });
218191
218223
  status.dirty();
218192
218224
  }
218193
- } else if (check.kind === "regex") {
218194
- check.regex.lastIndex = 0;
218195
- const testResult = check.regex.test(input.data);
218225
+ } else if (check2.kind === "regex") {
218226
+ check2.regex.lastIndex = 0;
218227
+ const testResult = check2.regex.test(input.data);
218196
218228
  if (!testResult) {
218197
218229
  ctx = this._getOrReturnCtx(input, ctx);
218198
218230
  addIssueToContext(ctx, {
218199
218231
  validation: "regex",
218200
218232
  code: ZodIssueCode.invalid_string,
218201
- message: check.message
218233
+ message: check2.message
218202
218234
  });
218203
218235
  status.dirty();
218204
218236
  }
218205
- } else if (check.kind === "trim") {
218237
+ } else if (check2.kind === "trim") {
218206
218238
  input.data = input.data.trim();
218207
- } else if (check.kind === "includes") {
218208
- if (!input.data.includes(check.value, check.position)) {
218239
+ } else if (check2.kind === "includes") {
218240
+ if (!input.data.includes(check2.value, check2.position)) {
218209
218241
  ctx = this._getOrReturnCtx(input, ctx);
218210
218242
  addIssueToContext(ctx, {
218211
218243
  code: ZodIssueCode.invalid_string,
218212
- validation: { includes: check.value, position: check.position },
218213
- message: check.message
218244
+ validation: { includes: check2.value, position: check2.position },
218245
+ message: check2.message
218214
218246
  });
218215
218247
  status.dirty();
218216
218248
  }
218217
- } else if (check.kind === "toLowerCase") {
218249
+ } else if (check2.kind === "toLowerCase") {
218218
218250
  input.data = input.data.toLowerCase();
218219
- } else if (check.kind === "toUpperCase") {
218251
+ } else if (check2.kind === "toUpperCase") {
218220
218252
  input.data = input.data.toUpperCase();
218221
- } else if (check.kind === "startsWith") {
218222
- if (!input.data.startsWith(check.value)) {
218253
+ } else if (check2.kind === "startsWith") {
218254
+ if (!input.data.startsWith(check2.value)) {
218223
218255
  ctx = this._getOrReturnCtx(input, ctx);
218224
218256
  addIssueToContext(ctx, {
218225
218257
  code: ZodIssueCode.invalid_string,
218226
- validation: { startsWith: check.value },
218227
- message: check.message
218258
+ validation: { startsWith: check2.value },
218259
+ message: check2.message
218228
218260
  });
218229
218261
  status.dirty();
218230
218262
  }
218231
- } else if (check.kind === "endsWith") {
218232
- if (!input.data.endsWith(check.value)) {
218263
+ } else if (check2.kind === "endsWith") {
218264
+ if (!input.data.endsWith(check2.value)) {
218233
218265
  ctx = this._getOrReturnCtx(input, ctx);
218234
218266
  addIssueToContext(ctx, {
218235
218267
  code: ZodIssueCode.invalid_string,
218236
- validation: { endsWith: check.value },
218237
- message: check.message
218268
+ validation: { endsWith: check2.value },
218269
+ message: check2.message
218238
218270
  });
218239
218271
  status.dirty();
218240
218272
  }
218241
- } else if (check.kind === "datetime") {
218242
- const regex = datetimeRegex(check);
218273
+ } else if (check2.kind === "datetime") {
218274
+ const regex = datetimeRegex(check2);
218243
218275
  if (!regex.test(input.data)) {
218244
218276
  ctx = this._getOrReturnCtx(input, ctx);
218245
218277
  addIssueToContext(ctx, {
218246
218278
  code: ZodIssueCode.invalid_string,
218247
218279
  validation: "datetime",
218248
- message: check.message
218280
+ message: check2.message
218249
218281
  });
218250
218282
  status.dirty();
218251
218283
  }
218252
- } else if (check.kind === "date") {
218284
+ } else if (check2.kind === "date") {
218253
218285
  const regex = dateRegex;
218254
218286
  if (!regex.test(input.data)) {
218255
218287
  ctx = this._getOrReturnCtx(input, ctx);
218256
218288
  addIssueToContext(ctx, {
218257
218289
  code: ZodIssueCode.invalid_string,
218258
218290
  validation: "date",
218259
- message: check.message
218291
+ message: check2.message
218260
218292
  });
218261
218293
  status.dirty();
218262
218294
  }
218263
- } else if (check.kind === "time") {
218264
- const regex = timeRegex(check);
218295
+ } else if (check2.kind === "time") {
218296
+ const regex = timeRegex(check2);
218265
218297
  if (!regex.test(input.data)) {
218266
218298
  ctx = this._getOrReturnCtx(input, ctx);
218267
218299
  addIssueToContext(ctx, {
218268
218300
  code: ZodIssueCode.invalid_string,
218269
218301
  validation: "time",
218270
- message: check.message
218302
+ message: check2.message
218271
218303
  });
218272
218304
  status.dirty();
218273
218305
  }
218274
- } else if (check.kind === "duration") {
218306
+ } else if (check2.kind === "duration") {
218275
218307
  if (!durationRegex.test(input.data)) {
218276
218308
  ctx = this._getOrReturnCtx(input, ctx);
218277
218309
  addIssueToContext(ctx, {
218278
218310
  validation: "duration",
218279
218311
  code: ZodIssueCode.invalid_string,
218280
- message: check.message
218312
+ message: check2.message
218281
218313
  });
218282
218314
  status.dirty();
218283
218315
  }
218284
- } else if (check.kind === "ip") {
218285
- if (!isValidIP(input.data, check.version)) {
218316
+ } else if (check2.kind === "ip") {
218317
+ if (!isValidIP(input.data, check2.version)) {
218286
218318
  ctx = this._getOrReturnCtx(input, ctx);
218287
218319
  addIssueToContext(ctx, {
218288
218320
  validation: "ip",
218289
218321
  code: ZodIssueCode.invalid_string,
218290
- message: check.message
218322
+ message: check2.message
218291
218323
  });
218292
218324
  status.dirty();
218293
218325
  }
218294
- } else if (check.kind === "jwt") {
218295
- if (!isValidJWT(input.data, check.alg)) {
218326
+ } else if (check2.kind === "jwt") {
218327
+ if (!isValidJWT(input.data, check2.alg)) {
218296
218328
  ctx = this._getOrReturnCtx(input, ctx);
218297
218329
  addIssueToContext(ctx, {
218298
218330
  validation: "jwt",
218299
218331
  code: ZodIssueCode.invalid_string,
218300
- message: check.message
218332
+ message: check2.message
218301
218333
  });
218302
218334
  status.dirty();
218303
218335
  }
218304
- } else if (check.kind === "cidr") {
218305
- if (!isValidCidr(input.data, check.version)) {
218336
+ } else if (check2.kind === "cidr") {
218337
+ if (!isValidCidr(input.data, check2.version)) {
218306
218338
  ctx = this._getOrReturnCtx(input, ctx);
218307
218339
  addIssueToContext(ctx, {
218308
218340
  validation: "cidr",
218309
218341
  code: ZodIssueCode.invalid_string,
218310
- message: check.message
218342
+ message: check2.message
218311
218343
  });
218312
218344
  status.dirty();
218313
218345
  }
218314
- } else if (check.kind === "base64") {
218346
+ } else if (check2.kind === "base64") {
218315
218347
  if (!base64Regex.test(input.data)) {
218316
218348
  ctx = this._getOrReturnCtx(input, ctx);
218317
218349
  addIssueToContext(ctx, {
218318
218350
  validation: "base64",
218319
218351
  code: ZodIssueCode.invalid_string,
218320
- message: check.message
218352
+ message: check2.message
218321
218353
  });
218322
218354
  status.dirty();
218323
218355
  }
218324
- } else if (check.kind === "base64url") {
218356
+ } else if (check2.kind === "base64url") {
218325
218357
  if (!base64urlRegex.test(input.data)) {
218326
218358
  ctx = this._getOrReturnCtx(input, ctx);
218327
218359
  addIssueToContext(ctx, {
218328
218360
  validation: "base64url",
218329
218361
  code: ZodIssueCode.invalid_string,
218330
- message: check.message
218362
+ message: check2.message
218331
218363
  });
218332
218364
  status.dirty();
218333
218365
  }
218334
218366
  } else {
218335
- util.assertNever(check);
218367
+ util.assertNever(check2);
218336
218368
  }
218337
218369
  }
218338
218370
  return { status: status.value, value: input.data };
@@ -218344,10 +218376,10 @@ var ZodString = class _ZodString extends ZodType {
218344
218376
  ...errorUtil.errToObj(message)
218345
218377
  });
218346
218378
  }
218347
- _addCheck(check) {
218379
+ _addCheck(check2) {
218348
218380
  return new _ZodString({
218349
218381
  ...this._def,
218350
- checks: [...this._def.checks, check]
218382
+ checks: [...this._def.checks, check2]
218351
218383
  });
218352
218384
  }
218353
218385
  email(message) {
@@ -218609,67 +218641,67 @@ var ZodNumber = class _ZodNumber extends ZodType {
218609
218641
  }
218610
218642
  let ctx = undefined;
218611
218643
  const status = new ParseStatus;
218612
- for (const check of this._def.checks) {
218613
- if (check.kind === "int") {
218644
+ for (const check2 of this._def.checks) {
218645
+ if (check2.kind === "int") {
218614
218646
  if (!util.isInteger(input.data)) {
218615
218647
  ctx = this._getOrReturnCtx(input, ctx);
218616
218648
  addIssueToContext(ctx, {
218617
218649
  code: ZodIssueCode.invalid_type,
218618
218650
  expected: "integer",
218619
218651
  received: "float",
218620
- message: check.message
218652
+ message: check2.message
218621
218653
  });
218622
218654
  status.dirty();
218623
218655
  }
218624
- } else if (check.kind === "min") {
218625
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
218656
+ } else if (check2.kind === "min") {
218657
+ const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value;
218626
218658
  if (tooSmall) {
218627
218659
  ctx = this._getOrReturnCtx(input, ctx);
218628
218660
  addIssueToContext(ctx, {
218629
218661
  code: ZodIssueCode.too_small,
218630
- minimum: check.value,
218662
+ minimum: check2.value,
218631
218663
  type: "number",
218632
- inclusive: check.inclusive,
218664
+ inclusive: check2.inclusive,
218633
218665
  exact: false,
218634
- message: check.message
218666
+ message: check2.message
218635
218667
  });
218636
218668
  status.dirty();
218637
218669
  }
218638
- } else if (check.kind === "max") {
218639
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
218670
+ } else if (check2.kind === "max") {
218671
+ const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value;
218640
218672
  if (tooBig) {
218641
218673
  ctx = this._getOrReturnCtx(input, ctx);
218642
218674
  addIssueToContext(ctx, {
218643
218675
  code: ZodIssueCode.too_big,
218644
- maximum: check.value,
218676
+ maximum: check2.value,
218645
218677
  type: "number",
218646
- inclusive: check.inclusive,
218678
+ inclusive: check2.inclusive,
218647
218679
  exact: false,
218648
- message: check.message
218680
+ message: check2.message
218649
218681
  });
218650
218682
  status.dirty();
218651
218683
  }
218652
- } else if (check.kind === "multipleOf") {
218653
- if (floatSafeRemainder(input.data, check.value) !== 0) {
218684
+ } else if (check2.kind === "multipleOf") {
218685
+ if (floatSafeRemainder(input.data, check2.value) !== 0) {
218654
218686
  ctx = this._getOrReturnCtx(input, ctx);
218655
218687
  addIssueToContext(ctx, {
218656
218688
  code: ZodIssueCode.not_multiple_of,
218657
- multipleOf: check.value,
218658
- message: check.message
218689
+ multipleOf: check2.value,
218690
+ message: check2.message
218659
218691
  });
218660
218692
  status.dirty();
218661
218693
  }
218662
- } else if (check.kind === "finite") {
218694
+ } else if (check2.kind === "finite") {
218663
218695
  if (!Number.isFinite(input.data)) {
218664
218696
  ctx = this._getOrReturnCtx(input, ctx);
218665
218697
  addIssueToContext(ctx, {
218666
218698
  code: ZodIssueCode.not_finite,
218667
- message: check.message
218699
+ message: check2.message
218668
218700
  });
218669
218701
  status.dirty();
218670
218702
  }
218671
218703
  } else {
218672
- util.assertNever(check);
218704
+ util.assertNever(check2);
218673
218705
  }
218674
218706
  }
218675
218707
  return { status: status.value, value: input.data };
@@ -218700,10 +218732,10 @@ var ZodNumber = class _ZodNumber extends ZodType {
218700
218732
  ]
218701
218733
  });
218702
218734
  }
218703
- _addCheck(check) {
218735
+ _addCheck(check2) {
218704
218736
  return new _ZodNumber({
218705
218737
  ...this._def,
218706
- checks: [...this._def.checks, check]
218738
+ checks: [...this._def.checks, check2]
218707
218739
  });
218708
218740
  }
218709
218741
  int(message) {
@@ -218838,45 +218870,45 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
218838
218870
  }
218839
218871
  let ctx = undefined;
218840
218872
  const status = new ParseStatus;
218841
- for (const check of this._def.checks) {
218842
- if (check.kind === "min") {
218843
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
218873
+ for (const check2 of this._def.checks) {
218874
+ if (check2.kind === "min") {
218875
+ const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value;
218844
218876
  if (tooSmall) {
218845
218877
  ctx = this._getOrReturnCtx(input, ctx);
218846
218878
  addIssueToContext(ctx, {
218847
218879
  code: ZodIssueCode.too_small,
218848
218880
  type: "bigint",
218849
- minimum: check.value,
218850
- inclusive: check.inclusive,
218851
- message: check.message
218881
+ minimum: check2.value,
218882
+ inclusive: check2.inclusive,
218883
+ message: check2.message
218852
218884
  });
218853
218885
  status.dirty();
218854
218886
  }
218855
- } else if (check.kind === "max") {
218856
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
218887
+ } else if (check2.kind === "max") {
218888
+ const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value;
218857
218889
  if (tooBig) {
218858
218890
  ctx = this._getOrReturnCtx(input, ctx);
218859
218891
  addIssueToContext(ctx, {
218860
218892
  code: ZodIssueCode.too_big,
218861
218893
  type: "bigint",
218862
- maximum: check.value,
218863
- inclusive: check.inclusive,
218864
- message: check.message
218894
+ maximum: check2.value,
218895
+ inclusive: check2.inclusive,
218896
+ message: check2.message
218865
218897
  });
218866
218898
  status.dirty();
218867
218899
  }
218868
- } else if (check.kind === "multipleOf") {
218869
- if (input.data % check.value !== BigInt(0)) {
218900
+ } else if (check2.kind === "multipleOf") {
218901
+ if (input.data % check2.value !== BigInt(0)) {
218870
218902
  ctx = this._getOrReturnCtx(input, ctx);
218871
218903
  addIssueToContext(ctx, {
218872
218904
  code: ZodIssueCode.not_multiple_of,
218873
- multipleOf: check.value,
218874
- message: check.message
218905
+ multipleOf: check2.value,
218906
+ message: check2.message
218875
218907
  });
218876
218908
  status.dirty();
218877
218909
  }
218878
218910
  } else {
218879
- util.assertNever(check);
218911
+ util.assertNever(check2);
218880
218912
  }
218881
218913
  }
218882
218914
  return { status: status.value, value: input.data };
@@ -218916,10 +218948,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
218916
218948
  ]
218917
218949
  });
218918
218950
  }
218919
- _addCheck(check) {
218951
+ _addCheck(check2) {
218920
218952
  return new _ZodBigInt({
218921
218953
  ...this._def,
218922
- checks: [...this._def.checks, check]
218954
+ checks: [...this._def.checks, check2]
218923
218955
  });
218924
218956
  }
218925
218957
  positive(message) {
@@ -219039,35 +219071,35 @@ var ZodDate = class _ZodDate extends ZodType {
219039
219071
  }
219040
219072
  const status = new ParseStatus;
219041
219073
  let ctx = undefined;
219042
- for (const check of this._def.checks) {
219043
- if (check.kind === "min") {
219044
- if (input.data.getTime() < check.value) {
219074
+ for (const check2 of this._def.checks) {
219075
+ if (check2.kind === "min") {
219076
+ if (input.data.getTime() < check2.value) {
219045
219077
  ctx = this._getOrReturnCtx(input, ctx);
219046
219078
  addIssueToContext(ctx, {
219047
219079
  code: ZodIssueCode.too_small,
219048
- message: check.message,
219080
+ message: check2.message,
219049
219081
  inclusive: true,
219050
219082
  exact: false,
219051
- minimum: check.value,
219083
+ minimum: check2.value,
219052
219084
  type: "date"
219053
219085
  });
219054
219086
  status.dirty();
219055
219087
  }
219056
- } else if (check.kind === "max") {
219057
- if (input.data.getTime() > check.value) {
219088
+ } else if (check2.kind === "max") {
219089
+ if (input.data.getTime() > check2.value) {
219058
219090
  ctx = this._getOrReturnCtx(input, ctx);
219059
219091
  addIssueToContext(ctx, {
219060
219092
  code: ZodIssueCode.too_big,
219061
- message: check.message,
219093
+ message: check2.message,
219062
219094
  inclusive: true,
219063
219095
  exact: false,
219064
- maximum: check.value,
219096
+ maximum: check2.value,
219065
219097
  type: "date"
219066
219098
  });
219067
219099
  status.dirty();
219068
219100
  }
219069
219101
  } else {
219070
- util.assertNever(check);
219102
+ util.assertNever(check2);
219071
219103
  }
219072
219104
  }
219073
219105
  return {
@@ -219075,10 +219107,10 @@ var ZodDate = class _ZodDate extends ZodType {
219075
219107
  value: new Date(input.data.getTime())
219076
219108
  };
219077
219109
  }
219078
- _addCheck(check) {
219110
+ _addCheck(check2) {
219079
219111
  return new _ZodDate({
219080
219112
  ...this._def,
219081
- checks: [...this._def.checks, check]
219113
+ checks: [...this._def.checks, check2]
219082
219114
  });
219083
219115
  }
219084
219116
  min(minDate, message) {
@@ -220846,10 +220878,10 @@ function cleanParams(params2, data) {
220846
220878
  const p22 = typeof p3 === "string" ? { message: p3 } : p3;
220847
220879
  return p22;
220848
220880
  }
220849
- function custom(check, _params = {}, fatal) {
220850
- if (check)
220881
+ function custom(check2, _params = {}, fatal) {
220882
+ if (check2)
220851
220883
  return ZodAny.create().superRefine((data, ctx) => {
220852
- const r32 = check(data);
220884
+ const r32 = check2(data);
220853
220885
  if (r32 instanceof Promise) {
220854
220886
  return r32.then((r4) => {
220855
220887
  if (!r4) {
@@ -302084,6 +302116,37 @@ var registerCheckShorts = (program2) => {
302084
302116
  });
302085
302117
  };
302086
302118
 
302119
+ // cli/check/source/register.ts
302120
+ import { categorizeErrorOrWarning as categorizeErrorOrWarning4 } from "@tscircuit/circuit-json-util";
302121
+ var isSourceDiagnostic = (issue) => categorizeErrorOrWarning4(issue) === "source";
302122
+ var checkSource = async (file) => {
302123
+ const resolvedInputFilePath = await resolveCheckInputFilePath(file);
302124
+ const circuitJson = await getCircuitJsonForCheck({
302125
+ filePath: resolvedInputFilePath,
302126
+ platformConfig: {
302127
+ pcbDisabled: true,
302128
+ routingDisabled: true,
302129
+ placementDrcChecksDisabled: true
302130
+ },
302131
+ allowPrebuiltCircuitJson: true
302132
+ });
302133
+ const diagnostics = analyzeCircuitJson(circuitJson);
302134
+ return formatCircuitJsonDiagnostics({
302135
+ errors: diagnostics.errors.filter(isSourceDiagnostic),
302136
+ warnings: diagnostics.warnings.filter(isSourceDiagnostic)
302137
+ });
302138
+ };
302139
+ var registerCheckSource = (program2) => {
302140
+ program2.commands.find((command) => command.name() === "check").command("source").description("Partially build and validate source diagnostics").argument("[file]", "Path to the entry file").action(async (file) => {
302141
+ try {
302142
+ console.log(await checkSource(file));
302143
+ } catch (error2) {
302144
+ console.error(error2 instanceof Error ? error2.message : String(error2));
302145
+ process.exit(1);
302146
+ }
302147
+ });
302148
+ };
302149
+
302087
302150
  // cli/check/trace-length/register.ts
302088
302151
  import path50 from "node:path";
302089
302152
  var loadTraceLengthAnalyzer = async () => {
@@ -314020,7 +314083,7 @@ var ZodType2 = class {
314020
314083
  const result = await (isAsync2(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
314021
314084
  return handleResult2(ctx, result);
314022
314085
  }
314023
- refine(check, message) {
314086
+ refine(check2, message) {
314024
314087
  const getIssueProperties = (val) => {
314025
314088
  if (typeof message === "string" || typeof message === "undefined") {
314026
314089
  return { message };
@@ -314031,7 +314094,7 @@ var ZodType2 = class {
314031
314094
  }
314032
314095
  };
314033
314096
  return this._refinement((val, ctx) => {
314034
- const result = check(val);
314097
+ const result = check2(val);
314035
314098
  const setError = () => ctx.addIssue({
314036
314099
  code: ZodIssueCode2.custom,
314037
314100
  ...getIssueProperties(val)
@@ -314054,9 +314117,9 @@ var ZodType2 = class {
314054
314117
  }
314055
314118
  });
314056
314119
  }
314057
- refinement(check, refinementData) {
314120
+ refinement(check2, refinementData) {
314058
314121
  return this._refinement((val, ctx) => {
314059
- if (!check(val)) {
314122
+ if (!check2(val)) {
314060
314123
  ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
314061
314124
  return false;
314062
314125
  } else {
@@ -314278,70 +314341,70 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
314278
314341
  }
314279
314342
  const status = new ParseStatus2;
314280
314343
  let ctx = undefined;
314281
- for (const check of this._def.checks) {
314282
- if (check.kind === "min") {
314283
- if (input.data.length < check.value) {
314344
+ for (const check2 of this._def.checks) {
314345
+ if (check2.kind === "min") {
314346
+ if (input.data.length < check2.value) {
314284
314347
  ctx = this._getOrReturnCtx(input, ctx);
314285
314348
  addIssueToContext2(ctx, {
314286
314349
  code: ZodIssueCode2.too_small,
314287
- minimum: check.value,
314350
+ minimum: check2.value,
314288
314351
  type: "string",
314289
314352
  inclusive: true,
314290
314353
  exact: false,
314291
- message: check.message
314354
+ message: check2.message
314292
314355
  });
314293
314356
  status.dirty();
314294
314357
  }
314295
- } else if (check.kind === "max") {
314296
- if (input.data.length > check.value) {
314358
+ } else if (check2.kind === "max") {
314359
+ if (input.data.length > check2.value) {
314297
314360
  ctx = this._getOrReturnCtx(input, ctx);
314298
314361
  addIssueToContext2(ctx, {
314299
314362
  code: ZodIssueCode2.too_big,
314300
- maximum: check.value,
314363
+ maximum: check2.value,
314301
314364
  type: "string",
314302
314365
  inclusive: true,
314303
314366
  exact: false,
314304
- message: check.message
314367
+ message: check2.message
314305
314368
  });
314306
314369
  status.dirty();
314307
314370
  }
314308
- } else if (check.kind === "length") {
314309
- const tooBig = input.data.length > check.value;
314310
- const tooSmall = input.data.length < check.value;
314371
+ } else if (check2.kind === "length") {
314372
+ const tooBig = input.data.length > check2.value;
314373
+ const tooSmall = input.data.length < check2.value;
314311
314374
  if (tooBig || tooSmall) {
314312
314375
  ctx = this._getOrReturnCtx(input, ctx);
314313
314376
  if (tooBig) {
314314
314377
  addIssueToContext2(ctx, {
314315
314378
  code: ZodIssueCode2.too_big,
314316
- maximum: check.value,
314379
+ maximum: check2.value,
314317
314380
  type: "string",
314318
314381
  inclusive: true,
314319
314382
  exact: true,
314320
- message: check.message
314383
+ message: check2.message
314321
314384
  });
314322
314385
  } else if (tooSmall) {
314323
314386
  addIssueToContext2(ctx, {
314324
314387
  code: ZodIssueCode2.too_small,
314325
- minimum: check.value,
314388
+ minimum: check2.value,
314326
314389
  type: "string",
314327
314390
  inclusive: true,
314328
314391
  exact: true,
314329
- message: check.message
314392
+ message: check2.message
314330
314393
  });
314331
314394
  }
314332
314395
  status.dirty();
314333
314396
  }
314334
- } else if (check.kind === "email") {
314397
+ } else if (check2.kind === "email") {
314335
314398
  if (!emailRegex2.test(input.data)) {
314336
314399
  ctx = this._getOrReturnCtx(input, ctx);
314337
314400
  addIssueToContext2(ctx, {
314338
314401
  validation: "email",
314339
314402
  code: ZodIssueCode2.invalid_string,
314340
- message: check.message
314403
+ message: check2.message
314341
314404
  });
314342
314405
  status.dirty();
314343
314406
  }
314344
- } else if (check.kind === "emoji") {
314407
+ } else if (check2.kind === "emoji") {
314345
314408
  if (!emojiRegex3) {
314346
314409
  emojiRegex3 = new RegExp(_emojiRegex2, "u");
314347
314410
  }
@@ -314350,61 +314413,61 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
314350
314413
  addIssueToContext2(ctx, {
314351
314414
  validation: "emoji",
314352
314415
  code: ZodIssueCode2.invalid_string,
314353
- message: check.message
314416
+ message: check2.message
314354
314417
  });
314355
314418
  status.dirty();
314356
314419
  }
314357
- } else if (check.kind === "uuid") {
314420
+ } else if (check2.kind === "uuid") {
314358
314421
  if (!uuidRegex2.test(input.data)) {
314359
314422
  ctx = this._getOrReturnCtx(input, ctx);
314360
314423
  addIssueToContext2(ctx, {
314361
314424
  validation: "uuid",
314362
314425
  code: ZodIssueCode2.invalid_string,
314363
- message: check.message
314426
+ message: check2.message
314364
314427
  });
314365
314428
  status.dirty();
314366
314429
  }
314367
- } else if (check.kind === "nanoid") {
314430
+ } else if (check2.kind === "nanoid") {
314368
314431
  if (!nanoidRegex2.test(input.data)) {
314369
314432
  ctx = this._getOrReturnCtx(input, ctx);
314370
314433
  addIssueToContext2(ctx, {
314371
314434
  validation: "nanoid",
314372
314435
  code: ZodIssueCode2.invalid_string,
314373
- message: check.message
314436
+ message: check2.message
314374
314437
  });
314375
314438
  status.dirty();
314376
314439
  }
314377
- } else if (check.kind === "cuid") {
314440
+ } else if (check2.kind === "cuid") {
314378
314441
  if (!cuidRegex2.test(input.data)) {
314379
314442
  ctx = this._getOrReturnCtx(input, ctx);
314380
314443
  addIssueToContext2(ctx, {
314381
314444
  validation: "cuid",
314382
314445
  code: ZodIssueCode2.invalid_string,
314383
- message: check.message
314446
+ message: check2.message
314384
314447
  });
314385
314448
  status.dirty();
314386
314449
  }
314387
- } else if (check.kind === "cuid2") {
314450
+ } else if (check2.kind === "cuid2") {
314388
314451
  if (!cuid2Regex2.test(input.data)) {
314389
314452
  ctx = this._getOrReturnCtx(input, ctx);
314390
314453
  addIssueToContext2(ctx, {
314391
314454
  validation: "cuid2",
314392
314455
  code: ZodIssueCode2.invalid_string,
314393
- message: check.message
314456
+ message: check2.message
314394
314457
  });
314395
314458
  status.dirty();
314396
314459
  }
314397
- } else if (check.kind === "ulid") {
314460
+ } else if (check2.kind === "ulid") {
314398
314461
  if (!ulidRegex2.test(input.data)) {
314399
314462
  ctx = this._getOrReturnCtx(input, ctx);
314400
314463
  addIssueToContext2(ctx, {
314401
314464
  validation: "ulid",
314402
314465
  code: ZodIssueCode2.invalid_string,
314403
- message: check.message
314466
+ message: check2.message
314404
314467
  });
314405
314468
  status.dirty();
314406
314469
  }
314407
- } else if (check.kind === "url") {
314470
+ } else if (check2.kind === "url") {
314408
314471
  try {
314409
314472
  new URL(input.data);
314410
314473
  } catch {
@@ -314412,153 +314475,153 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
314412
314475
  addIssueToContext2(ctx, {
314413
314476
  validation: "url",
314414
314477
  code: ZodIssueCode2.invalid_string,
314415
- message: check.message
314478
+ message: check2.message
314416
314479
  });
314417
314480
  status.dirty();
314418
314481
  }
314419
- } else if (check.kind === "regex") {
314420
- check.regex.lastIndex = 0;
314421
- const testResult = check.regex.test(input.data);
314482
+ } else if (check2.kind === "regex") {
314483
+ check2.regex.lastIndex = 0;
314484
+ const testResult = check2.regex.test(input.data);
314422
314485
  if (!testResult) {
314423
314486
  ctx = this._getOrReturnCtx(input, ctx);
314424
314487
  addIssueToContext2(ctx, {
314425
314488
  validation: "regex",
314426
314489
  code: ZodIssueCode2.invalid_string,
314427
- message: check.message
314490
+ message: check2.message
314428
314491
  });
314429
314492
  status.dirty();
314430
314493
  }
314431
- } else if (check.kind === "trim") {
314494
+ } else if (check2.kind === "trim") {
314432
314495
  input.data = input.data.trim();
314433
- } else if (check.kind === "includes") {
314434
- if (!input.data.includes(check.value, check.position)) {
314496
+ } else if (check2.kind === "includes") {
314497
+ if (!input.data.includes(check2.value, check2.position)) {
314435
314498
  ctx = this._getOrReturnCtx(input, ctx);
314436
314499
  addIssueToContext2(ctx, {
314437
314500
  code: ZodIssueCode2.invalid_string,
314438
- validation: { includes: check.value, position: check.position },
314439
- message: check.message
314501
+ validation: { includes: check2.value, position: check2.position },
314502
+ message: check2.message
314440
314503
  });
314441
314504
  status.dirty();
314442
314505
  }
314443
- } else if (check.kind === "toLowerCase") {
314506
+ } else if (check2.kind === "toLowerCase") {
314444
314507
  input.data = input.data.toLowerCase();
314445
- } else if (check.kind === "toUpperCase") {
314508
+ } else if (check2.kind === "toUpperCase") {
314446
314509
  input.data = input.data.toUpperCase();
314447
- } else if (check.kind === "startsWith") {
314448
- if (!input.data.startsWith(check.value)) {
314510
+ } else if (check2.kind === "startsWith") {
314511
+ if (!input.data.startsWith(check2.value)) {
314449
314512
  ctx = this._getOrReturnCtx(input, ctx);
314450
314513
  addIssueToContext2(ctx, {
314451
314514
  code: ZodIssueCode2.invalid_string,
314452
- validation: { startsWith: check.value },
314453
- message: check.message
314515
+ validation: { startsWith: check2.value },
314516
+ message: check2.message
314454
314517
  });
314455
314518
  status.dirty();
314456
314519
  }
314457
- } else if (check.kind === "endsWith") {
314458
- if (!input.data.endsWith(check.value)) {
314520
+ } else if (check2.kind === "endsWith") {
314521
+ if (!input.data.endsWith(check2.value)) {
314459
314522
  ctx = this._getOrReturnCtx(input, ctx);
314460
314523
  addIssueToContext2(ctx, {
314461
314524
  code: ZodIssueCode2.invalid_string,
314462
- validation: { endsWith: check.value },
314463
- message: check.message
314525
+ validation: { endsWith: check2.value },
314526
+ message: check2.message
314464
314527
  });
314465
314528
  status.dirty();
314466
314529
  }
314467
- } else if (check.kind === "datetime") {
314468
- const regex2 = datetimeRegex2(check);
314530
+ } else if (check2.kind === "datetime") {
314531
+ const regex2 = datetimeRegex2(check2);
314469
314532
  if (!regex2.test(input.data)) {
314470
314533
  ctx = this._getOrReturnCtx(input, ctx);
314471
314534
  addIssueToContext2(ctx, {
314472
314535
  code: ZodIssueCode2.invalid_string,
314473
314536
  validation: "datetime",
314474
- message: check.message
314537
+ message: check2.message
314475
314538
  });
314476
314539
  status.dirty();
314477
314540
  }
314478
- } else if (check.kind === "date") {
314541
+ } else if (check2.kind === "date") {
314479
314542
  const regex2 = dateRegex2;
314480
314543
  if (!regex2.test(input.data)) {
314481
314544
  ctx = this._getOrReturnCtx(input, ctx);
314482
314545
  addIssueToContext2(ctx, {
314483
314546
  code: ZodIssueCode2.invalid_string,
314484
314547
  validation: "date",
314485
- message: check.message
314548
+ message: check2.message
314486
314549
  });
314487
314550
  status.dirty();
314488
314551
  }
314489
- } else if (check.kind === "time") {
314490
- const regex2 = timeRegex2(check);
314552
+ } else if (check2.kind === "time") {
314553
+ const regex2 = timeRegex2(check2);
314491
314554
  if (!regex2.test(input.data)) {
314492
314555
  ctx = this._getOrReturnCtx(input, ctx);
314493
314556
  addIssueToContext2(ctx, {
314494
314557
  code: ZodIssueCode2.invalid_string,
314495
314558
  validation: "time",
314496
- message: check.message
314559
+ message: check2.message
314497
314560
  });
314498
314561
  status.dirty();
314499
314562
  }
314500
- } else if (check.kind === "duration") {
314563
+ } else if (check2.kind === "duration") {
314501
314564
  if (!durationRegex2.test(input.data)) {
314502
314565
  ctx = this._getOrReturnCtx(input, ctx);
314503
314566
  addIssueToContext2(ctx, {
314504
314567
  validation: "duration",
314505
314568
  code: ZodIssueCode2.invalid_string,
314506
- message: check.message
314569
+ message: check2.message
314507
314570
  });
314508
314571
  status.dirty();
314509
314572
  }
314510
- } else if (check.kind === "ip") {
314511
- if (!isValidIP2(input.data, check.version)) {
314573
+ } else if (check2.kind === "ip") {
314574
+ if (!isValidIP2(input.data, check2.version)) {
314512
314575
  ctx = this._getOrReturnCtx(input, ctx);
314513
314576
  addIssueToContext2(ctx, {
314514
314577
  validation: "ip",
314515
314578
  code: ZodIssueCode2.invalid_string,
314516
- message: check.message
314579
+ message: check2.message
314517
314580
  });
314518
314581
  status.dirty();
314519
314582
  }
314520
- } else if (check.kind === "jwt") {
314521
- if (!isValidJWT2(input.data, check.alg)) {
314583
+ } else if (check2.kind === "jwt") {
314584
+ if (!isValidJWT2(input.data, check2.alg)) {
314522
314585
  ctx = this._getOrReturnCtx(input, ctx);
314523
314586
  addIssueToContext2(ctx, {
314524
314587
  validation: "jwt",
314525
314588
  code: ZodIssueCode2.invalid_string,
314526
- message: check.message
314589
+ message: check2.message
314527
314590
  });
314528
314591
  status.dirty();
314529
314592
  }
314530
- } else if (check.kind === "cidr") {
314531
- if (!isValidCidr2(input.data, check.version)) {
314593
+ } else if (check2.kind === "cidr") {
314594
+ if (!isValidCidr2(input.data, check2.version)) {
314532
314595
  ctx = this._getOrReturnCtx(input, ctx);
314533
314596
  addIssueToContext2(ctx, {
314534
314597
  validation: "cidr",
314535
314598
  code: ZodIssueCode2.invalid_string,
314536
- message: check.message
314599
+ message: check2.message
314537
314600
  });
314538
314601
  status.dirty();
314539
314602
  }
314540
- } else if (check.kind === "base64") {
314603
+ } else if (check2.kind === "base64") {
314541
314604
  if (!base64Regex2.test(input.data)) {
314542
314605
  ctx = this._getOrReturnCtx(input, ctx);
314543
314606
  addIssueToContext2(ctx, {
314544
314607
  validation: "base64",
314545
314608
  code: ZodIssueCode2.invalid_string,
314546
- message: check.message
314609
+ message: check2.message
314547
314610
  });
314548
314611
  status.dirty();
314549
314612
  }
314550
- } else if (check.kind === "base64url") {
314613
+ } else if (check2.kind === "base64url") {
314551
314614
  if (!base64urlRegex2.test(input.data)) {
314552
314615
  ctx = this._getOrReturnCtx(input, ctx);
314553
314616
  addIssueToContext2(ctx, {
314554
314617
  validation: "base64url",
314555
314618
  code: ZodIssueCode2.invalid_string,
314556
- message: check.message
314619
+ message: check2.message
314557
314620
  });
314558
314621
  status.dirty();
314559
314622
  }
314560
314623
  } else {
314561
- util2.assertNever(check);
314624
+ util2.assertNever(check2);
314562
314625
  }
314563
314626
  }
314564
314627
  return { status: status.value, value: input.data };
@@ -314570,10 +314633,10 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
314570
314633
  ...errorUtil2.errToObj(message)
314571
314634
  });
314572
314635
  }
314573
- _addCheck(check) {
314636
+ _addCheck(check2) {
314574
314637
  return new _ZodString2({
314575
314638
  ...this._def,
314576
- checks: [...this._def.checks, check]
314639
+ checks: [...this._def.checks, check2]
314577
314640
  });
314578
314641
  }
314579
314642
  email(message) {
@@ -314835,67 +314898,67 @@ var ZodNumber2 = class _ZodNumber2 extends ZodType2 {
314835
314898
  }
314836
314899
  let ctx = undefined;
314837
314900
  const status = new ParseStatus2;
314838
- for (const check of this._def.checks) {
314839
- if (check.kind === "int") {
314901
+ for (const check2 of this._def.checks) {
314902
+ if (check2.kind === "int") {
314840
314903
  if (!util2.isInteger(input.data)) {
314841
314904
  ctx = this._getOrReturnCtx(input, ctx);
314842
314905
  addIssueToContext2(ctx, {
314843
314906
  code: ZodIssueCode2.invalid_type,
314844
314907
  expected: "integer",
314845
314908
  received: "float",
314846
- message: check.message
314909
+ message: check2.message
314847
314910
  });
314848
314911
  status.dirty();
314849
314912
  }
314850
- } else if (check.kind === "min") {
314851
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
314913
+ } else if (check2.kind === "min") {
314914
+ const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value;
314852
314915
  if (tooSmall) {
314853
314916
  ctx = this._getOrReturnCtx(input, ctx);
314854
314917
  addIssueToContext2(ctx, {
314855
314918
  code: ZodIssueCode2.too_small,
314856
- minimum: check.value,
314919
+ minimum: check2.value,
314857
314920
  type: "number",
314858
- inclusive: check.inclusive,
314921
+ inclusive: check2.inclusive,
314859
314922
  exact: false,
314860
- message: check.message
314923
+ message: check2.message
314861
314924
  });
314862
314925
  status.dirty();
314863
314926
  }
314864
- } else if (check.kind === "max") {
314865
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
314927
+ } else if (check2.kind === "max") {
314928
+ const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value;
314866
314929
  if (tooBig) {
314867
314930
  ctx = this._getOrReturnCtx(input, ctx);
314868
314931
  addIssueToContext2(ctx, {
314869
314932
  code: ZodIssueCode2.too_big,
314870
- maximum: check.value,
314933
+ maximum: check2.value,
314871
314934
  type: "number",
314872
- inclusive: check.inclusive,
314935
+ inclusive: check2.inclusive,
314873
314936
  exact: false,
314874
- message: check.message
314937
+ message: check2.message
314875
314938
  });
314876
314939
  status.dirty();
314877
314940
  }
314878
- } else if (check.kind === "multipleOf") {
314879
- if (floatSafeRemainder2(input.data, check.value) !== 0) {
314941
+ } else if (check2.kind === "multipleOf") {
314942
+ if (floatSafeRemainder2(input.data, check2.value) !== 0) {
314880
314943
  ctx = this._getOrReturnCtx(input, ctx);
314881
314944
  addIssueToContext2(ctx, {
314882
314945
  code: ZodIssueCode2.not_multiple_of,
314883
- multipleOf: check.value,
314884
- message: check.message
314946
+ multipleOf: check2.value,
314947
+ message: check2.message
314885
314948
  });
314886
314949
  status.dirty();
314887
314950
  }
314888
- } else if (check.kind === "finite") {
314951
+ } else if (check2.kind === "finite") {
314889
314952
  if (!Number.isFinite(input.data)) {
314890
314953
  ctx = this._getOrReturnCtx(input, ctx);
314891
314954
  addIssueToContext2(ctx, {
314892
314955
  code: ZodIssueCode2.not_finite,
314893
- message: check.message
314956
+ message: check2.message
314894
314957
  });
314895
314958
  status.dirty();
314896
314959
  }
314897
314960
  } else {
314898
- util2.assertNever(check);
314961
+ util2.assertNever(check2);
314899
314962
  }
314900
314963
  }
314901
314964
  return { status: status.value, value: input.data };
@@ -314926,10 +314989,10 @@ var ZodNumber2 = class _ZodNumber2 extends ZodType2 {
314926
314989
  ]
314927
314990
  });
314928
314991
  }
314929
- _addCheck(check) {
314992
+ _addCheck(check2) {
314930
314993
  return new _ZodNumber2({
314931
314994
  ...this._def,
314932
- checks: [...this._def.checks, check]
314995
+ checks: [...this._def.checks, check2]
314933
314996
  });
314934
314997
  }
314935
314998
  int(message) {
@@ -315064,45 +315127,45 @@ var ZodBigInt2 = class _ZodBigInt2 extends ZodType2 {
315064
315127
  }
315065
315128
  let ctx = undefined;
315066
315129
  const status = new ParseStatus2;
315067
- for (const check of this._def.checks) {
315068
- if (check.kind === "min") {
315069
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
315130
+ for (const check2 of this._def.checks) {
315131
+ if (check2.kind === "min") {
315132
+ const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value;
315070
315133
  if (tooSmall) {
315071
315134
  ctx = this._getOrReturnCtx(input, ctx);
315072
315135
  addIssueToContext2(ctx, {
315073
315136
  code: ZodIssueCode2.too_small,
315074
315137
  type: "bigint",
315075
- minimum: check.value,
315076
- inclusive: check.inclusive,
315077
- message: check.message
315138
+ minimum: check2.value,
315139
+ inclusive: check2.inclusive,
315140
+ message: check2.message
315078
315141
  });
315079
315142
  status.dirty();
315080
315143
  }
315081
- } else if (check.kind === "max") {
315082
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
315144
+ } else if (check2.kind === "max") {
315145
+ const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value;
315083
315146
  if (tooBig) {
315084
315147
  ctx = this._getOrReturnCtx(input, ctx);
315085
315148
  addIssueToContext2(ctx, {
315086
315149
  code: ZodIssueCode2.too_big,
315087
315150
  type: "bigint",
315088
- maximum: check.value,
315089
- inclusive: check.inclusive,
315090
- message: check.message
315151
+ maximum: check2.value,
315152
+ inclusive: check2.inclusive,
315153
+ message: check2.message
315091
315154
  });
315092
315155
  status.dirty();
315093
315156
  }
315094
- } else if (check.kind === "multipleOf") {
315095
- if (input.data % check.value !== BigInt(0)) {
315157
+ } else if (check2.kind === "multipleOf") {
315158
+ if (input.data % check2.value !== BigInt(0)) {
315096
315159
  ctx = this._getOrReturnCtx(input, ctx);
315097
315160
  addIssueToContext2(ctx, {
315098
315161
  code: ZodIssueCode2.not_multiple_of,
315099
- multipleOf: check.value,
315100
- message: check.message
315162
+ multipleOf: check2.value,
315163
+ message: check2.message
315101
315164
  });
315102
315165
  status.dirty();
315103
315166
  }
315104
315167
  } else {
315105
- util2.assertNever(check);
315168
+ util2.assertNever(check2);
315106
315169
  }
315107
315170
  }
315108
315171
  return { status: status.value, value: input.data };
@@ -315142,10 +315205,10 @@ var ZodBigInt2 = class _ZodBigInt2 extends ZodType2 {
315142
315205
  ]
315143
315206
  });
315144
315207
  }
315145
- _addCheck(check) {
315208
+ _addCheck(check2) {
315146
315209
  return new _ZodBigInt2({
315147
315210
  ...this._def,
315148
- checks: [...this._def.checks, check]
315211
+ checks: [...this._def.checks, check2]
315149
315212
  });
315150
315213
  }
315151
315214
  positive(message) {
@@ -315265,35 +315328,35 @@ var ZodDate2 = class _ZodDate2 extends ZodType2 {
315265
315328
  }
315266
315329
  const status = new ParseStatus2;
315267
315330
  let ctx = undefined;
315268
- for (const check of this._def.checks) {
315269
- if (check.kind === "min") {
315270
- if (input.data.getTime() < check.value) {
315331
+ for (const check2 of this._def.checks) {
315332
+ if (check2.kind === "min") {
315333
+ if (input.data.getTime() < check2.value) {
315271
315334
  ctx = this._getOrReturnCtx(input, ctx);
315272
315335
  addIssueToContext2(ctx, {
315273
315336
  code: ZodIssueCode2.too_small,
315274
- message: check.message,
315337
+ message: check2.message,
315275
315338
  inclusive: true,
315276
315339
  exact: false,
315277
- minimum: check.value,
315340
+ minimum: check2.value,
315278
315341
  type: "date"
315279
315342
  });
315280
315343
  status.dirty();
315281
315344
  }
315282
- } else if (check.kind === "max") {
315283
- if (input.data.getTime() > check.value) {
315345
+ } else if (check2.kind === "max") {
315346
+ if (input.data.getTime() > check2.value) {
315284
315347
  ctx = this._getOrReturnCtx(input, ctx);
315285
315348
  addIssueToContext2(ctx, {
315286
315349
  code: ZodIssueCode2.too_big,
315287
- message: check.message,
315350
+ message: check2.message,
315288
315351
  inclusive: true,
315289
315352
  exact: false,
315290
- maximum: check.value,
315353
+ maximum: check2.value,
315291
315354
  type: "date"
315292
315355
  });
315293
315356
  status.dirty();
315294
315357
  }
315295
315358
  } else {
315296
- util2.assertNever(check);
315359
+ util2.assertNever(check2);
315297
315360
  }
315298
315361
  }
315299
315362
  return {
@@ -315301,10 +315364,10 @@ var ZodDate2 = class _ZodDate2 extends ZodType2 {
315301
315364
  value: new Date(input.data.getTime())
315302
315365
  };
315303
315366
  }
315304
- _addCheck(check) {
315367
+ _addCheck(check2) {
315305
315368
  return new _ZodDate2({
315306
315369
  ...this._def,
315307
- checks: [...this._def.checks, check]
315370
+ checks: [...this._def.checks, check2]
315308
315371
  });
315309
315372
  }
315310
315373
  min(minDate, message) {
@@ -317072,10 +317135,10 @@ function cleanParams2(params2, data) {
317072
317135
  const p23 = typeof p3 === "string" ? { message: p3 } : p3;
317073
317136
  return p23;
317074
317137
  }
317075
- function custom2(check, _params = {}, fatal) {
317076
- if (check)
317138
+ function custom2(check2, _params = {}, fatal) {
317139
+ if (check2)
317077
317140
  return ZodAny2.create().superRefine((data, ctx) => {
317078
- const r4 = check(data);
317141
+ const r4 = check2(data);
317079
317142
  if (r4 instanceof Promise) {
317080
317143
  return r4.then((r23) => {
317081
317144
  if (!r23) {
@@ -334698,6 +334761,7 @@ registerCheckPlacement(program2);
334698
334761
  registerCheckRoutingDifficulty(program2);
334699
334762
  registerCheckSchematicPlacement(program2);
334700
334763
  registerCheckShorts(program2);
334764
+ registerCheckSource(program2);
334701
334765
  registerCheckTraceLength(program2);
334702
334766
  registerRegistry(program2);
334703
334767
  registerRegistryPackages(program2);