@tscircuit/cli 0.1.1182 → 0.1.1184
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 +83 -31
- package/dist/lib/index.js +82 -28
- package/package.json +2 -2
package/dist/cli/main.js
CHANGED
|
@@ -98409,7 +98409,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
|
98409
98409
|
// lib/getVersion.ts
|
|
98410
98410
|
import { createRequire as createRequire2 } from "node:module";
|
|
98411
98411
|
// package.json
|
|
98412
|
-
var version = "0.1.
|
|
98412
|
+
var version = "0.1.1183";
|
|
98413
98413
|
var package_default = {
|
|
98414
98414
|
name: "@tscircuit/cli",
|
|
98415
98415
|
version,
|
|
@@ -98441,7 +98441,7 @@ var package_default = {
|
|
|
98441
98441
|
"bun-match-svg": "^0.0.12",
|
|
98442
98442
|
chokidar: "4.0.1",
|
|
98443
98443
|
"circuit-json": "^0.0.403",
|
|
98444
|
-
"circuit-json-to-kicad": "^0.0.
|
|
98444
|
+
"circuit-json-to-kicad": "^0.0.96",
|
|
98445
98445
|
"circuit-json-to-readable-netlist": "^0.0.15",
|
|
98446
98446
|
"circuit-json-to-spice": "^0.0.10",
|
|
98447
98447
|
"circuit-json-to-tscircuit": "^0.0.9",
|
|
@@ -104968,7 +104968,7 @@ function createNpthPadFromCircuitJson({
|
|
|
104968
104968
|
drill = new PadDrill2({
|
|
104969
104969
|
diameter
|
|
104970
104970
|
});
|
|
104971
|
-
} else if (pcbHole.hole_shape === "oval") {
|
|
104971
|
+
} else if (pcbHole.hole_shape === "oval" || pcbHole.hole_shape === "pill") {
|
|
104972
104972
|
padShape = "oval";
|
|
104973
104973
|
const width = pcbHole.hole_width;
|
|
104974
104974
|
const height = pcbHole.hole_height;
|
|
@@ -105354,11 +105354,13 @@ var AddViasStage = class extends ConverterStage {
|
|
|
105354
105354
|
}
|
|
105355
105355
|
};
|
|
105356
105356
|
var AddStandalonePcbElements = class extends ConverterStage {
|
|
105357
|
-
|
|
105358
|
-
standaloneHoles = [];
|
|
105357
|
+
unprocessedElements = [];
|
|
105359
105358
|
constructor(input, ctx) {
|
|
105360
105359
|
super(input, ctx);
|
|
105361
|
-
this.
|
|
105360
|
+
this.unprocessedElements = [
|
|
105361
|
+
...this.ctx.db.pcb_hole.list().filter((hole) => !hole.pcb_component_id),
|
|
105362
|
+
...this.ctx.db.pcb_plated_hole.list().filter((hole) => !hole.pcb_component_id)
|
|
105363
|
+
];
|
|
105362
105364
|
}
|
|
105363
105365
|
_step() {
|
|
105364
105366
|
const { kicadPcb, c2kMatPcb } = this.ctx;
|
|
@@ -105368,32 +105370,84 @@ var AddStandalonePcbElements = class extends ConverterStage {
|
|
|
105368
105370
|
if (!c2kMatPcb) {
|
|
105369
105371
|
throw new Error("PCB transformation matrix not initialized in context");
|
|
105370
105372
|
}
|
|
105371
|
-
|
|
105373
|
+
const elm = this.unprocessedElements.shift();
|
|
105374
|
+
if (!elm) {
|
|
105372
105375
|
this.finished = true;
|
|
105373
105376
|
return;
|
|
105374
105377
|
}
|
|
105375
|
-
|
|
105376
|
-
|
|
105377
|
-
|
|
105378
|
-
|
|
105378
|
+
if (elm.type === "pcb_hole") {
|
|
105379
|
+
const hole = elm;
|
|
105380
|
+
const footprintSeed = `standalone_hole:${hole.pcb_hole_id}:${hole.x},${hole.y}`;
|
|
105381
|
+
const kicadPos = applyToPoint16(c2kMatPcb, { x: hole.x, y: hole.y });
|
|
105382
|
+
const libraryLink = this.getHoleLibraryLink(hole);
|
|
105383
|
+
const footprint = new Footprint4({
|
|
105384
|
+
libraryLink,
|
|
105385
|
+
layer: "F.Cu",
|
|
105386
|
+
at: [kicadPos.x, kicadPos.y, 0],
|
|
105387
|
+
uuid: generateDeterministicUuid(footprintSeed)
|
|
105388
|
+
});
|
|
105389
|
+
const ccwRotationDegrees = 0;
|
|
105390
|
+
const npthPads = convertNpthHoles([hole], { x: hole.x, y: hole.y }, ccwRotationDegrees);
|
|
105391
|
+
if (npthPads.length > 0) {
|
|
105392
|
+
footprint.fpPads = npthPads;
|
|
105393
|
+
const footprints = kicadPcb.footprints;
|
|
105394
|
+
footprints.push(footprint);
|
|
105395
|
+
kicadPcb.footprints = footprints;
|
|
105396
|
+
}
|
|
105397
|
+
} else if (elm.type === "pcb_plated_hole") {
|
|
105398
|
+
const hole = elm;
|
|
105399
|
+
const footprintSeed = `standalone_plated_hole:${hole.pcb_plated_hole_id}:${hole.x},${hole.y}`;
|
|
105400
|
+
const kicadPos = applyToPoint16(c2kMatPcb, { x: hole.x, y: hole.y });
|
|
105401
|
+
const libraryLink = this.getPlatedHoleLibraryLink(hole);
|
|
105402
|
+
const footprint = new Footprint4({
|
|
105403
|
+
libraryLink,
|
|
105404
|
+
layer: "F.Cu",
|
|
105405
|
+
at: [kicadPos.x, kicadPos.y, 0],
|
|
105406
|
+
uuid: generateDeterministicUuid(footprintSeed)
|
|
105407
|
+
});
|
|
105408
|
+
const pad = createThruHolePadFromCircuitJson({
|
|
105409
|
+
platedHole: hole,
|
|
105410
|
+
componentCenter: { x: hole.x, y: hole.y },
|
|
105411
|
+
padNumber: 1,
|
|
105412
|
+
componentRotation: 0
|
|
105413
|
+
});
|
|
105414
|
+
if (pad) {
|
|
105415
|
+
footprint.fpPads = [pad];
|
|
105416
|
+
const footprints = kicadPcb.footprints;
|
|
105417
|
+
footprints.push(footprint);
|
|
105418
|
+
kicadPcb.footprints = footprints;
|
|
105419
|
+
}
|
|
105379
105420
|
}
|
|
105380
|
-
|
|
105381
|
-
|
|
105382
|
-
const
|
|
105383
|
-
|
|
105384
|
-
|
|
105385
|
-
|
|
105386
|
-
|
|
105387
|
-
|
|
105388
|
-
|
|
105389
|
-
|
|
105390
|
-
|
|
105391
|
-
|
|
105392
|
-
|
|
105393
|
-
|
|
105394
|
-
|
|
105421
|
+
}
|
|
105422
|
+
getHoleLibraryLink(hole) {
|
|
105423
|
+
const { hole_shape: shape } = hole;
|
|
105424
|
+
if (shape === "circle") {
|
|
105425
|
+
return `tscircuit:hole_${shape}_holeDiameter${hole.hole_diameter}mm`;
|
|
105426
|
+
}
|
|
105427
|
+
if (shape === "pill" || shape === "oval") {
|
|
105428
|
+
const h = hole;
|
|
105429
|
+
return `tscircuit:hole_${shape}_holeWidth${h.hole_width}mm_holeHeight${h.hole_height}mm`;
|
|
105430
|
+
}
|
|
105431
|
+
return "tscircuit:hole";
|
|
105432
|
+
}
|
|
105433
|
+
getPlatedHoleLibraryLink(hole) {
|
|
105434
|
+
const shape = hole.shape;
|
|
105435
|
+
if (shape === "circle") {
|
|
105436
|
+
return `tscircuit:platedhole_${shape}_holeDiameter${hole.hole_diameter}mm_outerDiameter${hole.outer_diameter}mm`;
|
|
105437
|
+
}
|
|
105438
|
+
if (shape === "pill" || shape === "oval") {
|
|
105439
|
+
const h = hole;
|
|
105440
|
+
return `tscircuit:platedhole_${shape}_holeWidth${h.hole_width}mm_holeHeight${h.hole_height}mm_outerWidth${h.outer_width}mm_outerHeight${h.outer_height}mm`;
|
|
105441
|
+
}
|
|
105442
|
+
if (shape === "pill_hole_with_rect_pad") {
|
|
105443
|
+
const h = hole;
|
|
105444
|
+
return `tscircuit:platedhole_${shape}_holeWidth${h.hole_width}mm_holeHeight${h.hole_height}mm_rectPadWidth${h.rect_pad_width}mm_rectPadHeight${h.rect_pad_height}mm`;
|
|
105395
105445
|
}
|
|
105396
|
-
|
|
105446
|
+
if (shape === "circular_hole_with_rect_pad") {
|
|
105447
|
+
const h = hole;
|
|
105448
|
+
return `tscircuit:platedhole_${shape}_holeDiameter${h.hole_diameter}mm_rectPadWidth${h.rect_pad_width}mm_rectPadHeight${h.rect_pad_height}mm`;
|
|
105449
|
+
}
|
|
105450
|
+
return "tscircuit:platedhole";
|
|
105397
105451
|
}
|
|
105398
105452
|
getOutput() {
|
|
105399
105453
|
return this.ctx.kicadPcb;
|
|
@@ -108998,6 +109052,7 @@ import path38 from "node:path";
|
|
|
108998
109052
|
// lib/shared/thread-worker-pool.ts
|
|
108999
109053
|
import { Worker } from "node:worker_threads";
|
|
109000
109054
|
var DEFAULT_WORKER_JOB_TIMEOUT_MS = 3 * 60 * 1000;
|
|
109055
|
+
var DEFAULT_HEARTBEAT_INTERVAL_MS = 30 * 1000;
|
|
109001
109056
|
|
|
109002
109057
|
class ThreadWorkerPool {
|
|
109003
109058
|
workers = [];
|
|
@@ -109043,10 +109098,7 @@ class ThreadWorkerPool {
|
|
|
109043
109098
|
if (!this.options.onLog || this.heartbeatIntervalId) {
|
|
109044
109099
|
return;
|
|
109045
109100
|
}
|
|
109046
|
-
|
|
109047
|
-
return;
|
|
109048
|
-
}
|
|
109049
|
-
const heartbeatIntervalMs = this.options.heartbeatIntervalMs ?? 5000;
|
|
109101
|
+
const heartbeatIntervalMs = this.options.heartbeatIntervalMs ?? DEFAULT_HEARTBEAT_INTERVAL_MS;
|
|
109050
109102
|
if (heartbeatIntervalMs <= 0) {
|
|
109051
109103
|
return;
|
|
109052
109104
|
}
|
package/dist/lib/index.js
CHANGED
|
@@ -60678,7 +60678,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
|
60678
60678
|
}));
|
|
60679
60679
|
};
|
|
60680
60680
|
// package.json
|
|
60681
|
-
var version = "0.1.
|
|
60681
|
+
var version = "0.1.1183";
|
|
60682
60682
|
var package_default = {
|
|
60683
60683
|
name: "@tscircuit/cli",
|
|
60684
60684
|
version,
|
|
@@ -60710,7 +60710,7 @@ var package_default = {
|
|
|
60710
60710
|
"bun-match-svg": "^0.0.12",
|
|
60711
60711
|
chokidar: "4.0.1",
|
|
60712
60712
|
"circuit-json": "^0.0.403",
|
|
60713
|
-
"circuit-json-to-kicad": "^0.0.
|
|
60713
|
+
"circuit-json-to-kicad": "^0.0.96",
|
|
60714
60714
|
"circuit-json-to-readable-netlist": "^0.0.15",
|
|
60715
60715
|
"circuit-json-to-spice": "^0.0.10",
|
|
60716
60716
|
"circuit-json-to-tscircuit": "^0.0.9",
|
|
@@ -65953,7 +65953,7 @@ function createNpthPadFromCircuitJson({
|
|
|
65953
65953
|
drill = new PadDrill2({
|
|
65954
65954
|
diameter
|
|
65955
65955
|
});
|
|
65956
|
-
} else if (pcbHole.hole_shape === "oval") {
|
|
65956
|
+
} else if (pcbHole.hole_shape === "oval" || pcbHole.hole_shape === "pill") {
|
|
65957
65957
|
padShape = "oval";
|
|
65958
65958
|
const width = pcbHole.hole_width;
|
|
65959
65959
|
const height = pcbHole.hole_height;
|
|
@@ -66339,11 +66339,13 @@ var AddViasStage = class extends ConverterStage {
|
|
|
66339
66339
|
}
|
|
66340
66340
|
};
|
|
66341
66341
|
var AddStandalonePcbElements = class extends ConverterStage {
|
|
66342
|
-
|
|
66343
|
-
standaloneHoles = [];
|
|
66342
|
+
unprocessedElements = [];
|
|
66344
66343
|
constructor(input, ctx) {
|
|
66345
66344
|
super(input, ctx);
|
|
66346
|
-
this.
|
|
66345
|
+
this.unprocessedElements = [
|
|
66346
|
+
...this.ctx.db.pcb_hole.list().filter((hole) => !hole.pcb_component_id),
|
|
66347
|
+
...this.ctx.db.pcb_plated_hole.list().filter((hole) => !hole.pcb_component_id)
|
|
66348
|
+
];
|
|
66347
66349
|
}
|
|
66348
66350
|
_step() {
|
|
66349
66351
|
const { kicadPcb, c2kMatPcb } = this.ctx;
|
|
@@ -66353,32 +66355,84 @@ var AddStandalonePcbElements = class extends ConverterStage {
|
|
|
66353
66355
|
if (!c2kMatPcb) {
|
|
66354
66356
|
throw new Error("PCB transformation matrix not initialized in context");
|
|
66355
66357
|
}
|
|
66356
|
-
|
|
66358
|
+
const elm = this.unprocessedElements.shift();
|
|
66359
|
+
if (!elm) {
|
|
66357
66360
|
this.finished = true;
|
|
66358
66361
|
return;
|
|
66359
66362
|
}
|
|
66360
|
-
|
|
66361
|
-
|
|
66362
|
-
|
|
66363
|
-
|
|
66363
|
+
if (elm.type === "pcb_hole") {
|
|
66364
|
+
const hole = elm;
|
|
66365
|
+
const footprintSeed = `standalone_hole:${hole.pcb_hole_id}:${hole.x},${hole.y}`;
|
|
66366
|
+
const kicadPos = applyToPoint16(c2kMatPcb, { x: hole.x, y: hole.y });
|
|
66367
|
+
const libraryLink = this.getHoleLibraryLink(hole);
|
|
66368
|
+
const footprint = new Footprint4({
|
|
66369
|
+
libraryLink,
|
|
66370
|
+
layer: "F.Cu",
|
|
66371
|
+
at: [kicadPos.x, kicadPos.y, 0],
|
|
66372
|
+
uuid: generateDeterministicUuid(footprintSeed)
|
|
66373
|
+
});
|
|
66374
|
+
const ccwRotationDegrees = 0;
|
|
66375
|
+
const npthPads = convertNpthHoles([hole], { x: hole.x, y: hole.y }, ccwRotationDegrees);
|
|
66376
|
+
if (npthPads.length > 0) {
|
|
66377
|
+
footprint.fpPads = npthPads;
|
|
66378
|
+
const footprints = kicadPcb.footprints;
|
|
66379
|
+
footprints.push(footprint);
|
|
66380
|
+
kicadPcb.footprints = footprints;
|
|
66381
|
+
}
|
|
66382
|
+
} else if (elm.type === "pcb_plated_hole") {
|
|
66383
|
+
const hole = elm;
|
|
66384
|
+
const footprintSeed = `standalone_plated_hole:${hole.pcb_plated_hole_id}:${hole.x},${hole.y}`;
|
|
66385
|
+
const kicadPos = applyToPoint16(c2kMatPcb, { x: hole.x, y: hole.y });
|
|
66386
|
+
const libraryLink = this.getPlatedHoleLibraryLink(hole);
|
|
66387
|
+
const footprint = new Footprint4({
|
|
66388
|
+
libraryLink,
|
|
66389
|
+
layer: "F.Cu",
|
|
66390
|
+
at: [kicadPos.x, kicadPos.y, 0],
|
|
66391
|
+
uuid: generateDeterministicUuid(footprintSeed)
|
|
66392
|
+
});
|
|
66393
|
+
const pad = createThruHolePadFromCircuitJson({
|
|
66394
|
+
platedHole: hole,
|
|
66395
|
+
componentCenter: { x: hole.x, y: hole.y },
|
|
66396
|
+
padNumber: 1,
|
|
66397
|
+
componentRotation: 0
|
|
66398
|
+
});
|
|
66399
|
+
if (pad) {
|
|
66400
|
+
footprint.fpPads = [pad];
|
|
66401
|
+
const footprints = kicadPcb.footprints;
|
|
66402
|
+
footprints.push(footprint);
|
|
66403
|
+
kicadPcb.footprints = footprints;
|
|
66404
|
+
}
|
|
66364
66405
|
}
|
|
66365
|
-
|
|
66366
|
-
|
|
66367
|
-
const
|
|
66368
|
-
|
|
66369
|
-
|
|
66370
|
-
|
|
66371
|
-
|
|
66372
|
-
|
|
66373
|
-
|
|
66374
|
-
|
|
66375
|
-
|
|
66376
|
-
|
|
66377
|
-
|
|
66378
|
-
|
|
66379
|
-
|
|
66380
|
-
|
|
66381
|
-
|
|
66406
|
+
}
|
|
66407
|
+
getHoleLibraryLink(hole) {
|
|
66408
|
+
const { hole_shape: shape } = hole;
|
|
66409
|
+
if (shape === "circle") {
|
|
66410
|
+
return `tscircuit:hole_${shape}_holeDiameter${hole.hole_diameter}mm`;
|
|
66411
|
+
}
|
|
66412
|
+
if (shape === "pill" || shape === "oval") {
|
|
66413
|
+
const h = hole;
|
|
66414
|
+
return `tscircuit:hole_${shape}_holeWidth${h.hole_width}mm_holeHeight${h.hole_height}mm`;
|
|
66415
|
+
}
|
|
66416
|
+
return "tscircuit:hole";
|
|
66417
|
+
}
|
|
66418
|
+
getPlatedHoleLibraryLink(hole) {
|
|
66419
|
+
const shape = hole.shape;
|
|
66420
|
+
if (shape === "circle") {
|
|
66421
|
+
return `tscircuit:platedhole_${shape}_holeDiameter${hole.hole_diameter}mm_outerDiameter${hole.outer_diameter}mm`;
|
|
66422
|
+
}
|
|
66423
|
+
if (shape === "pill" || shape === "oval") {
|
|
66424
|
+
const h = hole;
|
|
66425
|
+
return `tscircuit:platedhole_${shape}_holeWidth${h.hole_width}mm_holeHeight${h.hole_height}mm_outerWidth${h.outer_width}mm_outerHeight${h.outer_height}mm`;
|
|
66426
|
+
}
|
|
66427
|
+
if (shape === "pill_hole_with_rect_pad") {
|
|
66428
|
+
const h = hole;
|
|
66429
|
+
return `tscircuit:platedhole_${shape}_holeWidth${h.hole_width}mm_holeHeight${h.hole_height}mm_rectPadWidth${h.rect_pad_width}mm_rectPadHeight${h.rect_pad_height}mm`;
|
|
66430
|
+
}
|
|
66431
|
+
if (shape === "circular_hole_with_rect_pad") {
|
|
66432
|
+
const h = hole;
|
|
66433
|
+
return `tscircuit:platedhole_${shape}_holeDiameter${h.hole_diameter}mm_rectPadWidth${h.rect_pad_width}mm_rectPadHeight${h.rect_pad_height}mm`;
|
|
66434
|
+
}
|
|
66435
|
+
return "tscircuit:platedhole";
|
|
66382
66436
|
}
|
|
66383
66437
|
getOutput() {
|
|
66384
66438
|
return this.ctx.kicadPcb;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1184",
|
|
4
4
|
"main": "dist/cli/main.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/cli/main.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"bun-match-svg": "^0.0.12",
|
|
30
30
|
"chokidar": "4.0.1",
|
|
31
31
|
"circuit-json": "^0.0.403",
|
|
32
|
-
"circuit-json-to-kicad": "^0.0.
|
|
32
|
+
"circuit-json-to-kicad": "^0.0.96",
|
|
33
33
|
"circuit-json-to-readable-netlist": "^0.0.15",
|
|
34
34
|
"circuit-json-to-spice": "^0.0.10",
|
|
35
35
|
"circuit-json-to-tscircuit": "^0.0.9",
|