@tscircuit/cli 0.1.1838 → 0.1.1840

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