@jlcpcb/core 0.1.0 → 0.1.1

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.
Files changed (88) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/api/easyeda-community.d.ts +36 -0
  3. package/dist/api/easyeda-community.d.ts.map +1 -0
  4. package/dist/api/easyeda.d.ts +23 -0
  5. package/dist/api/easyeda.d.ts.map +1 -0
  6. package/dist/api/index.d.ts +7 -0
  7. package/dist/api/index.d.ts.map +1 -0
  8. package/dist/api/jlc.d.ts +41 -0
  9. package/dist/api/jlc.d.ts.map +1 -0
  10. package/dist/constants/design-rules.d.ts +34 -0
  11. package/dist/constants/design-rules.d.ts.map +1 -0
  12. package/dist/constants/footprints.d.ts +134 -0
  13. package/dist/constants/footprints.d.ts.map +1 -0
  14. package/dist/constants/index.d.ts +7 -0
  15. package/dist/constants/index.d.ts.map +1 -0
  16. package/dist/constants/kicad.d.ts +67 -0
  17. package/dist/constants/kicad.d.ts.map +1 -0
  18. package/dist/converter/category-router.d.ts +47 -0
  19. package/dist/converter/category-router.d.ts.map +1 -0
  20. package/dist/converter/footprint-mapper.d.ts +40 -0
  21. package/dist/converter/footprint-mapper.d.ts.map +1 -0
  22. package/dist/converter/footprint-mapper.test.d.ts +2 -0
  23. package/dist/converter/footprint-mapper.test.d.ts.map +1 -0
  24. package/dist/converter/footprint.d.ts +106 -0
  25. package/dist/converter/footprint.d.ts.map +1 -0
  26. package/dist/converter/global-lib-table.d.ts +29 -0
  27. package/dist/converter/global-lib-table.d.ts.map +1 -0
  28. package/dist/converter/index.d.ts +12 -0
  29. package/dist/converter/index.d.ts.map +1 -0
  30. package/dist/converter/lib-table.d.ts +61 -0
  31. package/dist/converter/lib-table.d.ts.map +1 -0
  32. package/dist/converter/svg-arc.d.ts +45 -0
  33. package/dist/converter/svg-arc.d.ts.map +1 -0
  34. package/dist/converter/symbol-templates.d.ts +34 -0
  35. package/dist/converter/symbol-templates.d.ts.map +1 -0
  36. package/dist/converter/symbol.d.ts +223 -0
  37. package/dist/converter/symbol.d.ts.map +1 -0
  38. package/dist/converter/value-normalizer.d.ts +33 -0
  39. package/dist/converter/value-normalizer.d.ts.map +1 -0
  40. package/dist/index.d.ts +12 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +9198 -0
  43. package/dist/parsers/easyeda-shapes.d.ts +115 -0
  44. package/dist/parsers/easyeda-shapes.d.ts.map +1 -0
  45. package/dist/parsers/http-client.d.ts +16 -0
  46. package/dist/parsers/http-client.d.ts.map +1 -0
  47. package/dist/parsers/index.d.ts +11 -0
  48. package/dist/parsers/index.d.ts.map +1 -0
  49. package/dist/parsers/utils.d.ts +17 -0
  50. package/dist/parsers/utils.d.ts.map +1 -0
  51. package/dist/services/component-service.d.ts +31 -0
  52. package/dist/services/component-service.d.ts.map +1 -0
  53. package/dist/services/fix-service.d.ts +40 -0
  54. package/dist/services/fix-service.d.ts.map +1 -0
  55. package/dist/services/index.d.ts +8 -0
  56. package/dist/services/index.d.ts.map +1 -0
  57. package/dist/services/library-service.d.ts +111 -0
  58. package/dist/services/library-service.d.ts.map +1 -0
  59. package/dist/types/component.d.ts +56 -0
  60. package/dist/types/component.d.ts.map +1 -0
  61. package/dist/types/easyeda-community.d.ts +74 -0
  62. package/dist/types/easyeda-community.d.ts.map +1 -0
  63. package/dist/types/easyeda.d.ts +326 -0
  64. package/dist/types/easyeda.d.ts.map +1 -0
  65. package/dist/types/index.d.ts +12 -0
  66. package/dist/types/index.d.ts.map +1 -0
  67. package/dist/types/jlc.d.ts +78 -0
  68. package/dist/types/jlc.d.ts.map +1 -0
  69. package/dist/types/kicad.d.ts +141 -0
  70. package/dist/types/kicad.d.ts.map +1 -0
  71. package/dist/types/mcp.d.ts +66 -0
  72. package/dist/types/mcp.d.ts.map +1 -0
  73. package/dist/types/project.d.ts +60 -0
  74. package/dist/types/project.d.ts.map +1 -0
  75. package/dist/utils/conversion.d.ts +59 -0
  76. package/dist/utils/conversion.d.ts.map +1 -0
  77. package/dist/utils/file-system.d.ts +59 -0
  78. package/dist/utils/file-system.d.ts.map +1 -0
  79. package/dist/utils/index.d.ts +8 -0
  80. package/dist/utils/index.d.ts.map +1 -0
  81. package/dist/utils/logger.d.ts +26 -0
  82. package/dist/utils/logger.d.ts.map +1 -0
  83. package/dist/utils/validation.d.ts +259 -0
  84. package/dist/utils/validation.d.ts.map +1 -0
  85. package/package.json +1 -1
  86. package/src/converter/footprint-mapper.test.ts +159 -0
  87. package/src/converter/footprint-mapper.ts +42 -134
  88. package/src/converter/footprint.ts +24 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @jlcpcb/core
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - **@jlcpcb/core:**
8
+ - Fix: Restrict built-in footprints to 2-pad passives only — prevents pin-flip issues on multi-pin components
9
+
10
+ **@jlcpcb/cli & @jlcpcb/mcp:**
11
+ - Updated dependencies
12
+
3
13
  ## 0.1.0
