circuit-json-to-kicad 0.0.29 → 0.0.31

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
@@ -1,6 +1,6 @@
1
1
  import { CircuitJson } from 'circuit-json';
2
2
  import { CircuitJsonUtilObjects, cju } from '@tscircuit/circuit-json-util';
3
- import { KicadSch, KicadPcb } from 'kicadts';
3
+ import { KicadSch, KicadPcb, SchematicSymbol } from 'kicadts';
4
4
  import { Matrix } from 'transformation-matrix';
5
5
 
6
6
  type PaperSize = "A0" | "A1" | "A2" | "A3" | "A4" | "A5";
@@ -17,6 +17,22 @@ interface PcbNetInfo {
17
17
  id: number;
18
18
  name: string;
19
19
  }
20
+ interface SymbolEntry {
21
+ symbolName: string;
22
+ symbol: SchematicSymbol;
23
+ }
24
+ interface FootprintEntry {
25
+ footprintName: string;
26
+ kicadModString: string;
27
+ model3dSourcePaths: string[];
28
+ }
29
+ interface KicadLibraryOutput {
30
+ kicadSymString: string;
31
+ footprints: FootprintEntry[];
32
+ fpLibTableString: string;
33
+ symLibTableString: string;
34
+ model3dSourcePaths: string[];
35
+ }
20
36
  interface ConverterContext {
21
37
  db: CircuitJsonUtilObjects;
22
38
  circuitJson: CircuitJson;
@@ -38,6 +54,13 @@ interface ConverterContext {
38
54
  y: number;
39
55
  }>;
40
56
  pcbNetMap?: Map<string, PcbNetInfo>;
57
+ libraryName?: string;
58
+ fpLibraryName?: string;
59
+ kicadSchString?: string;
60
+ kicadPcbString?: string;
61
+ symbolEntries?: SymbolEntry[];
62
+ footprintEntries?: FootprintEntry[];
63
+ libraryOutput?: KicadLibraryOutput;
41
64
  }
