@tscircuit/core 0.0.600 → 0.0.601

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/index.d.ts CHANGED
@@ -557,6 +557,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
557
557
  _portsRoutedOnPcb: Port[];
558
558
  subcircuit_connectivity_map_key: string | null;
559
559
  _traceConnectionHash: string | null;
560
+ _couldNotFindPort?: boolean;
560
561
  constructor(props: z.input<typeof traceProps>);
561
562
  get config(): {
562
563
  zodProps: z.ZodUnion<[z.ZodObject<{
package/dist/index.js CHANGED
@@ -5002,13 +5002,45 @@ var convertFacingDirectionToElbowDirection = (facingDirection) => {
5002
5002
  }
5003
5003
  };
5004
5004
 
5005
+ // lib/errors/AutorouterError.ts
5006
+ import packageJson from "@tscircuit/capacity-autorouter/package.json" with { type: "json" };
5007
+ var autorouterVersion = packageJson.version ?? "unknown";
5008
+ var AutorouterError = class extends Error {
5009
+ constructor(message) {
5010
+ super(`${message} (capacity-autorouter@${autorouterVersion})`);
5011
+ this.name = "AutorouterError";
5012
+ }
5013
+ };
5014
+
5015
+ // lib/errors/TraceConnectionError.ts
5016
+ var TraceConnectionError = class extends Error {
5017
+ constructor(errorData) {
5018
+ super(errorData.message);
5019
+ this.errorData = errorData;
5020
+ this.name = "TraceConnectionError";
5021
+ }
5022
+ };
5023
+
5005
5024
  // lib/components/primitive-components/Trace/Trace_doInitialSchematicTraceRender.ts
5006
5025
  var Trace_doInitialSchematicTraceRender = (trace) => {
5026
+ if (trace._couldNotFindPort) return;
5007
5027
  if (trace.root?.schematicDisabled) return;
5008
5028
  const { db } = trace.root;
5009
5029
  const { _parsedProps: props, parent } = trace;
5010
5030
  if (!parent) throw new Error("Trace has no parent");
5011
- const { allPortsFound, portsWithSelectors: connectedPorts } = trace._findConnectedPorts();
5031
+ let allPortsFound;
5032
+ let connectedPorts;
5033
+ try {
5034
+ const result = trace._findConnectedPorts();
5035
+ allPortsFound = result.allPortsFound;
5036
+ connectedPorts = result.portsWithSelectors ?? [];
5037
+ } catch (error) {
5038
+ if (error instanceof TraceConnectionError) {
5039
+ db.source_trace_not_connected.insert(error.errorData);
5040
+ return;
5041
+ }
5042
+ throw error;
5043
+ }
5012
5044
  const { netsWithSelectors } = trace._findConnectedNets();
5013
5045
  if (!allPortsFound) return;
5014
5046
  const portIds = connectedPorts.map((p) => p.port.schematic_port_id).sort();
@@ -5707,7 +5739,6 @@ function Trace__doInitialSchematicTraceRenderWithDisplayLabel(trace) {
5707
5739
 
5708
5740
  // lib/components/primitive-components/Trace/Trace__findConnectedPorts.ts
5709
5741
  function Trace__findConnectedPorts(trace) {
5710
- const { db } = trace.root;
5711
5742
  const { _parsedProps: props, parent } = trace;
5712
5743
  if (!parent) throw new Error("Trace has no parent");
5713
5744
  const portSelectors = trace.getTracePortPathSelectors();
@@ -5733,33 +5764,44 @@ function Trace__findConnectedPorts(trace) {
5733
5764
  targetComponent = trace.getSubcircuit().selectOne(`.${parentSelector}`);
5734
5765
  }
5735
5766
  if (!targetComponent) {
5736
- if (parentSelector) {
5737
- trace.renderError(
5738
- `Could not find port for selector "${selector}". Component "${parentSelector}" not found`
5739
- );
5740
- } else {
5741
- trace.renderError(`Could not find port for selector "${selector}"`);
5742
- }
5743
- } else {
5744
- const ports = targetComponent.children.filter(
5745
- (c) => c.componentName === "Port"
5746
- );
5747
- const portLabel = portToken.includes(".") ? portToken.split(".").pop() ?? "" : portToken;
5748
- const portNames = ports.flatMap((c) => c.getNameAndAliases());
5749
- const hasCustomLabels = portNames.some((n) => !/^(pin\d+|\d+)$/.test(n));
5750
- const labelList = Array.from(new Set(portNames)).join(", ");
5751
- let detail;
5752
- if (ports.length === 0) {
5753
- detail = "It has no ports";
5754
- } else if (!hasCustomLabels) {
5755
- detail = `It has ${ports.length} pins and no pinLabels (consider adding pinLabels)`;
5756
- } else {
5757
- detail = `It has [${labelList}]`;
5758
- }
5759
- trace.renderError(
5760
- `Could not find port for selector "${selector}". Component "${targetComponent.props.name ?? parentSelector}" found, but does not have pin "${portLabel}". ${detail}`
5761
- );
5767
+ const errorMessage2 = parentSelector ? `Could not find port for selector "${selector}". Component "${parentSelector}" not found` : `Could not find port for selector "${selector}"`;
5768
+ const subcircuit2 = trace.getSubcircuit();
5769
+ const sourceGroup2 = subcircuit2.getGroup();
5770
+ throw new TraceConnectionError({
5771
+ error_type: "source_trace_not_connected",
5772
+ message: errorMessage2,
5773
+ subcircuit_id: subcircuit2.subcircuit_id ?? void 0,
5774
+ source_group_id: sourceGroup2?.source_group_id ?? void 0,
5775
+ source_trace_id: trace.source_trace_id ?? void 0,
5776
+ selectors_not_found: [selector]
5777
+ });
5762
5778
  }
5779
+ const ports = targetComponent.children.filter(
5780
+ (c) => c.componentName === "Port"
5781
+ );
5782
+ const portLabel = portToken.includes(".") ? portToken.split(".").pop() ?? "" : portToken;
5783
+ const portNames = ports.flatMap((c) => c.getNameAndAliases());
5784
+ const hasCustomLabels = portNames.some((n) => !/^(pin\d+|\d+)$/.test(n));
5785
+ const labelList = Array.from(new Set(portNames)).join(", ");
5786
+ let detail;
5787
+ if (ports.length === 0) {
5788
+ detail = "It has no ports";
5789
+ } else if (!hasCustomLabels) {
5790
+ detail = `It has ${ports.length} pins and no pinLabels (consider adding pinLabels)`;
5791
+ } else {
5792
+ detail = `It has [${labelList}]`;
5793
+ }
5794
+ const errorMessage = `Could not find port for selector "${selector}". Component "${targetComponent.props.name ?? parentSelector}" found, but does not have pin "${portLabel}". ${detail}`;
5795
+ const subcircuit = trace.getSubcircuit();
5796
+ const sourceGroup = subcircuit.getGroup();
5797
+ throw new TraceConnectionError({
5798
+ error_type: "source_trace_not_connected",
5799
+ message: errorMessage,
5800
+ subcircuit_id: subcircuit.subcircuit_id ?? void 0,
5801
+ source_group_id: sourceGroup?.source_group_id ?? void 0,
5802
+ source_trace_id: trace.source_trace_id ?? void 0,
5803
+ selectors_not_found: [selector]
5804
+ });
5763
5805
  }
5764
5806
  }
5765
5807
  if (portsWithSelectors.some((p) => !p.port)) {
@@ -5780,6 +5822,7 @@ var Trace3 = class extends PrimitiveComponent2 {
5780
5822
  _portsRoutedOnPcb;
5781
5823
  subcircuit_connectivity_map_key = null;
5782
5824
  _traceConnectionHash = null;
5825
+ _couldNotFindPort;
5783
5826
  constructor(props) {
5784
5827
  super(props);
5785
5828
  this._portsRoutedOnPcb = [];
@@ -5896,7 +5939,20 @@ var Trace3 = class extends PrimitiveComponent2 {
5896
5939
  this.renderError("Trace has no parent");
5897
5940
  return;
5898
5941
  }
5899
- const { allPortsFound, portsWithSelectors: ports } = this._findConnectedPorts();
5942
+ let allPortsFound;
5943
+ let ports;
5944
+ try {
5945
+ const result = this._findConnectedPorts();
5946
+ allPortsFound = result.allPortsFound;
5947
+ ports = result.portsWithSelectors ?? [];
5948
+ } catch (error) {
5949
+ if (error instanceof TraceConnectionError) {
5950
+ db.source_trace_not_connected.insert(error.errorData);
5951
+ this._couldNotFindPort = true;
5952
+ return;
5953
+ }
5954
+ throw error;
5955
+ }
5900
5956
  if (!allPortsFound) return;
5901
5957
  this._traceConnectionHash = this._computeTraceConnectionHash();
5902
5958
  const existingTraces = db.source_trace.list();
@@ -6839,18 +6895,6 @@ import {
6839
6895
 
6840
6896
  // lib/utils/autorouting/CapacityMeshAutorouter.ts
6841
6897
  import { CapacityMeshSolver } from "@tscircuit/capacity-autorouter";
6842
-
6843
- // lib/errors/AutorouterError.ts
6844
- import packageJson from "@tscircuit/capacity-autorouter/package.json" with { type: "json" };
6845
- var autorouterVersion = packageJson.version ?? "unknown";
6846
- var AutorouterError = class extends Error {
6847
- constructor(message) {
6848
- super(`${message} (capacity-autorouter@${autorouterVersion})`);
6849
- this.name = "AutorouterError";
6850
- }
6851
- };
6852
-
6853
- // lib/utils/autorouting/CapacityMeshAutorouter.ts
6854
6898
  var CapacityMeshAutorouter = class {
6855
6899
  input;
6856
6900
  isRouting = false;
@@ -11268,7 +11312,7 @@ import { identity as identity5 } from "transformation-matrix";
11268
11312
  var package_default = {
11269
11313
  name: "@tscircuit/core",
11270
11314
  type: "module",
11271
- version: "0.0.599",
11315
+ version: "0.0.600",
11272
11316
  types: "dist/index.d.ts",
11273
11317
  main: "dist/index.js",
11274
11318
  module: "dist/index.js",
@@ -11313,7 +11357,7 @@ var package_default = {
11313
11357
  "bun-match-svg": "0.0.12",
11314
11358
  "calculate-elbow": "^0.0.5",
11315
11359
  "chokidar-cli": "^3.0.0",
11316
- "circuit-json": "^0.0.221",
11360
+ "circuit-json": "^0.0.224",
11317
11361
  "circuit-json-to-bpc": "^0.0.13",
11318
11362
  "circuit-json-to-connectivity-map": "^0.0.22",
11319
11363
  "circuit-json-to-simple-3d": "^0.0.2",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.600",
4
+ "version": "0.0.601",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -46,7 +46,7 @@
46
46
  "bun-match-svg": "0.0.12",
47
47
  "calculate-elbow": "^0.0.5",
48
48
  "chokidar-cli": "^3.0.0",
49
- "circuit-json": "^0.0.221",
49
+ "circuit-json": "^0.0.224",
50
50
  "circuit-json-to-bpc": "^0.0.13",
51
51
  "circuit-json-to-connectivity-map": "^0.0.22",
52
52
  "circuit-json-to-simple-3d": "^0.0.2",