4
14
 
5
15
  ### Minor Changes
@@ -0,0 +1,36 @@
1
+ /**
2
+ * EasyEDA Community Library API client
3
+ * For searching and fetching user-contributed components
4
+ *
5
+ * Uses shared parsers from common/parsers for all shape types.
6
+ */
7
+ import type { EasyEDACommunitySearchParams, EasyEDACommunitySearchResult, EasyEDACommunityComponent } from '../types/index.js';
8
+ export declare class EasyEDACommunityClient {
9
+ /**
10
+ * Search the EasyEDA community library
11
+ */
12
+ search(params: EasyEDACommunitySearchParams): Promise<EasyEDACommunitySearchResult[]>;
13
+ /**
14
+ * Get full component details by UUID
15
+ */
16
+ getComponent(uuid: string): Promise<EasyEDACommunityComponent | null>;
17
+ /**
18
+ * Download 3D model for a component
19
+ */
20
+ get3DModel(uuid: string, format?: 'step' | 'obj'): Promise<Buffer | null>;
21
+ /**
22
+ * Parse search results from the API response
23
+ */
24
+ private parseSearchResults;
25
+ /**
26
+ * Parse a single search result item
27
+ */
28
+ private parseSearchItem;
29
+ /**
30
+ * Parse full component data from the API response
31
+ * Uses shared parsers for consistent shape parsing with LCSC client.
32
+ */
33
+ private parseComponent;
34
+ }
35
+ export declare const easyedaCommunityClient: EasyEDACommunityClient;
36
+ //# sourceMappingURL=easyeda-community.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"easyeda-community.d.ts","sourceRoot":"","sources":["../../src/api/easyeda-community.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,EAC1B,MAAM,mBAAmB,CAAA;AAkB1B,qBAAa,sBAAsB;IACjC;;OAEG;IACG,MAAM,CACV,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,4BAA4B,EAAE,CAAC;IAgC1C;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAoB3E;;OAEG;IACG,UAAU,CACd,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,MAAM,GAAG,KAAc,GAC9B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAczB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAyB1B;;OAEG;IACH,OAAO,CAAC,eAAe;IA+BvB;;;OAGG;IACH,OAAO,CAAC,cAAc;CAgFvB;AAED,eAAO,MAAM,sBAAsB,wBAA+B,CAAA"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * EasyEDA API client for component library fetching
3
+ *
4
+ * Uses shared parsers from common/parsers for all shape types.
5
+ */
6
+ import type { EasyEDAComponentData } from '../types/index.js';
7
+ export declare class EasyEDAClient {
8
+ private userAgent;
9
+ /**
10
+ * Fetch component data from EasyEDA API
11
+ */
12
+ getComponentData(lcscPartNumber: string): Promise<EasyEDAComponentData | null>;
13
+ /**
14
+ * Download 3D model for a component
15
+ */
16
+ get3DModel(uuid: string, format?: 'step' | 'obj'): Promise<Buffer | null>;
17
+ /**
18
+ * Parse raw EasyEDA API response into structured data
19
+ */
20
+ private parseComponentData;
21
+ }
22
+ export declare const easyedaClient: EasyEDAClient;
23
+ //# sourceMappingURL=easyeda.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"easyeda.d.ts","sourceRoot":"","sources":["../../src/api/easyeda.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAc9D,qBAAa,aAAa;IACxB,OAAO,CAAC,SAAS,CAA2B;IAE5C;;OAEG;IACG,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAoBpF;;OAEG;IACG,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,KAAc,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAavF;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAqF3B;AAED,eAAO,MAAM,aAAa,eAAsB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * API clients for JLC and EasyEDA
3
+ */
4
+ export { JLCClient, jlcClient } from './jlc.js';
5
+ export { EasyEDAClient, easyedaClient } from './easyeda.js';
6
+ export { EasyEDACommunityClient, easyedaCommunityClient } from './easyeda-community.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * JLC API client for component search and details
3
+ * Uses JLCPCB's parts library API which provides LCSC component data
4
+ */
5
+ import type { LCSCSearchOptions, ComponentSearchResult } from '../types/index.js';
6
+ export interface LCSCProduct {
7
+ productCode: string;
8
+ productModel: string;
9
+ brandNameEn: string;
10
+ encapStandard: string;
11
+ productPriceList: Array<{
12
+ ladder: number;
13
+ productPrice: number;
14
+ currencySymbol: string;
15
+ }>;
16
+ stockNumber: number;
17
+ productIntroEn: string;
18
+ }
19
+ export declare class JLCClient {
20
+ /**
21
+ * Search for components via JLCPCB API
22
+ */
23
+ search(query: string, options?: LCSCSearchOptions): Promise<ComponentSearchResult[]>;
24
+ /**
25
+ * Get stock and pricing information for a component
26
+ */
27
+ getStock(lcscPartNumber: string): Promise<{
28
+ stock: number;
29
+ priceBreaks: Array<{
30
+ quantity: number;
31
+ price: number;
32
+ }>;
33
+ }>;
34
+ /**
35
+ * Get detailed component information including attributes
36
+ * Used to enrich EasyEDA data with JLC-specific attributes
37
+ */
38
+ getComponentDetails(lcscPartNumber: string): Promise<ComponentSearchResult | null>;
39
+ }
40
+ export declare const jlcClient: JLCClient;
41
+ //# sourceMappingURL=jlc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jlc.d.ts","sourceRoot":"","sources":["../../src/api/jlc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AA6ClF,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,KAAK,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC,CAAC;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,SAAS;IACpB;;OAEG;IACG,MAAM,CACV,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,qBAAqB,EAAE,CAAC;IA+EnC;;OAEG;IACG,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;QAC9C,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,KAAK,CAAC;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACzD,CAAC;IAeF;;;OAGG;IACG,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;CAOzF;AAED,eAAO,MAAM,SAAS,WAAkB,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Default design rules for common PCB manufacturers
3
+ */
4
+ export interface DesignRules {
5
+ name: string;
6
+ minTraceWidth: number;
7
+ minTraceClearance: number;
8
+ minViaDrill: number;
9
+ minViaPad: number;
10
+ minHoleDrill: number;
11
+ minAnnularRing: number;
12
+ minSilkscreenWidth: number;
13
+ minSilkscreenClearance: number;
14
+ }
15
+ export declare const JLCPCB_STANDARD: DesignRules;
16
+ export declare const JLCPCB_ADVANCED: DesignRules;
17
+ export declare const PCBWAY_STANDARD: DesignRules;
18
+ export declare const OSHPARK_STANDARD: DesignRules;
19
+ export declare const HOBBY_RULES: DesignRules;
20
+ export declare const TRACE_WIDTH_CURRENT: Record<string, number>;
21
+ export declare const LAYER_STACKUPS: {
22
+ readonly '2-layer': {
23
+ readonly layers: readonly ["F.Cu", "B.Cu"];
24
+ readonly copperThickness: 0.035;
25
+ readonly boardThickness: 1.6;
26
+ };
27
+ readonly '4-layer': {
28
+ readonly layers: readonly ["F.Cu", "In1.Cu", "In2.Cu", "B.Cu"];
29
+ readonly copperThickness: 0.035;
30
+ readonly boardThickness: 1.6;
31
+ };
32
+ };
33
+ export declare function getDesignRulesForManufacturer(manufacturer: string): DesignRules;
34
+ //# sourceMappingURL=design-rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-rules.d.ts","sourceRoot":"","sources":["../../src/constants/design-rules.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAGD,eAAO,MAAM,eAAe,EAAE,WAU7B,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,WAU7B,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,WAU7B,CAAC;AAGF,eAAO,MAAM,gBAAgB,EAAE,WAU9B,CAAC;AAGF,eAAO,MAAM,WAAW,EAAE,WAUzB,CAAC;AAGF,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAOtD,CAAC;AAGF,eAAO,MAAM,cAAc;;;;;;;;;;;CAWjB,CAAC;AAEX,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,CAa/E"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Standard footprint patterns and dimensions
3
+ */
4
+ export declare const SMD_PACKAGE_SIZES: Record<string, {
5
+ length: number;
6
+ width: number;
7
+ }>;
8
+ export declare const IC_PACKAGE_PATTERNS: {
9
+ readonly SOIC8: {
10
+ readonly pins: 8;
11
+ readonly pitch: 1.27;
12
+ readonly width: 3.9;
13
+ };
14
+ readonly SOIC14: {
15
+ readonly pins: 14;
16
+ readonly pitch: 1.27;
17
+ readonly width: 3.9;
18
+ };
19
+ readonly SOIC16: {
20
+ readonly pins: 16;
21
+ readonly pitch: 1.27;
22
+ readonly width: 3.9;
23
+ };
24
+ readonly TSSOP8: {
25
+ readonly pins: 8;
26
+ readonly pitch: 0.65;
27
+ readonly width: 3;
28
+ };
29
+ readonly TSSOP14: {
30
+ readonly pins: 14;
31
+ readonly pitch: 0.65;
32
+ readonly width: 4.4;
33
+ };
34
+ readonly TSSOP16: {
35
+ readonly pins: 16;
36
+ readonly pitch: 0.65;
37
+ readonly width: 4.4;
38
+ };
39
+ readonly TSSOP20: {
40
+ readonly pins: 20;
41
+ readonly pitch: 0.65;
42
+ readonly width: 4.4;
43
+ };
44
+ readonly LQFP32: {
45
+ readonly pins: 32;
46
+ readonly pitch: 0.8;
47
+ readonly size: 7;
48
+ };
49
+ readonly LQFP48: {
50
+ readonly pins: 48;
51
+ readonly pitch: 0.5;
52
+ readonly size: 7;
53
+ };
54
+ readonly LQFP64: {
55
+ readonly pins: 64;
56
+ readonly pitch: 0.5;
57
+ readonly size: 10;
58
+ };
59
+ readonly LQFP100: {
60
+ readonly pins: 100;
61
+ readonly pitch: 0.5;
62
+ readonly size: 14;
63
+ };
64
+ readonly LQFP144: {
65
+ readonly pins: 144;
66
+ readonly pitch: 0.5;
67
+ readonly size: 20;
68
+ };
69
+ readonly QFN16: {
70
+ readonly pins: 16;
71
+ readonly pitch: 0.5;
72
+ readonly size: 3;
73
+ };
74
+ readonly QFN20: {
75
+ readonly pins: 20;
76
+ readonly pitch: 0.5;
77
+ readonly size: 4;
78
+ };
79
+ readonly QFN24: {
80
+ readonly pins: 24;
81
+ readonly pitch: 0.5;
82
+ readonly size: 4;
83
+ };
84
+ readonly QFN32: {
85
+ readonly pins: 32;
86
+ readonly pitch: 0.5;
87
+ readonly size: 5;
88
+ };
89
+ readonly QFN48: {
90
+ readonly pins: 48;
91
+ readonly pitch: 0.5;
92
+ readonly size: 7;
93
+ };
94
+ readonly BGA100: {
95
+ readonly pins: 100;
96
+ readonly pitch: 0.8;
97
+ };
98
+ readonly BGA144: {
99
+ readonly pins: 144;
100
+ readonly pitch: 0.8;
101
+ };
102
+ readonly BGA256: {
103
+ readonly pins: 256;
104
+ readonly pitch: 0.8;
105
+ };
106
+ };
107
+ export declare const CONNECTOR_PITCHES: {
108
+ readonly STANDARD_2_54MM: 2.54;
109
+ readonly STANDARD_2MM: 2;
110
+ readonly FINE_1_27MM: 1.27;
111
+ readonly FINE_1MM: 1;
112
+ readonly USB_C: 0.5;
113
+ readonly FPC_0_5MM: 0.5;
114
+ readonly FPC_1MM: 1;
115
+ };
116
+ export declare const MOUNTING_HOLES: {
117
+ readonly M2: {
118
+ readonly drill: 2.2;
119
+ readonly pad: 4;
120
+ };
121
+ readonly M2_5: {
122
+ readonly drill: 2.7;
123
+ readonly pad: 5;
124
+ };
125
+ readonly M3: {
126
+ readonly drill: 3.2;
127
+ readonly pad: 6;
128
+ };
129
+ readonly M4: {
130
+ readonly drill: 4.3;
131
+ readonly pad: 8;
132
+ };
133
+ };
134
+ //# sourceMappingURL=footprints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"footprints.d.ts","sourceRoot":"","sources":["../../src/constants/footprints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAU/E,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BtB,CAAC;AAGX,eAAO,MAAM,iBAAiB;;;;;;;;CAQpB,CAAC;AAGX,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;CAKjB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * ai-eda-common constants
3
+ */
4
+ export * from './kicad.js';
5
+ export * from './footprints.js';
6
+ export * from './design-rules.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * KiCad layer names and constants
3
+ */
4
+ export declare const KICAD_LAYERS: {
5
+ readonly F_CU: "F.Cu";
6
+ readonly B_CU: "B.Cu";
7
+ readonly IN1_CU: "In1.Cu";
8
+ readonly IN2_CU: "In2.Cu";
9
+ readonly IN3_CU: "In3.Cu";
10
+ readonly IN4_CU: "In4.Cu";
11
+ readonly F_ADHES: "F.Adhes";
12
+ readonly F_PASTE: "F.Paste";
13
+ readonly F_SILKS: "F.SilkS";
14
+ readonly F_MASK: "F.Mask";
15
+ readonly F_CRTYD: "F.CrtYd";
16
+ readonly F_FAB: "F.Fab";
17
+ readonly B_ADHES: "B.Adhes";
18
+ readonly B_PASTE: "B.Paste";
19
+ readonly B_SILKS: "B.SilkS";
20
+ readonly B_MASK: "B.Mask";
21
+ readonly B_CRTYD: "B.CrtYd";
22
+ readonly B_FAB: "B.Fab";
23
+ readonly EDGE_CUTS: "Edge.Cuts";
24
+ readonly MARGIN: "Margin";
25
+ readonly DWGS_USER: "Dwgs.User";
26
+ readonly CMTS_USER: "Cmts.User";
27
+ readonly ECO1_USER: "Eco1.User";
28
+ readonly ECO2_USER: "Eco2.User";
29
+ };
30
+ export declare const KICAD_LAYER_GROUPS: {
31
+ readonly ALL_CU: readonly ["*.Cu"];
32
+ readonly ALL_MASK: readonly ["*.Mask"];
33
+ readonly FRONT_LAYERS: readonly ["F.Cu", "F.Paste", "F.Mask"];
34
+ readonly BACK_LAYERS: readonly ["B.Cu", "B.Paste", "B.Mask"];
35
+ readonly SMD_FRONT: readonly ["F.Cu", "F.Paste", "F.Mask"];
36
+ readonly SMD_BACK: readonly ["B.Cu", "B.Paste", "B.Mask"];
37
+ readonly THT: readonly ["*.Cu", "*.Mask"];
38
+ };
39
+ export declare const KICAD_DEFAULTS: {
40
+ readonly TEXT_SIZE: 1.27;
41
+ readonly TEXT_THICKNESS: 0.15;
42
+ readonly WIRE_WIDTH: 0.25;
43
+ readonly GRID_SCHEMATIC: 2.54;
44
+ readonly GRID_PCB: 0.25;
45
+ readonly PIN_LENGTH: 1.27;
46
+ readonly PIN_NAME_OFFSET: 0;
47
+ };
48
+ export declare const KICAD_SYMBOL_VERSION = "20241209";
49
+ export declare const KICAD_FOOTPRINT_VERSION = "20241209";
50
+ export declare const KICAD_PIN_TYPES: readonly ["input", "output", "bidirectional", "tri_state", "passive", "free", "unspecified", "power_in", "power_out", "open_collector", "open_emitter", "no_connect"];
51
+ export declare const KICAD_PAD_SHAPES: readonly ["circle", "rect", "oval", "trapezoid", "roundrect", "custom"];
52
+ export declare const KICAD_PAD_TYPES: readonly ["thru_hole", "smd", "connect", "np_thru_hole"];
53
+ export declare const KICAD_LIBRARY_NAME = "EDA-MCP";
54
+ export declare const KICAD_LIBRARY_DESCRIPTION = "AI-EDA Component Library (JLC/EasyEDA)";
55
+ export declare const KICAD_VERSIONS: readonly ["9.0", "8.0"];
56
+ /**
57
+ * Get global KiCad library paths for a specific platform
58
+ * Returns paths in the format that kicad-sch-mcp's search pattern expects:
59
+ * ~/Documents/KiCad/{version}/symbols/*.kicad_sym
60
+ */
61
+ export declare function getGlobalKicadLibraryPaths(homeDir: string, platform: 'darwin' | 'win32' | 'linux', version?: string): {
62
+ base: string;
63
+ symbols: string;
64
+ footprints: string;
65
+ models3d: string;
66
+ } | null;
67
+ //# sourceMappingURL=kicad.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kicad.d.ts","sourceRoot":"","sources":["../../src/constants/kicad.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;CAgCf,CAAC;AAGX,eAAO,MAAM,kBAAkB;;;;;;;;CAQrB,CAAC;AAGX,eAAO,MAAM,cAAc;;;;;;;;CAQjB,CAAC;AAGX,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAC/C,eAAO,MAAM,uBAAuB,aAAa,CAAC;AAGlD,eAAO,MAAM,eAAe,uKAalB,CAAC;AAGX,eAAO,MAAM,gBAAgB,yEAOnB,CAAC;AAGX,eAAO,MAAM,eAAe,0DAKlB,CAAC;AAGX,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAC5C,eAAO,MAAM,yBAAyB,2CAA2C,CAAC;AAGlF,eAAO,MAAM,cAAc,yBAA0B,CAAC;AAEtD;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,EACtC,OAAO,GAAE,MAAc,GACtB;IACD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CA0BP"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Category Router
3
+ * Routes components to category-based symbol libraries with robust keyword matching
4
+ * JLC-MCP-Resistors.kicad_sym, JLC-MCP-MCUs.kicad_sym, etc.
5
+ */
6
+ export type LibraryCategory = 'Resistors' | 'Capacitors' | 'Inductors' | 'Diodes' | 'Transistors' | 'Crystals' | 'Power' | 'MCUs' | 'Memory' | 'Sensors' | 'Interface' | 'Optocouplers' | 'Connectors' | 'ICs' | 'Misc';
7
+ /**
8
+ * Determine library category from component prefix, LCSC category, and description
9
+ * Uses priority-ordered keyword matching with fuzzy detection
10
+ */
11
+ export declare function getLibraryCategory(prefix: string, category?: string, description?: string): LibraryCategory;
12
+ /**
13
+ * Get symbol library filename for a category
14
+ * Returns: "JLC-MCP-Resistors.kicad_sym"
15
+ */
16
+ export declare function getLibraryFilename(category: LibraryCategory): string;
17
+ /**
18
+ * Get footprint library directory name
19
+ * All footprints go in a single directory
20
+ * Returns: "JLC-MCP.pretty"
21
+ */
22
+ export declare function getFootprintDirName(): string;
23
+ /**
24
+ * Get 3D models directory name
25
+ * Returns: "JLC-MCP.3dshapes"
26
+ */
27
+ export declare function get3DModelsDirName(): string;
28
+ /**
29
+ * Get full symbol reference for use in schematics
30
+ * Format: "JLC-MCP-Resistors:SymbolName"
31
+ */
32
+ export declare function getSymbolReference(category: LibraryCategory, symbolName: string): string;
33
+ /**
34
+ * Get full footprint reference for use in schematics/boards
35
+ * Format: "JLC-MCP:FootprintName"
36
+ */
37
+ export declare function getFootprintReference(footprintName: string): string;
38
+ /**
39
+ * Get all possible library categories
40
+ */
41
+ export declare function getAllCategories(): LibraryCategory[];
42
+ /**
43
+ * Parse library name to extract category
44
+ * "JLC-MCP-Resistors" -> "Resistors"
45
+ */
46
+ export declare function parseLibraryName(libraryName: string): LibraryCategory | null;
47
+ //# sourceMappingURL=category-router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"category-router.d.ts","sourceRoot":"","sources":["../../src/converter/category-router.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,aAAa,GACb,UAAU,GACV,OAAO,GACP,MAAM,GACN,QAAQ,GACR,SAAS,GACT,WAAW,GACX,cAAc,GACd,YAAY,GACZ,KAAK,GACL,MAAM,CAAC;AAyfX;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,GACnB,eAAe,CAuBjB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAGxF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,EAAE,CAkBpD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAS5E"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * KiCad Standard Footprint Mapper
3
+ * Maps common package names to KiCad built-in footprints for hybrid approach
4
+ *
5
+ * CONSERVATIVE APPROACH: Only uses KiCad built-ins for 2-pad unpolarized passives (R/C/L).
6
+ * All other components (ICs, transistors, diodes, etc.) generate custom footprints
7
+ * to avoid pin-flip issues from pad numbering mismatches.
8
+ */
9
+ export interface FootprintMapping {
10
+ library: string;
11
+ footprint: string;
12
+ }
13
+ /**
14
+ * Map package name to KiCad standard footprint
15
+ *
16
+ * CONSERVATIVE APPROACH: Only returns built-in mappings for 2-pad unpolarized passives.
17
+ * This avoids pin-flip issues that can occur when pad numbering differs between
18
+ * EasyEDA data and KiCad built-in footprints (e.g., SOT-23 transistors have
19
+ * different BCE/CBE/EBC pinouts across manufacturers).
20
+ *
21
+ * Returns null if no standard mapping exists (will fall back to generated footprint)
22
+ */
23
+ export declare function mapToKicadFootprint(packageName: string, componentPrefix: string, _category?: string, _description?: string): FootprintMapping | null;
24
+ /**
25
+ * Get expected pad count for a KiCad footprint mapping
26
+ * Used to validate that EasyEDA footprint matches before using built-in
27
+ *
28
+ * Returns null if pad count is unknown (caller should allow the mapping)
29
+ */
30
+ export declare function getExpectedPadCount(mapping: FootprintMapping): number | null;
31
+ /**
32
+ * Get full KiCad footprint reference string
33
+ * Format: "Library:Footprint"
34
+ */
35
+ export declare function getKicadFootprintRef(mapping: FootprintMapping): string;
36
+ /**
37
+ * Check if a package is likely a standard passive that can use KiCad footprints
38
+ */
39
+ export declare function isStandardPassive(packageName: string, prefix: string): boolean;
40
+ //# sourceMappingURL=footprint-mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"footprint-mapper.d.ts","sourceRoot":"","sources":["../../src/converter/footprint-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AA4DD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,GACpB,gBAAgB,GAAG,IAAI,CAqBzB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,GAAG,IAAI,CAW5E;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAEtE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAG9E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=footprint-mapper.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"footprint-mapper.test.d.ts","sourceRoot":"","sources":["../../src/converter/footprint-mapper.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * EasyEDA Footprint to KiCad Footprint Converter
3
+ * Complete rewrite to handle all EasyEDA shape types
4
+ *
5
+ * Supported shapes: PAD, TRACK, HOLE, CIRCLE, ARC, RECT, VIA, TEXT, SOLIDREGION
6
+ */
7
+ import type { EasyEDAComponentData } from '../types/index.js';
8
+ export interface FootprintConversionOptions {
9
+ libraryName?: string;
10
+ include3DModel?: boolean;
11
+ modelPath?: string;
12
+ }
13
+ export interface FootprintResult {
14
+ type: 'reference' | 'generated';
15
+ reference?: string;
16
+ content?: string;
17
+ name: string;
18
+ }
19
+ export declare class FootprintConverter {
20
+ /**
21
+ * Convert EasyEDA component data to KiCad footprint format string
22
+ */
23
+ convert(component: EasyEDAComponentData, options?: FootprintConversionOptions): string;
24
+ /**
25
+ * Get footprint using hybrid approach:
26
+ * - Use KiCad standard footprint if available (for common 2-pad passives)
27
+ * - Generate custom footprint for all other components
28
+ *
29
+ * CONSERVATIVE APPROACH: Only uses KiCad built-ins for R/C/L passives.
30
+ * This prevents pin-flip issues from pad numbering mismatches in ICs/transistors.
31
+ */
32
+ getFootprint(component: EasyEDAComponentData, options?: FootprintConversionOptions): FootprintResult;
33
+ /**
34
+ * Generate PAD element
35
+ * Handles all shapes: RECT, ELLIPSE, OVAL, POLYGON
36
+ */
37
+ private generatePad;
38
+ /**
39
+ * Generate custom POLYGON pad using gr_poly primitive
40
+ * Supports both SMD and through-hole polygon pads
41
+ */
42
+ private generatePolygonPad;
43
+ /**
44
+ * Generate HOLE as NPTH pad
45
+ */
46
+ private generateHole;
47
+ /**
48
+ * Generate VIA as through-hole pad (no number)
49
+ */
50
+ private generateVia;
51
+ /**
52
+ * Generate TRACK as fp_line segments
53
+ */
54
+ private generateTrack;
55
+ /**
56
+ * Generate CIRCLE as fp_circle
57
+ */
58
+ private generateCircle;
59
+ /**
60
+ * Generate ARC as fp_arc (from SVG path)
61
+ */
62
+ private generateArc;
63
+ /**
64
+ * Generate RECT as 4 fp_line elements
65
+ */
66
+ private generateRect;
67
+ /**
68
+ * Generate TEXT as fp_text (user text, not REF/VAL)
69
+ */
70
+ private generateText;
71
+ /**
72
+ * Generate SOLIDREGION as fp_poly (filled polygon)
73
+ * Parses SVG path with M/L/Z commands and converts to KiCad polygon
74
+ */
75
+ private generateSolidRegion;
76
+ /**
77
+ * Parse SVG path string (M/L/Z commands) to array of points
78
+ * Format: "M x1,y1 L x2,y2 L x3,y3 Z" or "M x1,y1 L x2,y2 ..."
79
+ */
80
+ private parseSvgPathToPoints;
81
+ /**
82
+ * Calculate bounding box from all footprint elements
83
+ */
84
+ private calculateBounds;
85
+ /**
86
+ * Generate footprint properties
87
+ * Positions Reference above courtyard and Value below courtyard
88
+ */
89
+ private generateProperties;
90
+ /**
91
+ * Generate fab reference text
92
+ */
93
+ private generateFabReference;
94
+ /**
95
+ * Generate courtyard outline
96
+ */
97
+ private generateCourtyard;
98
+ /**
99
+ * Generate 3D model reference
100
+ */
101
+ private generate3DModel;
102
+ private sanitizeName;
103
+ private escapeString;
104
+ }
105
+ export declare const footprintConverter: FootprintConverter;
106
+ //# sourceMappingURL=footprint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"footprint.d.ts","sourceRoot":"","sources":["../../src/converter/footprint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,oBAAoB,EAUrB,MAAM,mBAAmB,CAAC;AAyD3B,MAAM,WAAW,0BAA0B;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,WAAW,GAAG,WAAW,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAiKD,qBAAa,kBAAkB;IAC7B;;OAEG;IACH,OAAO,CAAC,SAAS,EAAE,oBAAoB,EAAE,OAAO,GAAE,0BAA+B,GAAG,MAAM;IA2F1F;;;;;;;OAOG;IACH,YAAY,CACV,SAAS,EAAE,oBAAoB,EAC/B,OAAO,GAAE,0BAA+B,GACvC,eAAe;IA2ClB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAiDnB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAwD1B;;OAEG;IACH,OAAO,CAAC,YAAY;IAapB;;OAEG;IACH,OAAO,CAAC,WAAW;IAcnB;;OAEG;IACH,OAAO,CAAC,aAAa;IA4BrB;;OAEG;IACH,OAAO,CAAC,cAAc;IAqBtB;;OAEG;IACH,OAAO,CAAC,WAAW;IAqBnB;;OAEG;IACH,OAAO,CAAC,YAAY;IAiCpB;;OAEG;IACH,OAAO,CAAC,YAAY;IAkCpB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAyB3B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAyB5B;;OAEG;IACH,OAAO,CAAC,eAAe;IA2DvB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAkE1B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA8BzB;;OAEG;IACH,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;CAGrB;AAED,eAAO,MAAM,kBAAkB,oBAA2B,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Global Library Table Manager
3
+ * Registers JLC libraries in KiCad's global sym-lib-table and fp-lib-table
4
+ * Works cross-platform: macOS, Windows, Linux
5
+ */
6
+ interface TableUpdateResult {
7
+ path: string;
8
+ created: boolean;
9
+ modified: boolean;
10
+ entriesAdded: number;
11
+ }
12
+ export interface GlobalRegistrationResult {
13
+ success: boolean;
14
+ version: string;
15
+ symLibTable: TableUpdateResult;
16
+ fpLibTable: TableUpdateResult;
17
+ libraryStubs: {
18
+ symbolsCreated: string[];
19
+ directoriesCreated: string[];
20
+ };
21
+ errors: string[];
22
+ }
23
+ /**
24
+ * Main entry point: Ensure JLC libraries are registered in KiCad global tables
25
+ * Call this on MCP server startup
26
+ */
27
+ export declare function ensureGlobalLibraryTables(): Promise<GlobalRegistrationResult>;
28
+ export {};
29
+ //# sourceMappingURL=global-lib-table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-lib-table.d.ts","sourceRoot":"","sources":["../../src/converter/global-lib-table.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA2JH,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AA0JD,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,YAAY,EAAE;QACZ,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,kBAAkB,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;IACF,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,wBAAwB,CAAC,CA2DnF"}