42
65
  declare abstract class ConverterStage<Input, Output> {
43
66
  MAX_ITERATIONS: number;
@@ -156,4 +179,26 @@ declare class CircuitJsonToKicadProConverter {
156
179
  getOutputString(): string;
157
180
  }
158
181
 
159
- export { CircuitJsonToKicadPcbConverter, CircuitJsonToKicadProConverter, CircuitJsonToKicadSchConverter };
182
+ interface CircuitJsonToKicadLibraryOptions {
183
+ libraryName?: string;
184
+ footprintLibraryName?: string;
185
+ }
186
+
187
+ declare class CircuitJsonToKicadLibraryConverter {
188
+ ctx: ConverterContext;
189
+ pipeline: ConverterStage<CircuitJson, KicadLibraryOutput>[];
190
+ currentStageIndex: number;
191
+ finished: boolean;
192
+ get currentStage(): ConverterStage<CircuitJson, KicadLibraryOutput> | undefined;
193
+ constructor(circuitJson: CircuitJson, options?: CircuitJsonToKicadLibraryOptions);
194
+ step(): void;
195
+ runUntilFinished(): void;
196
+ getOutput(): KicadLibraryOutput;
197
+ getSymbolLibraryString(): string;
198
+ getFootprints(): FootprintEntry[];
199
+ getFpLibTableString(): string;
200
+ getSymLibTableString(): string;
201
+ getModel3dSourcePaths(): string[];
202
+ }
203
+
204
+ export { CircuitJsonToKicadLibraryConverter, CircuitJsonToKicadPcbConverter, CircuitJsonToKicadProConverter, CircuitJsonToKicadSchConverter, type FootprintEntry, type KicadLibraryOutput, type SymbolEntry };
package/dist/index.js CHANGED
@@ -75,33 +75,50 @@ import {
75
75
  } from "kicadts";
76
76
  import { symbols } from "schematic-symbols";
77
77
 
78
+ // lib/utils/getKicadCompatibleComponentName.ts
79
+ function getKicadCompatibleComponentName(sourceComponent, cadComponent) {
80
+ if (sourceComponent.manufacturer_part_number) {
81
+ return sanitizeName(sourceComponent.manufacturer_part_number);
82
+ }
83
+ const cleanType = getCleanTypeName(sourceComponent.ftype);
84
+ const footprinterString = cadComponent?.footprinter_string;
85
+ if (footprinterString) {
86
+ return sanitizeName(`${cleanType}_${footprinterString}`);
87
+ }
88
+ return sanitizeName(cleanType);
89
+ }
90
+ function getCleanTypeName(ftype) {
91
+ if (!ftype) return "component";
92
+ let cleanName = ftype.replace(/^simple_/, "");
93
+ if (!cleanName) return "component";
94
+ return cleanName;
95
+ }
96
+ function sanitizeName(name) {
97
+ return name.replace(/[\\\/:\s]+/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "").trim() || "component";
98
+ }
99
+ function extractReferencePrefix(name) {
100
+ if (!name) return "U";
101
+ const match = name.match(/^([A-Za-z]+)/);
102
+ return match?.[1]?.toUpperCase() ?? "U";
103
+ }
104
+
78
105
  // lib/schematic/getLibraryId.ts
79
- function getLibraryId(sourceComp, schematicComp) {
106
+ function getLibraryId(sourceComp, schematicComp, cadComponent) {
80
107
  if (sourceComp.type !== "source_component") {
81
108
  if (schematicComp.symbol_name) {
82
109
  return `Custom:${schematicComp.symbol_name}`;
83
110
  }
84
111
  return "Device:Component";
85
112
  }
86
- if (sourceComp.ftype === "simple_resistor") {
87
- return `Device:R_${sourceComp.source_component_id}`;
88
- }
89
- if (sourceComp.ftype === "simple_capacitor") {
90
- return `Device:C_${sourceComp.source_component_id}`;
91
- }
92
- if (sourceComp.ftype === "simple_inductor") {
93
- return `Device:L_${sourceComp.source_component_id}`;
94
- }
95
- if (sourceComp.ftype === "simple_diode") {
96
- return `Device:D_${sourceComp.source_component_id}`;
97
- }
98
- if (sourceComp.ftype === "simple_chip") {
99
- return `Device:U_${sourceComp.source_component_id}`;
100
- }
101
113
  if (schematicComp.symbol_name) {
102
114
  return `Custom:${schematicComp.symbol_name}`;
103
115
  }
104
- return `Device:Component_${sourceComp.source_component_id}`;
116
+ const ergonomicName = getKicadCompatibleComponentName(
117
+ sourceComp,
118
+ cadComponent
119
+ );
120
+ const refPrefix = extractReferencePrefix(sourceComp.name);
121
+ return `Device:${refPrefix}_${ergonomicName}`;
105
122
  }
106
123
 
107
124
  // lib/schematic/stages/AddLibrarySymbolsStage.ts
@@ -149,13 +166,19 @@ var AddLibrarySymbolsStage = class extends ConverterStage {
149
166
  const { db } = this.ctx;
150
167
  const sourceComp = schematicComponent.source_component_id ? db.source_component.get(schematicComponent.source_component_id) : null;
151
168
  if (!sourceComp) return null;
169
+ const cadComponent = db.cad_component?.list()?.find(
170
+ (cad) => cad.source_component_id === sourceComp.source_component_id
171
+ );
152
172
  const symbolName = schematicComponent.symbol_name || (sourceComp.ftype === "simple_chip" ? `generic_chip_${schematicComponent.source_component_id}` : null);
153
173
  if (!symbolName) return null;
154
174
  const symbolData = this.getSymbolData(symbolName, schematicComponent);
155
175
  if (!symbolData) return null;
156
- const libId = getLibraryId(sourceComp, schematicComponent);
176
+ const libId = getLibraryId(sourceComp, schematicComponent, cadComponent);
157
177
  const isChip = sourceComp.ftype === "simple_chip";
158
- const footprintName = sourceComp.ftype || "";
178
+ const footprintName = getKicadCompatibleComponentName(
179
+ sourceComp,
180
+ cadComponent
181
+ );
159
182
  return this.createLibrarySymbol({
160
183
  libId,
161
184
  symbolData,
@@ -626,7 +649,14 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
626
649
  uuid,
627
650
  fieldsAutoplaced: true
628
651
  });
629
- const libId = getLibraryId(sourceComponent, schematicComponent);
652
+ const cadComponent = db.cad_component?.list()?.find(
653
+ (cad) => cad.source_component_id === sourceComponent.source_component_id
654
+ );
655
+ const libId = getLibraryId(
656
+ sourceComponent,
657
+ schematicComponent,
658
+ cadComponent
659
+ );
630
660
  const symLibId = new SymbolLibId(libId);
631
661
  symbol._sxLibId = symLibId;
632
662
  const { reference, value, description } = this.getComponentMetadata(sourceComponent);
@@ -1842,7 +1872,13 @@ var AddFootprintsStage = class extends ConverterStage {
1842
1872
  }
1843
1873
  const component = this.pcbComponents[this.componentsProcessed];
1844
1874
  const sourceComponent = component.source_component_id ? this.ctx.db.source_component.get(component.source_component_id) : null;
1845
- const footprintName = sourceComponent?.ftype || "Unknown";
1875
+ const cadComponent = this.getCadComponentForPcbComponent(
1876
+ component.pcb_component_id
1877
+ );
1878
+ const footprintName = sourceComponent ? getKicadCompatibleComponentName(
1879
+ sourceComponent,
1880
+ cadComponent
1881
+ ) : "Unknown";
1846
1882
  const transformedPos = applyToPoint9(c2kMatPcb, {
1847
1883
  x: component.center.x,
1848
1884
  y: component.center.y
@@ -1919,9 +1955,6 @@ var AddFootprintsStage = class extends ConverterStage {
1919
1955
  }
1920
1956
  }
1921
1957
  footprint.fpPads = fpPads;
1922
- const cadComponent = this.getCadComponentForPcbComponent(
1923
- component.pcb_component_id
1924
- );
1925
1958
  if (cadComponent) {
1926
1959
  const models = this.create3DModelsFromCadComponent(
1927
1960
  cadComponent,
@@ -2430,7 +2463,350 @@ var CircuitJsonToKicadProConverter = class {
2430
2463
  `;
2431
2464
  }
2432
2465
  };
2466
+
2467
+ // lib/kicad-library/CircuitJsonToKicadLibraryConverter.ts
2468
+ import { cju as cju4 } from "@tscircuit/circuit-json-util";
2469
+
2470
+ // lib/kicad-library/stages/GenerateKicadSchAndPcbStage.ts
2471
+ var GenerateKicadSchAndPcbStage = class extends ConverterStage {
2472
+ _step() {
2473
+ const schConverter = new CircuitJsonToKicadSchConverter(
2474
+ this.ctx.circuitJson
2475
+ );
2476
+ schConverter.runUntilFinished();
2477
+ this.ctx.kicadSchString = schConverter.getOutputString();
2478
+ const pcbConverter = new CircuitJsonToKicadPcbConverter(
2479
+ this.ctx.circuitJson
2480
+ );
2481
+ pcbConverter.runUntilFinished();
2482
+ this.ctx.kicadPcbString = pcbConverter.getOutputString();
2483
+ this.finished = true;
2484
+ }
2485
+ getOutput() {
2486
+ return this.ctx.libraryOutput;
2487
+ }
2488
+ };
2489
+
2490
+ // lib/kicad-library/stages/ExtractSymbolsStage.ts
2491
+ import { parseKicadSexpr, KicadSch as KicadSch2 } from "kicadts";
2492
+ var ExtractSymbolsStage = class extends ConverterStage {
2493
+ _step() {
2494
+ const schContent = this.ctx.kicadSchString;
2495
+ const fpLibraryName = this.ctx.fpLibraryName ?? "tscircuit";
2496
+ if (!schContent) {
2497
+ throw new Error(
2498
+ "Schematic content not available. Run GenerateKicadSchAndPcbStage first."
2499
+ );
2500
+ }
2501
+ const uniqueSymbols = /* @__PURE__ */ new Map();
2502
+ try {
2503
+ const parsed = parseKicadSexpr(schContent);
2504
+ const sch = parsed.find(
2505
+ (node) => node instanceof KicadSch2
2506
+ );
2507
+ if (!sch) {
2508
+ this.ctx.symbolEntries = [];
2509
+ this.finished = true;
2510
+ return;
2511
+ }
2512
+ const libSymbols = sch.libSymbols;
2513
+ if (!libSymbols) {
2514
+ this.ctx.symbolEntries = [];
2515
+ this.finished = true;
2516
+ return;
2517
+ }
2518
+ const symbols3 = libSymbols.symbols ?? [];
2519
+ for (const symbol of symbols3) {
2520
+ const symbolName = this.sanitizeSymbolName(symbol.libraryId);
2521
+ if (!uniqueSymbols.has(symbolName)) {
2522
+ symbol.libraryId = symbolName;
2523
+ this.updateFootprintProperty(symbol, fpLibraryName);
2524
+ uniqueSymbols.set(symbolName, {
2525
+ symbolName,
2526
+ symbol
2527
+ });
2528
+ }
2529
+ }
2530
+ } catch (error) {
2531
+ console.warn("Failed to parse schematic for symbol extraction:", error);
2532
+ }
2533
+ this.ctx.symbolEntries = Array.from(uniqueSymbols.values());
2534
+ this.finished = true;
2535
+ }
2536
+ /**
2537
+ * Updates the Footprint property in a symbol to use the correct library name.
2538
+ * Changes "tscircuit:footprint_name" to "fpLibraryName:footprint_name"
2539
+ */
2540
+ updateFootprintProperty(symbol, fpLibraryName) {
2541
+ const properties = symbol.properties ?? [];
2542
+ for (const prop of properties) {
2543
+ if (prop.key === "Footprint" && prop.value) {
2544
+ const parts = prop.value.split(":");
2545
+ if (parts.length > 1) {
2546
+ prop.value = `${fpLibraryName}:${parts[1]}`;
2547
+ } else if (prop.value.trim()) {
2548
+ prop.value = `${fpLibraryName}:${prop.value}`;
2549
+ }
2550
+ }
2551
+ }
2552
+ }
2553
+ sanitizeSymbolName(libraryId) {
2554
+ if (!libraryId) return "symbol";
2555
+ const parts = libraryId.split(":");
2556
+ const name = parts.length > 1 ? parts[1] : parts[0];
2557
+ return name?.replace(/[\\\/]/g, "-").trim() || "symbol";
2558
+ }
2559
+ getOutput() {
2560
+ return this.ctx.libraryOutput;
2561
+ }
2562
+ };
2563
+
2564
+ // lib/kicad-library/stages/ExtractFootprintsStage.ts
2565
+ import {
2566
+ parseKicadSexpr as parseKicadSexpr2,
2567
+ KicadPcb as KicadPcb2,
2568
+ FootprintModel as FootprintModel2,
2569
+ At as At2
2570
+ } from "kicadts";
2571
+ function getBasename(filePath) {
2572
+ const parts = filePath.split(/[/\\]/);
2573
+ return parts[parts.length - 1] || filePath;
2574
+ }
2575
+ var ExtractFootprintsStage = class extends ConverterStage {
2576
+ _step() {
2577
+ const kicadPcbString = this.ctx.kicadPcbString;
2578
+ const fpLibraryName = this.ctx.fpLibraryName ?? "tscircuit";
2579
+ if (!kicadPcbString) {
2580
+ throw new Error(
2581
+ "PCB content not available. Run GenerateKicadSchAndPcbStage first."
2582
+ );
2583
+ }
2584
+ const uniqueFootprints = /* @__PURE__ */ new Map();
2585
+ try {
2586
+ const parsed = parseKicadSexpr2(kicadPcbString);
2587
+ const pcb = parsed.find(
2588
+ (node) => node instanceof KicadPcb2
2589
+ );
2590
+ if (!pcb) {
2591
+ this.ctx.footprintEntries = [];
2592
+ this.finished = true;
2593
+ return;
2594
+ }
2595
+ const footprints = pcb.footprints ?? [];
2596
+ for (const footprint of footprints) {
2597
+ const sanitized = this.sanitizeFootprint(footprint, fpLibraryName);
2598
+ if (!uniqueFootprints.has(sanitized.footprintName)) {
2599
+ uniqueFootprints.set(sanitized.footprintName, sanitized);
2600
+ }
2601
+ }
2602
+ } catch (error) {
2603
+ console.warn("Failed to parse PCB for footprint extraction:", error);
2604
+ }
2605
+ this.ctx.footprintEntries = Array.from(uniqueFootprints.values());
2606
+ this.finished = true;
2607
+ }
2608
+ sanitizeFootprint(footprint, fpLibraryName) {
2609
+ const libraryLink = footprint.libraryLink ?? "footprint";
2610
+ const parts = libraryLink.split(":");
2611
+ const footprintName = (parts.length > 1 ? parts[1] : parts[0])?.replace(/[\\\/]/g, "-").trim() || "footprint";
2612
+ footprint.libraryLink = footprintName;
2613
+ footprint.position = At2.from([0, 0, 0]);
2614
+ footprint.locked = false;
2615
+ footprint.placed = false;
2616
+ footprint.uuid = void 0;
2617
+ footprint.path = void 0;
2618
+ footprint.sheetfile = void 0;
2619
+ footprint.sheetname = void 0;
2620
+ footprint.properties = [];
2621
+ const texts = footprint.fpTexts ?? [];
2622
+ for (const text of texts) {
2623
+ text.uuid = void 0;
2624
+ if (text.type === "reference") {
2625
+ text.text = "REF**";
2626
+ } else if (text.type === "value" && text.text.trim().length === 0) {
2627
+ text.text = footprintName;
2628
+ }
2629
+ }
2630
+ footprint.fpTexts = texts;
2631
+ const pads = footprint.fpPads ?? [];
2632
+ for (const pad of pads) {
2633
+ pad.uuid = void 0;
2634
+ pad.net = void 0;
2635
+ }
2636
+ footprint.fpPads = pads;
2637
+ const models = footprint.models ?? [];
2638
+ const updatedModels = [];
2639
+ const modelFiles = [];
2640
+ for (const model of models) {
2641
+ if (model.path) {
2642
+ const modelFilename = getBasename(model.path);
2643
+ const newPath = `\${KIPRJMOD}/${fpLibraryName}.3dshapes/${modelFilename}`;
2644
+ const newModel = new FootprintModel2(newPath);
2645
+ if (model.offset) newModel.offset = model.offset;
2646
+ if (model.scale) newModel.scale = model.scale;
2647
+ if (model.rotate) newModel.rotate = model.rotate;
2648
+ updatedModels.push(newModel);
2649
+ modelFiles.push(model.path);
2650
+ }
2651
+ }
2652
+ footprint.models = updatedModels;
2653
+ return {
2654
+ footprintName,
2655
+ kicadModString: footprint.getString(),
2656
+ model3dSourcePaths: modelFiles
2657
+ };
2658
+ }
2659
+ getOutput() {
2660
+ return this.ctx.libraryOutput;
2661
+ }
2662
+ };
2663
+
2664
+ // lib/kicad-library/stages/GenerateSymbolLibraryStage.ts
2665
+ import { KicadSymbolLib } from "kicadts";
2666
+ var KICAD_SYM_LIB_VERSION = 20211014;
2667
+ var GENERATOR = "circuit-json-to-kicad";
2668
+ var GenerateSymbolLibraryStage = class extends ConverterStage {
2669
+ _step() {
2670
+ const symbolEntries = this.ctx.symbolEntries ?? [];
2671
+ const symbolLibrary = this.generateSymbolLibrary(symbolEntries);
2672
+ if (!this.ctx.libraryOutput) {
2673
+ this.ctx.libraryOutput = {
2674
+ kicadSymString: "",
2675
+ footprints: [],
2676
+ fpLibTableString: "",
2677
+ symLibTableString: "",
2678
+ model3dSourcePaths: []
2679
+ };
2680
+ }
2681
+ this.ctx.libraryOutput.kicadSymString = symbolLibrary;
2682
+ this.finished = true;
2683
+ }
2684
+ generateSymbolLibrary(symbolEntries) {
2685
+ const symbolLib = new KicadSymbolLib({
2686
+ version: KICAD_SYM_LIB_VERSION,
2687
+ generator: GENERATOR,
2688
+ symbols: symbolEntries.map((entry) => entry.symbol)
2689
+ });
2690
+ return symbolLib.getString();
2691
+ }
2692
+ getOutput() {
2693
+ return this.ctx.libraryOutput;
2694
+ }
2695
+ };
2696
+
2697
+ // lib/kicad-library/stages/GenerateLibraryTablesStage.ts
2698
+ var GenerateLibraryTablesStage = class extends ConverterStage {
2699
+ _step() {
2700
+ const libraryName = this.ctx.libraryName ?? "tscircuit";
2701
+ const fpLibraryName = this.ctx.fpLibraryName ?? "tscircuit";
2702
+ const footprintEntries = this.ctx.footprintEntries ?? [];
2703
+ const model3dSourcePathsSet = /* @__PURE__ */ new Set();
2704
+ for (const fp of footprintEntries) {
2705
+ for (const modelPath of fp.model3dSourcePaths) {
2706
+ model3dSourcePathsSet.add(modelPath);
2707
+ }
2708
+ }
2709
+ const fpLibTableString = this.generateFpLibTable(fpLibraryName);
2710
+ const symLibTableString = this.generateSymLibTable(libraryName);
2711
+ if (!this.ctx.libraryOutput) {
2712
+ this.ctx.libraryOutput = {
2713
+ kicadSymString: "",
2714
+ footprints: [],
2715
+ fpLibTableString: "",
2716
+ symLibTableString: "",
2717
+ model3dSourcePaths: []
2718
+ };
2719
+ }
2720
+ this.ctx.libraryOutput.footprints = footprintEntries;
2721
+ this.ctx.libraryOutput.fpLibTableString = fpLibTableString;
2722
+ this.ctx.libraryOutput.symLibTableString = symLibTableString;
2723
+ this.ctx.libraryOutput.model3dSourcePaths = Array.from(
2724
+ model3dSourcePathsSet
2725
+ );
2726
+ this.finished = true;
2727
+ }
2728
+ generateFpLibTable(fpLibraryName) {
2729
+ return `(fp_lib_table
2730
+ (version 7)
2731
+ (lib (name "${fpLibraryName}") (type "KiCad") (uri "\${KIPRJMOD}/${fpLibraryName}.pretty") (options "") (descr "Generated by circuit-json-to-kicad"))
2732
+ )
2733
+ `;
2734
+ }
2735
+ generateSymLibTable(libraryName) {
2736
+ return `(sym_lib_table
2737
+ (version 7)
2738
+ (lib (name "${libraryName}") (type "KiCad") (uri "\${KIPRJMOD}/${libraryName}.kicad_sym") (options "") (descr "Generated by circuit-json-to-kicad"))
2739
+ )
2740
+ `;
2741
+ }
2742
+ getOutput() {
2743
+ return this.ctx.libraryOutput;
2744
+ }
2745
+ };
2746
+
2747
+ // lib/kicad-library/CircuitJsonToKicadLibraryConverter.ts
2748
+ var CircuitJsonToKicadLibraryConverter = class {
2749
+ ctx;
2750
+ pipeline;
2751
+ currentStageIndex = 0;
2752
+ finished = false;
2753
+ get currentStage() {
2754
+ return this.pipeline[this.currentStageIndex];
2755
+ }
2756
+ constructor(circuitJson, options = {}) {
2757
+ this.ctx = {
2758
+ db: cju4(circuitJson),
2759
+ circuitJson,
2760
+ libraryName: options.libraryName ?? "tscircuit",
2761
+ fpLibraryName: options.footprintLibraryName ?? "tscircuit"
2762
+ };
2763
+ this.pipeline = [
2764
+ new GenerateKicadSchAndPcbStage(circuitJson, this.ctx),
2765
+ new ExtractSymbolsStage(circuitJson, this.ctx),
2766
+ new ExtractFootprintsStage(circuitJson, this.ctx),
2767
+ new GenerateSymbolLibraryStage(circuitJson, this.ctx),
2768
+ new GenerateLibraryTablesStage(circuitJson, this.ctx)
2769
+ ];
2770
+ }
2771
+ step() {
2772
+ if (!this.currentStage) {
2773
+ this.finished = true;
2774
+ return;
2775
+ }
2776
+ this.currentStage.step();
2777
+ if (this.currentStage.finished) {
2778
+ this.currentStageIndex++;
2779
+ }
2780
+ }
2781
+ runUntilFinished() {
2782
+ while (!this.finished) {
2783
+ this.step();
2784
+ }
2785
+ }
2786
+ getOutput() {
2787
+ if (!this.ctx.libraryOutput) {
2788
+ throw new Error("Converter has not been run yet");
2789
+ }
2790
+ return this.ctx.libraryOutput;
2791
+ }
2792
+ getSymbolLibraryString() {
2793
+ return this.getOutput().kicadSymString;
2794
+ }
2795
+ getFootprints() {
2796
+ return this.getOutput().footprints;
2797
+ }
2798
+ getFpLibTableString() {
2799
+ return this.getOutput().fpLibTableString;
2800
+ }
2801
+ getSymLibTableString() {
2802
+ return this.getOutput().symLibTableString;
2803
+ }
2804
+ getModel3dSourcePaths() {
2805
+ return this.getOutput().model3dSourcePaths;
2806
+ }
2807
+ };
2433
2808
  export {
2809
+ CircuitJsonToKicadLibraryConverter,
2434
2810
  CircuitJsonToKicadPcbConverter,
2435
2811
  CircuitJsonToKicadProConverter,
2436
2812
  CircuitJsonToKicadSchConverter
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "circuit-json-to-kicad",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.29",
4
+ "version": "0.0.31",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -21,7 +21,7 @@
21
21
  "@types/bun": "latest",
22
22
  "circuit-json": "^0.0.302",
23
23
  "circuit-to-svg": "^0.0.208",
24
- "kicadts": "^0.0.22",
24
+ "kicadts": "^0.0.23",
25
25
  "schematic-symbols": "^0.0.202",
26
26
  "sharp": "^0.34.4",
27
27
  "transformation-matrix": "^3.1.0",