@tscircuit/cli 0.1.1686 → 0.1.1687
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/build/build.worker.js +27 -16
- package/dist/cli/main.js +151 -81
- package/dist/cli/snapshot/snapshot.worker.js +27 -16
- package/dist/lib/index.js +6 -61
- package/package.json +4 -4
|
@@ -12369,23 +12369,21 @@ class AutorouterDiagnostics {
|
|
|
12369
12369
|
for (const trace of this.completedPhaseTraces) {
|
|
12370
12370
|
if (!trace || typeof trace !== "object")
|
|
12371
12371
|
continue;
|
|
12372
|
-
const
|
|
12373
|
-
const id = this.getCircuitElementId(element);
|
|
12372
|
+
const id = this.getCircuitElementId(trace);
|
|
12374
12373
|
const existingIndex = id ? elementIndexById.get(id) : undefined;
|
|
12375
12374
|
if (existingIndex === undefined) {
|
|
12376
|
-
circuitJson.push(
|
|
12375
|
+
circuitJson.push(trace);
|
|
12377
12376
|
if (id)
|
|
12378
12377
|
elementIndexById.set(id, circuitJson.length - 1);
|
|
12379
12378
|
} else {
|
|
12380
|
-
circuitJson[existingIndex] =
|
|
12379
|
+
circuitJson[existingIndex] = trace;
|
|
12381
12380
|
}
|
|
12382
12381
|
}
|
|
12383
12382
|
return circuitJson;
|
|
12384
12383
|
}
|
|
12385
12384
|
getCircuitElementId(element) {
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
const id = element[`${element.type}_id`];
|
|
12385
|
+
const idEntry = Object.entries(element).find(([key, value]) => key === `${element.type}_id` && typeof value === "string");
|
|
12386
|
+
const id = idEntry?.[1];
|
|
12389
12387
|
return typeof id === "string" ? id : undefined;
|
|
12390
12388
|
}
|
|
12391
12389
|
isRouteElement(element) {
|
|
@@ -12415,17 +12413,18 @@ class AutorouterDiagnostics {
|
|
|
12415
12413
|
return parts.join(", ");
|
|
12416
12414
|
}
|
|
12417
12415
|
getConnectionNames(simpleRouteJson) {
|
|
12416
|
+
const circuitJsonLookup = this.createCircuitJsonLookup();
|
|
12418
12417
|
return [
|
|
12419
12418
|
...new Set((simpleRouteJson?.connections ?? []).map((connection) => [
|
|
12420
12419
|
connection.rootConnectionName,
|
|
12421
12420
|
connection.name,
|
|
12422
12421
|
connection.source_trace_id
|
|
12423
|
-
].filter((value) => typeof value === "string").map((value) => this.resolveCircuitJsonId(value)).find((value) => value !== null)).filter((name) => name !== null))
|
|
12422
|
+
].filter((value) => typeof value === "string").map((value) => this.resolveCircuitJsonId(value, circuitJsonLookup)).find((value) => value !== null)).filter((name) => name !== null))
|
|
12424
12423
|
];
|
|
12425
12424
|
}
|
|
12426
|
-
resolveCircuitJsonId(value) {
|
|
12427
|
-
const circuitJson =
|
|
12428
|
-
const element =
|
|
12425
|
+
resolveCircuitJsonId(value, lookup = this.createCircuitJsonLookup()) {
|
|
12426
|
+
const { circuitJson, elementById } = lookup;
|
|
12427
|
+
const element = elementById.get(value);
|
|
12429
12428
|
if (!element)
|
|
12430
12429
|
return value;
|
|
12431
12430
|
if (element.type === "source_trace") {
|
|
@@ -12442,15 +12441,27 @@ class AutorouterDiagnostics {
|
|
|
12442
12441
|
return null;
|
|
12443
12442
|
}
|
|
12444
12443
|
formatUserFacingText(value) {
|
|
12444
|
+
const circuitJsonLookup = this.createCircuitJsonLookup();
|
|
12445
12445
|
let formattedValue = value;
|
|
12446
|
-
|
|
12446
|
+
const idsInMessage = [...circuitJsonLookup.elementById.keys()].filter((id) => formattedValue.includes(id)).sort((a, b) => b.length - a.length);
|
|
12447
|
+
for (const id of idsInMessage) {
|
|
12448
|
+
formattedValue = formattedValue.replaceAll(id, this.resolveCircuitJsonId(id, circuitJsonLookup) ?? "internal element");
|
|
12449
|
+
}
|
|
12450
|
+
return formattedValue.replace(CIRCUIT_JSON_ID_PATTERN, "internal element");
|
|
12451
|
+
}
|
|
12452
|
+
createCircuitJsonLookup() {
|
|
12453
|
+
const circuitJson = this.getCurrentCircuitJson();
|
|
12454
|
+
const elementById = new Map;
|
|
12455
|
+
for (const element of circuitJson) {
|
|
12447
12456
|
for (const [key, id] of Object.entries(element)) {
|
|
12448
|
-
if (!key.endsWith("_id") || typeof id !== "string")
|
|
12457
|
+
if (!key.endsWith("_id") || typeof id !== "string" || id.length === 0)
|
|
12449
12458
|
continue;
|
|
12450
|
-
|
|
12459
|
+
if (!elementById.has(id)) {
|
|
12460
|
+
elementById.set(id, element);
|
|
12461
|
+
}
|
|
12451
12462
|
}
|
|
12452
12463
|
}
|
|
12453
|
-
return
|
|
12464
|
+
return { circuitJson, elementById };
|
|
12454
12465
|
}
|
|
12455
12466
|
getTraceSelector(trace, circuitJson) {
|
|
12456
12467
|
const portIds = trace.connected_source_port_ids;
|
|
@@ -12468,7 +12479,7 @@ class AutorouterDiagnostics {
|
|
|
12468
12479
|
if (!portName)
|
|
12469
12480
|
return null;
|
|
12470
12481
|
const component = circuitJson.find((element) => element.type === "source_component" && element.source_component_id === port.source_component_id);
|
|
12471
|
-
const componentName = component && typeof component.name === "string" ? component.name : null;
|
|
12482
|
+
const componentName = component && "name" in component && typeof component.name === "string" ? component.name : null;
|
|
12472
12483
|
return componentName ? `${componentName}.${portName}` : portName;
|
|
12473
12484
|
}
|
|
12474
12485
|
countErrors(simpleRouteJson) {
|
package/dist/cli/main.js
CHANGED
|
@@ -22743,7 +22743,7 @@ var require_isarray = __commonJS((exports2, module2) => {
|
|
|
22743
22743
|
};
|
|
22744
22744
|
});
|
|
22745
22745
|
|
|
22746
|
-
// node_modules/
|
|
22746
|
+
// node_modules/safe-buffer/index.js
|
|
22747
22747
|
var require_safe_buffer = __commonJS((exports2, module2) => {
|
|
22748
22748
|
var buffer = __require("buffer");
|
|
22749
22749
|
var Buffer2 = buffer.Buffer;
|
|
@@ -23597,64 +23597,9 @@ var require__stream_duplex = __commonJS((exports2, module2) => {
|
|
|
23597
23597
|
};
|
|
23598
23598
|
});
|
|
23599
23599
|
|
|
23600
|
-
// node_modules/string_decoder/node_modules/safe-buffer/index.js
|
|
23601
|
-
var require_safe_buffer2 = __commonJS((exports2, module2) => {
|
|
23602
|
-
var buffer = __require("buffer");
|
|
23603
|
-
var Buffer2 = buffer.Buffer;
|
|
23604
|
-
function copyProps(src, dst) {
|
|
23605
|
-
for (var key in src) {
|
|
23606
|
-
dst[key] = src[key];
|
|
23607
|
-
}
|
|
23608
|
-
}
|
|
23609
|
-
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
|
|
23610
|
-
module2.exports = buffer;
|
|
23611
|
-
} else {
|
|
23612
|
-
copyProps(buffer, exports2);
|
|
23613
|
-
exports2.Buffer = SafeBuffer;
|
|
23614
|
-
}
|
|
23615
|
-
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
23616
|
-
return Buffer2(arg, encodingOrOffset, length);
|
|
23617
|
-
}
|
|
23618
|
-
copyProps(Buffer2, SafeBuffer);
|
|
23619
|
-
SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
|
23620
|
-
if (typeof arg === "number") {
|
|
23621
|
-
throw new TypeError("Argument must not be a number");
|
|
23622
|
-
}
|
|
23623
|
-
return Buffer2(arg, encodingOrOffset, length);
|
|
23624
|
-
};
|
|
23625
|
-
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
23626
|
-
if (typeof size !== "number") {
|
|
23627
|
-
throw new TypeError("Argument must be a number");
|
|
23628
|
-
}
|
|
23629
|
-
var buf = Buffer2(size);
|
|
23630
|
-
if (fill !== undefined) {
|
|
23631
|
-
if (typeof encoding === "string") {
|
|
23632
|
-
buf.fill(fill, encoding);
|
|
23633
|
-
} else {
|
|
23634
|
-
buf.fill(fill);
|
|
23635
|
-
}
|
|
23636
|
-
} else {
|
|
23637
|
-
buf.fill(0);
|
|
23638
|
-
}
|
|
23639
|
-
return buf;
|
|
23640
|
-
};
|
|
23641
|
-
SafeBuffer.allocUnsafe = function(size) {
|
|
23642
|
-
if (typeof size !== "number") {
|
|
23643
|
-
throw new TypeError("Argument must be a number");
|
|
23644
|
-
}
|
|
23645
|
-
return Buffer2(size);
|
|
23646
|
-
};
|
|
23647
|
-
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
23648
|
-
if (typeof size !== "number") {
|
|
23649
|
-
throw new TypeError("Argument must be a number");
|
|
23650
|
-
}
|
|
23651
|
-
return buffer.SlowBuffer(size);
|
|
23652
|
-
};
|
|
23653
|
-
});
|
|
23654
|
-
|
|
23655
23600
|
// node_modules/string_decoder/lib/string_decoder.js
|
|
23656
23601
|
var require_string_decoder = __commonJS((exports2) => {
|
|
23657
|
-
var Buffer2 =
|
|
23602
|
+
var Buffer2 = require_safe_buffer().Buffer;
|
|
23658
23603
|
var isEncoding = Buffer2.isEncoding || function(encoding) {
|
|
23659
23604
|
encoding = "" + encoding;
|
|
23660
23605
|
switch (encoding && encoding.toLowerCase()) {
|
|
@@ -60130,8 +60075,8 @@ var require__stream_duplex2 = __commonJS((exports2, module2) => {
|
|
|
60130
60075
|
});
|
|
60131
60076
|
});
|
|
60132
60077
|
|
|
60133
|
-
// node_modules/safe-buffer/index.js
|
|
60134
|
-
var
|
|
60078
|
+
// node_modules/gerber-parser/node_modules/readable-stream/node_modules/string_decoder/node_modules/safe-buffer/index.js
|
|
60079
|
+
var require_safe_buffer2 = __commonJS((exports2, module2) => {
|
|
60135
60080
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
60136
60081
|
var buffer = __require("buffer");
|
|
60137
60082
|
var Buffer2 = buffer.Buffer;
|
|
@@ -60189,7 +60134,7 @@ var require_safe_buffer3 = __commonJS((exports2, module2) => {
|
|
|
60189
60134
|
|
|
60190
60135
|
// node_modules/gerber-parser/node_modules/readable-stream/node_modules/string_decoder/lib/string_decoder.js
|
|
60191
60136
|
var require_string_decoder2 = __commonJS((exports2) => {
|
|
60192
|
-
var Buffer2 =
|
|
60137
|
+
var Buffer2 = require_safe_buffer2().Buffer;
|
|
60193
60138
|
var isEncoding = Buffer2.isEncoding || function(encoding) {
|
|
60194
60139
|
encoding = "" + encoding;
|
|
60195
60140
|
switch (encoding && encoding.toLowerCase()) {
|
|
@@ -64158,6 +64103,63 @@ var require__stream_duplex3 = __commonJS((exports2, module2) => {
|
|
|
64158
64103
|
});
|
|
64159
64104
|
});
|
|
64160
64105
|
|
|
64106
|
+
// node_modules/gerber-plotter/node_modules/readable-stream/node_modules/string_decoder/node_modules/safe-buffer/index.js
|
|
64107
|
+
var require_safe_buffer3 = __commonJS((exports2, module2) => {
|
|
64108
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
64109
|
+
var buffer = __require("buffer");
|
|
64110
|
+
var Buffer2 = buffer.Buffer;
|
|
64111
|
+
function copyProps(src, dst) {
|
|
64112
|
+
for (var key in src) {
|
|
64113
|
+
dst[key] = src[key];
|
|
64114
|
+
}
|
|
64115
|
+
}
|
|
64116
|
+
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
|
|
64117
|
+
module2.exports = buffer;
|
|
64118
|
+
} else {
|
|
64119
|
+
copyProps(buffer, exports2);
|
|
64120
|
+
exports2.Buffer = SafeBuffer;
|
|
64121
|
+
}
|
|
64122
|
+
function SafeBuffer(arg, encodingOrOffset, length67) {
|
|
64123
|
+
return Buffer2(arg, encodingOrOffset, length67);
|
|
64124
|
+
}
|
|
64125
|
+
SafeBuffer.prototype = Object.create(Buffer2.prototype);
|
|
64126
|
+
copyProps(Buffer2, SafeBuffer);
|
|
64127
|
+
SafeBuffer.from = function(arg, encodingOrOffset, length67) {
|
|
64128
|
+
if (typeof arg === "number") {
|
|
64129
|
+
throw new TypeError("Argument must not be a number");
|
|
64130
|
+
}
|
|
64131
|
+
return Buffer2(arg, encodingOrOffset, length67);
|
|
64132
|
+
};
|
|
64133
|
+
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
64134
|
+
if (typeof size !== "number") {
|
|
64135
|
+
throw new TypeError("Argument must be a number");
|
|
64136
|
+
}
|
|
64137
|
+
var buf = Buffer2(size);
|
|
64138
|
+
if (fill !== undefined) {
|
|
64139
|
+
if (typeof encoding === "string") {
|
|
64140
|
+
buf.fill(fill, encoding);
|
|
64141
|
+
} else {
|
|
64142
|
+
buf.fill(fill);
|
|
64143
|
+
}
|
|
64144
|
+
} else {
|
|
64145
|
+
buf.fill(0);
|
|
64146
|
+
}
|
|
64147
|
+
return buf;
|
|
64148
|
+
};
|
|
64149
|
+
SafeBuffer.allocUnsafe = function(size) {
|
|
64150
|
+
if (typeof size !== "number") {
|
|
64151
|
+
throw new TypeError("Argument must be a number");
|
|
64152
|
+
}
|
|
64153
|
+
return Buffer2(size);
|
|
64154
|
+
};
|
|
64155
|
+
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
64156
|
+
if (typeof size !== "number") {
|
|
64157
|
+
throw new TypeError("Argument must be a number");
|
|
64158
|
+
}
|
|
64159
|
+
return buffer.SlowBuffer(size);
|
|
64160
|
+
};
|
|
64161
|
+
});
|
|
64162
|
+
|
|
64161
64163
|
// node_modules/gerber-plotter/node_modules/readable-stream/node_modules/string_decoder/lib/string_decoder.js
|
|
64162
64164
|
var require_string_decoder3 = __commonJS((exports2) => {
|
|
64163
64165
|
var Buffer2 = require_safe_buffer3().Buffer;
|
|
@@ -68116,9 +68118,66 @@ var require__stream_duplex4 = __commonJS((exports2, module2) => {
|
|
|
68116
68118
|
});
|
|
68117
68119
|
});
|
|
68118
68120
|
|
|
68121
|
+
// node_modules/gerber-to-svg/node_modules/readable-stream/node_modules/string_decoder/node_modules/safe-buffer/index.js
|
|
68122
|
+
var require_safe_buffer4 = __commonJS((exports2, module2) => {
|
|
68123
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
68124
|
+
var buffer = __require("buffer");
|
|
68125
|
+
var Buffer2 = buffer.Buffer;
|
|
68126
|
+
function copyProps(src, dst) {
|
|
68127
|
+
for (var key in src) {
|
|
68128
|
+
dst[key] = src[key];
|
|
68129
|
+
}
|
|
68130
|
+
}
|
|
68131
|
+
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
|
|
68132
|
+
module2.exports = buffer;
|
|
68133
|
+
} else {
|
|
68134
|
+
copyProps(buffer, exports2);
|
|
68135
|
+
exports2.Buffer = SafeBuffer;
|
|
68136
|
+
}
|
|
68137
|
+
function SafeBuffer(arg, encodingOrOffset, length67) {
|
|
68138
|
+
return Buffer2(arg, encodingOrOffset, length67);
|
|
68139
|
+
}
|
|
68140
|
+
SafeBuffer.prototype = Object.create(Buffer2.prototype);
|
|
68141
|
+
copyProps(Buffer2, SafeBuffer);
|
|
68142
|
+
SafeBuffer.from = function(arg, encodingOrOffset, length67) {
|
|
68143
|
+
if (typeof arg === "number") {
|
|
68144
|
+
throw new TypeError("Argument must not be a number");
|
|
68145
|
+
}
|
|
68146
|
+
return Buffer2(arg, encodingOrOffset, length67);
|
|
68147
|
+
};
|
|
68148
|
+
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
68149
|
+
if (typeof size !== "number") {
|
|
68150
|
+
throw new TypeError("Argument must be a number");
|
|
68151
|
+
}
|
|
68152
|
+
var buf = Buffer2(size);
|
|
68153
|
+
if (fill !== undefined) {
|
|
68154
|
+
if (typeof encoding === "string") {
|
|
68155
|
+
buf.fill(fill, encoding);
|
|
68156
|
+
} else {
|
|
68157
|
+
buf.fill(fill);
|
|
68158
|
+
}
|
|
68159
|
+
} else {
|
|
68160
|
+
buf.fill(0);
|
|
68161
|
+
}
|
|
68162
|
+
return buf;
|
|
68163
|
+
};
|
|
68164
|
+
SafeBuffer.allocUnsafe = function(size) {
|
|
68165
|
+
if (typeof size !== "number") {
|
|
68166
|
+
throw new TypeError("Argument must be a number");
|
|
68167
|
+
}
|
|
68168
|
+
return Buffer2(size);
|
|
68169
|
+
};
|
|
68170
|
+
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
68171
|
+
if (typeof size !== "number") {
|
|
68172
|
+
throw new TypeError("Argument must be a number");
|
|
68173
|
+
}
|
|
68174
|
+
return buffer.SlowBuffer(size);
|
|
68175
|
+
};
|
|
68176
|
+
});
|
|
68177
|
+
|
|
68119
68178
|
// node_modules/gerber-to-svg/node_modules/readable-stream/node_modules/string_decoder/lib/string_decoder.js
|
|
68120
68179
|
var require_string_decoder4 = __commonJS((exports2) => {
|
|
68121
|
-
var Buffer2 =
|
|
68180
|
+
var Buffer2 = require_safe_buffer4().Buffer;
|
|
68122
68181
|
var isEncoding = Buffer2.isEncoding || function(encoding) {
|
|
68123
68182
|
encoding = "" + encoding;
|
|
68124
68183
|
switch (encoding && encoding.toLowerCase()) {
|
|
@@ -118447,7 +118506,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
|
118447
118506
|
// lib/getVersion.ts
|
|
118448
118507
|
import { createRequire as createRequire2 } from "node:module";
|
|
118449
118508
|
// package.json
|
|
118450
|
-
var version = "0.1.
|
|
118509
|
+
var version = "0.1.1686";
|
|
118451
118510
|
var package_default = {
|
|
118452
118511
|
name: "@tscircuit/cli",
|
|
118453
118512
|
version,
|
|
@@ -118463,14 +118522,14 @@ var package_default = {
|
|
|
118463
118522
|
"@tscircuit/circuit-json-placement-analysis": "^0.0.6",
|
|
118464
118523
|
"@tscircuit/circuit-json-routing-analysis": "^0.0.6",
|
|
118465
118524
|
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#b6d5fe675adc26a2fc988aa081e6fb51e6bf696a",
|
|
118466
|
-
"@tscircuit/eval": "^0.0.
|
|
118525
|
+
"@tscircuit/eval": "^0.0.1016",
|
|
118467
118526
|
"@tscircuit/fake-snippets": "^0.0.182",
|
|
118468
118527
|
"@tscircuit/file-server": "^0.0.32",
|
|
118469
118528
|
"@tscircuit/footprinter": "^0.0.374",
|
|
118470
118529
|
"@tscircuit/image-utils": "^0.0.8",
|
|
118471
118530
|
"@tscircuit/krt-wasm": "^0.1.6",
|
|
118472
118531
|
"@tscircuit/math-utils": "0.0.36",
|
|
118473
|
-
"@tscircuit/props": "^0.0.
|
|
118532
|
+
"@tscircuit/props": "^0.0.580",
|
|
118474
118533
|
"@tscircuit/runframe": "^0.0.2217",
|
|
118475
118534
|
"@tscircuit/schematic-match-adapt": "^0.0.22",
|
|
118476
118535
|
"@tscircuit/solver-utils": "0.0.16",
|
|
@@ -118529,7 +118588,7 @@ var package_default = {
|
|
|
118529
118588
|
semver: "^7.6.3",
|
|
118530
118589
|
stepts: "^0.0.3",
|
|
118531
118590
|
tempy: "^3.1.0",
|
|
118532
|
-
tscircuit: "0.0.
|
|
118591
|
+
tscircuit: "0.0.2099-libonly",
|
|
118533
118592
|
tsx: "^4.7.1",
|
|
118534
118593
|
"typed-ky": "^0.0.4",
|
|
118535
118594
|
zod: "^3.23.8"
|
|
@@ -123106,23 +123165,21 @@ class AutorouterDiagnostics {
|
|
|
123106
123165
|
for (const trace of this.completedPhaseTraces) {
|
|
123107
123166
|
if (!trace || typeof trace !== "object")
|
|
123108
123167
|
continue;
|
|
123109
|
-
const
|
|
123110
|
-
const id = this.getCircuitElementId(element);
|
|
123168
|
+
const id = this.getCircuitElementId(trace);
|
|
123111
123169
|
const existingIndex = id ? elementIndexById.get(id) : undefined;
|
|
123112
123170
|
if (existingIndex === undefined) {
|
|
123113
|
-
circuitJson.push(
|
|
123171
|
+
circuitJson.push(trace);
|
|
123114
123172
|
if (id)
|
|
123115
123173
|
elementIndexById.set(id, circuitJson.length - 1);
|
|
123116
123174
|
} else {
|
|
123117
|
-
circuitJson[existingIndex] =
|
|
123175
|
+
circuitJson[existingIndex] = trace;
|
|
123118
123176
|
}
|
|
123119
123177
|
}
|
|
123120
123178
|
return circuitJson;
|
|
123121
123179
|
}
|
|
123122
123180
|
getCircuitElementId(element) {
|
|
123123
|
-
|
|
123124
|
-
|
|
123125
|
-
const id = element[`${element.type}_id`];
|
|
123181
|
+
const idEntry = Object.entries(element).find(([key, value]) => key === `${element.type}_id` && typeof value === "string");
|
|
123182
|
+
const id = idEntry?.[1];
|
|
123126
123183
|
return typeof id === "string" ? id : undefined;
|
|
123127
123184
|
}
|
|
123128
123185
|
isRouteElement(element) {
|
|
@@ -123152,17 +123209,18 @@ class AutorouterDiagnostics {
|
|
|
123152
123209
|
return parts.join(", ");
|
|
123153
123210
|
}
|
|
123154
123211
|
getConnectionNames(simpleRouteJson) {
|
|
123212
|
+
const circuitJsonLookup = this.createCircuitJsonLookup();
|
|
123155
123213
|
return [
|
|
123156
123214
|
...new Set((simpleRouteJson?.connections ?? []).map((connection) => [
|
|
123157
123215
|
connection.rootConnectionName,
|
|
123158
123216
|
connection.name,
|
|
123159
123217
|
connection.source_trace_id
|
|
123160
|
-
].filter((value) => typeof value === "string").map((value) => this.resolveCircuitJsonId(value)).find((value) => value !== null)).filter((name) => name !== null))
|
|
123218
|
+
].filter((value) => typeof value === "string").map((value) => this.resolveCircuitJsonId(value, circuitJsonLookup)).find((value) => value !== null)).filter((name) => name !== null))
|
|
123161
123219
|
];
|
|
123162
123220
|
}
|
|
123163
|
-
resolveCircuitJsonId(value) {
|
|
123164
|
-
const circuitJson =
|
|
123165
|
-
const element =
|
|
123221
|
+
resolveCircuitJsonId(value, lookup = this.createCircuitJsonLookup()) {
|
|
123222
|
+
const { circuitJson, elementById } = lookup;
|
|
123223
|
+
const element = elementById.get(value);
|
|
123166
123224
|
if (!element)
|
|
123167
123225
|
return value;
|
|
123168
123226
|
if (element.type === "source_trace") {
|
|
@@ -123179,15 +123237,27 @@ class AutorouterDiagnostics {
|
|
|
123179
123237
|
return null;
|
|
123180
123238
|
}
|
|
123181
123239
|
formatUserFacingText(value) {
|
|
123240
|
+
const circuitJsonLookup = this.createCircuitJsonLookup();
|
|
123182
123241
|
let formattedValue = value;
|
|
123183
|
-
|
|
123242
|
+
const idsInMessage = [...circuitJsonLookup.elementById.keys()].filter((id) => formattedValue.includes(id)).sort((a, b) => b.length - a.length);
|
|
123243
|
+
for (const id of idsInMessage) {
|
|
123244
|
+
formattedValue = formattedValue.replaceAll(id, this.resolveCircuitJsonId(id, circuitJsonLookup) ?? "internal element");
|
|
123245
|
+
}
|
|
123246
|
+
return formattedValue.replace(CIRCUIT_JSON_ID_PATTERN, "internal element");
|
|
123247
|
+
}
|
|
123248
|
+
createCircuitJsonLookup() {
|
|
123249
|
+
const circuitJson = this.getCurrentCircuitJson();
|
|
123250
|
+
const elementById = new Map;
|
|
123251
|
+
for (const element of circuitJson) {
|
|
123184
123252
|
for (const [key, id] of Object.entries(element)) {
|
|
123185
|
-
if (!key.endsWith("_id") || typeof id !== "string")
|
|
123253
|
+
if (!key.endsWith("_id") || typeof id !== "string" || id.length === 0)
|
|
123186
123254
|
continue;
|
|
123187
|
-
|
|
123255
|
+
if (!elementById.has(id)) {
|
|
123256
|
+
elementById.set(id, element);
|
|
123257
|
+
}
|
|
123188
123258
|
}
|
|
123189
123259
|
}
|
|
123190
|
-
return
|
|
123260
|
+
return { circuitJson, elementById };
|
|
123191
123261
|
}
|
|
123192
123262
|
getTraceSelector(trace, circuitJson) {
|
|
123193
123263
|
const portIds = trace.connected_source_port_ids;
|
|
@@ -123205,7 +123275,7 @@ class AutorouterDiagnostics {
|
|
|
123205
123275
|
if (!portName)
|
|
123206
123276
|
return null;
|
|
123207
123277
|
const component = circuitJson.find((element) => element.type === "source_component" && element.source_component_id === port.source_component_id);
|
|
123208
|
-
const componentName = component && typeof component.name === "string" ? component.name : null;
|
|
123278
|
+
const componentName = component && "name" in component && typeof component.name === "string" ? component.name : null;
|
|
123209
123279
|
return componentName ? `${componentName}.${portName}` : portName;
|
|
123210
123280
|
}
|
|
123211
123281
|
countErrors(simpleRouteJson) {
|
|
@@ -3322,23 +3322,21 @@ class AutorouterDiagnostics {
|
|
|
3322
3322
|
for (const trace of this.completedPhaseTraces) {
|
|
3323
3323
|
if (!trace || typeof trace !== "object")
|
|
3324
3324
|
continue;
|
|
3325
|
-
const
|
|
3326
|
-
const id = this.getCircuitElementId(element);
|
|
3325
|
+
const id = this.getCircuitElementId(trace);
|
|
3327
3326
|
const existingIndex = id ? elementIndexById.get(id) : undefined;
|
|
3328
3327
|
if (existingIndex === undefined) {
|
|
3329
|
-
circuitJson.push(
|
|
3328
|
+
circuitJson.push(trace);
|
|
3330
3329
|
if (id)
|
|
3331
3330
|
elementIndexById.set(id, circuitJson.length - 1);
|
|
3332
3331
|
} else {
|
|
3333
|
-
circuitJson[existingIndex] =
|
|
3332
|
+
circuitJson[existingIndex] = trace;
|
|
3334
3333
|
}
|
|
3335
3334
|
}
|
|
3336
3335
|
return circuitJson;
|
|
3337
3336
|
}
|
|
3338
3337
|
getCircuitElementId(element) {
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
const id = element[`${element.type}_id`];
|
|
3338
|
+
const idEntry = Object.entries(element).find(([key, value]) => key === `${element.type}_id` && typeof value === "string");
|
|
3339
|
+
const id = idEntry?.[1];
|
|
3342
3340
|
return typeof id === "string" ? id : undefined;
|
|
3343
3341
|
}
|
|
3344
3342
|
isRouteElement(element) {
|
|
@@ -3368,17 +3366,18 @@ class AutorouterDiagnostics {
|
|
|
3368
3366
|
return parts.join(", ");
|
|
3369
3367
|
}
|
|
3370
3368
|
getConnectionNames(simpleRouteJson) {
|
|
3369
|
+
const circuitJsonLookup = this.createCircuitJsonLookup();
|
|
3371
3370
|
return [
|
|
3372
3371
|
...new Set((simpleRouteJson?.connections ?? []).map((connection) => [
|
|
3373
3372
|
connection.rootConnectionName,
|
|
3374
3373
|
connection.name,
|
|
3375
3374
|
connection.source_trace_id
|
|
3376
|
-
].filter((value) => typeof value === "string").map((value) => this.resolveCircuitJsonId(value)).find((value) => value !== null)).filter((name) => name !== null))
|
|
3375
|
+
].filter((value) => typeof value === "string").map((value) => this.resolveCircuitJsonId(value, circuitJsonLookup)).find((value) => value !== null)).filter((name) => name !== null))
|
|
3377
3376
|
];
|
|
3378
3377
|
}
|
|
3379
|
-
resolveCircuitJsonId(value) {
|
|
3380
|
-
const circuitJson =
|
|
3381
|
-
const element =
|
|
3378
|
+
resolveCircuitJsonId(value, lookup = this.createCircuitJsonLookup()) {
|
|
3379
|
+
const { circuitJson, elementById } = lookup;
|
|
3380
|
+
const element = elementById.get(value);
|
|
3382
3381
|
if (!element)
|
|
3383
3382
|
return value;
|
|
3384
3383
|
if (element.type === "source_trace") {
|
|
@@ -3395,15 +3394,27 @@ class AutorouterDiagnostics {
|
|
|
3395
3394
|
return null;
|
|
3396
3395
|
}
|
|
3397
3396
|
formatUserFacingText(value) {
|
|
3397
|
+
const circuitJsonLookup = this.createCircuitJsonLookup();
|
|
3398
3398
|
let formattedValue = value;
|
|
3399
|
-
|
|
3399
|
+
const idsInMessage = [...circuitJsonLookup.elementById.keys()].filter((id) => formattedValue.includes(id)).sort((a, b) => b.length - a.length);
|
|
3400
|
+
for (const id of idsInMessage) {
|
|
3401
|
+
formattedValue = formattedValue.replaceAll(id, this.resolveCircuitJsonId(id, circuitJsonLookup) ?? "internal element");
|
|
3402
|
+
}
|
|
3403
|
+
return formattedValue.replace(CIRCUIT_JSON_ID_PATTERN, "internal element");
|
|
3404
|
+
}
|
|
3405
|
+
createCircuitJsonLookup() {
|
|
3406
|
+
const circuitJson = this.getCurrentCircuitJson();
|
|
3407
|
+
const elementById = new Map;
|
|
3408
|
+
for (const element of circuitJson) {
|
|
3400
3409
|
for (const [key, id] of Object.entries(element)) {
|
|
3401
|
-
if (!key.endsWith("_id") || typeof id !== "string")
|
|
3410
|
+
if (!key.endsWith("_id") || typeof id !== "string" || id.length === 0)
|
|
3402
3411
|
continue;
|
|
3403
|
-
|
|
3412
|
+
if (!elementById.has(id)) {
|
|
3413
|
+
elementById.set(id, element);
|
|
3414
|
+
}
|
|
3404
3415
|
}
|
|
3405
3416
|
}
|
|
3406
|
-
return
|
|
3417
|
+
return { circuitJson, elementById };
|
|
3407
3418
|
}
|
|
3408
3419
|
getTraceSelector(trace, circuitJson) {
|
|
3409
3420
|
const portIds = trace.connected_source_port_ids;
|
|
@@ -3421,7 +3432,7 @@ class AutorouterDiagnostics {
|
|
|
3421
3432
|
if (!portName)
|
|
3422
3433
|
return null;
|
|
3423
3434
|
const component = circuitJson.find((element) => element.type === "source_component" && element.source_component_id === port.source_component_id);
|
|
3424
|
-
const componentName = component && typeof component.name === "string" ? component.name : null;
|
|
3435
|
+
const componentName = component && "name" in component && typeof component.name === "string" ? component.name : null;
|
|
3425
3436
|
return componentName ? `${componentName}.${portName}` : portName;
|
|
3426
3437
|
}
|
|
3427
3438
|
countErrors(simpleRouteJson) {
|
package/dist/lib/index.js
CHANGED
|
@@ -45336,7 +45336,7 @@ var require_isarray = __commonJS((exports2, module2) => {
|
|
|
45336
45336
|
};
|
|
45337
45337
|
});
|
|
45338
45338
|
|
|
45339
|
-
// node_modules/
|
|
45339
|
+
// node_modules/safe-buffer/index.js
|
|
45340
45340
|
var require_safe_buffer = __commonJS((exports2, module2) => {
|
|
45341
45341
|
var buffer = __require("buffer");
|
|
45342
45342
|
var Buffer3 = buffer.Buffer;
|
|
@@ -46190,64 +46190,9 @@ var require__stream_duplex = __commonJS((exports2, module2) => {
|
|
|
46190
46190
|
};
|
|
46191
46191
|
});
|
|
46192
46192
|
|
|
46193
|
-
// node_modules/string_decoder/node_modules/safe-buffer/index.js
|
|
46194
|
-
var require_safe_buffer2 = __commonJS((exports2, module2) => {
|
|
46195
|
-
var buffer = __require("buffer");
|
|
46196
|
-
var Buffer3 = buffer.Buffer;
|
|
46197
|
-
function copyProps(src, dst) {
|
|
46198
|
-
for (var key in src) {
|
|
46199
|
-
dst[key] = src[key];
|
|
46200
|
-
}
|
|
46201
|
-
}
|
|
46202
|
-
if (Buffer3.from && Buffer3.alloc && Buffer3.allocUnsafe && Buffer3.allocUnsafeSlow) {
|
|
46203
|
-
module2.exports = buffer;
|
|
46204
|
-
} else {
|
|
46205
|
-
copyProps(buffer, exports2);
|
|
46206
|
-
exports2.Buffer = SafeBuffer;
|
|
46207
|
-
}
|
|
46208
|
-
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
46209
|
-
return Buffer3(arg, encodingOrOffset, length);
|
|
46210
|
-
}
|
|
46211
|
-
copyProps(Buffer3, SafeBuffer);
|
|
46212
|
-
SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
|
46213
|
-
if (typeof arg === "number") {
|
|
46214
|
-
throw new TypeError("Argument must not be a number");
|
|
46215
|
-
}
|
|
46216
|
-
return Buffer3(arg, encodingOrOffset, length);
|
|
46217
|
-
};
|
|
46218
|
-
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
46219
|
-
if (typeof size !== "number") {
|
|
46220
|
-
throw new TypeError("Argument must be a number");
|
|
46221
|
-
}
|
|
46222
|
-
var buf = Buffer3(size);
|
|
46223
|
-
if (fill !== undefined) {
|
|
46224
|
-
if (typeof encoding === "string") {
|
|
46225
|
-
buf.fill(fill, encoding);
|
|
46226
|
-
} else {
|
|
46227
|
-
buf.fill(fill);
|
|
46228
|
-
}
|
|
46229
|
-
} else {
|
|
46230
|
-
buf.fill(0);
|
|
46231
|
-
}
|
|
46232
|
-
return buf;
|
|
46233
|
-
};
|
|
46234
|
-
SafeBuffer.allocUnsafe = function(size) {
|
|
46235
|
-
if (typeof size !== "number") {
|
|
46236
|
-
throw new TypeError("Argument must be a number");
|
|
46237
|
-
}
|
|
46238
|
-
return Buffer3(size);
|
|
46239
|
-
};
|
|
46240
|
-
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
46241
|
-
if (typeof size !== "number") {
|
|
46242
|
-
throw new TypeError("Argument must be a number");
|
|
46243
|
-
}
|
|
46244
|
-
return buffer.SlowBuffer(size);
|
|
46245
|
-
};
|
|
46246
|
-
});
|
|
46247
|
-
|
|
46248
46193
|
// node_modules/string_decoder/lib/string_decoder.js
|
|
46249
46194
|
var require_string_decoder = __commonJS((exports2) => {
|
|
46250
|
-
var Buffer3 =
|
|
46195
|
+
var Buffer3 = require_safe_buffer().Buffer;
|
|
46251
46196
|
var isEncoding = Buffer3.isEncoding || function(encoding) {
|
|
46252
46197
|
encoding = "" + encoding;
|
|
46253
46198
|
switch (encoding && encoding.toLowerCase()) {
|
|
@@ -65812,7 +65757,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
|
65812
65757
|
}));
|
|
65813
65758
|
};
|
|
65814
65759
|
// package.json
|
|
65815
|
-
var version = "0.1.
|
|
65760
|
+
var version = "0.1.1686";
|
|
65816
65761
|
var package_default = {
|
|
65817
65762
|
name: "@tscircuit/cli",
|
|
65818
65763
|
version,
|
|
@@ -65828,14 +65773,14 @@ var package_default = {
|
|
|
65828
65773
|
"@tscircuit/circuit-json-placement-analysis": "^0.0.6",
|
|
65829
65774
|
"@tscircuit/circuit-json-routing-analysis": "^0.0.6",
|
|
65830
65775
|
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#b6d5fe675adc26a2fc988aa081e6fb51e6bf696a",
|
|
65831
|
-
"@tscircuit/eval": "^0.0.
|
|
65776
|
+
"@tscircuit/eval": "^0.0.1016",
|
|
65832
65777
|
"@tscircuit/fake-snippets": "^0.0.182",
|
|
65833
65778
|
"@tscircuit/file-server": "^0.0.32",
|
|
65834
65779
|
"@tscircuit/footprinter": "^0.0.374",
|
|
65835
65780
|
"@tscircuit/image-utils": "^0.0.8",
|
|
65836
65781
|
"@tscircuit/krt-wasm": "^0.1.6",
|
|
65837
65782
|
"@tscircuit/math-utils": "0.0.36",
|
|
65838
|
-
"@tscircuit/props": "^0.0.
|
|
65783
|
+
"@tscircuit/props": "^0.0.580",
|
|
65839
65784
|
"@tscircuit/runframe": "^0.0.2217",
|
|
65840
65785
|
"@tscircuit/schematic-match-adapt": "^0.0.22",
|
|
65841
65786
|
"@tscircuit/solver-utils": "0.0.16",
|
|
@@ -65894,7 +65839,7 @@ var package_default = {
|
|
|
65894
65839
|
semver: "^7.6.3",
|
|
65895
65840
|
stepts: "^0.0.3",
|
|
65896
65841
|
tempy: "^3.1.0",
|
|
65897
|
-
tscircuit: "0.0.
|
|
65842
|
+
tscircuit: "0.0.2099-libonly",
|
|
65898
65843
|
tsx: "^4.7.1",
|
|
65899
65844
|
"typed-ky": "^0.0.4",
|
|
65900
65845
|
zod: "^3.23.8"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1687",
|
|
4
4
|
"main": "dist/cli/main.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/cli/main.js",
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"@tscircuit/circuit-json-placement-analysis": "^0.0.6",
|
|
14
14
|
"@tscircuit/circuit-json-routing-analysis": "^0.0.6",
|
|
15
15
|
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#b6d5fe675adc26a2fc988aa081e6fb51e6bf696a",
|
|
16
|
-
"@tscircuit/eval": "^0.0.
|
|
16
|
+
"@tscircuit/eval": "^0.0.1016",
|
|
17
17
|
"@tscircuit/fake-snippets": "^0.0.182",
|
|
18
18
|
"@tscircuit/file-server": "^0.0.32",
|
|
19
19
|
"@tscircuit/footprinter": "^0.0.374",
|
|
20
20
|
"@tscircuit/image-utils": "^0.0.8",
|
|
21
21
|
"@tscircuit/krt-wasm": "^0.1.6",
|
|
22
22
|
"@tscircuit/math-utils": "0.0.36",
|
|
23
|
-
"@tscircuit/props": "^0.0.
|
|
23
|
+
"@tscircuit/props": "^0.0.580",
|
|
24
24
|
"@tscircuit/runframe": "^0.0.2217",
|
|
25
25
|
"@tscircuit/schematic-match-adapt": "^0.0.22",
|
|
26
26
|
"@tscircuit/solver-utils": "0.0.16",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"semver": "^7.6.3",
|
|
80
80
|
"stepts": "^0.0.3",
|
|
81
81
|
"tempy": "^3.1.0",
|
|
82
|
-
"tscircuit": "0.0.
|
|
82
|
+
"tscircuit": "0.0.2099-libonly",
|
|
83
83
|
"tsx": "^4.7.1",
|
|
84
84
|
"typed-ky": "^0.0.4",
|
|
85
85
|
"zod": "^3.23.8"
|